DIY WiFi Smart Socket
This is a Smart Plug-point with Temperature Humidity Sensor DHT 11 and a Emergency LED Light. As usual this socket can be turned on and off through WiFi of any smartphone. This can also be connected to Internet and avail feature as Internet of Thing (IOT).
Features including:
1. Inbuilt Temperature Humidity Sensor
2. Bypass switch to directly operate the socket
3. Stable ESP8266 PCB
4. 230VAC to 3.3VDC incorporated within
5. Wifi operable Emergency LED Light
6. Using a third party software can cut off and cut in laptop or smartphone charger at certain battery level.
7. Small, handy and compact.
Parts Needed
LEVEL : INTERMEDIATE
1. ESP-12F or ESP-12E
2. Copper Clad board + Etchant
3. AMS1117 3.3V Voltage regulator
4. 1k and 3528 Red SMD Resistor and LED
5. 10uF, 100uF, 220uF, 0.1uFx2, 470uF Capacitors
6. 10kOhm Resistor
7. 15 Ohm Resistor
8. 1 Channel 5V Relay board (I made my own)
9. 230V to 5V Nokia charger power supply module
10. LED Driver Circuit
- Berg strip pins
- PC817 optocoupler
- 2x 470Ohm resistor
- 2N2222 Transistor
11. 5V LED Strip
12. Berg strip
13. Dupont Female to Female wires
14. 1 x 2 Way Wago Connector
15. 1 x Female 3 Pin Socket
16. DHT11 or DHT22 Sensor
17. 1 x 6A Flip switch
18. Plastic Enclosure
19. Securing screws
20. 1 x Cable Gland
21. 1 x 3 Pin Plug
22. 3 core wire of suitable length
23. 1 Core wire 1 meter (for AC connections)
Preparation
Items to be prepared:
1. ESP-12 PCB
2. Emergency LED Driver
ESP-12 PCB
Find the attached for the Schematic of PCB. Have included the files for Laser printer Toner Transfer method.
https://www.instructables.com/id/PCB-ETCHING-TONER...
The above instructable will guide to etch a PCB.
I have broadened the tracks for easy etching.
Solder the components.
LED DRIVER
Attached schematic, soldered on a dot board will route 5V to LED strip when 3.3V signal from ESP8266 is received by the optocoupler.
POWER SUPPLY
For powering the setup, I took a old Nokia charger, break open it and took the power supply board. Soldered wires for 230V and placed berg strip pins for 5V output.
RELAY BOARD
Its cheaper to buy a readymade 5V optoisolated relay board. I had one, which I made long time back.
Firmware Loading
Thanks to ESPEASY firmware, which relieves me from Arduino coding.
Below is the step by step procedure to load the firmware easily into ESP8266.
Assembling
Depending on the enclosure, cut it to place the female socket , etched ESP-12 PCB and LED strip in front.
I have placed the DHT11 sensor and Bypass flip switch at the side of enclosure.
Have drilled a 7mm dia hole to pass the DHT11 wires.
On the top a 3 core wire with 3 pin socket connecting the enclosure through a cable gland.
Place the components suiting your enclosure.
Connection
Connect using dupont female to female wires wherever berg strip pins has been used.
Make sure to use a standard wires for AC
Use wago 2 way connector for AC source, Relay connection, Flip switch connection, 230V to 5V. As the wires are relatively thin I have inserted 2 wires in 1 way of the wago connector.
Neutral is screwed to to female socket and 230V to 5V also screwed to the same female socket where there is enough room for it.
GPIO 13 of ESP-12 goes to DHT11 using dupont
GPIO 12 of ESP-12 goes to RelayBoard using dupont
GPIO 14 of ESP-12 goes to LED Driver using dupont
DHT11 is powered using the output from ESP-12 as it operates on 3.3V
Relay board and LED Driver is directly powered by 5V from the charger module.
Configuration and Testing
I have attached the HTML file to view the TEMP, HUMIDITY, operating socket and emergency LED.
For first boot setup the ESP-12 as per below link instructions
https://www.letscontrolit.com/wiki/index.php/ESPEa...
By default attached HTML IP Address is set for standalone mode. This has to be changed if ESP is being connected to a router.
Since its an IOT device, when connected to internet router, set the device to same IP always when more devices are connected (this can be done is router config page) and input that IP in the HTML editor (Notepad) of the attached file. Eg. Replace 192.168.4.1 to 192.168.1.xxx (whatever)
Follow this step and add DHT11 sensor info to ESP-12
https://www.letscontrolit.com/wiki/index.php/DHT11...
After connecting as per previous step before giving 230VAC, have connected 5VDC to DC pins to check the behavior and amperage.
Later connected to AC power supply and tested with the AC LED LAMP.
Then test the onboard LED.
Downloads
Laptop Auto Cut in and Cut Off Setup
With the use of third party application Battery Deley and Curl command line automatically turn off the socket when battery level reaches 90% and turn on the socket when battery level reaches 16%.
You may input your own range.
Attached zip is preconfigured for my IP address just replace the IP address to your ESP IP address in BatteryDeley.ini file.
Similarly apps like Tasker, IFTTT for android can do the same for Android smartphones.
If any doubts or corrections comment or mail me @
kua201@gmail.com
-Kumaran