ESP01s Relay Circuit Design Without Neutral Wire?

Hi everyone, I am trying to build a remote Wi-Fi relay for a light bulb. The ESP01S relay module will be installed at the wall switch for the light bulb. However, the wall switch is a simple switch that cuts off the live wire, it does not provide a neutral wire (live wire → switch → light bulb → neutral ). So, I came up with a hypothetical idea of allowing a small current to flow through the circuit to power the ESP01S relay module. Would this be a dangerous way to implement such a circuit?

How dangerous, depends on your skills. But it would not work. For the same reason that most smart switches don’t work without neutral. The whole circuit needs to be designed for that.

1 Like

So this is going behind the wall switch? But you don’t have a neutral there, so how is the lower wire going to work?
Are you meaning you should route a wire down to the switch?
That is possible, but if you already plan on doing that then you might as well replace the switch to something “smart”.

1 Like

无黑科技-基于智能开关的单火线电源方案
https://www-99zh-net.translate.goog/news/224.html?_x_tr_sch=http&_x_tr_sl=en&_x_tr_tl=zh-TW&_x_tr_hl=en&_x_tr_pto=wapp
Yup, this isn’t an easy DIY solution for me at the moment :sob:

Neither for me or about for anyone… :wink:

ps. there are many smart relays that can work without neutral.

Hi Steven,
Welcome to HA!

Sadly, you have designed a flashing light that is very likely to fail badly.

At switch-on, current may flow through the “220V transformer” and the “bulb”. If we assume the “bulb” is (say) three resistive filament lamps (and not LED or CF), and assume there is enough current for the “220V transformer” to operate, when the ESP01 ESP8266 module turns the relay on, the contacts short out the “220V transformer” primary, turning off the relay, and turning on the “220V transformer” again. The ESP01 then boots, connects, turns the relay on again, and you have a oscillator.

You are likely only considering in-phase current though - if the “220V transformer” really is a wound step-down transformer, the magnetic field will collapse when the relay shorts out the primary causing a back-EMF spike which might well arc the contacts together.

Worse:

  • The “220V transformer” is unlikely to be a linear power supply (transformer + rectifier + smoothing), but a complex high-frequency buck converter. These are usually capacitive loads.
  • The bulb is unlikely to be a simple resistive filament, but a complex high-frequency dedicated chip. This could be a capacitive or inductive load.

Without a Neutral connection any power for the “220V transformer” has to flow through the load (bulbs). With incandescent bulbs, this wasn’t ideal, but with LEDs and their multiple boost-buck, capacitive-dropper, etc complex driver chips, the result is often unpredictable. And yes, I’ve tried “ballast” devices (usually a capacitor and bleed resistor).

Mixing complex loads together often causes flashing (as capacitors charge, inductors field collapse, or even as microprocessors brown-out). This ranges from annoying to BOOM as components overheat and fail badly.

Basically, DON’T.

Add a neutral or move the location of the module to somewhere it has one.

I’ve been installing similar automation in the UK since X10 started in the US and with very few exceptions, “No Neutral Required” means “Will Not Work Reliably”.

Further bad news is the ESP01 board you show is likely a clone-of-a-clone-of-a-clone so may be troublesome to get ESPhome working reliably. I’ve seen devices fail to flash, have only 1Mb of flash (some designs assume ESP8266 have 4Mb), or fail randomly in service. The worse boards had a second microprocessor controlling the relay via a serial interface - that is if they remembered to flash the micro (not the ESP01)!

My suggestion is buy something like a Shelly, or a Sonoff device. Several types can be flashed with ESPhome (e.g I have a Shelly running a custom towel heater), and are designed to be safe. The new Sonoff Mini4RM work well with Matter.

If this helps, :heart: this post!

1 Like

I would suggest a smart bulb or to pull a neutral from the ceiling down to the switch.
In most countries it’s not legal but very easy to do yourself