ESP8266 Wifi Timer Switch for AC Loads

by kumaran512 in Circuits > Electronics

26184 Views, 109 Favorites, 0 Comments

ESP8266 Wifi Timer Switch for AC Loads

KIMG_20160113_150756_HDR.jpg

This instructable is based on ESP8266 version ESP-01 which is programmed as wifi timer for switching AC loads.

As ESP-01 has only 2 GPIOs, only 2 loads can be controlled, here my necessity is to control one AC load in timer delay off mode.

Before proceeding further have good info about ESP8266 and its flashing and uploading.

http://randomnerdtutorials.com/flashing-nodemcu-fi...

Parts Required

KIMG_20160112_220501.jpg
KIMG_20160113_080503_HDR.jpg

ESP 8266 Ver ESP-01 (any other version also compatible)

DC DC Buck Converter LM2596

Usb 230VAC to 5VDC Adapter

Usb Male Cable

2 Pin AC Socket

OptoIsolated 3V Relay Board (schematic attached)

1 x 1N4148 Diode

1 x 2k2ohm Resistor

Berg strip

Cable Gland

Small screws with nut

Plastic or similar enclosure to suit

Designing

KIMG_20160113_081014.jpg
KIMG_20160113_092719.jpg
KIMG_20160113_105240.jpg
KIMG_20160113_111502.jpg
KIMG_20160113_111839.jpg
KIMG_20160113_112223.jpg
KIMG_20160113_112338.jpg

Here 5V adapter is powered from the same switch used to turn off after the time is elapsed. Neutral is taken seperately for the adapter.

Board is drilled and proper holes are made to suit the components.

A switch used here is a dummy switch to block the wrongly made hole.

From GPIO2 a 1N4148 diode is used for one way trigger signal. The diode is crimped to the dupont wire as shown.

Similarly 2k2ohm resistor for VCC to CH_PD is dupont crimped.

Here berg strip is soldered at bottom to be used for vcc and ground, source for Esp and Relay board.

Components are attached with the hot glue.

Schematic

KIMG_20160118_114844.jpg
OptoRelayChannelData-575 (1).jpg
KIMG_20160113_110137.jpg
KIMG_20160113_122458.jpg
KIMG_20160113_125730.jpg
KIMG_20160113_130322.jpg
KIMG_20160113_131632.jpg

From DC Buck converter 3V output is taken to berg strips which is hot glued.

Connected to Relay board and Esp as shown.

Modify the current AC wiring switch to be series with terminal block of relay board.

Since 3V relay board is not readily available in market I made my own board as shown in schematic.

Progamming

2016-01-18_114559.png
KIMG_20160113_145411.jpg

Using Esp8266 can be elaborately found here

http://randomnerdtutorials.com/flashing-nodemcu-fi...

Programming Uploading code are all available here.

I have uploaded my code here to

https://onedrive.live.com/redir?resid=5CED78388049...

just burn the above code to Esp, do not change the name of 'init.lua'

Here my load is an exhaust fan timed to be off after 2 minutes.

To change the time delay edit the above code to required time in microseconds as shown.

Keep the Esp quite away from relay module as RST pin is very sensitive can pick up interference easily and Esp crashes.

Finish

KIMG_20160113_150728_HDR.jpg

Working with 230VAC is dangerous, handle with care and have a certified electrician when modifying AC wiring.

-Kumaran

kua201@gmail.com