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:

{wifi_button:1}

{electrodragon:1}

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:

{id:”electro2”}

{ssid:”wififorus”}

{pass:”xxxxxxxx”}

{ssid2:”wififorus”}

{pass2:”xxxxxxxx”}

{mqtt_host:”192.168.1.19”}

{mqtt_pass:”xxxxxxxx”}

{mqtt_port:1883}

{mqtt_user:”admin”}

{mqtt_pass:”xxxxxxxx”}

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.

Facebooktwitterpinterestlinkedin

92 thoughts on “The Electrodragon Alternative

  1. My current issue is Electrodragon products documentation and revision tracking:
    I have R1.1 with the blue relays then purchased the R1.5 version with the black relays and now they have new version of both. The New version of the blue relays is ?? they haven’t posted the revision number! The R1.5 version with the black relays is suppose to be R1.6 now with a means to isolate the i2c lines from the pull-ups. BUT the ‘NEW’ R1.6 board I just received is labeled R1.5 yet the layout is different from the first R1.5 versions I purchased and on both they do not have the pads to isolate i2c. At electrodragon’s website they have http://www.electrodragon.com/w/File:Esp_relay_board_r1.6.png but have removed all other version of the schematics!
    They have the L (HOT) not switched with N (neutral) switched. Simple issue, reverse the incoming connection so HOT is N and L is neutral, in the US that means Black to N and White to L. Of course you will unplug the board from A/C before reversing the wires. 🙂

  2. “but that’s on the 5v setting by the link on the FTDI and won’t that break the board?”
    The A/C to D/C converter on the electrodragon product provides 5 volt D/C, by hooking a 5 volt supply to the electrodragon product 5+ pin you are feeding the 3.3 volt electrodragon product on board regulator which provides power to the ESP-12.

  3. What do we all think of attaching a DS18B20 on flying lead (like https://www.amazon.co.uk/gp/product/B00CHEZ250/ref=oh_aui_detailpage_o00_s00?ie=UTF8&psc=1) to a sonoff; I note that in the schematic, the low voltage does seem to be isolated from the mains (not as in the Slampher, where the 5V is directly connected to LIVE)?
    When I get the DS18B20s, I’ll investigate if the stainless encapsulation is deliberatelyt connected to gnd; but there is no info on if it is specifically isolated.

  4. Hi Peter,
    Great article, I am also running MQTT at home, with my own firmware over OTA on the Electrodragon boards. I do have a question, I uploaded the firmware by connecting the pins and since I am used to doing this only the first time I installed the Electrodragon boards in a difficult to reach place. Afterwards I wanted to add another feature to the firmware but I don’t seem to be able to program them via OTA. The authentication works but the upload doesn’t. Do you have experience with ArduinoOTA and the Electrodragon boards ? Is it because their flash button needs to be pressed ?
    Thanks.
    Vincent

    1. I tend not to use the Arduino environment – preferring C and the Exclipse environment using the official SDK – however it does sound like a flash button issue – this needs to be pressed before you hit reset (or remove power) and released AFTER that.

      1. Hey Peter,
        I think so too, any idea how this can be solved without pressing (like with NodeMCU) ? The module is situated in a very bad place (even if it is just for pressing a button), and you have to dismantle the entire case just to find the button.
        Greetings Vincent

        1. Hi there,
          Thanks for the tips in your blog, help quite a bit.
          I’m a little confused though with regard to the wiring of the relay board. I’ve attached a pic of the version I have and it has a different wiring layout for the live and neutral cables, to the pinout you’ve described. Live is on the outer and neutral is on the inner connectors for the output terminal. The live terminals are also passed straight through ie no switching. Is this correct? I thought live should be switched? I also have an earth cable which I’ve just passed straight through to the devices….

          1. Did you get an answer to your problem? i have just purchased the same board and confused as to why it would be switching neutral leaving live runing straight through! dont really want to try and reverse the polarity and potentially blow the board!

              1. Well i’m clearly not an electrician so i cant tell if the directly powered step-down transformer can handle either polarity.
                But if its not designed for it then i’m surely going to melt some bits?!
                I notice that the separate transformer PCB is also clearly marked with L&N to match the main board which i still cant understand why you would switch Neutral rather than Live.

                So i’m just asking if it will be ok to power the opposite way round to what both boards are marked as (this is R1.6 btw). We are rather scrict in the UK with what is live and what is neutral. The board would certainly not get RoHS Compliance in the UK.

                1. The only reason it is strict in the UK is because of what we for reasons I’ve never fathomed out do with the neutral line – the power supply could give two hoots which way around the live and neutral are. You want the live (in the UK at least) to be on the switched side purely and simply from a safety perspective.

                  If you don’t feel they are “compliant” enough – of course – you don’t have to buy them.

                  If you have a board which you are SURE is switching on the neutral then perhaps an email to the company is the sensible approach as they may have made a mess up of a batch of boards… or their experience may be in Europe – here in Spain there is no difference between so called live and neutral – or if there is – no-one takes any notice as the two-way plugs can be plugged into the wall either way.

    2. Hi, I also experienced this same problem, but after some analysis, I discovered that the issue was in my prior firmware upload configuration.
      Seems that the OTA needs some free available space on the SPIFSS in order to upload the new firmware before its actual update.
      So, to me the solution was to upload it again, in classic manner through serial, but now, being sure that having applied the right configuration of SPIFSS.
      In my case, it was needed to use configure the flash size to 4M (3M SPIFSS).
      After reflashing with this configuration, keep it to every new OTA upload and enjoy it.

  5. Hi,
    First sorry for my bad english…

    I’ve buy 1 electrodragon because i thought it was like Sonoff…
    And now after reading all your comments, i would like to know 2 things

    1- Can i use ‘ewelink’ to drive the wifi iot ?
    2- Is it possible to control the motor of a shutter ?

    1. It is like Sonoff in that it controls a relay – I stopped using Electrodragon because simply the Sonoff is a better deal. No idea what (1) means – (2) depends entirely on the motor. Check out current requirements and remember that a motor is inductive so make sure you have plenty of margin.

  6. Great blog. I purchased some Sonoff and played with them then came across the ElectroDragon parts with actual documentation, needless to say I’m using them now and the Sonoff are pet rocks.
    The ElectroDragon parts I have are the new model with black relays, to drive the contactor relays I use, it only takes 750ma, those relays control 5hp motors at 40amp 240vac. It seems Electrodragon wants you to experiment with their hardware whereas sonoff not so much. I’ve ordered the RF parts to add an RF switch for a customer that doesn’t use smart phones (there are a few). That a look at the latest version!

    1. I have to say I found the opposite – Itead go out of their way to encourage you to experiment – and even advertise the open source software for one of their products – there are several alternatives now for the software for them. I put the Electrodragon units to one side. Some of their prices are horrendous compared to the likes of AliExpress. I’m assuming you mean this one? http://www.electrodragon.com/product/wifi-iot-relay-board-based-esp8266/

      I’ll grant you it has 2 relays – but it is competing against the basic Sonoff at under $5 with a case and fixings. I’m not sure if anyone is working on the Electrodragon parts now but there is support for Amazon Alexa with the Sonoffs. Still – if it works for you….

  7. Hi Just bought some electrodragon and wonder how to use the GPIO marked on the pins. The wiki indicates that GPIO15, 5, and 4 should be available. Though using ESP Easy I’m not able to read the status over the GPIO’s. I managed successfully using the Sonoff (1 and 3). Can anyone help me out how to get the electrodragon working?

    Thanks Mark

  8. Peter,

    I’ve attached a DS18B20 to the board (left-to right, red 3.3v,yellow DATA,blank,black GND). Then sent {temp_type:0} and did a {temperature?}. I mostly get -1 and sometimes a 0. Am I missing something obvious? Do I need to tell it what GPIO the sensor is on?

    Cheers Oliver

      1. You may (I’ve not checked with that board) also need a pullup – if there is not on already on the pin – something like 4.7k

          1. Ok. With additional pullup (4K7) there is no answer at all to {temperature?}. I’ll check your code and see if I can glean anything.

    1. And tested on another board with a DHT11. Same thing. Checked all soldering is ok too.

  9. Hi,

    So noticed that there are Electrodragons with red boards and with yellow/green boards. Anyone notice a difference?

    also there are two VCC pins on the pinout. One is 5V (which the above description connects to and the one to the right of GND is 3.3V.

    Cheers
    Oliver

    1. Ok, tried everything I could think of. I can’t get the Electrodragons to flash. Using esptool like I did on my test esp, nothing. Just can’t connect. No blinking blue light (only blinks at 9600 and 19200 baud). Treid 74880 and 115200 baud. Tried a FTDI and a PL2303. Tried two different Electrodragons.

      I have the power hooked up to a 5V 2A supply. If I start in non flash mode I get to see the AITINKER welcome.

      Help!

      1. Suggest you get in touch with the company – they ARE using a bog-standard ESP board.

        1. Argh! The one I tried works fine. Just that GPIO0 is permanently linked to GND. So I can’t get out of program mode. So I’ll desolder the button. Also Arduino IDE’s serial monitor just didn’t wanna work. I also had to use a PL2303 as my FTDI didn’t have enough juice.
          I have 4 electrodragons now working. Now need to solder on some temp sensors.
          Love MQTT and your ROM! So THANKS HEAPS!

          1. Last one I can flash and I think I see the “Waiting for Wifi” messages appear but they are gibberish. Tried different ttl speeds but nothing. Thing is the messages appear in exactly the same rhythm and the relay does it’s thing. Guess the unit is bung or I fried something.

  10. Hi Sergee,
    maybe you can add a bigger capacitor to the original power supply to make it more stable.

  11. I have tested two boards. Both have problem with internal power supply: ESP8266 may reboot when switch on the 7W LED Lamp in 4 sec on/off cycle. With 1A mobile phone charger or power bank connected (by solder) instead internal PS, test cycle work without reboting MCU.

  12. Hi Scropian86 ….
    I don’t want to be viewed as a ‘picky white coat’ here …. Yes the slotting etc is good, but track spacing seems to be based on 240V pk, not the peak of 230Vac mains and possibly higher spikes that can occur.
    I know everything is getting tighter these days, but for me, 3mm is absolute minimum regardless, and tracing low voltage track close to mains is not for me either.
    It’s possibly ok in clean and sealed environments, but that does not always exist, especially after a year or so in the field.

    The relay diode is there to protect the transistor from back emf voltage spikes when turning off, so any track lengths should be short. Without the diode and a high enough Vce transistor, all ‘should’ be well, but I have seen guys puzzling about random resets occurring many times. Put a clamp diode in and all becomes good again.

    I suppose my mindset comes from way back from when a design of mine was investigated by Health and Safety. ( Not a comfortable situation). It involved pyrotechnics and idiots thinking they would have ‘fun’. The truth prevailed in the end but when you have top guys x-raying everything, pulling your design apart, you have to be able to answer and affirm your design methods, regardless of what any theoretical specs appear to validate.

    When it comes to mains voltages and safety where 3rd parties are involved, I always question a design in terms of it being pulled apart by these guys. If I feel that if all ‘questionable’ aspects can be addressed then the design is ok. (always room for a Mk2 though!) That’s another reason I don’t like those ‘middle pin’ relays, regardless of who uses them.

    Again, please don’t take this in any other way than as a personal view from experiences that I have had, and hopefully combine some of it to your obvious skillset.

    regards

    1. My comments to add to Dave’s….and like Dave only meant to be helpful…. diode on transistor – for me that is utterly mandatory regardless of transistor. Comment about random reset is quite common.

      3mm clearance that is what I have always worked to and it also is my understanding… never failed me.

      1. thanks Peter and Dave. for you kind suggestions , and that notes will be taken in future designs
        and as you know that is Rev. 1 and next rev. will take such flaws away.
        to reduce the risk of using these rev.1 PCB i ma planing to used Conformal coating for the back side of the PCB hope that makes it more safe to use.

    1. THAT’s Nice! I’m feeling an urgent need to make my software work with it…..

        1. Yes, Scropian86, all looks very neat …..
          points I would make would be the following….

          Relays … Those relays which have the ‘live’ connection between the coils pins …. if you cut one open and take a look, would you really want to use these at mains potential where the possibility of ‘tracking’ between mains and low voltage exists and contact gaps are that small?
          If you open the sonoff relay for example you’ll see the difference. Good coil isolation and contact structure.
          Ever since the appearance of this relay format, I have stayed away from it for any use where safety could be an issue.

          Relay coil clamping diodes really need to be as close to the coil as possible in order to prevent any track crosstalk issues.

          Running low voltage tracks around the possible mains voltage relay pins (and too close) is not a reliably safe method and would be much frowned upon by ‘the powers that be’ should any repercussions prevail.

          Please remember these comments are only those relating to my personal experience, and are in no way meant to detract from the amount of good work that has gone into this project. A few minor changes and the board becomes ‘solid’ and very useful.

          1. Interesting Dave, I’ve not opened the Sonoff relay but being smaller we thought it might be less able to handle current. Thanks for the feedback – clearly, more testing is in order.

          2. i understand your concerns , and please note that it’s my first Design and can be have some flows.
            before i started i already read more about safety of power supply and also PCB high voltage insulation

            as per the standers for creepage and clearance calculated http://www.creepage.com

            i kept my design higher than the minimum here , even if the clearance is less than that i milled the PCB to increase the creepage distance.

            below is the measurements for 240 V clearance

            http://community.blynk.cc/uploads/default/optimized/2X/6/6bb301dfe747d71754d4c922800ce0158659c8ee_1_690x173.png

            also creepage

            http://community.blynk.cc/uploads/default/original/2X/f/fc926f70184589c1553339a72fb2bf313d8509b6.png

            http://www.smps.us/pcbtracespacing.html for the coated clearance measurements

            http://community.blynk.cc/uploads/default/original/2X/5/5bd7ad6d261477f8ea051f6c2da192885f9dc226.png

          3. more note , i also implement the Diode to protect the 2N2222a and my ESP-12F from coil releasing back current which is 71.4 mA as per the data sheet and the diode can handle it as per diode datasheet also .

            i have milled The PCB under the Relay between the coil pins and the AC line.
            also near the AC/CD Power input.

            and in my blog post i mention that max suggested Amps that should be used with the relays is 3A according to the trace width (manly some lights that will never do more than 1A).

            and the Relay i used is the same as the one in electrodragon PCB.

            i hope that will be safe enough.

            again thanks a lot to check and give your opinion that note will help me in any next project .

    1. Will try Andreas – we’ve a new board coming, I did some updates to home control yesterday which should save some confusion and in a couple of weeks I’m going to try adding an i2c extender now I know how to setup i2c on GPIO4 and 5… I’ll make it an option.

      1. Just to share my findings about GPIO pins on the electrodragon relay pcb, after many hours debugging and trying to solve the issues about undetected I2C devices using the I2C scanner, I carefully inspected the pcb and its schematic and verified the presence of R11 and R12 (and also R13, R14) resistors pulling down the input signals, conflicting with the pull up requirement of the I2C. After removing these resistors (R11 and R12), I finally was able to run the sketch successfully.
        Additionally, to solve unstability of the signals, I also partially updated the I2C core funcionts using the most recent release of hardware/esp8266com/esp8266/cores/esp8266/core_esp8266_si2c.c, available on https://github.com/esp8266/Arduino/commit/84c8605f694f03535205d2062ad5dd1fae81ca5e.
        I hope that in the future the Electrodragon remove these resistors from the project or make optional their usage.

  13. The twin 10A switching capability worries me and to be honest I’d avoid a unit like this and certainly wouldn’t promote it to amateurs who aren’t used to dealing with mains power.

    I’m working on a similar design but sourcing the components myself – I reckon it’ll cost about £8 – £10 to put together a “smart” switch for the lamp in my living room. Another design for my central heating will be about £20 but, as an electronics / electrical engineer I’ll be able to trust the circuitry.

    1. Making claims based on the claimed attributes of a sub-item is absolutely standard in the industry so I would not put people off because of that. How many claims of X thousand hours do you see for LED lighting – when in fact NONE that I have seen have that lifetime. They take the theoretical maximum life proposed by the LED manufacturer themselves in ideal conditions, add a crappy power supply and apply that to any subsystem comprising a LED no matter how badly designed… and that is but one trivial example. It’s all very nice having “professional standards” – but when those standards put thing above the financial reach of the amateurs you refer to… you, like me – are no doubt able to design “professional” kit we can trust… but you know as I do – we could not get it on the market with all the mark-up that entails, at a price people would buy into. SONOFF are available for little more than 4 quid, the Electrodragons for not too much more – we can’t stop people buying them and I for one am not part of a view which would encourage them to play safe – I spent my youth before such things were considered terrorist activity, making explosives for fun – all we can do is invite people to take on some responsibility of their own and offer advice on the assumption they WILL buy this equipment. My advice would be – at least HALF the claims you see in front of you, thoroughly test anything you buy before leaving it un-attended and if it fails ALWAYS demand a refund, don’t accept anything less – and do your own testing. One would HOPE that the people reading blogs like this have some common sense and WANT to experiment. Those who don’t can continue on paying over the odds for retail markup. You can buy a nice mains switch from B&Q for a mere 8 times the price of the stuff we’re talking about.

      1. Pete,
        off topic – Don’t take this the wrong way – but all you have to do is put a disclaimer on your front page – especially when main voltages are involved.
        Think of it that a 12 year old kid could be following your blog and wanting to copy you etc

        on topic – Be careful with making incorrect generalisations like
        “over here in Spain where I am right now there’s no difference between the two “live” wires”
        and
        “I THINK the situation is the same in the UK… 2 pin plugs”
        Whilst a 2 pin plug may make you think there is no difference, there is a lot more to it than that – Hence the reason why I think you should put a disclaimer on your front page.

        1. Not a bad idea really – done – on the right. Oh and on generalisations: European and American American plugs which are reversible definitely (and clearly) do NOT follow a principle of one side being live and the other neutral. I am sitting in front of a large extension which has 2 way facility which is utterly reversible as are the USA plugs I put into adaptors here (clearly only for devices that handle anything from 110v to 250v). That is not to say that such countries do not have the concept of live and neutral – but in some circumstances there is no way to tell which way you are connecting the device to the mains. This article makes for interesting and probably confusing reading. https://www.quora.com/What-are-the-differences-between-live-earth-and-neutral-wire

      2. Oops, my comment was intended more as observation rather than criticism of your blog post in general.

        In saying that however, my main concern with the option of switching two mains appliances at up to 10A (using an external mains supply for the appliances) just seems bizarre. First you need a mains connection for the unit itself – then you need power for whatever it’s switching. There’s a whole lot of mains cabling going on there.

        Sure we all need to experiment to learn – at the age of 15 me and my friends bought old TVs from the small ads and repaired them – I’ve lost count of the number of times one of us got a belt of 15kV or more and we still survived. As I’ve got older I’ve got a little more cautious however, and I don’t always trust everyone who might have Googled a topic to be responsible enough to take every precaution. A classic example was in the kitchen of the house I bought a few years ago – a 15A spur taken from an electric cooker point was a potential fire risk – as the cooker point was protected by a 40A fuse, potentially an equipment fault on the spur would could mean the 15A spur cable drawing way more than 15A – the fuse would hold out to 40A but the spur cable could burn.

        Agreed, people pay over the odds for consumer goods and I’m all for more sensible pricing BUT, I still think this is a slightly odd design – I’d also prefer to see an earth connection for each of the switched circuits, switching light bulbs is one thing but anything more complex is another matter.

        1. Shocks from TV – sounds like my history. Well of course in all of this it did occur to me that as these things all have just 0.2″ screw connectors, one could always arrange an input and a twin socket output and do one’s own earth. That would keep everyone happy. I see these units more as handling a couple of separate lights – and there’s no getting away from the price for that purpose. Similar the Sonoffs – a fan, a light, perhaps even as far as a 500w wall heater – I would not be tempted to go further than that. At some point however I will put one of these in the middle of a ceramic floor, fasten it to an oil heater for 5 minutes then pull it apart to see if it suffered any 🙂

          1. my oil heater (B & Q special) contains two of the exact same relays as the sonoff. In know only because one had melted and fused on, and I had to replace them…. An although i’ve not checked, I assume the relays were handling 1/2 of the possible 2.5kw (i.e no more than 5 A)…

    1. No I don’t… I show NEUTRAL – and SWITCHED – the LIVE is switched…. I checked it myself… and incidentally you’re assuming everyone is in Britain – over here in Spain where I am right now there’s no difference between the two “live” wires and most plugs do not differentiate. I THINK the situation is the same in the UK… 2 pin plugs

      1. I have to remark that you must connect the main power as described by Peter: neutral on neutral and live on live. If you revert them the electrodragon board works in the same way BUT the live relays pin is not switched, the neutral one is switched. Not desiderable at all.

    1. That’s most likely because they are often marked the wrong way around on ESP12s… I had to reverse them in software in my code.

      1. Oh, thanks! Only to clarify the buttons:
        button 1 is gpio2 (right)
        button 2 (and not button 0) is gpio0 (flash)
        You said it but I understood wrongly they were shifted

  14. I have got one of these. I agree the power line is very tiny. I understand by google it can drain up to 1 A safety . I don’t need the twin relay system too. BUT I like so much those wired esp8266 pins. I can wire the buttons and some extra things (buttons…) out the box. I’d like some ectra pins wired. You can’t deep sleep it without rst pin for eample.
    Hacks: it will be not so hard to remove the power supply and trasform it in a low voltage unit.
    I think I can cut the power tracks and solder 1 wire to the relay to trasform it in a dry contact relay (and bypass the 1A issue). I’ll try it if need it.
    I soldered a dallas ds18b20 on the dht22 socket (3 10cm wires) and it works smoothly over onewire (ardunio IDE).
    I can use it as thermostat heater station in minutes (arduino ide, OTA, mqtt, nodered).
    Notice: I had to erase the esp8266 (esptool.py) because it failed to download code sometimes otherwise.

    1. You’re probably not far off on 1 amp at 250v – but when I get a chance I’ll strap a heater to the board for a few minutes and then check temperatures (after disconnecting). Bringing the pins out is a good idea. I think the point about the SONOFF and these ELECTRODRAGON units is cost – they are simply the cheapest way to switch mains voltages wirelessly – the SONOFF having the edge unless postage is an issue. My gut instincts tell me the SONOFF power supply is better but that’s about as scientific as I can be for now. More testing will prove either way.

    2. can you give the pilot for the 4 connections of the dot and how to connect the ds1820 to it

      1. I meant give a description of the 4 pins for the dht22, and how to connect the ds1820 there
        to the board

        1. You don’t need the pullup resistor on gpio because the library uses the internal pullup, I think.
          I connect 3 pins directly and it works…

  15. Got another candidate for flashing – Its an WIFI RGB controller (normally called a H801)
    http://www.ebay.co.uk/itm/WiFi-APP-Controlled-Output-5-Routes-PWM-Data-RGBW-Strip-Light-Lamp-Wireless-H8B3-/311590480556?hash=item488c3d6aac:g:GT4AAOSwgApXDLRv

    I got it working nicely as per this
    https://eryk.io/2015/10/esp8266-based-wifi-rgb-controller-h801/

    However, in my case I changed the code slightly – to minimise flickering
    https://bitbucket.org/snippets/Curlywurly/EKqBj

    I hope to change it soon – to use MQTT with Imperihome (!)

      1. Hi. Great work. any plans to introduce MQTT yet? I’ve been looking for just this solution to add to my OpenHAB and Mosquitton home automation. Thanks, Andy.

          1. Thanks. I’ve ordered one from China. I’ll try your software when it arrive. Many thanks! Andy

  16. i am in the process of doing a 4way opto-triac A.C. plug now. i just got the program installed on a nodemcu 0.9. its just some copy paste code but it works.. on-off for 4 pins and a temperature pub..node red and mqtt on a pi-b.
    i still have a nextion i want to use some day 🙂

    #include 
    #include 
    #include 
    #include 
    
    // wifi and MQTT broker vars
    
    const char* ssid = "*****";
    const char* password = "****";
    const char* mqtt_server = "192.168.1.121";
    boolean pin1 = false;
    boolean pin2 = false;
    boolean pin3 = false;
    boolean pin4 = false;
    boolean pin5 = false;
    //boolean pin6 = false;
    const int   misc_sens_pin = 12;
    const int   mqtt_interval = 60000;
    
    WiFiClient espClient;
    PubSubClient client(espClient);
    OneWire oneWire(misc_sens_pin);
    DallasTemperature DS18B20(&oneWire);
    
    long lastMsg = 0;
    char msg[50];
    int value = 0;
    
    void setup_wifi() {
    
      delay(10);
      Serial.println();
      Serial.print("Connecting to ");
      Serial.println(ssid);
    
      WiFi.begin(ssid, password);
    
      while (WiFi.status() != WL_CONNECTED) {
        delay(500);
        Serial.print(".");
      }
    
      Serial.println("");
      Serial.println("WiFi connected");
      Serial.println("IP address: ");
      Serial.println(WiFi.localIP());
    }
    
    void callback(char* topic, byte* payload, unsigned int length) {
      if( (char)topic[0] == 'A') {
        if ((char)payload[0] == '1') {
            digitalWrite(16, LOW);   // Turn the LED on (Note that LOW is the voltage level
        }
        if ((char)payload[0] == '0') {
            digitalWrite(16, HIGH);   // Turn the LED on (Note that LOW is the voltage level
        }
      }
    
      
      if( (char)topic[0] == 'B') {
        if ((char)payload[0] == '1') {
            digitalWrite(4, LOW);   // Turn the LED on (Note that LOW is the voltage level
        }
        if ((char)payload[0] == '0') {
            digitalWrite(4, HIGH);   // Turn the LED on (Note that LOW is the voltage level
        }
      }
    
      if( (char)topic[0] == 'C') {
        if ((char)payload[0] == '1') {
            digitalWrite(0, LOW);   // Turn the LED on (Note that LOW is the voltage level
        }
        if ((char)payload[0] == '0') {
            digitalWrite(0, HIGH);   // Turn the LED on (Note that LOW is the voltage level
        }
      }
     
      if( (char)topic[0] == 'D') {
        if ((char)payload[0] == '1') {
            digitalWrite(2, LOW);   // Turn the LED on (Note that LOW is the voltage level
        }
        if ((char)payload[0] == '0') {
            digitalWrite(2, HIGH);   // Turn the LED on (Note that LOW is the voltage level
        }
      }
    }
      
    void reconnect() {
      // Loop until we're reconnected
      while (!client.connected()) {
        Serial.print("Attempting MQTT connection...");
        // Attempt to connect
        if (client.connect("ESP8266Client5")) {
          Serial.println("connected");
          // Once connected, publish an announcement...
          
          // ... and resubscribe
          client.subscribe("A");
          client.subscribe("B");
          client.subscribe("C");
          client.subscribe("D");
    
        } else {
          Serial.print("failed, rc=");
          Serial.print(client.state());
          Serial.println(" try again in 5 seconds");
          // Wait 5 seconds before retrying
          delay(5000);
        }
      }
    }
    
    
    void setup() {
      pinMode(16, OUTPUT);
      pinMode(4, OUTPUT);
      pinMode(0, OUTPUT);
      pinMode(2, OUTPUT);
      pinMode(14, OUTPUT);
      pinMode(12, INPUT);
      Serial.begin(115200);
      setup_wifi();
      client.setServer(mqtt_server, 1883);
      client.setCallback(callback);
    }
    
    void loop() {
      float temp;
      char tempStr[5];
      
      if (!client.connected()) {
        reconnect();
      }
      client.loop();
       long now = millis();
      if (now - lastMsg > mqtt_interval) {
        lastMsg = now;
        ++value;
        DS18B20.requestTemperatures();
        temp = DS18B20.getTempCByIndex(0); 
         
        String(temp).toCharArray(tempStr, 2);
        
        String(temp).toCharArray(tempStr, 5);
        client.publish("outTopictemp", tempStr);
        client.publish("outTopic", "Relay Board OK");
        
      }
    }
    
  17. My conclusions were similar regarding the housing and dubious power handling: https://nathan.chantrell.net/20160422/esp8266-relay-modules-from-itead-and-electrodragon/
    The power modules on my boards were really shoddily built too.

    When they refer to AT commands they mean the default ESP8266 AT firmware that comes pre-loaded on most ESP8266 modules, ie. there is nothing pre-installed to use the relays at all! Really basic but still potentially useful given the price.

    1. Thanks for that Nathan. Right… I’ll get some coffee down me and finish documenting putting my software in them. Later today I’ll update the blog.

    2. Nathan,

      We have been using these Power Supplies for my inhouse projects :
      http://www.aerial.net/shop/product/161/1585/85265v-ac-to-5v33v.html
      Running over a year now w/o a single failure washed away all my initial doubts.

      Although a bit different in the design they fall in the same category as the one present in the elctrodragon PCB so I would not really worry about them. Passing CE certs as a system … who knows !

      1. Ok, well that’s a good start and I hope you are right because I’m about to press two of these units into service. I know my software will last… I’m hoping the hardware will, too.

Comments are closed.