Thursday, 27 September 2018

ESP8266 IoT AC Mains Power Extension Part 1 of 3

Right socket:: regular UK 230V power socket with builtin USB charger. Left socket: ESP-01S controllerd
Using the same parts as the IoT Porchlight, it is possible to make a remotely-switched AC power extension. This lets you switch almost any low-power electrical device without having to worry about fitting the ESP8266 bits. All you need is a stack of IoT Power Extensions ...

Warning- this project involves hazardous AC mains voltages. Do not attempt this if you are not a qualified electrician/engineer. 

Luckily here in Malaysia we use the UK 230V standard. This means it is easy to buy AC wall socket parts.

Two-gang UK Mains AC wall socket
I salvaged a two-gang wall socket enclosure, and swapped one of the wall sockets with a new type (SIRIM approved) with a built-in USB charger. This solved the problem of the 5V power supply for ESP-01S Relay Module. The charger is rated for 1500mA at 5V. The ESP-01S Relay Module required 60mA on standby and 130mA when the relay is on. That leaves plenty of wiggle room for I noticed that these built-in chargers tend to get hot at full load, probably due to the lack of ventilation.

AC mains wall socket with built-in USB charger. I paid RM25 for mine.

It is not difficult to fit the ESP-01S Relay Module into the socket enclosure. By fitting it face-down over the opening in the middle, this makes sure the AC mains on the PCB cannot be accessed from outside the enclosure. It also makes the ESP-01S's blinkenlights visible and gives its antenna an unobstructed view of the WiFi modem router.
Fitting in the ESP-01S Relay Module
A cheap (RM2) phone charger cable from Alibaba is used to connect the Relay Module to the charger output.

Wired thus, the right socket is a normal, manually switched AC mains socket at full 13A rating. Only the left socket can be remotely switched and although the load of 10A is claimed on the little 5V relay, it is prudent to switch no more than a 2A load maximum. Anything more the little relay tends to get stuck, especially with inductive loads, and most switched-mode power supplies (even little USB chargers) are inductive loads.

There you have it: an IoT (ie remotely-switched) AC mains power socket. Happy Trails.