Friday, 22 December 2017

Sonoff External Button Input

It seems like an obvious thing that's missing from the excellent Sonoff modules out there: an input for an external button (or two or four!). A common thing to do is to solder some wires across the existing switch on the PCB, but this isn't the best idea. In this post I will quickly show what I did, which is a more robust solution for a permanent installation.

The built in button(s) on the Sonoff's are hooked up directly to one of the GPIO inputs on the ESP8266. This is fine for a button on a PCB as no ESD or surge or wrong connections are likely. On the other hand, hooking a pin to a long wire which will be handled during installation, is susceptible to interference coupling, etc. is not the best idea. The ESD protection diodes on the chip may be able to handle some punishment but over the years it's going to be a real hassle to replace the Sonoff...

In the photo and rough circuit diagram below you can see I have simply soldered everything (with some heatshrink for insulation) to a pin header which plugs onto the Sonoff serial header. A 2.2k pullup resistor is there to provide a strong pull up. I have found that the built in pullups aren't strong enough, causing the inputs to trigger sporadically and sometimes even "randomly" - possibly when lightning strikes... A series 470 ohm resistor prevents too much current going into or coming out of the pin in case of mis-connection, surge or even static to some extent.


I plan on designing some small input protection PCBs to use with all of my Sonoffs which will have proper ESD and surge protection by using clamp diodes, etc. These will be totally bullet-proof and could probably even handle a mains wire shorting to them!


No comments:

Post a Comment

Hybrid ESP8266+UNO Energy Measurement

To complement my home automation system I needed to add a multi-channel power measurement system to my DB board. I figured four channels is ...