High Power Mains Switching with Sonoff

Sonoff BASIC

I am as most of you know a great fan of the Sonoff BASIC modules – because, in the main, they are cheap and reliable – but increasingly I’ve been faced with challenges that involve the need for isolated contacts – or high power (immersion heating) or both.

Well, here is my solution – which remains really low cost. The Sonoff BASIC (last but one version) is REALLY cheap at Banggood – and like most other Sonoffs (and other similar devices) it tops out at 10 amps maximum. There are a few devices like Blitzwolf and others which handle up to 16A MAX… but even then, one immersion heater I’m controlling, heats for example the Sonoff TH16 up a little too much for my liking when in a warm cupboard.

DIN Contactor

Also few if any of these devices have completely isolated contacts (I need that for my thermostat) and all of them switch only the LIVE wire. The answer to all of my problems has been staring at me all this time and I didn’t see it.

Simply take the cheapest option, Sonoff BASIC – and add a 25 AMP contactor from AliExpress – 220v coil (American readers can use 110v verions of all of this)…. 2 poles in my case so you get live AND neutral switching from one Sonoff and one dual contactor – £3.85 + free post for the contactor – right now the v2 Sonoff BASIC is under £4 – I just grabbed some. Add a short piece of DIN rail if you like. That’s what I am doing. It is possible for £1 ($1.40) more to switch up to 63A – I didn’t need that.

You could probably (I will try) make the Sonoff BASIC a bad fit onto the same piece of DIN rail…. the advantage of all of this in my case is 2 screws into the pasterboard wall for the DIN rail, the rest mounts on the rail. If you have a larger set, how about a Sonoff 4CH Pro – which is DIN mounted with isolated outputs – adding in a breaker if and where needed for the extra power.

I’m ordering this stuff up now so it will be here when I get back from a short visit to the USA. What fun.


63 thoughts on “High Power Mains Switching with Sonoff

  1. In case you’re wanting to install a few of these contactors, remember to leave an air space between them if running at over 50% rating.
    Also, Itead do a ‘Din Rail Tray’ which neatly mounts the Sonoff onto the same rail as the contactor…

  2. Are you going to trust that contactor on such a high amperage?

    From my research that will invalidate any insurance you have in case of a fire.

    At least buy it from somewhere like CPC or RS.

    1. I am not a “qualified” electrician so anything I’ve done has probably already given the insurance company an opt-out. I will test the device properly under load at worse-case temperature. I may class as a hacker but I’m not suicidal. I just checked CPC and the prices horrified me.

      1. I have an exceedingly expensive LG air souurce heating system, fully certified and fitted by qualified operators a year ago – the main unit (now on 2nd replacement) has never been very reliable – the main boards outside have been replaced twice – and it came with a fully certified thermostat fitted by the same qualified installers and was anything but reliable. My home designed and made un-certified thermostat replacement is on the other hand very reliable. If only I could design and build air source heat pumps.

        Neil – Sonoffs – I would normally never go anywhere near relay capacity – given that the Sonoff TH16 is currently getting warm with a slight smell of bakelite when left running the immersion heater for an hour or so, I’m planning to lower my self-imposed limit in future. Waiting for the contactor to arrive – the immersion heater cannot be more than 2Kw so I’ve no idea why it is getting so warm but I’m counting on the dual pole 25A contactor with a Sonoff BASIC doing a lot better (the contactor will only ever be handling 13A in the event of failure as that is the incoming mains fuse size and the heater at 2KW should normally need around 8A at 250v – which is the voltage we have here in the Northeast of England).

        1. Okay so Basic controls the contactor, got it.

          As far as I recall the inductive devices (motors & heaters) do cause issues for automation and things like the X10 modules were derated for any inductive device. I recall seeing several X10 modules that didn’t fair well when paired with inductive control so our rule was to avoid it.

          My guess on the heating is back-emf (though I’m not 100% sure of that). I do know that my 5m extension code (20A rated) would heat up when used with my 15A pool motor.

          1. Some devices use extra current at startup – and yes, with inductive dvices I’d knock the maximum down a bit. X10 is a lifetime back.

            Back EMF – surely a vdr would sort that? The pool motor – well that is indeed inductive – could it also be using extra power at atartup… I guess thats where power monitoring comes in. I just moved from the TH16 to the Sonoff POWR2 for that reason – and using Tasmota I’ve put a time limit on the immersion heater.

    2. Paul, a bit confused … “Are you going to trust that contactor on such a high amperage?”

      My friends work on the railroad (real high power – 40KV) so yes they use and trust certified contactors. If you mean one that’s not certified then I agree. Not going to trust high current to a £1 (or even a £4) contactor to 63A.

      And while I also do as Pete does (using the uncertified Sonoffs) I do limit them to less than 60% of there ratings and no inductive loads (switching power supplied are the exception).

  3. 2 pole switching the neutral that is a really bad idea and quite like you to be illegal in Australia and New Zealand failure to isolate the phase where the neutral is open circuit indicates to the uninitiated the circuit is dead but still very dangerous. Switching neutral is a very bad practice

    1. I find this advice confusing because (in the UK) many high current switches (eg cooker control switches) are by specification double pole isolating the device from both live and neutral.

      1. I’m finding it confusing also – I wonder if this fellow has 3-phase mains. I definitely favour isolating both live and neutral – then iof one contactor fails closed at least you gave the other one.

    2. Er, no… **Single** pole switching the neutral is A Bad Idea in countries with neutral:earth bonding on their networks.
      **Double** pole switching is perfectly acceptable ~ indeed in rural NZ and AUS may even be recommended due to long overhead runs and difficult local earthing conditions (dry ground etc.)
      Many european countries don’t explicitly reference any pole to earth, and it’s a lucky dip as to whether a single-pole switch is in a ‘line’ or a ‘neutral’ conductor. Circuit protection, i.e. MCB’s, will always be double-pole in this case.

      1. Absolutely – I was being polite as one could always be wrong but it seems absolutely sensible to me to do double pole isolation – especially when there is little or no cost penalty – in Spain where we spend our summers – most of the time, sockets are not even marked live and neutral and certainly small appliance/lamp 2 pin plugs are completely reversible.

        1. I have a place in Romania ~ similar electrics to rural Spain with 10Amp and 20Amp supplies. We have fused ‘neutrals’ in our old fuseboard… it’s quite a “refresher” when the neutral fuse pops, leaving the live one intact – and you begin UK-style faultfinding….

      2. Carl, Peter and all – yes you are correct and my comment was poorly written from the international perspective. In Australia and New Zealand we have very strict Neutral : Earth bonding at many points in the network. I can assure you in New Zealand we have no problem with dry ground, quite a different story in Australia atm., however!

        99% of outlets or service isolators (in the single phase domain) are single pole down here and I am not sure the other 1% would receive official sign off.

        1. In the UK the neutrals are typically bonded to earth too.
          However, metallic devices have an additional earth conductor solidly bonded to any metallic components. Earth conductors are never switched.
          Safe use and control of mains electrical devices is an interesting subject and it is interesting to learn how it is applied across the world.

  4. I was recently looking for a din rail equivalent of sonoff basic and came across a few tuya devices but quite expensive (20€ range) so I gave up. Don’t want to throw 20€ on a device that may happens running a non-Esp chip.
    The contactor looks a good alternative. I was just in the idea of changing the very old one of my legacy heater installation (which is driven by the electricity company to enable water heating at low tariff time) and yes it cost between 40€ to 65€.
    But I will not make any € hard-saving on this one by purchasing Chinese. Security 1st.

  5. 2 years ago I also purchased a pair of 20A Solid State Relay (SSR) with their heat sink with the idea of experimenting heaters switching but they are still waiting in a tray

  6. Hi I have used sonoff basic for my outside lights ; but if going to use high loads than that I would use a double pole contactor 16-20amp; have got some sonoff din rail adaptors from AliExpress; have you tried the Sonoff mini yet?

  7. Well, I was using a Sonoff TH16 but this conversation got me thinking as it gets (got)warm. Instead I’ve put in a Sonoff POWR2 which runs cooler – mind you it could hasve been the connections – I’m not 100% happy with those push-on connectors. Contactors are the next step for me for high loads like immersion heaters (3KW would you believe, I though they were mostly 2KW). I’m also feeling inclined to add in a Dallas temperatur e sensor – should not be hard to add as I’m using Tasmota for firmware.

    1. Pete, I’ve been using the circuit described in the Open energy solar divert pages to divert to the immersion heater in our Heat Bank for the last few years with no problems this uses a solid state device.

      The circuit is very simple see -> https://learn.openenergymonitor.org/pv-diversion/introduction/choosing-an-energy-diverter.

      Obviously you’d need to build the circuit, so not as easy as cascading two off the shelf units as you were suggesting.


      1. I have used that circuit too and it works well. The author is very helpful too. One huge advantage of ‘build your own’ is that one can ensure it is built to the highest safety standards. It is also very easy to add a DS18B20 to monitor temperature of the heatsink and enclosure. One could even add current monitoring using a CT (as per the same website) to monitor the heater is actually on or has failed. 9 times out of 10 it is the internal thermostat that fails in the immersion heater.

        1. Hi Bob,

          My circuit is hanging off an emonTX which has 3 CTs monitoring the PV, house usage and the diversion (not really necessary). I’m using Martin’s sketch with some mods for more DS18B20s – these monitor temperatures in the Heat Bank.

          Can’t speak too highly of the openenergy community.


          PS Lovely sunny day, eventually, so it’s working flat out now! 😀

  8. Domestic immersion heaters in the UK have been 3 kW for many years and are generally wired through a 20A double pole switch on a 2.5 mm TW/E cable direct to the fuse board. Since the main isolator is a double pole device, live and neutral, Peter is spot on using a 2 pole contactor.
    In respect of fuses neither cartridge fuses nor MCB’s will blow or operate at the rated amperage, say 13A, the fuse will carry that current indefinitely. The purpose of the fuse is to protect the suppply cables. A significant overload, say x5, would be required to blow the fuse or trip the MCB in a very short time, or a dead short.
    Those people who are experiencing odour from electrical devices please be aware those odours can be toxic.

    1. It doesn’t matter if Peter is using a single- or double-pole contactor for the immersion ~ what he’s doing with it is ‘Functional Switching’ and provided it opens the Live pole the job’s done and the Regs are satisfied…

      Using both poles just gives a little reassurance the the heater will still go off if one contact of this cheap contactor were to weld closed.
      After all, just about every immersion timer ever built has been single pole…

    1. Board does not seem to have programming headers so you would have to solder directly to the chip – not a unit that I would fancy messing around internally with and still be able to trust

  9. I am against a different solution- there are Latch relays that turn off and on with just a short impulse, than no power is needed to keep it up. So actually I have this setup for all my lights for now, then, I have a regular latch wall-mounter light switches. Automating this is as easy as adding a small relay to give a short contact for a quarter of a second, imitating a real latch switch.

    The problem of tracking the state was solved by using a 2-chanel latch relay – with a single pulse it toggles 2 separate lines. Thus I can use the second line to track the current state on 5v.

    I know this is a more complex solution, but this is electronics-proof one and allows for a seamless fallback to the native installation and also allows to get the installation up and running long before the automation part

    1. Hi Brian, Thanks for the link, it is a shame they do not show a view of the rear side of the PCB so one could see if the PCB tracks are appropriately sized / spaced for that level of voltage / current.

  10. Just received a TOCT1-25 contactor and noticed that the AC-7b rating (Household Inductive) is 9A. Almost 65% lower than its non inductive current rating. Even more noticeable is that the inductive power rating is 1.4Kw which equates to less than 6A at UK/European voltages (over 75% lower). I have usually worked on a safety factor of 40-50% reduction on relay ratings for inductive loads but maybe it needs to be an even higher margin. It also brings into question whether an even bigger contactor is needed.

    1. A very good point Steve – well, of course it depends on what you do with it, mine just turned up today – same model – and I want to use it with a 3Kw heater which is a little inductive though not inductive like a motor. Right now a Sonoff T16 is running the whow- and getting slightly hot – that has a 16A non-inductivee capability so I’m hoping this contactor with 25A non-inductive capability will run warm to cool instead. Being twin pole, if something were to go wrong my theory is that breaking both leads is better than breaking one.

  11. I would not worry about an immersion heater (3kW) being slightly inductive in terms of de-rating the contactor. The de-rating is for truly inductive loads like motors, transformers, fluorescent light chokes or anything with a copper winding on a iron core.
    Your two pole theory is good for UK mains supplies where a completely separate earth conductor is connected to the electrical load.
    I hope all is well with your scan Peter.

    1. I figured as much, Bob ut thanks for that confirmation. An immersion heater – my GUT feeling is that they are not THAT inductive, no-where near as much as a motor etc as you suggest. My contactor has turned up – as we used to say back in the “old days” the proof of the pudding is in the eating, I guess I’ll soon find out how well it works. If it runs cool to barely warm I’ll be very happy.
      Scan – well, I had the scan but typical NHS all I got from the operator was hello – goodbye – I guess it takes an in-short-supply specialist to actually read the scan so I guess I’ll find out if I’m dead or alive in a month or two. I asked how long it would take to find out – response “all consultants are different”. I may as well have asked “how long is a piece of string” 🙂

    1. That video highlights the potential dangers of switching high current loads. It is not just the steady state current that has to be considered but the inrush current also which can be 5 to 7 times the steady state current. Other factors are the open gap of the relay contacts and the ability of the contacts to break the current flow when opening.
      The other item mentioned was smoke alarms, whether it links to Home Assistant openHab or any other home automation system is IRRELEVANT! The key criterion are that it must be utterly reliable, work totally independently of any external factor and be able to be heard all over the house. The latter point may be achieved by multiple wireless or mains wired linked modules.
      A smoke alarm could save the life of you and your family and prevent your house being burnt down! Please do not buy cheap smoke alarms. In the Uk AICO are one of the best makes, not cheap but neither is a funeral or re-building a house.
      In UK rented properties linked smoke alarms properly located are a legal requirement.

  12. We are fulfilling every UK lockdown cliche / buying a hot-tub. I’d really like to monitor power usage. Currently we have a patio heater with a Sonoff POW R2 (they work up to 15A). The hot tub needs a 32A (wah!) feed. I think most of the time it should use a lot less, perhaps that is for power spikes or whatever.

    Wonder how I can monitor that level of current? Any decent Tasmota-ready devices out there that can do this?

    * delete as appropriate

    1. Controlling and monitoring devices at 32 amps – that is beyond most of the devices I’ve tested, actually ALL of the devices I’ve tested – if anyone knows better, please do comment. At 220v that must be a powerful hot-tub.

      1. Just re-checked the specs and it requires minimum 25A feed. That *is* a lot of power. I’m hoping they have over-egged that spec, or there’s going to be a hefty electricity bill!

        1. Mat, for a hot tub, that isn’t a lot power! Assuming UK mains voltage of 240 VAC and 25A it is a 6 kW load, less than a domestic electric shower. It is effectively an immersion heater and thus a resistive, not inductive load.
          Regarding monitoring the current the easiest and safest way is to use a current transformer (CT) where the ‘live’ (or neutral) wire passes as one loop through the sensing toroid. There is an excellent article on the ‘Open Energy Monitor’ website on using CT’s with an Arduino. The monitoring can also be done using an ESP8266 or ESP32 and very likely a Raspi zero W, once you can get the current value into one of those devices then you can use, for example, MQTT or HTTP to process the data as you wish.
          However, unless the heater has thermostatic control it will be on constantly drawing 6 kW which is about £1 / hour currently. If it has a thermostat then you could monitor the thermostat output, to the heater, with a 240 vAC coil relay. The relay contacts could provide a low voltage input to, say, an ESP8266 for you to time the amount of time the heater is energised and thus how much power it has consumed.
          There is NO Sonoff or similar device that can control 25A, you MUST use a properly rated contactor. If you are not competent to work with mains voltage systems then please get a qualified electrician to do the wiring.
          If you tell me the volume of water the tub holds I can calculate how long it will take to heat from a starting temperature to a given bathing temperature, the time is less if the cover is in place.
          BTW if your patio heater has a 13A plug then it is very likely 3 kW or less that is definitely the limit for the supposedly 15A Sonoff. I would advise you to check the Sonoff frequently for signs of over heating.

          1. Hi Bob

            Thanks for your reply. Until today I hadn’t realised that relays don’t generally carry above 10 or 15A, and I have just read about the difference between a contactor and a relay so wasn’t aware of the additional safety features of a contactor.

            I have three cheap Chinese current transformers (an eBay purchase from a couple of years ago, never got around to using them) and have watched numerous videos about their use with arduino. I like that they are easy to connect up and relatively safe as ling as burden resistor is used of course.

            Another idea is that the tub has a built in computer with colour screen etc for temperature control, chemical monitoring reminder etc, so I could consider hacking that to get heating info out of it.

            My ideal situation would be to monitor and log power usage, temperature, pH, and bromine levels but the last two are particularly difficult if not impossible to do electronically (at least in any permanent fashion).

            1. Mat, as discussed power usage is achievable in a number of ways, temperature is no problem either. PH can be done relatively easily but the probes are expensive. PH is widely measured in hydroponic / aquaponic growing systems. Bromine, no idea 3-5 ppm is a very small value to measure.

Leave a Reply

Your email address will not be published. Required fields are marked *

Leave the field below empty!

This site uses Akismet to reduce spam. Learn how your comment data is processed.