|
WiFi control of Porch :Light |
Warning: this project contains live mains voltages that can be lethal. There can be a fire risk especially if you use generic no-name China parts like I have. Do not use generic parts unless you first test them under load and disassemble them. Some generic parts are under-specified and can be hazardous. Do not mount the lamp on flammable surfaces like wood or plastic.
Following related posts on
ESP-01S, the
ESP-12E Arduino sketch, this post shows the final assembly of the light panel and the 5V power supply.
The light panel is a generic "
Surface LED Down Light Panel Lamp" from cpeelectrical which I bought for RM43, mainly because there is room inside the enclosure to mount the ESP-1S and relay PCB.
|
Top: ESP-01S with relay module. Middle: 230Vac to 5Vdc power supply. Bottom: 18W LED Driver |
For the ESP-01S power supply I used an old smartphone charger. It was marked as 'output 5.7V 800mA' but when used I measured 5.05V which is just as well as the ESP-01S only takes 5V. It is too large to be mounted inside the lamp, so I removed the PCB and mounted it without its enclosure.
|
Old Android smartphone charger, disassembled. Note the lack of a controller IC |
The power supply was extremely simple: all the components were discrete devices (ie no IC) and just an oscillator at the primary side, and a single rectifier diodes at the primary and secondary. Still, it had been used for some 3 years sealed in its plastic enclosure with no ventilation holes and should be reliable enough for this purpose.
|
5V Charger tested on ESP-01S |
If you do not have an old charger, you can buy them here in Malaysia for RM6 or more. It is better to buy branded chargers like Samsung, as generic chargers have been known to catch fire.
The ESP-01S drew 170mA during WiFi access, and 60mA more when operating the relay. In practice it drew somewhat more than 230mA on power up so that 800mA at 5V came in handy. For easy installation I had the relay come on on power up. This also acts as a manual override 'ON' from the light AC mains power switch.
The final part, the LED Driver came with the lamp. It took in 85-230Vac (any lower and it shuts down) and puts out a stonking 60Vdc at no load, but settled down to 50Vdc at 330mA when the lamp is turned on.
|
LED driver 18W 230V |
Now the relay can be wired up to switch the DC or AC side of the LED driver. I opted to switch the AC side- hopefully it saves a little power as the primary side will not be always on.
|
LED Driver. Note the IC controller on the primary side |
For enclosures for the ESP-01S and the mains 5V power, I used the casings from 20W LED drivers. The entire LED driver costs only RM6 each and I had a couple of faulty ones left over from other LED lamps. You must enclose them: all 3 boards have 230V mains voltages that must be insulated. Here in Malaysia insects get into electrical fittings, especially light fittings including bulbs.
There you have it: an IoT lamp, switched from your smartphone or desktop browser. Happy Trails.