ESP8266 Wireless Light Switch - Mains Powered (UK)

Thread Starter


Joined Sep 20, 2018
Hello all,

First post on the forum so please be gentle with me! Also my first time in many years putting together a schematic so apologies if it's extremely messy!

I'm looking at making my UK light switches "Smart" and controllable via Wi-Fi and have come up with the following and wanted some advice on what I have so far: namely, will it work as I think it will and secondly is it safe the way I have gone about doing it.

The idea is to keep my regular light switch as they are expensive stainless steel plated switches and I don't want to replace them with tacky Wi-Fi switches like the LightWave RF or Sonos T1 and then use this light switch as an input in to an ESP8266 GPIO. This way the light can be controlled both by the physical switch or via Wi-Fi and won't cause any issues should the Wi-Fi decide to die. When it senses a change in the GPIO the program will power an optocoupler which will in turn power a triac causing the light to turn on.

I want to make use of the mains 240V powering both the light and the ESP8266. I have a neutral wire in my sockets unlike most of the UK. To achieve the mains powering the ESP8266 I have opted for a HLK-PM03 240V - 3.3V supply.

I know people will probably say why not use a Sonoff Basic.... but where's the fun in that plus I think they're a bit big to fit inside a normal light switch backbox.

Let me know your thoughts please :)