# sensing the existance of the AC power line [duplicate]

I have more than one AC power source and I want to detect which one of them is ON which one is OFF using a Microcontroller. So my question here is what is the cheapest and smallest in size method to detect whether an AC power line is there or not?

From 100~240 VAC to 3.3V Steady DC

• – dim Oct 31 '16 at 16:25

I'd use an AC input opto coupler like this: -

Or maybe the IL755 because it is available with two in one package but beware of the voltage breakdown rating between two supplies conected on the diode side: -

Of course you don't need to use an AC input opto, you could use a circuit like this: -

Here, D1 protects the photodiode from reverse voltages but you only get half wave pulses passed through to the microcontroller. In the ones above you get full-wave pulses (twice as many per second). That might be a big deal or it might not.

• Comments are not for extended discussion; this conversation has been moved to chat. – Dave Tweed Nov 3 '16 at 21:45

Many people often make the mistake of think they just need some voltage margin above Vsine-pk and forget about ESD and Lightning transients and IEC standards for flashover and hope their Opto will protect them.

• the best method is an LC common mode choke on Line-Neutral with ED protection. then add opto Isolation if the system requires isolation as opposed to offline AMR meters which do not. Cost $0.20/(1k) • When I was in the AMR ( Automated Meter Reading ) R&D mfg biz we used special ceramic hybrids to reduce 240Vac to 22Vdc with large SMT resistors and zener bridge and storage cap to also power the unit and ISM 928MHz transmitter receiver. • But you may also consider line chokes with Y caps. and then use low voltage R's (500V) simulate this circuit – Schematic created using CircuitLab • R1,R3 must be impulse V rated or line transient pre-filtered • adjust C1*R4 to 10/f = 100ms if you dont want to see each cycle pulse and have a software timeout. • R4 for additional current limit protection. • BOM Cost 10 Rupees in volume ( how cheap are you? ) • my advice$500 USD (joking of course)

• what you need isolation too?

• Please note the IEC surge withstanding test requirements above and test method. As well as Hipot std test methods limited to 500uA. – Tony Stewart Sunnyskyguy EE75 Oct 31 '16 at 15:16
• pls support your opinions with evidence -1 – Tony Stewart Sunnyskyguy EE75 Oct 31 '16 at 18:02
• You response literally has nothing to do with the question. The question is "how do I detect the presence of the AC mains". Your answer is a bunch of off-topic rambling about ESD protection. "Here is how (side note about requiring ESD protection)" would be a reasonable response, but not even answering the question at all is completely off-topic. – Connor Wolf Nov 1 '16 at 3:59
• @Conner Wolf, I respectfully disagree strongly. When detecting ACLine voltage, you must be compliant to International standards for safety and functional requirements for noise immunity. none of the other comments or answers addressed this. – Tony Stewart Sunnyskyguy EE75 Nov 3 '16 at 15:39