Saving a few coins is not worth your life or the life of the next innocent that picks up your project. An Arduino tied directly to the AC line is a death trap.thank u bro for your help!!!
what if i put Zener diode before connecting to Arduino just i want to save money by not buying transformer
Hi,Was that comment to me Colin? I'm in the UK 220vac. This is a DIY optocoupler but the AC side is IMO much simpler.
I simply want to sense 220vac and produce a digital output @ 5V for on or off.
This is the circuit for the neon activated optotransistor. I used an LED to test it (now replaced with 10K resistor) so the output will be Neg (0) when the neon is on. If you want Pos (1) just use a PNP and switch the position of the 10K resistor and transistor. Signal taken from the junction of collector to 10K.
As said before the voltage drop across the Neon is about 60vac. The 220 ohm resistor is just a precautionary current limiter for the optotransistor. The 82k resistor came with the neon, I've seen them with a resistor as high as 150K but I wasn't sure how bright they would be so went for the higher current rating. It would be very easy to hide most of the 220vac part in an insulated cover/tube and since it's only about 300mW, heat dissipation isn't a major issue.
View attachment 106377
Although I have had some neons fail on household sockets, I've got many that have worked for years, so unless you know something I don't, I'd say neons are reliable. At 50 for £2 I'm not too worried about having to replace one now and then. Also this is an optocoupler it's just using a neon instead of an IR LED, it may not be one piece, but an optocoupler none the less. Some of the datasheets for visible light optotransistors suggest neon as a possible light source. That's what gave me the idea of using one. I know that transformer less 220ac to 5vdc are technically sound but I'm not over keen on them, too many components. I find it interesting that people are happy to use a transformer but then say that a transformer less circuit isn't safe. Why do they trust 2 copper coils wrapped around each other? If the insulation failed or it was overloaded, the resultant meltdown wouldn't be very isolated. If a capacitor/resistor/diode in a transformer less circuit failed it is highly unlikely to fail as a short, most likely open circuit, just like a fuse!Hi,
Neons are somewhat unreliable, you can use an LED instead, or better, use an opto coupler.
To compensate for the pulsing due to the line frequency, use a capacitor just before the base resistor.