Low standby power AC detection - direct capacitive coupling?  - Page 1
Forum section: electronics / projects

author: inevitableavoidance
author_rank: Contributor
timestamp: March 18, 2025, 07:19:07 pm
content: I'm working on a commercial product for which we'd like to know when someone's unplugged the mains cable as soon as possible, to safely shut down the system in the remaining ~500ms we have before the power module runs out of juice. It has to meet the standby power norms however, and we're quite low on our remaining power budget.Using an optocoupler with 1M series resistors we'd get 230uA led current, which is close to unreliable little, and still uses 50mW of power at 230VAC. Using a capacitor instead of series resistors would already reduce the total losses. When considering this however, I thought, can't I just capacitively couple the 230VAC lines directly into two MCU pins? With additional ~ 1MΩ series resistors, Y caps (or internal plane capacitors on the PCB), clamping the signals with diodes? Perhaps with a Schmitt trigger and OR port to save an MCU pin.I feel like I'm missing a safety aspect here. What would you think of this approach?

author: UnijunctionTransistor
author_rank: Frequent Contributor
timestamp: March 18, 2025, 07:57:01 pm
content: Unfortunately, power lines have this nasty habit called electrical faults: overvoltage spikes ranging form a few hundred volts to a pair of kilovolts, neutral faults lifting the ground above earth, high frequency noise, and others.Not to mention human errors, where the line and neutral have been swapped.You mention a commercial product. Don't you think it is in your best interest not to produce a product with a potential liability?Use the optocoupler with a capacitive dropper if you must reduce power consumption.

author: TimFox
author_rank: Super Contributor
timestamp: March 18, 2025, 08:52:18 pm
content: With a capacitor in series to lower the voltage at the LED, be sure to have a second diode antiparallel to the LED (to pull AC current through the capacitor, not rectified current) and a reasonable series resistor after the capacitor to protect the LED.

author: PCB.Wiz
author_rank: Super Contributor
timestamp: March 18, 2025, 09:42:41 pm
content: Quote from: inevitableavoidance on March 18, 2025, 07:19:07 pmYes, with care that can work. If you do not care so much about phase integrity, but just want to sense mains presence, it could be ok.You cannot be 100% certain which AC line is more active, so a dual sense would be needed.eg Spice says 230V 50Hz via 0.1pF couples 200mV p-p into 10M, and 0.6pF couples 1.25V p-p into 10MPCB planes should give enough isolation, but you could also use an optocoupler as a HV capacitor, for that 0.6pFQuote from: inevitableavoidance on March 18, 2025, 07:19:07 pmYou can use an active drive circuit if you want to lower that current.It is more parts, but can slash the power.

author: David Hess
author_rank: Super Contributor
timestamp: March 19, 2025, 02:23:50 am
content: As an alternative to an optocoupler, a current transformer can sense either the current, or voltage with a resistive load, provide isolation, and also provide power.Or a normal but small transformer could replace an optocoupler to provide a galvanically isolated signal to whatever detector you choose.

author: PCB.Wiz
author_rank: Super Contributor
timestamp: March 19, 2025, 03:37:41 am
content: Quote from: David Hess on March 19, 2025, 02:23:50 am?Optocouplers come from around 2c, and need no magnetization energy.Any links to pick and place compatible, mains rated transformers, sub 2c, and with sub 200uA magnetization energy ?

author: David Hess
author_rank: Super Contributor
timestamp: March 19, 2025, 05:33:31 am
content: Quote from: PCB.Wiz on March 19, 2025, 03:37:41 amMagnetization can be arbitrarily lowered by using a higher inductance primary, like a higher voltage primary at a lower voltage, or two separate transformers with their primaries in series.The OP was looking for lower power alternatives, and transformers are one of those.

author: inevitableavoidance
author_rank: Contributor
timestamp: March 19, 2025, 03:00:42 pm
content: Quote from: UnijunctionTransistor on March 18, 2025, 07:57:01 pmOvervoltage spikes would be clamped, lifted grounds don't seem like a problem in this case, high frequency noise can be filtered - right? And I'm in the Netherlands, line and neutral are swapped when you rotate the mains plug. I'm looking to understand what the potential liability would be, not just avoid it because it sounds iffy.Evaluating part failures - If the class Y or PCB plane capacitor would short, there would still be 1MΩ in series with the 230VAC, meaning there'd be ~325uA peak going into the clamping diodes. That's still less than the maximum allowed leakage current. If the 1MΩ would short, similar story. Diodes failing or not being soldered correctly would be a bigger problem, leaving the MCU to clamp the signal with its ESD diodes. But it'd still be within their current rating. What else is there?

author: inevitableavoidance
author_rank: Contributor
timestamp: March 19, 2025, 03:05:24 pm
content: Quote from: TimFox on March 18, 2025, 08:52:18 pmGood tips, thanks!Quote from: PCB.Wiz on March 18, 2025, 09:42:41 pmThat's more of a signal than I imagined with so little capacitance, curious how flaky it would be. Phase does indeed not really matter, we just want to know when someone pulls the plug. Two lines wouldn't be a problem. Making a voltage divider between the two mains lines might also work, tapping the signal in the middle.Quote from: PCB.Wiz on March 18, 2025, 09:42:41 pmWhat would that look like on the AC side? Sounds like a good approach as well

author: fchk
author_rank: Frequent Contributor
timestamp: March 19, 2025, 03:12:41 pm
content: You are trying to connect mains voltage to SELV Safety Extra Low Voltage?The safety requirements for this is high. Your circuit must withstand a test voltage of at least 4000V and a creepage distance of a least 4mm. Capacitive coupling is forbidden in this case.If you only need functional isolation (i.e the entire circuit is completely isolated, there are no other connections etc), then you might get away with R-C-coupling. Most Electronic power meters work this way. They only have optical interface for a reason because the entive microcontroller and LCD display circuit is on mains voltage level.

author: inevitableavoidance
author_rank: Contributor
timestamp: March 19, 2025, 03:54:05 pm
content: Quote from: fchk on March 19, 2025, 03:12:41 pmIt's for an active monitor speaker, with exposed in- and output connectors, all with their grounds connected to the grounded chassis. Is capacitive coupling that big of a deal? Wrapping a wire around the mains conductors would in theory achieve the same. And inner plane plate capacitors would meet the 4mm creepage distance... Hmmmm.

author: UnijunctionTransistor
author_rank: Frequent Contributor
timestamp: March 19, 2025, 04:12:03 pm
content: Before I could reply, fchk answered very clearly exactly my concerns.Again, only YOU know how this project will be implemented and used.But I repeat myself, that for a commercial product, I would not be concerned about a few extra cents in the form of an optocoupler, if that gives me peace of mind.That is only my opinion, the final decision is yours.

author: fchk
author_rank: Frequent Contributor
timestamp: March 19, 2025, 05:32:45 pm
content: Quote from: inevitableavoidance on March 19, 2025, 03:54:05 pmYes, it is. It's a connection between live power and touchable ground. You must be able to prove that this capacitor is guaranteed to never ever fail. Otherwise you will face severe legal liability issues if something ever goes wrong. This could easily cost you millions.First you need a 3-pole Schuko connector with PE connected to ground. An Euro connector won't do it.Second you need to use a capacitor with an Y1 or Y2 safety certification. These are designed to fail open if they fail. The metallic layer will evaporate a the failure location. Choose a reputable brand and store the safety certificate for later reference.Then the current limiting resistor must also be able to withstand the testing voltage. You will need to put multiple resistors in series in order to accomplish this. Failure to design this properly might also cost you millions.Then you have a grounded design. This will be susceptible to ground loops which may impact sound quality.

author: PCB.Wiz
author_rank: Super Contributor
timestamp: March 19, 2025, 09:52:30 pm
content: Quote from: inevitableavoidance on March 19, 2025, 03:05:24 pmYou just need to pulse the opto. That can be via a R+C+DIAC, tho most DIACS are ~50uA and ST makes a 10uA one, for a more premium price.To get to a 10uA RMS ballpark, you can uselowC, low charge MOSFETSlike this. (Switch element can also be Analog SW, or uA comparator, or CMOS gate or NPN )This gives the opto a significant kick of almost 2mA on each mains rising edge.

author: inevitableavoidance
author_rank: Contributor
timestamp: March 21, 2025, 06:10:44 pm
content: I quite like that approach - will play around with a simulation for a bit.