Introduction: Low Cost 4 Channel Wifi Switch (IOT Application).
Hello everyone, this is my first intractable and I am going
to share my project of low cost 4 channel WiFi switch.
My requirements:
It should incur low cost as far as hardware is concerned.
The device should be reliable as I would be using it to control lights at my home while I am on a vacation.
I should get an update on my mobile device once the switch changes state.
Step 1: Selecting the Hardware
Opted Solution:
For the hardware I chose ESP8266-01 as the wifi and control module from Aliexpress with few other discreet low cost components.
A four channel relay board from NSK electronics India.
A 12-0-12, 500 milliamps transformer that was lying around with me.
For 3.3 volt supply required for the module I used a LM317 three terminal regulator.
The setup:
ESP 8266-01 is a wifi module with a small foot print with accessible pin count of 8.
Step 2:
In this project I am going to use pins GPIO0, GPIO1 (RX pin), GPIO2, GPIO3
(TX pin) pins of the ESP8266-01 module to control a four channel relay board.
Step 3: Hurdles Faced
Problems Faced:
During power up if the pins of the ESP8266-01 remain connected to relay board the module hangs and becomes useless, photo coupler on the IO pins even failed to be fruitful but if the unit is powered on without the relay module initially connected everything works nice as expected.
Solution:
To overcome this situation I used a strange but effective low cost idea. A small analogue delay circuit using 555 timer IC was used to power up the relay module that puts a 10-15 second delay so that the wifi module gets access to network before the relay board gets powered on.
Step 4: The Hardware & Schematic
In the schematic the ESP module shows as ESP8266-07 as I was not finding the 01 version in the Fritzing library please consider the same as type 01.
Step 5: Enclosure
For the enclosure I used a Plastic box measuring 3.5 inch by 9 inch this will provide some extra space for future modifications. the side of the box is cut for getting access to the relay terminals. This box in turn will remain inside a wooden beam type structure in my drawing room.
Step 6:
Flashing the ESP is really easy just copy the code from the
attachment and open in Arduino (I used version 1.6.8) have the necessary files copied in the libraries folder, select upload speed as 115200 and program the ESP. Regarding procedure to program the module there are lots of tutorials on the internet.
Attachments
Step 7: The Blynk App
Now for a few screen shots of Blynk app from My phone.. As can be seen the real time status change that happens on the ESP port gets updated in the LCD, suppose by chance due to some network error the relay does not activate, if the LCD is absent we do not know if the status change has actually happened, the LCD shall state the actual condition of the device. In my setup SW2 is connected to the gate light which has to remain on from 5:20P.M. till 8:00 P.M. in the evening, rest are all normal switch. Blynk provides the flexibility to modify any normal switch to a timer switch, push switch, or a dimmer without interfering with the hardware and can be done on the go. Instead of LCD one can use four LEDs also as the status change indicator
Step 8: Device in Action
So now a small video shall show the device in action.
Any comments are welcome, if you liked it share your feedback or any improvements that may be done. Thanks everyone and see you soon with my next instructable.