I was looking for a way to detect AC mains voltage (120V here in the US) when a fan in an enclosure turned on. I'm not measuring the voltage, just detecting it's presence.
Edwin Robotics had a breakout board I used for a little while since it was convenient, but now I am looking to bring to parts onto my own PCB. I know there is a necessary separation distance and board cuts that need to be done from DC.
My question is, how would you rate this for safety, and what would you add or change?
I once did this by wrapping insulated (guaranteeing safe separation) wire around the live then connecting that wire to an input on a 40106 hex Schmitt trigger, with a 10M Ohm pull up / down (can't remember) and the whole circuit connected to earth (note 'earth', not 'ground'). Added some RC smoothing and a couple more of the spare Schmitt triggers and got a reliable output showing mains present or not. No connection to mains anywhere.
Many multimeters /testers can detect mains live NCV without earth connection, without user holding the device. I wouldn't mind to learn how they do it.
Any AC opto coupler.
Pin with internal pull up (no 10k resistor).
Zero crossing removal can be done in software (no capacitor).
Two resistors for safety.
I think everyone here has put forth some good ideas, and can work in different scenarios.
@WaWa That's an even simpler solution eliminating the rectifier. This will work perfectly for future projects. The K814P is obsolete now (what isn't?), but Lite-On and others still make the LTV814 (as mentioned by @6v6gt), especially in DIP, which is a drop in replacement. I'll probably throw a picofuse on the L leg - 250V@250mA for added safety.
Not needed. No significant current can flow because of the two resistors.
In some countries phase and neutral can be swapped (no keyed power plugs).
There every wire of a power cord should be treated as live, hence one resistor in each leg.
I usually build these things inline with a power cord, with heatshrink.
The pc814 could work, as do many others.
Even with keyed plugs neutral should be treated as live. Faults happen. Wiring mistakes happen. You can't safely assume the neutral wire will always be neutral.
Broadcom HCPL-3700 is a chip designed to give a logic level output in response to mains voltage on its input side. It's basically an optocoupler.
Works fine on 240-V AC, but does need thermal management on the input resistors.
The specific application was for a no-neutral lights programmer that worked fine with halogen lamps but didn't like LED lamps. Can't remember the exact circuit, now replaced by a WiFi switch, but useful for the duration.
@tigger,
Good chip and solution, but not economical at over $12 each at Digikey, even for my projects. I'll keep an eye on it though. If it was cheaper I'd take it as the solution for sure.