Author Topic: Isolated voltage detector (AC mains)  (Read 24176 times)

0 Members and 1 Guest are viewing this topic.

Offline JJallingTopic starter

  • Supporter
  • ****
  • Posts: 246
  • Country: dk
Isolated voltage detector (AC mains)
« on: June 18, 2015, 06:21:12 pm »
Hi all,

How would you detect mains AC with a microcontroller? It needs to be isolated, so i'm thinking of just using an opto-couple and a couple of resistors.
Can anyone suggest a better solution?

BR Jonas
 

Offline Fungus

  • Super Contributor
  • ***
  • Posts: 16560
  • Country: 00
Re: Isolated voltage detector (AC mains)
« Reply #1 on: June 18, 2015, 07:02:18 pm »
Connecting an optocoupler directly to the mains is risky.

But... a very similar way is to connect one of those little neon mains indicator bulbs to the mains wires then detect the light from it with a phototransistor.

Those neon mains indicators are very robust against mains spikes, etc. Much more so than a LED.

« Last Edit: June 18, 2015, 07:04:01 pm by Fungus »
 

Offline LukeW

  • Frequent Contributor
  • **
  • Posts: 686
Re: Isolated voltage detector (AC mains)
« Reply #2 on: June 18, 2015, 11:45:19 pm »
You could use a zero-crossing detector, something like this.

http://www.dextrel.net/diyzerocrosser.htm

This gives you galvanic isolation and a sensible driver circuit on the AC side powering the LED, efficiently.

Alternatively, how about using an ordinary cheap, off-the-shelf small switchmode power supply to supply 5V or so to one of the microcontroller inputs from the AC mains circuit?
 

Offline jeroen79

  • Frequent Contributor
  • **
  • Posts: 529
Re: Isolated voltage detector (AC mains)
« Reply #3 on: June 18, 2015, 11:52:31 pm »
Or a small transformer, perhaps with a rectifier.
Or a mains operated relay.

What do you want to use it for?
 

Offline AlfBaz

  • Super Contributor
  • ***
  • Posts: 2183
  • Country: au
Re: Isolated voltage detector (AC mains)
« Reply #4 on: June 19, 2015, 12:02:17 am »
What am I missing?

Take the ubiquitous 4N25 opto. The first line in the data sheet under applications "Mains Detection"
 

Offline c4757p

  • Super Contributor
  • ***
  • Posts: 7799
  • Country: us
  • adieu
Re: Isolated voltage detector (AC mains)
« Reply #5 on: June 19, 2015, 01:42:17 am »
What am I missing?

Take the ubiquitous 4N25 opto. The first line in the data sheet under applications "Mains Detection"

This. I'm not sure why you'd want any of the other solutions, they're all rather over-complicated in my opinion.
No longer active here - try the IRC channel if you just can't be without me :)
 

Offline codeboy2k

  • Super Contributor
  • ***
  • Posts: 1836
  • Country: ca
Re: Isolated voltage detector (AC mains)
« Reply #6 on: June 19, 2015, 02:00:46 am »
Connecting an optocoupler directly to the mains is risky.

What?  While I like your neon idea, it's not necessary and it's not risky to connect the opto to mains.  You can do it with a protection diode and a 220k resistor.  100k for 110V AC.

I just whipped this (untested) circuit  up.  You don't need the MOVS or the spark gap, I just put it there to fully protect the opto from line transients and alleviate any fears of connecting the opto to the mains.   If your AC lines are already protected or you otherwise don't care, then you can leave it out.  It's a complete (and good) solution with them in there, though.



EDIT: updated with V2 schematic and LTSpice file.  Adds peak detector and logic level output, 3.0V when AC is on, 0V when AC is off.
EDIT: updated with V3 schematic: Adds 100mA fuse for ultimate protection with the MOVs.
« Last Edit: June 30, 2015, 11:09:40 am by codeboy2k »
 

Offline JJallingTopic starter

  • Supporter
  • ****
  • Posts: 246
  • Country: dk
Re: Isolated voltage detector (AC mains)
« Reply #7 on: June 19, 2015, 08:19:24 am »
Thanks for all your suggestions.
I need to detect if the fuse is blown on 50 mains lines, so it needs to be small and efficient. I think I will give the circuit that codeboy2k suggests a try.

BR Jonas
 

Offline Gyro

  • Super Contributor
  • ***
  • Posts: 9410
  • Country: gb
Re: Isolated voltage detector (AC mains)
« Reply #8 on: June 19, 2015, 10:26:32 am »
If you've got as many as 50 to sense then it might almost be worth designing some mains referenced logic to sense them directly (resistively) and transmitting serial status to your ground referred micro via a single opto.

It would need designing with care of course but might end up smaller and cheaper - depends how many you're making.
Best Regards, Chris
 

Offline Psi

  • Super Contributor
  • ***
  • Posts: 9889
  • Country: nz
Re: Isolated voltage detector (AC mains)
« Reply #9 on: June 19, 2015, 11:27:46 am »
an opto darlington will have plenty of gain so you can turn it hard one with a small amount of LED current, which is useful if your dropping 230V down to 3V with a resistor
Greek letter 'Psi' (not Pounds per Square Inch)
 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 19344
  • Country: gb
  • 0999
Re: Isolated voltage detector (AC mains)
« Reply #10 on: June 19, 2015, 11:31:16 am »
If you've got as many as 50 to sense then it might almost be worth designing some mains referenced logic to sense them directly (resistively) and transmitting serial status to your ground referred micro via a single opto.

It would need designing with care of course but might end up smaller and cheaper - depends how many you're making.
Whether that can be done, depends on whether the channels need to be isolated from one another.
 

Online Kleinstein

  • Super Contributor
  • ***
  • Posts: 14072
  • Country: de
Re: Isolated voltage detector (AC mains)
« Reply #11 on: June 19, 2015, 03:02:35 pm »
If efficiency is important the resistor to set the current could be replaced by a capacitor to a large extend (e.g. 10 nF and 1 K in series). Also a more sensitive opto coupler, that can work with something like 0.1 mA helps.

Usually mains voltage fuses are in the hot side, with the other side at neutral. So a common circuit could be connected to the mains neutral side and detect different lines even if they use different phases or voltages. Still an opto coupler at the output is a good idea.
 

Offline eneuro

  • Super Contributor
  • ***
  • Posts: 1528
  • Country: 00
Re: Isolated voltage detector (AC mains)
« Reply #12 on: June 19, 2015, 08:52:50 pm »
Connecting an optocoupler directly to the mains is risky.
... unless you and additional diode anti-parallel to PC817 optocoupler input diode and a few resistors  >:D

https://www.eevblog.com/forum/projects/inverse-parallel-scr-driver-circuit-with-moc3041ac-mosfets-switch/msg691833/#msg691833

Update: Ups, now noticed that @codeboy2k  send something similar ;)
Testing my circuit with 100k total series resistance @ 230VAC, but I have four 0.25W 100k which gives from calculation ~0.13W for each of them and I have them soldered to 0.5m copper wires, so heat is transfered additionally to wire-probably using ~200k @ 230VAC could be better idea, however didn't notice they got hot in final assembly like this below:
« Last Edit: June 19, 2015, 09:06:59 pm by eneuro »
12oV4dWZCAia7vXBzQzBF9wAt1U3JWZkpk
“Let the future tell the truth, and evaluate each one according to his work and accomplishments. The present is theirs; the future, for which I have really worked, is mine”  - Nikola Tesla
-||-|-
 

Offline gogoman

  • Regular Contributor
  • *
  • Posts: 116
Re: Isolated voltage detector (AC mains)
« Reply #13 on: June 28, 2015, 01:54:29 pm »
hi
what was the reason for the choice of 400 volt MOV for the 220ac. for a 250vac would 300volts MOV be the enought?
Why is the spark gap needed.
 

Offline poorchava

  • Super Contributor
  • ***
  • Posts: 1672
  • Country: pl
  • Troll Cave Electronics!
Re: Isolated voltage detector (AC mains)
« Reply #14 on: June 28, 2015, 02:02:28 pm »
A completly non-contact detection is quite easy to do by detecting electrical field. This approach involves an opamp in a non-orthodox configuration and steep bandpass filtering.

Since this is used in a product which my company sells, I can't be more specific than that.

It does not require any bulky or expensive components, can be done using jellybean parts only.

Sent from my HTC One M8s using Tapatalk
« Last Edit: June 28, 2015, 02:04:07 pm by poorchava »
I love the smell of FR4 in the morning!
 

Offline codeboy2k

  • Super Contributor
  • ***
  • Posts: 1836
  • Country: ca
Re: Isolated voltage detector (AC mains)
« Reply #15 on: June 28, 2015, 03:10:36 pm »
hi
what was the reason for the choice of 400 volt MOV for the 220ac. for a 250vac would 300volts MOV be the enought?
Why is the spark gap needed.

250VAC is the RMS value.  250*1.414 is the peak AC voltage, and that is about 355V, so a 300 volt MOV is not going to be acceptable here, so 400V MOV's are usually specified.

I mentioned that all of the protection devices are just there for completeness in my circuit drawing and you can choose to use them or not, depending on your needs.  The spark gap is just "Guilding the Lily" a little bit more, and for most cases, the MOV's alone provide good protection, as you've said yourself.

The spark gap might be needed in a more exposed installation, i.e. one that was outdoors in a hut under a transmitter tower (my own personal experience is here).

So I put it in my circuit and added a caveat that you only use what you need to use.
 

Offline gogoman

  • Regular Contributor
  • *
  • Posts: 116
Re: Isolated voltage detector (AC mains)
« Reply #16 on: June 28, 2015, 06:55:34 pm »
MOV are available in different Diameters, is there advantage using a 7mm vs 10mm Vs 20mm.
 

Where in the AC line should they be placed?

thanks
 

Offline codeboy2k

  • Super Contributor
  • ***
  • Posts: 1836
  • Country: ca
Re: Isolated voltage detector (AC mains)
« Reply #17 on: June 29, 2015, 02:29:09 am »
MOV are available in different Diameters, is there advantage using a 7mm vs 10mm Vs 20mm.

Where in the AC line should they be placed?
thanks

Choose the MOV by it's voltage rating. The thickness is determined by the chemistry, and some manufacturers are using different chemistries to achieve thinner or smaller MOVs with the same or higher voltage ratings.  It's all about reducing size.

MOV's should be placed just at the line entrance point to your circuit.

Also, you should ideally have a fuse in it at the line entrance point too. The fuse would be placed before the MOVs.  Then, when a transient occurs and  punches through the MOV you want the fuse to blow. This is especially important with a low-current load, such as in this case with the LED inside the opto-isolator being the load.  When a MOV punches through, it creates a low-impedance path that can continue to flow current, bypassing the load (the MOV becomes the new load) and overheating the MOV,  causing it to catch fire.  To counter this possibility (for low current loads) a fuse is used to open the circuit if the MOV shorts out like this.  Since the load is less than 10 mA, I would say perhaps a fuse rated at 100 mA should be ok;  if that blows, something is wrong and you likely need to replace the MOV's then.

*note- for higher current loads, a fuse might be rated too high for a MOV event to blow it.. in those cases you would need to use a TCO (thermal cut-off) in series and placed near the MOV, or a single TMOV, a device with a built-in TCO. This detects the overheating of the MOV and takes the MOV out of circuit before it can catch fire.

This AC mains stuff needs to be put in Dave's Wiki... should I do it :)
 

Offline Circlotron

  • Super Contributor
  • ***
  • Posts: 3166
  • Country: au
Re: Isolated voltage detector (AC mains)
« Reply #18 on: June 29, 2015, 08:01:16 am »
Could use a differential amplifier with the inputs connected either side of the fuse,and with the input resistors about 100 times the size of the feedback resistors.
 

Offline funkathustra

  • Regular Contributor
  • *
  • Posts: 150
  • Country: us
Re: Isolated voltage detector (AC mains)
« Reply #19 on: June 30, 2015, 06:45:41 am »
If you just need to detect the *presence* of voltage, whack on the classic H11AA1 bi-directional NPN-output photo transistor H11AA1, a series 33k resistor, and a pull-up resistor to your logic voltage (3.3 or 5V).

Totally isolated. Only uses 1 active + 2 passives.

When you see pulses on the output, you know there's AC there. When you don't, the AC is gone. Boom.

[
]
« Last Edit: June 30, 2015, 06:49:19 am by funkathustra »
 

Offline eneuro

  • Super Contributor
  • ***
  • Posts: 1528
  • Country: 00
Re: Isolated voltage detector (AC mains)
« Reply #20 on: June 30, 2015, 09:23:25 am »
If you just need to detect the *presence* of voltage, whack on the classic H11AA1 bi-directional NPN-output photo transistor
This is another option-I've decided to use classic PC817 optocoupler with additional anti parallel diode with builtin PC817 input diode, while I wanted to know when given AC polarity waveform begins, and using this half period AC signal detection still was able compute AC mains period in MCU and offests due to presence of this series resitance 100k-200k.
If someone doesn't need to detect given AC waveform polarity,  than H11AA1 will be even more compact design  :-+
12oV4dWZCAia7vXBzQzBF9wAt1U3JWZkpk
“Let the future tell the truth, and evaluate each one according to his work and accomplishments. The present is theirs; the future, for which I have really worked, is mine”  - Nikola Tesla
-||-|-
 

Offline DavidAlfa

  • Super Contributor
  • ***
  • Posts: 5836
  • Country: es
Re: Isolated voltage detector (AC mains)
« Reply #21 on: July 31, 2022, 03:43:14 pm »
Let me wake up this thread for the same reason, a friend wants a simple RPM detector for a generator.
Instead using an inductive sensor I'd thought it'd be much easier and cheaper to detect the AC frequency.
How about this? Resistors might need to be smaller, perhabs 75-82K each, but in the simulator it works from 35V or so.
Small cap to filter fast trasients.
« Last Edit: July 31, 2022, 03:46:41 pm by DavidAlfa »
Hantek DSO2x1x            Drive        FAQ          DON'T BUY HANTEK! (Aka HALF-MADE)
Stm32 Soldering FW      Forum      Github      Donate
 

Offline R_G_B_

  • Frequent Contributor
  • **
  • Posts: 399
  • Country: gb
« Last Edit: July 31, 2022, 08:34:06 pm by R_G_B_ »
R_G_B
 

Offline srb1954

  • Super Contributor
  • ***
  • Posts: 1085
  • Country: nz
  • Retired Electronics Design Engineer
Re: Isolated voltage detector (AC mains)
« Reply #23 on: August 01, 2022, 02:20:43 am »
MOV are available in different Diameters, is there advantage using a 7mm vs 10mm Vs 20mm.
 

Where in the AC line should they be placed?

thanks
Larger diameter MOVs can safely absorb more energy. They are usually specified in the number of Joules they can absorb per transient pulse and a larger device will have a greater Joule rating.

Each time a MOV absorbs a transient pulse it is damaged a little; most only rated for absorbing 10 pulses at their specified Joule rating. Eventually, the MOV will be sufficiently damaged that the leakage current increases to excessive levels and it overheats. Consequently, a MOV should be placed downstream of a protective device such as a fuse or circuit breaker, which will prevent this overheating escalating into a fire.
 

Offline DavidAlfa

  • Super Contributor
  • ***
  • Posts: 5836
  • Country: es
Re: Isolated voltage detector (AC mains)
« Reply #24 on: August 01, 2022, 07:38:35 am »
Damn, shouldn't have re-floated it. Don't answer to the 2015 question folks!  :palm:
Hantek DSO2x1x            Drive        FAQ          DON'T BUY HANTEK! (Aka HALF-MADE)
Stm32 Soldering FW      Forum      Github      Donate
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf