Electrical – Switching on and off a LED light if a AC is passing through a wire or not

control systemledswitchestransistors

This is the basic setup of what I'm going to do. Have a wire plugged into the mains that is then connected to a ON/OFF flip switch then goes on to the rest of my project. Want I want to do is to add an internal DC circuit supplied by a 9V battery that when detects that the switch is closed i.e. their is mains power going through the wire, a green LED will light and when there is no power, there's a red LED.

What should I do to achieve this? (I was thinking of using some sort of transistor) A circuit diagram would be great as well.


Best Answer

If you just want to detect mains on / off then a neon-LDR optocoupler provides a safe way to do it. I offer this as an incomplete answer as I have not tested it.


simulate this circuit – Schematic created using CircuitLab

Neons are relatively low-power and a 1/4 W 220 kΩ resistor is all that's required to light it from 230 V mains. An LDR (light dependent resistor) is used on the low-voltage side. In the schematic above I have added a 1 uF capacitor to maintain the 'mains present' signal during the zero-cross.

Neon optocouplers were used by Fender guitar amplifier vibrato circuits and are still available. A web search for 'neon optocoupler' shows up some more recent implementations for modern micros for 'mains presence' rather than the usual zero-cross applications.

Fender neon optocoupler - http://shop.sonnywalton.com

Neon optocoupler for Fender vibrato. Note use of opaque heatshrink to prevent ingress of stray light. The neon appears to be on the left with bulb point visible pointing to the LDR on right.

I suggest that this idea is worth consideration. The neon optocoupler can be home-made using a regular neon, an LDR and black heatshrink.