Introduction: The Complete Smart Home Addon

About: Electronics Hobbyist

My previous project "The Complete Smart Home" is successfully running for almost 5 years without any issues. Now that I decided to add a feedback to the same without any modification to the present circuit and schematic. So this add on project will provide the lacking functionality of feedback whether the load is on or off to the existing relay board. I used Tasmota firmware on Wemos D1 Mini connecting to Node-Red for UI.

CAUTION: WORKING ON AC MAINS IS HIGHLY DANGEROUS. THIS PROJECT INVOLVES WORKING ON AC MAINS. SWITCH OFF ALL AC MAINS WHEN AND WHEREVER NECESSARY.

Step 1: Parts Needed

My initial idea was to use this board so called "8 Channel Optocoupler Isolation Voltage Test Board MCU TTL to PLC" to get feedback to Wemos D1 Mini. Since the AC Live line is at relay side this board was not usable. Later I came up with the following circuit

Required Parts:

1. 2 Pole Connector - 9 Pcs

2. 10A10 Diode - 64 Pcs

3. S8050 Transistor - 16 Pcs

4. MCP23017 IC - 1 Pce

5. 220uF 16 V Electrolytic Capacitor - 16 Pcs

6. 47Ω ¼W Resistor - 16 Pcs

7. 1kΩ ¼W Resistor - 49 Pcs

8. Wemos D1 mini - 1 Pce

9. Green or Red Led - 16 Pcs

10. PC817 Optocoupler - 16 Pcs

11. Female Headers as needed

12. Dot board or Copper Clad board (Requires etching) as necessary.

13. Hook up wires

14. Silvered Copper wire

Here I have used a dot board and quite some time for soldering and testing soldered joints.

Step 2: Soldering ☺

Soldering in a dot board for 16 channels is of course a difficult task.

Finally I managed to finish the board with 15 channels as my relay board uses only 15 Channels

Later there was not enough space to mount MCP23017 and Wemos d1 mini so a small dot board accommodates the same.

Step 3: Oscilloscoping

After designed circuit and placing in dot board and soldering finally did not give proper output, as I did not use proper rectifying circuit.

This gave a wrong values to MCP23017 and finally to Wemos.

After tracing with Oscilloscope at emitter of S8050 found, 50Hz square wave, which is logical. Later by adding 220uF capacitor as shown in schematic solved the problem. Check the pictures before and after adding the capacitor.

Step 4: Assembly

Now I drilled 4 holes and used 4 screws with nuts as shown and sleeve from a ethernet cable to secure the diode feedback board nearby to the existing relay board.

Moved the existing relay board and replaced / extended the connecting wires as found necessary.

Step 5: Testing

Circuit was taking 250mA DC for powering the whole setup. Testing with UI and local leds found to be ok.

Circuit was simple just to place in series to AC live wire to the pole terminal of relay. Refer the schematic.

Circuit working is simple, AC mains live is passed though a 10A diode which causes some voltage drop, this voltage drop is fed to optocoupler-transistor combination to give binary signal to MCP23017 and later to Wemos.

Step 6: Firmware

Here I used Tasmota firmware with I2C MCP23017 enabled which gives easy json output to node red.

Download the firmware from below and compile MCP23XXX sensor enabled with the help of PlatformIO

https://github.com/arendst/Tasmota/releases

Step 7: Schematic

Schematic has full details.

I used a 5V 1.5A SMPS is power the circuit

All emitters of transistors are pulled down.

Addressing of MCP23017 is 0x20, Reset pin is pulled high.

Step 8: Finalizing and Node Red Integration

After a successful test. New flow is added to node red running on my old Android phone.

Refer attached pictures.

If any doubts feel free to mail me at

kua201@gmail.com

http://kumaran.page.tl