# Cheapest HV AC detector

I need to detect AC voltage with MCU for ensure relay health condition, the cheapest and smallest solution are most welcome. I have no hard time restrictions or noise canceling\debounce requirements (will processed inside MCU).

Most of cheapest optocouplers (OC) has adequate CTR only with If >= 1mA. But with VAC 230V, the dropping resistor (Rdr) must have decent power dissipation raiting, size and price.

To use SMD or cheapest THT resistors, in worst case Vac == 270V, i must have Prdr < 0.2W. It means, what Rdr must be not less 360k (or 510k for long life safety). So in another wrost case Vac == 185, i will have If ~= 0.3mA with pretty low CTR. For example, for TCMT110x what i used in project it would be near 0.2x.

Ok, that looks pretty clear, i just need to use:

1. Double diode optocoupler (otherwise the OC will breaked by reversed 230VAC voltage).
2. Amplifting transistor on the output.

simulate this circuit – Schematic created using CircuitLab

Does my thoughts has mistakes? Does i not consider some effects, what i must consider?

• Note: when your question title says HV most of us will be expecting > 1 kV. "Mains" would be a better description. There are dozens of zero-cross detection circuits on this site which would do the job for you. A capacitive dropper will solve most of the power dissipation problem since you don't care about any phase shift that it would introduce. May 19 at 17:44
• You might want to consider using 2 (or 3) resistors in series. A single failure mode can make your circuit dangerous. May 19 at 17:44
• Series of resistors are not an option because lack of place. Capacitive dropper too because same problem and also BOM cost. I am doesn't need zero-crossing detection, only voltage presence without any time restrictions. What you mean under dangerous? If Rdr are going to break, device just detects relay fault and disable the circuit. May 19 at 17:57
• If you can debounce in software why can't you use a single LED optocoupler? How quickly must you detect a loss of ac? May 19 at 18:13
• Do you have any safety requirements for this? What happens if Rdr fails short instead of open? You are using resistors rated for high voltage, aren't you? May 19 at 18:14

Anything that requires you to attach to the line is a hazard, even with an optocoupler. Dropping circuits are the worst. They're totally unsafe, for a number of reasons:

• they bring line close to low voltage
• they dissipate power
• they have to deal with creepage
• they don't protect from transients

Consider instead using a capacitive sensor, something like those cheap testers that pick up live voltage. Then there's complete galvanic isolation, certainly better than what you will have with the optocoupler. This requires no direct attachment to the line, only proximity to it, so all the insulation distance and creepage issues go away. It saves the cost of the optocoupler, and your board can be smaller owing to not needing the opto or the stand-off distance. So this meets your 'cheapest' requirement, by far.

This kind of a sensor is a popular and cheap hobby project. Example here: https://www.electronicshub.org/non-contact-voltage-tester/

• Can you explain the point of hazard in dropping circuits with optocoupler? May 19 at 18:24
• Any contact you make with the line is a hazard, and must provide adequate stand-off distance between the line voltage and low voltage, including allowing for creepage. Resistors must be large enough to deal with the voltage differential across them, and be sized for adequate power (other commenters noted this.) May 19 at 18:36
• Dropping circuits usually also use a capacitor by the way. Nevertheless I still don't recommend your approach. May 19 at 18:38