Sonoff to Mains Block

sonoffJust an update – today I was clearing out my office boxes and noted 4 old mains control blocks – the kind you buy at B&Q – the kind the cats lose the remote controls – these were a little bigger than some but I think the general principle applies to sonoffmany of the cheaper units. B&M had some at a great price – 3 for a tenner – the software sadly was rubbish and did not remember the state they were in when the power cycled.

Well, as we know, Sonoffs are small boards – and, well I took one of the mains control units apart, ripped out the electronics – and – the Sonoff board fit in there a TREAT.

Total time around 15 minutes or less and a soldering iron. The mains units had a common neutral (as do the Sonoffs – mains in – mains out. I wasn’t interested in buttons so I took them out – but then I thought it might make sense to leave the holes open to get rid of any heat.

And there you have it – one plug-in-the-wall mains controller… larger than a sonoff but for many applications a hell of a lot more useful than having to solder to a choc-block.

The photos should scale when you click them. In the photo below I connected neutral (Black) to the common just one one side of the sonoff, the mains in to the other input and I used a piece of single choc-block to extend the other red lead.



In the photo above I have the output side of the Sonoff nearest the mains plug – in practice (the next day) I’ve now done four of these and it is better to have the dirty end (blue VDR) nearest the mains plug – black wire into the neutral (which is common so you don’t have to connect the other end) – bottom incoming red wire into live… and the top live wire extended with a single choc block to the output on the other side of the board – no soldering required.  As you can see below, here it is looking ok (I put a label on with the MQTT name of the device). After listing to comments in here I have “Maximum 1KW” label – though I think that is under-ambitious – probably 1.5k is possible but I’ve not tested it – they claim 10 amps hence 2.5k but the relay is just too small.

Anyway, under an hour to make 4 of them – not a bad investment of holiday time.




60 thoughts on “Sonoff to Mains Block

  1. Does anyone know if you could run a Dyson heater off one of these? 2000 Watt heater…. 8 amps right? is that how you work it out? 2000/240?

    1. In theory, yes, but it if it’s a fan heater (an inductive load) rather than an oil filled radiator (non inductive load), I’d want to allow a bit extra safety headroom in the relay capacity.

      Luckily, Sonoff do make a higher capacity unit – the Sonoff POW and the Sonoff TH16 – these are allegedly rated at 16A.

      I run an Ariston under-sink water heater (2kw) off a 16A Sonoff unit and it doesn’t break into a sweat at all although it rarely runs for more than 15 minutes at a time before the water gets hot and it stops consuming power. I use the 16A Sonoff POW running the Sonoff-Tasmota firmware which reports back voltage/current usage and that’s a nice additional feature rather than just power on / power off.

  2. Has anyone found a current 433 wirelss box that will take a sonoff, I wasted 13 squid today on 3 that looked similar but were too short. Thing is you cannot get sizes when looking online.

  3. Good morning. I purchased a few of these with a view to adding Wifi Capability to some of the appliances in my home. I use homebridge with the MQTT adapter to control a few simple items – desk fan, desk lamp, but I’d like to add them to a number of additional items and am worried at the lack of earth. Not being an electrician I don’t fully understand the implications or how I could work around this if fitted to, for instance, an adapter block. I realise I can now buy a sonoff wall adapter (which i hope is considerably more reliable than my orvibo one!) but i’d like to reliably and safely use the few sonoffs I have laying around. Any advice? Thanks for your great write up here.

    1. So – if you feel you need an earth – just use a 3-core lead with plug – wire live and neutral into the Sonoff – take another lead off to your appliance – and carry the earth from the original lead straight past the Sonoff. Typically many lamp leads don’t have an earth so that’s not an issue for them.

  4. Not being an electrician I was wondering about amps etc.

    would it be possible/sensible to put some kind of replaceable fuse in them or in line ?

    The fuse being something like 6amp so it blows before the 10 ?

    Or am I being daft, as the fuse is in the plug

    1. I am an Electrical Engineer my concerns are with the phisical electrical connectors as they appear to be around 6 Amp, I use these myself but fuse them at 3Amp and enclosed within CE approved fire retardant box. Would not trust these units for any more than 5Amp

    1. On the surface of it yes, this has two of the relays you normally see which are 10amp rated. I assume because of this it will be bigger and hence less able to fit into small cases.. However only one way to find out – I’ve asked them for a couple of samples to be shipped to Spain – as I’ll be there in a couple of week – so maybe 18 days from now keep an eye out and I’ll give one of them a good hammering – no doubt it will take my software and I see they have made room for a DHT22 – sadly it is WAY too near the power supply to be of any use so it will need to be on a lead. Exciting that they’ve put (presumably) other IO leads on a header…. so really it is down to size – and reliability. The Sonoffs up to now are cheap and are working absolutely reliably. Can this new board achieve the same and will it fit into an old mains remote adaptor box? Time will tell. I can’t help thinking I used a power supply exactly like that and it was NOT a good one… but without seeing the underside of the board I can’t tell you – yet.

      1. I am happy, there are more and more final products based on ESP8266.
        If possible, please, add a new menu on you site with links to each interesting product you found.
        For example ESP8266 can be found in the following final products:
        – Sonoff
        – Sonoff SV
        – RGB Led controller
        – electrodragon relay board

        This will be a very useful for readers who can not make their own PCB’s

          1. You can add to that sonoff list above:

            – sonoff th (adds access to gpio14 .. 5 pin header instead of 4 pin)
            – sonoff pro (I ordered 2 sonoff with rf and pro version was sent, same as th but with rf)

  5. After you converted you sockets, don’t throw the old sonoff case, its a perfect fit for pizero 🙂

  6. For some time now I’ve been using a “proper” mains switch – an ORBIVO rated at 10amps.. it is running a small hall light. Meanwhile in my office, a Sonoff is running the heater – probably around 1Kw.

    Guess which one just packed in – NOT the Sonoff.

    1. Orvibo use 20A rated relay,
      that relay has detail spec in PDF.

      I trust Orvibo relay than sonoff when connecting to heater.
      Orvibo has real UL/CE as I know
      owns 3 orvibis S20 that control by esp8266-mqtt.

          1. Orvibo that has FCC ID using 20A rated relay.

            old link on knowing your relay.
            The contacts on electromechanical relays tend to be larger and more robust than some other relay types. The larger contacts give them the ability to withstand unexpected surge currents caused by parasitic capacitances present in your circuit, cables, etc. An unfortunate tradeoff, however, is that the larger contacts require larger package sizes so they cannot be placed as densely on a switch module.

            if you want to compare, just look on datasheet each relay,
            I looked on both sonoff and Orvibo (has FCC ID and adheres US safety).
            sonoff Relay has minimal info, and Orvibo relay has detail info such as surge current, and other detail.

            surge current is the devil on electromagnetic Relay, that could melt relay contact. on other hand, robust contact would survive mostly.

            on space heater:
            this is the reason on every heater always has overcurrent device “plug”.

            the question is.. the relay can sustain surged before overcurrent device get kicked off or not.

            I still trust Orvibo (legally sold in US) to handle demanding surge current 😀

            those just my experience and understanding.

            1. We’re in danger of missing the point here – I’m sure that had ITEAD chosen to charge more – they could have put a more expensive relay in – but the whole point – I guess was to produce a low cost item – and they have done that as far as I’m aware, FAR better than anyone else. Used with care, the Sonoff is a good product. The Orbivo is much more expensive and therefore more robust – except that mine packed in. Anyone can produce an expensive unit that will handle lots of current and has certifications etc, no-one else has been able to my knowledge to produce a reasonable item at such a very low price – and more’s the point, we can re-program Sonoffs.

  7. Hi.

    It is the sonoff switch robust enough to be connected 7/24 and within a ceiling or a wall without meaning a fire hazard or sonoff switch failure as such.


    1. Noone can answer that… but I can say the circuitry has the hallmarks of a good design. I leave mine on 24-7.

    2. the main concern is the relay :P.
      you have make sure you do not pull much power on super tiny relay that I doubtly can do 10A 220V constantly :P.

      1. Why? The relay is rated 10 amps – the designers have assured us they will handle 10 amps – even if you went as low as 3 amps – that’s still 750w at 250v.

        1. that is the peak current, not 24/7.

          if you open 15A rated plugs. they will put 20A rated relay

          all relay does not create equally.

          heather is the most issue due on demanding constant current.

          I compared sonoff relay datasheet and do not see detail spec.
          I have other real UL/CE plugs that has 20A rated relay, and the spec has detail including temperature/transient/constant current.

          please remember, there are two metal arms that touch together in relay that generate heat.
          if you need detail. grab one good relay datasheet, this tell everything..

          1. The argument could apply to any relay, any product. Not sure why Sonoff should be singled out.

  8. Andrew you need to talk to Aidan about boards – I think everything is there – certainly someone has already sent boards off to be made…. Aidan may or may not be back from hols – if he is I’m sure he’ll see this.

      1. doh! indeed… thanks
        slight aside… where do you recommend for PCB manufacture?
        1) for a quick 1 off, to make sure it all works… (i.e. quick… based in uk if it helps)
        2) bulk order… say 10? (likely china etc..)


        1. Hi Andrew

          Well, ITEAD do PCBS, but I believe we use

          Sadly, UK UK – well there’s a sorry tale – I’ve worked in electronics for much of my career (before becoming IT Chairman of the FSB for 14 years I ran an electronics company with a business partner – you’ll have seen him in here – Aidan Ruff) – we used a wide range of UK PCB manufacturers – who to the last one charged a small fortune for one-off prototypes and even small runs – they could not see past the end of their noses to help small businesses get started with new products and I guess that’s where the Chinese stepped in – hence today I would not even consider going to look at a UK company for this. A shame but there you are.

          For the purposes of this response – I went looking for “UK PCBs” and the first responses had nothing to do with printed circuit boards – so then I tried “UK PRINTED CIRCUIT BOARDS” and one promising site had a “prototypes” link – which came back “This is embarrassing – iot seems we can’t find what you’re looking for” ( – interestingly the same company had a page warning about Chinese imports. You had to fill in a form to get a quote.. WHAT??? Can’t be bothered.

          I tried another – – 50mm square boards – 1 off… ~£46

          Another – quick-tech £76 for 10 boards – similar size

          So… it looks like nothing has changed really…

          Chinese companies we’ve dealt with (over some time and successfully) generally charge around £10 for 10 boards – dirtyPCBs – include shipping – e-tested – and yes the quality is good.

          So disappointed in the UK guys.

          1. question… i’m using eagle 7. something and it says if your using that not to upload the eagle file but the gerber files. Can you just zip them all up and upload that?

  9. After seeing this I checked them out on ITEAD. How do you set these up? Do they open a local AP? Do I need to use their apps or will they work with any mqtt (like node red) messages?

      1. Thanks. I assume the ftdi pins are exposed? At under $5 they seem even easier than writing up a raw esp-12 to control the mains. Hopefully I can get these working with my Nextion when they ship.

  10. not sure why i did not think of that, i ripped out all the 433MHz bits out and fitted a 3v3 regulator and a ESP8266-01 on to a socket fitted to the PCB.

    ~Have a bunch of Sonoffs this looks like it might make a quick an dirty way to use one or two, i don’t quite like using them in their case as a lack of earth, did think of just cutting into the cable so that the earth was left intact but won’t look to pretty.

    do you have a link to your mqtt code? as i’m just getting in to it, last switch was done using a web page interface and i’m trying to move away from that form of control.

    1. I had an example sitting in front of me and I STILL didn’t think about it until last night 🙂

      Depending on what you’re doing the earth might not be an issue – many desk lamps only have 2 wires anyway… I do have a link to my code – see article Home Control 2016 – but be aware that it needs to run under Windows in the unofficial development environment with Eclipse etc… (C code). I have NO idea how to turn that makefile back into a Linux Makefile.

      1. Thanks for link, i have the Eclipse setup and C as I don’t like being removed from the hardware that you get with the higher level languages.

    2. Hi Neil,
      I’ve been tinkering with this recently
      which uses this code on an ESP8266 as per this

      It works quite nicely and has some interesting features and maps well with this board
      i.e. the rgb led and the light sensor

      If you wanted a rough and ready “standalone” system, you could put rechargeables in the test board and use this to power up the batteries during the day.
      Solar Power

      1. This has a good diagram of the MQTT messages that handshake back and forth.
        The concept of the “IoT Manager” solution is similar to “Imperihome”, in that the Android App is quite dumb really, and what the app displays, is “programmed” in the ESP8266 code.
        Even if this solution is not adopted, it is a useful example of MQTT messaging and highights some very cute ways to handle MQT in the Arduino IDE.

  11. Great “food for thought” – I’ve been looking for enclosures of this type (mains plug pins on the back, socket on front). My project is to use a battery powered ESP8266 module with a luminosity sensor sitting on my living room window sill plus an ESP8266 module with associated mains relay or triac circuitry in an enclosure like this to switch on/off a standard lamp in the living room. I’m sure you get the idea – light levels drop at sunset, ESP8266 on the window sill triggers the ESP8266 in the wall enclosure which switches the light on (and reverse in the morning when the sun comes up).

    1. Great stuff Brian – enclosures are the bane of my life – the thing about the Sonoff board it is so small (yet, and no I don’t work for them) pretty reasonable quality that it lends itself to fitting into various enclosures. There are a few (but not all) of these radio frequency plug-in-the-wall controllers that have enough room to house the Sonoff board. I’ve just finished updating the software to try multiple access points so I can pretty much plug one of these anywhere in the house and it’ll work – and of course unlike the radio versions – I can control it from anywhere in the world (which in my case is valid as we live in the UK in winter and Spain in the summer). Excellent. Tell us more about the battery-powered ESP…. battery last long?

      1. Hi Peter, Your project sounds interesting – ideally I’d like a few around the house so I’ll be sourcing some more ESP modules once I’ve done some more development. I could go with Sonoff boards but I like making life difficult for myself. 🙂 Besides, I’m an electronics engineer so it’s fun to source the components and design the circuitry. It’s all a bit Heath Robinson at the moment (breadboard stage) and I have no idea how long a battery powered ESP would last although I’m hoping with deep sleep mode only waking the ESP occasionally I should get some decent battery life. I’m also an Android programmer so I figure I can control my units from an app on my phone. 🙂

  12. Yes, worth labelling the units to avoid someone down the line thinking they can switch a 13A heater!

  13. Nice hack,
    just a note: although the product is marketed as 10A, I wouldn’t trust it to switch anything higher than 3-4A. Don’t risk burning up the house

    1. And that, gentlemen is just what I am doing now as I wire up my second unit (I have 4 of these old remote controls which are otherwise a waste of space). I’m putting the Id of the unit on and a message “1KW MAX”. Generally they’ll be used for lighting etc and with LEDS and fluorescents I think we’ll be hard pushed to reach 1KW.

      It would be nice to get some clarification from ITEAD here – have these actually been tested at anywhere near 10amps on 240v? I suspect not as they look too small – but I’ve been wrong before. Looking forward to seeing your finished board Martin. Would not hurt to have a couple of heavy duty boards lying around.

      1. Of course it is worse in the USA where they need twice the current to get the same job done.

      2. 220V10A, keep working,.. two days….non-stop.
        There is no any problem.

        during the past winter, Sonoff worked with my electrical oil heater (1500W), it’s still alive.

        1. Hey thanks for that Jerry as people have been asking about Sonoff and whether that is truly a 10 amp relay.

        2. watch out for a longterm usage…

          the relay life is counted on how many off-on events.

          if you put more stress, the relay head inside the plastic got meltdown or stick

          I wolus treat sonoff relay to around <10A for 220V or 6A for 120V.

          I have other switch that has relay 20A for 120V rated, the relay is bigger than 2X than sonoff relay.

          sonoff is for light duty, such as: <30W lights.

  14. Im looking at my useless 433MHz controllers and wondering if the sonoff will fit.

    They are useless because they forget their pairing with losing power so will bind to the first compatible remote that they see a transmission from, often that is not even one of mine.

Comments are closed.