Project firmware may be found here.
This project utilises the ubiquitous ESP8266. For simplicity (and still very cost effective), I chose the castellated version; an ESP-07 (with uFL connector, which can be used for greater range) or ESP-12.
It expands on Corban Mailloux’s design by adding an optically isolated input and output, and a low-cost temperature and humidity sensor, namely a DHT22, also known as the DHT Pro, AM2302 or RHT03, which is more accurate than the DHT11. Any of the pin-compatible versions (DHT11, DHT12, DHT22, DHT21 or AM2301) can be used, as they all work with the Adafruit library.
The fuse (F1) provides short circuit protection, while D1 provides reverse input voltage protection to the circuit. A DC/DC converter provides the voltage supply to the circuit (not including the LED strip) from an 8 to 28V source (I use 12V strips); the converter can be supplied from 7VDC, but D1 will drop approx. 0.7V. Capacitors, C1 & C2, stabilise the supply to the ESP8266.
J4, SW1 and SW2 provide means to program the 8266.
I used the opto-isolated input and output to control/monitor my washing machine.
- The output (J5-1 and J5-2) is wired across the “Pause/Play” button, which, for example, allows me to start my washing before work with the “Rinse Hold” function and finish/continue the cycle when I’m coming home.
- The input (J5-3 & J5-4) is wired to the power of the logic circuitry of the washing machine. Voltage is present when the machine is activated and ceases shortly after the cycle is complete. This allows a notification to be sent to me when the washing is complete.
For added safety, I incorporated two optocouplers (AKA: opto-isolator, opto), which behave similarly to relays, but uses light instead of electro-magnetism. This will be fast responding & reliable (if used within specs). A relay, generally, will require too much current from the GPIO and would, also, require further drive components (e.g. transistor and other "passives").
You will have to set/limit the current (via a resistor) through the LED (input side): Say you would like to monitor the 12V rail of a device; the LED is rated at 1.2V (Vf [typ]) @ 20mA (If): R11 = (Supply voltage – LED voltage) / LED current = (12-1.3) / 20m = 2.0 - 0.02 = 535 Ohm; a common and suitable value would be 560 Ohms.
Opto explanation: When current (limited by the resistor) passes through the (usually InfraRed) diode inside the opto package, the IR light causes the photo-transistor to conduct. When the transistor conducts it, essentially, acts as a switch, "putting" the voltage on its collector onto its emitter.
Bonus: To remember which is an Anode and Cathode; an Anode kind-of looks like an 'A', where a Cathode looks like a 'K'.