Tag Archives: Electrodragon WIFI Twin Mains Controller

The Electrodragon Alternative


electrodragon[6]Part 1: At $6, the Electrodragon “WIFI IOT Relay Board based on ESP8266” looks like a force to be reckoned with, offering WIFI control over two 10 amp relays. But what about the SONOFF from ITEAD? How do they compare?

Making use of their own incredibly cheap power supply is one reason the cost is so low and the board looks on the surface to be well made and well thought out – but read on.

The unit uses what appears (from the antenna design) to be the ESP-12F module which, it is said, has a better antenna than previous models but is otherwise pretty much like the ESP-12E.

The two relay outputs are on GPIO12 and 13 respectively – with the status LED on GPIO16. The socket for a temperature sensor uses GPIO14 !!! That’s new – usually people use GPIO2. Oh, well.

In order to do the board justice I went off to their website http://www.electrodragon.com/w/ESP_Relay_Board#Pin_Mapping_and_Wiring and there seemed to be a fair bit of info available. Clearly the first thing I’d be interested in would be blowing my own software. The page refers to buttons 0 and 1 but on the board are buttons 1 and 2…  but elsewhere they clarify these as buttons 1 and 2. I had expected these would be used for reset and programming respectively and that as it happens is easy as a 6*2 way connector conveniently brings out RX and TX. In practice one of them does indeed go to GPIO1 for programming but you have to power cycle the board to start programming – that kept me going for a while… always read the manual.

electrodragonThe case of the module I received, it would seem, was one already available because the 4-way connection bringing out the power via the relays, is partially obscured by the case itself. Not a good idea when you’re messing with mains wires – and especially those able to take 10 amps – but wait - there are lots of thing they’ve gotten right – the neutral line is not only separated from the live by a gap but it is also on the other side of the board, but the two tracks bringing power right across the board from the mains to the two relays –  while being nicely isolated by an air gap which is GOOD, are WAY too thin to handle a total of 20 amps (2 * 10amp relays) or, IMHO. I’m happy with that as I’m only likely to want to power a couple of bulbs but it seems a bit daft to use a pair of 10 amp relays then keep the track so narrow – around 1mm.

The power supply claims to have all matter of things including temperature protection, overcurrent, overvoltage and short circuit full protection, high and low voltage isolation – and yet, it is a really small and simple looking, exceedingly low cost model available for little under £1 – do we believe the claims? Do they matter? If you’re powering only the relays there’s not much chance of getting an electric shock but the board encourages you to attach a DHT22 which means you could be in contact with wires – my only advice here would be never to touch them when this board is connected to the mains – and make sure no-one else can.  But why you ask, surely you’d put the DHT22 in the unit itself?  Not if you want any meaningful temperature sensing out of it – these devices HAVE to have air around them and not the warm air off a power supply. Really, don’t waste your time putting a temperature sensor inside this OR a SONOFF box unless of course you’re using it to see how hot the electronics get.

So, how was I going to test this unit – I noticed something about AT commands – but I gave up on that way of programming with ESP8266 chips a LONG time ago – regular readers will know that I generally talk to such boards by MQTT protocol using my own code as found in the Home Control 2016 project and the prize-winning (subtle) WIFI Touch Display project and this was to give me pause for thought as I use GPIO13 for status indication – as do the SONOFF units and the relays here are on 12 and 13.

Well, nothing should be set in stone so I spent the evening adding more commands to my code and added a function to allow for these Electrodragon units – strangely enough I’ve named the command “electrodragon” – if set to 1… we’re using these boards, if set to 0, we’re not! Simples.

Programming Electrodragon

So, I’d not realised this but reader Nathan tells me that the chip isn’t actually programmed other than what’s on the chip initially i.e. the AT command set. So that has to come off.

Above you see a picture of a typical FTDI – that is the little box that plugs into your PC or whatever and converts USB into serial signals. That box is wired as you see above to the connector on the Electrodragon – and the button I’ve highlighted is the one that needs pressing BEFORE AND DURING POWERON in order to put the Electrodragon into programming mode.

To program the board I did NOT connect it to the mains or to any output. I connected up my FTDI as you see above – now, the sharp reader might say “but that’s on the 5v setting by the link on the FTDI and won’t that break the board?” – I have to say that the vast majority of the information on the web says YES, but here’s why I’ve done it this way: firstly putting the FTDI in 3v3 mode means it has VERY little power to spare and in many cases you’ll end up with relays jittering and lights flashing and you’ll get no-where (that would be with the power (red) lead elsewhere of course – bottom right pin in fact on the Electrodragon), and secondly while I would never normally use 5v logic with an ESP8266, I have NEVER broken an ESP12 by using a 5v FTDI signal on the serial.  Serial from the Electrodragon incidentally to the FDTI is fine – it’s the higher voltage serial output from the FTDI to the serial in on the Electrodragon we’re talking about.  Your choice if you decide to copy me – but specifically using FTDIs that look like the one above – I have blown ESP12s WELL over 1000 times without doing them any harm. The alternative is a 3v3 power supply feed to the board and leave the power output of the FTDI unconnected. Your choice, your responsibility.

Remember I use my own software that needs to talk to MQTT and have access to a WIFI access point.

For the software you need to go to the home control 2016 blog – there is source code for the Windows Unofficial Programming Environment or a pair of ROMS for those unable to do this (and to be fair it took me a while to get to grips with using the SDK etc)  – RBOOT.BIN to 0x000000 and ROMX.BIN to 0x002000 using your preferred tool. The ROMS are in the root of www.scargill.net.  Once programmed, disconnect and reconnect the FTDI.  Most likely you won’t see the light flashing on the board. Instead you’ll hear a relay flashing on and off quickly – that’s because by default, GPIO13 is an indicator!!!!  At 115,200k send serially the commands:



The relay will stop clicking but the indicator won’t yet flash - and now reboot – the indicator on the board should start to flash and these commands will now work…  {out13:1}, {out13:0}, {out12:1}, {out12:0} – so that’s your two relays working - you’ll then need to go through the instructions to set up your WIFI access point and MQTT details – that’s done by a web interface or just as easily you can do it by serial just as above. Once that is done – Bob’s your uncle.

So in my case:











reboot (i.e. pull the power and reconnect.

Now WHY does that have to be complicated by adding a second SSID? Because my software handles two of them for backup and while you’re messing about it is trying to connect to a default SSID you don’t have – there’s a chance by the time you get around to it that it is trying to connect to the SECOND SSID.  If you can’t be bothered to put the second one in – eventually the unit will get around to trying the first one again.

I’m calling my units “electro1” and “electro2” as I have two of them – they are now all programmed up and ready to go. Just to be sure I was not missing anything I left one on at midnight last night and as expected it operated flawlessly.

NEXT: Plug in the power - I don’t expect any surprises. Nathan and I have both passed comment about the power – from here on it is all your responsibility.