3Cheap WiFi SmartPlugs with SmartThings

SmartTh­ings com­pat­ible smart plugs are annoy­ingly expens­ive — typ­ic­ally around £40. This is far too expens­ive to con­sider buy­ing many of. There are how­ever WiFi plugs avail­able online for around £10 that don’t offi­cially work with SmartTh­ings. Most of them are based on the ESP8266 chip which can be reflashed with new firm­ware that will work with SmartTh­ings. Below I doc­u­ment my tri­als and tribu­la­tions with hack­ing these plugs

As of March-2018 I’ve tried 4 difer­ent makes of plugs with a vari­ety of results.

Note — Regard­less of the soft­ware you plan to use to flash the device, and regard­less of the flash image you use, I recom­mend using pin head­ers (ideally soldered) to get a reli­able con­nec­tion dur­ing flash­ing. I got a pack for around £10 which has enough head­ers to do hun­dreds of smart plugs. I also recom­mend using a CH340G USB to seri­al adapter instead of an FTDI adapter as there can be issues with the drivers for the FTDI adapters. If you already got an FTDI adapter make sure you are using the older drivers. Also ensure your adapter can sup­ply 3.3v rather than 5v (which will likely fry the ESP8266 chip)

I have used Sonoff-Tas­mota which I build and install via the Ardu­ino IDE (see bot­tom of post for addi­tion­al info). I then installed a cus­tom device hand­ler, made by Brett Sheleski.

By the end of my exper­i­ments I had 2 work­ing Smart­Plugs, hav­ing bought 4 dif­fer­ent plugs (£44.94 total), 1 USB adapter (£5.99), and 1 set of pin head­ers (£6.69). If you don’t have a sol­der­ing iron you’ll need one of those too (£26.29). Includ­ing the sol­der­ing iron my total cost was £83.91. Had all 4 plugs worked this would have been decent value. As it is, I’ve got 2 work­ing plugs, at a cost of £41.96 each. This is almost identic­al to a Belkin WeeMo, which might make the whole thing seem point­less — and if you only want a total of 1 or 2 plugs it prob­ably isn’t the best way to go. How­ever, I plan to have quite a few more plugs, and I can now add more plugs to my col­lec­tion at a total cost of £8.97 each as I already have everything else I need to flash them. (Update Dec-2018, I now have a total of 20 smart­plugs, and have paid no more than £12 for any of them)

1. SWA1 (has a purple but­ton) — branded as COOSA, Annstory, Lingan­zh, and no doubt oth­er names too. Seems to be asso­ci­ated with the app “eFam­ily­Cloud”.

This has a second PCB inside it which is labelled as an SWA1. Googling this indic­ates that it uses an ESP8266 inside and a suc­cess­ful firm­ware hack has been doc­u­mented (with pins shown) by Nath­an Chantrell. I have fol­lowed Nath­an’s meth­od with suc­cess, although the mod­ule type did­n’t show up the first time (I made an error modi­fy­ing the code) but I was able to get the device work­ing by select­ing Gen­er­ic and then con­fig­ur­ing the pins myself. This worked but not quite flaw­lessly, so after a bit of read­ing I reflashed it. Nath­an’s guide does­n’t make it clear that 3 changes are needed to the code before flash­ing — the large sec­tion at the bot­tom, and the match­ing name from it needs to be added to 2 lists above which should be obvi­ous when view­ing the file. Since reflash­ing (via the web inter­face) it has worked very well. To keep the sol­der­ing simple I fed 5v from my USB adapter to the 5v pin, but I left the adapter set to 3.3v (i.e. the set­ting for the data pins). So it is worth hav­ing an adapter with both 5v and 3.3v pins and a jump­er to set the voltage of the data pins inde­pend­ently (as the CH340G I linked to on Amazon has). I was able to leave the pins attached by bend­ing them over to nearly 90degrees before put­ting the PCB back into the plastic casing.

_

2. The HowiseAcc S126 Smart plug with USB (curves in slightly in the middle)

Inform­a­tion online indic­ated that the TYWE3S com­pon­ent in this smart plug con­tains and ESP8266 and hence it should (in the­ory) be flash­able. I have not as yet iden­ti­fied the cor­rect pins, altho there are labels for 3.3v and ground on the under­side and the TX, RX and GPIO0 pins on the TYWE3S are shown on a sim­il­ar device on a post on Git­Hub. I found at least 1 oth­er thread with anoth­er per­son ask­ing about the same device, and some more inform­a­tion from Andreas Engel, but with 2 of my 4 “test plugs” work­ing I decided that try­ing to solder this head­ers on this plug was too dif­fi­cult and have ditched it. If you’ve got a stead­i­er hand than me then take a look at the link, espe­cially the second one and please let me know if you have any luck.

_

3. Floureon PS-16-MB Smart Plug

This has an ESP8285 chip onboard which is com­pat­ible with the ESP8266. It has trick­i­er head­ers to solder but once soldered it flashed per­fectly first time. Just con­nect the 4 reg­u­lar pins (3.3v, ground, TX, RX) and hold the but­ton down whilst power­ing it up (1−2 seconds was enough). As this is effect­ively a Sonoff S20 clone I sus­pect it can be flashed more eas­ily with the NodeM­CU flash­er by fol­low­ing Eric M’s guide, S20 firm­ware, Device hand­ler, and Smart App code. How­ever, I pre­ferred to go with the Tas­mota firm­ware as I had already set everything up to build and flash it, and it sup­ports the oth­er smart plugs which aren’t all Sonoff S20 clones. The choice of which way to go is up to you.

_

4. The Aonokoy SE01 (16 Amp) smart plug

This has an ESP8266 and easy to access head­ers, although they are too close togeth­er to con­nect reg­u­lar pin head­ers to so I used loose wires instead. I have been able to con­nect mine to my PC and flash it. After flash­ing it boots up as expec­ted and the web inter­face of the firm­ware loads, but the unit crashes after around 10 seconds every time. I am not sure why this is, but it does it with sev­er­al dif­fer­ent firm­wares flashed onto it. I am hop­ing it is just bad luck with a duff unit.

_

5. The Hyleton HLT 315 smart plug (looks a lot like a Floureon on the outside)

This was more fiddly than I had hoped as there are no pin head­ers on the PCB itself — instead you have to solder to the exist­ing join between the main PCB and the wifi card PCB. For­tu­nately there was a guide for a very sim­il­ar 313 device which (cor­rectly!) iden­ti­fied the pins needed. Flash­ing was suc­cess­ful and the only dif­fi­cult part was to identi­fy which device type to select (or cus­tom­ise) so that the LED, but­ton, and relay would all work. The GPI0 pin had to be shor­ted to ground phys­ic­ally, as hold­ing the but­ton down did­n’t put the device into flash mode. This was a bit fiddly — I really needed 3 hands! It is pos­sible to (mostly) con­fig­ure the device cor­rectly by using the gen­er­ic device type and set­ting GPIO2 as Led1i, GPIO13 as Button1 and GPIO15 as Relay1. If you also want the red LED to be always on then set GPIO0 as Led2i.

Building sonoff-tasmota yourself

  • Down­load the Ardu­ino devel­op­ment environment
  • Install and run it
  • Open Pref­er­ences from the File menu
  • In “addi­tion­al boards man­ager” enter https://arduino.esp8266.com/stable/package_esp8266com_index.json and click OK
  • Open Tools > Board > Boards Manager
  • Search for ESP8266
  • Hov­er over the res­ult and click the Install but­ton that appears
  • After it has installed change your board using Tools > Board >and select the Generic ESP8266 Module
  • Close Arduio IDE
  • Install the drivers for the CH340G (down­load theme here)
  • Down­load and extract from zip the Sonoff-Tas­mota firmware
  • Open sonoff.ino in the sonoff sub­folder (this will reload the ardu­ino IDE)
  • Option­al: Edit 2 lines (lines 62 and 63) in my_user_config.h to set wire­less net­work name and password
  • Con­nect the CH340G to the board, and then plug the CH340G into a USB port
  • Select Upload from the Sketch menu of the Aru­dio IDE

I found that with new­er builds of Sonoff-Tas­mota that at least 1 LED would flick­er con­tinu­ously. I even­tu­ally real­ised (by look­ing at the logs) that this was because MQTT is enabled by default and the device is search­ing con­tinu­ously for an MQTT net­work / con­trol­ler or some­thing. I don’t use MQTT so I turned this off and the LED stopped flashing.

Cevap bırakın

3 Comments

RKRob De Koning

Jon, I have a num­ber of the SWA1’s that I’d like to flash how­ever I am stuck at cus­tom­iz­ing the firm­ware to include the SWA1 before flash­ing. Nath­ans site shows the edits to make, how­ever the firm­ware down­loads all appear to be bin files, so I’m not sure how to access the sonoff_template.h file?

Reply
LLeon

how did you man­age to flash this Aonokoy device?
There are some guys try­ing to flash it but its not possible…

Reply
JSJon Scaife

I used the CH340G USB adaptor linked at the top of the art­icle, and just stripped the wires and poked them through the holes in the PCB. That was­n’t easy as they always want to twist and touch each oth­er, or they want to lose con­tact. You can see how the wires are looped through in the 5th image (https://diymediahome.org/wp-content/uploads/aonokoy_6.jpg). There are 2 areas that need wires con­nect­ing — the set of 5 holes near the edge of the PCB which need 4 wires from the USB adaptor. The last 2 holes need con­nect­ing togeth­er. There is also anoth­er set of pin holes near the middle of the PCB 2 of these need short­ing togeth­er. I then used the Ardu­ino IDE to flash Sonoff Tas­mota as described at the top of the art­icle. As I say above altho it worked, it crashes after a short period

Reply