Itead Slampher and Sonoff

Slampher - in Scargill's review of Slampher and SonoffRemind you of IKEA? No? Heard of ESP8266? Yes? Well, Slampher and Sonoff are two products from Itead and I think you’ll like at least one of them. They arrived at my desk today. Slampher is a screwfit lamp fitting – take the E27 lamp out – put Slampher in – screw the lamp back in and you’re in business with a remote controlled lamp. It really is that easy.

This blog updated July 26, 2017

There’s a tiny button on the unit that you press to turn the lamp on or off manually if you ever need to – or hold it down and you can make it listen for a controller – the handy – and i have to say very nice quality – keychain controller which can control 4 devices.

Handset - in Scargill's review of Slampher and SonoffThe REALLY good thing is that both of these products use ESP8266 so if you want to go in and re-program them – as I have  – to handle MQTTon your WIFI!!!! You CAN do but there is an APP if you don’t want to do it the hard way. I don’t have the App at this time so I can’t comment… but it’s an ESP8266 – how hard can it be to get that right.

Slampher and SonoffThe other product is called Sonoff and it’s just a little box that you wire mains into – and out the other end you fasten it to whatever you want – and control it the same way. SO the units obviously have both WIFI (ESP) and a 433Mhz receiver – because the little handset is 433Mhz.  Sonoff would not look out of place on a skirting board at all (proper little screw connectors inside – no soldering needed).

These are NOT expensive – in fact that really IS the point – Sonoff in particular – I could not build one at that price – and I guess that is part of the charm.  I can make this stuff with my eyes shut but by the time I put it all together and in a box….

The units I have are solid looking – the little mains controller Sonoff – the PCB inside is well put together with proper isolation on the PCB (some of you will have seen some HORRIBLY DANGEROUS pcbs in the past when it comes to UK mains but little Sonoff is ok at least at first glance).  I’ve not had a chance to pull the lamp unit apart yet – that will come later.

Pricing: I found this – $4.85 – if you live in the UK the postage brings it to $9.37 but even then! I checked out the cost of 3 – $14.55 all in to UK that is $5 each – that’s around £3 or so.

DIY programming: You’ll like this if you know how to program ESP8266 chips. I now have a diagram for Sonoff – initially the connectors did not seem to match those on the diagram – so I contacted Itead – they were keen to point out that they have a cloud system and App and of course the remote control via radio – all of which I’ll lose when I reprogram the board – but hey…. I want to control these with MY kit.

Look at the diagram below… this is looking at the TOP of the board. There is a 4 way or 5 way connector. If the latter you might want to get the meter out – but on the 4-way (mine)….  the SQUARE pin is not as you might think ground – it is 3v3 – then we have serial, serial and ground. If you wire your FTDI as per the wiring diagram below it should work.  The relay is controlled by GPIO12.

I was happy to see cooperation from Itead – obviously they would prefer that you use their cloud software and most will – but we are hackers and would never be satisfied without control, right? Ignore the LED, it is fastened to the RF device so you don’t have control over that. Right now I don’t have enough info to make any use of the RF device. If someone knows better please write in. Would be nice to have both.

Warning – you are on your own if you start this – you will need your own software and messing with the board will kill any warranty.  Clearly this must NOT be plugged into the mains while programming – use FTDI at 3v3 settings. No doubt 5v would cause damage.


Sonoff board



CLARIFICATION – the square pin is NOT ground – the square hole is 3v3. You should see that the round hole is connected to the flood filling (if you have good eyesight).

Use FTDI at 3v3 setting – in the original boards,  press the large button –THEN power up FTDI. DO NOT connect mains power while doing this – you will fry. Test MQTT connectivity, disconnect, put back in the box, use. NOTE – the newer boards marked RF do not seem to attach GPIO0 to the button – see later blog – it may be necessary to make a VERY find short at power=up – of two surface mount components.

As for actual use.. here’s the interface in Node-Red


Complicated, isn’t it. The node on the left is one of Andrei’s UI components – the node on the right is the standard MQTT connection – all of course running on my Raspberry Pi2 and already in charge of the heating and a load of experiments.

Here’s what it looks like on the phone…


and here it is – waiting for the screws which for the LIFE of me I can’t find… works a TREAT. The output relay is on GPIO12.


I have modified my general purpose MQTT software to run with the Sonoff devices and it works a treat.   – see the home control 2016 project in here where you’ll also find binary files.  A couple of settings need changing from normal – I normally use GPIO2 for WIFI setup and the SONOFF WIFI units use GPIO0…  also  – GPIO13 which I use as a status indicator – turns out the Sonoffs use them but reference 3v3 so I have an inversion setting so they flash off most of the time instead of on all the time – it’s all in the DOC file in the project above. With both of those settings updated… you can also use the button as an on-off button if you like (toggle).

The SONOFFs have only 1MByte of FLASH which would kill off OTA for all but the simplest of projects – my code needs the larger size IF you want OTA. With this in mind, is it worth paying extra for the Electrodragon? Some say the quality of the latter is not so good? But they do use an ESP-12 which will have the normal 4Mbytes of FLASH… what do you think. Update Jly 2016:  The Electrodragons didn’t turn out so well – but now I’ve just proven that it is in face easy with a fine soldering iron to fit a £0.37 32Mbit FLASH chip to these, replacing the original – which means full OTA and no problems expanding.  See for more info.

July 2017 – By now most of us are familiar with the Sonoff units but there is always the cost of postage..

See above – includes postage – absolute bargain.


309 thoughts on “Itead Slampher and Sonoff

  1. Hi.

    Have you ever had this problem with a Sonoff switch Peter?

    All of mine occasionally and independently (probably once or twice a month) switch on and off very, very rapidly. It’s a rapid clicking of the relay and it’s worrying me that if I’m not around at some point to physically unplug it it might overheat …. ?!

    I read somewhere that this might be to do with interference and soldering an extra capacitor in might help but I’ve not found anything definitive online.

    Are you aware of anyone else experiencing this?

    Thanks, Don

    1. Which software are you using Don – mine, the original Itead software, Tasmota, someone elses?

      1. argh. good point. I’d just assumed it was a hardware thing, They’re all using Tasmota. Maybe I should try yours…?

        1. Beacause Tasmota has been so successful with Sonoff I’ve not focussed on that and I have also abandoned support for small Flash devices i.e. under 4MB.That allows me to fit the kitchen sink into mine. I would suggest your first stop be to ensure you are using fully up to date Tasmota and also to bring up this issue on his Github page to see if others have had the same issue. Could be nothing, could be a 32 bit variable overflow or some other thing that only appears after a long time. Or it could be flash failure if the flash is being updated…

    2. I’m using Pete’s wiring expertise and backing it with self built software based on an mqtt library available on github for client side and a linux based library for server side… just built a simple widget and website for lighting needs…. never seen what you describe

    3. I had the same thing happen with a first gen Sonoff 4ch. I had converted a robotic arm to run on 4 channels, l,r, up, down, and the thing came alive one night, flailing about like it had gained sentience, but didn’t like it.

      I gutted it on the spot and left it in pieces.

      Scary Skynet moment.

  2. Please excuse my lack of knowledge but would you please point me toward a proper USB to TTL adapter. When I google search I get too many different things.

        1. That’s old news – they stopped bricking them ages ago as far as I know – all of mine are fake and all work.

          1. I just ordered one, different seller as I’m in the US but the same description and a large number of sales.


  3. Hi Pete,

    I’m really happy to have found your blog. This provided me with a great in-road to programming for hardware.

    I am experiencing a minor hiccup with the sonoff. I am trying to use the wifi switch on an existing wall switch while maintaining the physical usefulness of the wall switch.

    It works, however there is a delay between using the physical switch at the wall and the time at which the light comes on of about five seconds.

    I have tried putting digitalwrite code into the void setup () method to speed up the process, but the code does not seem to fire.

    I ended up putting it in the void loop () method. It works there, but there is a delay while waiting for the connection and then the beginning of the loop method.

    Have you encountered this problem and if so how did you solve it?

    1. Remember I see these comments in isolation – including more info as to what software you are using would help. You say “DigitalWrite” so you’re not talking about my software – in which case you need to get to the repository of the writer and ask the question there. Something seriously wrong if you are waiting 5 seconds for a response.

      1. You’re right, I am not running your software! As you said above in the blog, “I want to control these with MY kit.”

        I tracked down the problem; in fact there were two. First, I was setting the relaypin to LOW in the setup method. This should be a reminder to everyone to check your spelling first!

        Second, I put the digitalwrite code in the setup method after a while loop–a blocking call.

        These were silly errors that I should have seen right off the bat, but I was both so giddy that the thing worked and so wrapped up in being afraid there were hardware issues that I skipped over some glaringly obvious mistakes in my code.

        Thanks for taking the time to read and respond, I really appreciate that!

  4. Problem fixed, it was the router all along. Four week of hell for a router which kept downing the Sonoff off or turning wifi on and off.

      1. Ok, Just lost for paragraphs of what I wrote due to not being connected to the network. Short and dirty talked to you found MQTTspy which is JavaScript look for it by googling it. Connected it to my pi through my old router “NBN ready and two years old lol”. Both pi and MQTTSpy passed messagers to the broker and back. Have a video of it on my Youtube talking and monitoring via WireShark. Filter is ” tcp.port eq 1883 ” Sonoff’s showed up on old router. I used Android app “Fling” to see them. Widen the search with Wireshark got this message. Sonoff: IP adress (Tell Who has
        Sonoff’s would connect to MQTT Broker then disconnect and continuously repeat this over and over again.
        If you google not much relating to a sonoff. In the end I got smart replaced my router and guess what happened the sonoffs now talk to the pi.
        I still need to check your sonoff software as I have being using a basic script no OTA. By the way how do we get sonoff to put 4 meg chip on as I have only got one to work out of three my eyesight is getting bad and the tracks are to small.

        Anyway thank you Peter, Peter Oakes, and Andreas Spiess for your help and direction. Also please add a edit mod on you blog page just in case I make a mistake.

        1. Hi – firstly I think the blog already has an edit mode… secondly, if you can’t solder the 4M parts then you are out of luck – but you could write to ITEAD to ask them to please consider using those parts instead of the smaller ones in future. It would be nice to know why the router did that. Consider this software

          1. Not should may the router was on the way out. I will never know unless I put it apart. Peter do you know any going voice activation software? As here in Australia we don’t have Amazon Echo or Google home yet. I am using Node-red too.

  5. Hi Peter, I’ve run into 2 different problems, hope you can help me! 🙂

    1) I flashed a SonOff device with my arduino FTDI cable. I didn’t realize that the arduino FTDI cable is a 5V FTDI, but amazaingly, it worked. Right now that Sonoff works but the power regulator in the lower part of the board gets extremely hot (it has even melted the case…) Any idea of what did I broke when y flashed with a 5V FTDI??

    2) I decided that it was not worth the value of the SONOFF to fix it, so I decided to buy 3 more SONOFF devices and a 3.3V FTDI device. But I’ve repeated the same steps with the 3.3V FTDi and I can re-program correctly the device that heats up (and still heats up obiously), but I’m unable to re-program de 3 new devices, all 3 seems “bricked”, the do not have the original firmware anymore (no led flashing at all at powerup) but flashing with arduino IDE always give an error (no response to erase comand” .

    ¿any idea how to force reprograming in these devices?

    Thx on advance

  6. Hi Peter,
    I can’t use your software so I want to replace it on my sonoff. First problem sonoff will not let me change the software. After updating to other software unit just give me your information when{debug}. Tried Ardiuno IDE and Luauploader. I get this at the start. Can’t autodetect firmware, because proper answer not received (may be unknown firmware).
    Please, reset module or continue.
    Now could I replace memory on the board to get your program stuff off. I am not saying this stuff does not work to everyone. It could be memake a mistake.

  7. Can’t help automating just about everything about the house. First year that we’ve had a WiFi enabled Christmas tree, good man Pete!

    Christmas Tree lights using your Bigtimer and a basic Sonoff to come on at dusk -30 mins with some UI over-rides.

    Thanks for all the highly distracting projects Pete!

    Happy Christmas


    1. Yup and same to you Gary – my little ESP-flashing flame serial RGB candle is by far the most impressive thing hanging out of the window… some day when I can afford to buy a very big 3d Printer (well, any, actually) I will make a point of making Santa frames with special clips for RGB LED!

      1. oh, cool! Did you talk about it somewhere here? Links, or hints on how you did it? thanks 🙂

        oh, a Prusa I3 clone can be bought for about 300€ now… just be sure it has aluminium infrastructure, of if you take an acrylic one, you can buy the conversion kit (look for the hephestos kits)

          1. No. First video WAY too simple – there is no MOVEMENT – check a real candle…

            Same with second video. I reckon serial RGB strip – 3 long – a triangle.. so you get to see it all sides…. top led weakest most of the time… occasionally the light would move UP as well as flickering at the top (but not the bottom). A candle flame is often blue-ish at the bottom – then yellow etc.. these simple 2-3 LED jobs are ok – they work – but they’re not fooling anyone.

          1. depends on what prusa… the basic kits you take for 200€ have acrilyc mountings so the structure moves and the Z-axis make “wobble” and you’ll have uneven layers… the hephestos version (which i have, bought original BQ kit exactly a year ago) is very stable, on the contrary… sure there are better option, especially today, but i’m good with it, and was very educative to assemble the kit 🙂

  8. hi , may i ask you something??
    i have a sonoff in the folowing configuration:

    power—->normal switch——-> wifi sonoff——->bulb

    could it be posible to program the sonoof so when i ever switch my “normal switch” off and then on , cuting the power on the sonoff and the reestablishing it, the sonoof toggles the state of the internal relay? i want to do this in order to use both no matter if i switch it of from the smartphone or the normal switch

    thank you

    1. Kind of depends if you are using this stand-alone or part of a home control system – and where you are using my software, some other software or the original software – no-where near enough info here.

  9. Hi Peter,
    The user name and password work in MQTTspy and pass to the broker and back well. I use wireshark to check the network but can only see the stuff I send from MQTTspy. The sonoff connects to my network but does not send any esplogin information. I can’t see your code so I am in the dark what to do next. By the way it connects to the broker. I think I have worked it out does your software have a {mqtt_passwd:”placepasswordhere”} ?

  10. 1480922678: Client ARPS_000776B7 already connected, closing old connection.
    1480922678: Client ARPS_000776B7 disconnected.
    1480922678: New client connected from as ARPS_000776B7 (c1, k120, u’admin’).
    1480922759: New connection from on port 1883.
    1480922759: Client ARPS_000776B7 already connected, closing old connection.
    1480922759: Client ARPS_000776B7 disconnected.
    1480922759: New client connected from as ARPS_000776B7 (c1, k120, u’admin’).
    1480922771: Client mqtt_def9a805.210658 disconnected.
    1480922771: New connection from on port 1883.
    1480922771: New client connected from as mqtt_d8ca63c1.2735a (c1, k60, u’admin’).
    1480922819: Client mqtt_d8ca63c1.2735a disconnected.
    1480922819: New connection from on port 1883.
    1480922819: New client connected from as mqtt_8a0dcbde.75f238 (c1, k60, u’admin’).
    1480922879: Socket error on client ARPS_000776B7, disconnecting.
    1480922882: New connection from on port 1883.
    1480922882: New client connected from as ARPS_000776B7 (c1, k120, u’admin’).
    1480923779: New connection from on port 1883.
    1480923779: Client ARPS_000776B7 already connected, closing old connection.
    1480923779: Client ARPS_000776B7 disconnected.
    1480923779: New client connected from as ARPS_000776B7 (c1, k120, u’admin’).
    1480923849: New connection from on port 1883.
    1480923849: Client ARPS_000776B7 already connected, closing old connection.
    1480923849: Client ARPS_000776B7 disconnected.
    1480923849: New client connected from as ARPS_000776B7 (c1, k120, u’admin’).
    1480923967: Saving in-memory database to /var/lib/mosquitto/mosquitto.db.
    1480925768: Saving in-memory database to /var/lib/mosquitto/mosquitto.db.
    1480927569: Saving in-memory database to /var/lib/mosquitto/mosquitto.db.
    1480927722: Socket error on client ARPS_000776B7, disconnecting.
    1480927723: New connection from on port 1883.
    1480927723: New client connected from as ARPS_000776B7 (c1, k120, u’admin’).
    1480929370: Saving in-memory database to /var/lib/mosquitto/mosquitto.db.
    1480929619: Client mqtt_8a0dcbde.75f238 disconnected.
    1480929619: New connection from on port 1883.
    1480929619: New client connected from as mqtt_847ca8f2.7b8358 (c1, k60, u’admin’).
    1480929676: Client mqtt_847ca8f2.7b8358 disconnected.
    1480929676: New connection from on port 1883.
    1480929676: New client connected from as mqtt_ca4888a0.35b778 (c1, k60, u’admin’).
    1480930442: Error in poll: Interrupted system call.
    1480930442: mosquitto version 1.4.9 terminating
    Mosquitto log file from pi.

  11. Here is what I get now after changing mqtt_password. Said there a good youtube channel to learn node-red?

    _STATION mode
    Web page control enabled
    Connected as 10:1:1:26
    MQTT connecting
    MQTT Broker connected
    Device ID is ARPS_000776B7
    MQTT Disconnected
    MQTT connecting
    MQTT Broker connected
    Device ID is ARPS_000776B7
    I must be doing something wrong the update never gets to the Sonoff.

    1. Well, it all looks like it is working – try renaming the units to sensible names (ID) – I normally always do that and I’m wondering if perhaps the automatic underscore in the names has something to do with it…

  12. Hi Peter, I am having problems with connecting my sonoff to Node-red. Here is the output.Can’t autodetect firmware, because proper answer not received (may be unknown firmware).
    Please, reset module or continue.
    MQTT Broker connected
    Device ID is ARPS_000776B7
    MQTT Disconnected
    MQTT connecting
    MQTT Broker connected
    Device ID is ARPS_000776B7
    MQTT Disconnected

    Dusk/dawn will not update to the sonoff too. Debug show no updating.
    Here is a picture of my Node-red setup.

    1. Sounds to me like you have the wrong details in there for the MQTT broker… likely username and pass.

      1. I redid it. But it could be my image as I used home assistant as it made my usbaudio work for me. Can I reinstall via the script to set Mosquitto? I did think about setting up Node-red on a old Tab Acer Iconia. Then turning off my pi’s and testing it. By the way thank you and the whole team for doing this software. It has got me back into electronics after a long while.

      2. Just to let you know the all-in-one script is stopping at pushbullet. Now I have been manually doing the script from there. Then rerunning the script to get the last bit in without node-red part. Would this cause the problem?

        1. Can’t imagine it being a problem. Not sure why it would stop at Pushbullet – perhaps temporary issue with their script.

  13. Hi Peter,
    I have tried my best to get my Pi and the all in one script to work. I now get the sonoff to conect but it disconnects soon after. I have tried to follow Peter Oates great videos to connect to the Sonoff as well. Here is a serial output from the sonoff, plus a picture on what node-red is doing.
    Can’t autodetect firmware, because proper answer not received (may be unknown firmware).
    Please, reset module or continue.
    MQTT Broker connected
    Device ID is ARPS_000776B7
    MQTT Disconnected
    MQTT connecting
    MQTT Broker connected
    Device ID is ARPS_000776B7
    MQTT Disconnected

  14. Peter,

    I want to use a Sonoff and MQTT to control my light switches. At the same time, I want to be able to manually toggle the lights using the physical switch.
    1. Can your firmware toggle the relay on the Sonoff when there is a state change on GPIO 14?
    2. Can this be done if the MQTT server is not available? – (If my MQTT gets knocked off the network)


    1. As MQTT is how the whole thing communicates – it would be like removing it’s veins. I have never, ever had Mosquitto Broker fail on me in 2 years. The Firmware does not attempt to “do” things – it sends messages out and it reacts to messages coming in. Node-Red (in my case) acts as the controller. If you use node-red-contrib-bigtimer – you can simply inject manual override messages into bigtimer to manually turn stuff on and off. So let’s say you set bigtimer to turn the lights on at dusk and off at mignight. Injecting “on” or “off” into the timer will override the automatic settings until the next change of state. Or you can inject “auto” to reset bigtimer to it’s auto state.

    2. I’m very interested using GPIO14 to work as the wall switch. This makes the existing wall switch work as a controller for manual operation.

      But I’m worried that it’ll have a power surge issue as I have not much knowledge on sonoff.

      Are you successful in the setup you described in the photo? A bit more details of how you connected GPIO14 would be very helpful.

      Thank you very much. Guy.

      1. As long as you don’t let mains anywhere near that wall switch there is no reason you can’t use the mains switch as an on-off toggle. There is a certain amount of protection on those inputs but I guess you could fit a low voltage vdr at the board end from ground to the input… make sure you’ve something like a 2k2 pullup to vcc on the pin.

  15. I am trying to clear the flash of my sonoff with esptool. When I try to do it I get esptool error: argument –port/-p: expected one argument. Does anyone know what this means?


  16. Hello Pete,
    Using your blog I tried flashing my first Sonoff, which didn’t work. Turned out my Funduino FTDI programmer – with 3v3/5v switch – outputs 5v no matter what the switch is set to (thanks China!).
    This makes me believe I fried something. With the original eWelink app, everthing still functions, but I cannot enter flash mode. Can I revive the unit by soldering a new Winbond W25Q80BVSSIG IC? Thanks for any help!

    1. Well, that kind of depends what’s bust. As it isn’t working you’ve not a lot to lose by trying.

  17. From further reading in this thread and the “Sonoff TH10 and TH16” thread, I’ve gathered some good info that answered many of my questions and it looks like Peter plans to do some reviews on some of the models I’ve mentioned soon.

    Looking forward to reading what he has to say and i’ll plan on placing some orders so I can start working with them.

  18. Anyone tried using any of the Sonoff Touch – Luxury Glass Panel Touch LED Light Switches or the Sonoff Dual WiFi Wireless Smart Swtich for controlling multi / gang switches? Except for a few closet light switches most of the light / fan switches in my house are in the 2-5 gang (US) / switch range. Not sure if these will easily fit inside a regular 1-2 gang switch box and utilizing a momentary push button switch in place of the original switch to provide manual on / off device control. If they can be reprogrammed and used in the same way, using the Sonoff Touch switches could do the trick.

    I see the site also lists a 4 Channel WiFi Wireless Switch which includes an RF remote and no case, but I don’t have an interest in using those remotes and it would be nice if it had a case so insulating bare contacts (in a metal gang box) wouldn’t be necessary.

    1. Sorry the pic was larger than I thought and was thinking it was the profile pic! I’ll have to register and edit the post if possible.

    1. Hi there

      It is Amazon Echo – there are plenty of guides out there – this is WAY too vague a question.

Comments are closed.