Introduction: ESP8266 Wifi Timer Switch for AC Loads
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.
Step 1: Parts Required
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
Small screws with nut
Plastic or similar enclosure to suit
Step 2: Designing
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.
Step 3: Schematic
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.
Step 4: Progamming
Using Esp8266 can be elaborately found here
Programming Uploading code are all available here.
I have uploaded my code here to
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.
Step 5: Finish
Working with 230VAC is dangerous, handle with care and have a certified electrician when modifying AC wiring.