The Complete Smart Home Addon

by kumaran512 in Circuits > Electronics

8377 Views, 19 Favorites, 0 Comments

The Complete Smart Home Addon

KIMG20200122181721~01.jpg

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.

Parts Needed

KIMG20200116064324.jpg
61s7C85VLhL._SL1000_.jpg

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.

Soldering ☺

KIMG20200115114322.jpg
KIMG20200115150051.jpg
KIMG20200116064312.jpg
KIMG20200116070401.jpg
KIMG20200118195508~01.jpg
KIMG20200118195529~01.jpg

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.

Oscilloscoping

IMG20200117173301.jpg
KIMG20200117150125.jpg
KIMG20200117190405.jpg

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.

Assembly

KIMG20200122105119.jpg
KIMG_20200122_110645.jpg
KIMG20200122142502.jpg

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.

Testing

KIMG20200122163901.jpg
KIMG20200122165805.jpg
KIMG20200122165821.jpg

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.

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

Schematic

Schematic_DiodeFeedback_Sheet_1_20200123114044.png

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.

Finalizing and Node Red Integration

IMG20200123181833.jpg
Untitled.png
Untitleds.png

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