Maker Pro
Maker Pro

Isolated sense of AC mains (240V) voltage and phase

Status
Not open for further replies.

rogerclark

Dec 28, 2013
3
Joined
Dec 28, 2013
Messages
3
Hi,

I'm trying to build a low cost power monitor for AC mains (220V - 250V), and have previously been using a transformer to sense the voltage (and an Allegro hall effect sensor IC for current).

This works fine, but transformers are relatively large and expensive and also draw power all the time.

So I've been looking at isolation amplifiers, but they are all quite expensive, i.e $15+

Trying to design something that uses simple optocoupler(s).

It seems to be possible to do it with 2 x 4N25 (or similar), when I model it in LTSpice, but I'm not really sure if this is a true reflection of what would happen in practice.

Could anyone comment on the design and let me know if there is something that I'm ignored, which would prevent the circuit functioning as it appears to in LTSpice

Note. The HT side is on the left, the LT side on the right. The GND on the right is only in the simulation to allow spice to run, and has a large value series resistance.

The 5V supply on the right is from the computer (Arduino) supply.


I can see there is an issue near the zero crossing point, but for my application I don't think this is an issue as the error it will cause is less than other errors I have in the overall system.


Thanks.

Edit. I forgot to mention the zip file contains the LTSpice file.
 

Attachments

  • ac_sense.zip
    932 bytes · Views: 255
  • AC_sense.png
    AC_sense.png
    17.1 KB · Views: 6,240
Last edited:

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
Hi Roger and welcome to Electronics Point :)

Check your AC mains voltage. In LTSpice, a sinewave AC signal with an "amplitude" of 240V is NOT 240V RMS - it's 240V peak! Unexpected quirk of LTSpice. Check by looking at the voltage waveform. You'll see it's 240V peak.

The trouble with optocouplers is that their transfer characteristics are not linear, and the current transfer ratio (CTR) (i.e. the "gain" from input to output) is poorly defined and varies with temperature and age! Look for the CTR parameter in the data sheet and you'll see how poorly defined it is.

So if you're hoping to be able to measure the output voltage waveform's amplitude and calculate the input voltage from it, you're out of luck with that method, I'm afraid.

What isolation amplifiers have you been considering?
 

jcurrie

Feb 22, 2011
128
Joined
Feb 22, 2011
Messages
128
call me dense but do you just want to monotor if power failes or read voltage or current ?
is this for single phase or three phase?
can't open the zip file .
jcurrie
 

Harald Kapp

Moderator
Moderator
Nov 17, 2011
13,700
Joined
Nov 17, 2011
Messages
13,700
Unexpected quirk of LTSpice
I wouldn't call it a quirk, It's the way a sine wave is defined: u(t)=û*sin(w*t). Therefore you give û as parameter to the simulator. I agree, you have top be aware of this.

Assuming that you want to measure the mains voltage, I agree with Kris: an optocoupler is not a good choice. It even may end up using more power than a transformer. While the LED in an optocoupler requires 1mA or more to light, a transformer can run with 100µA or less - provided you don't put a heavy load on the secondary side. this is probably the least expensive solution.

You could also use a voltage divider on the primary side plus an ADC and send the digitized signal to the arduino via n isolated (optocoupler) serial interface. This, however, requires that you provide an isolated operating voltage to the primary side and you also have to be rather carerful in designing and layouting the circuit on the primary side because it operates on mains voltage level.
 

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
Yes, I agree with Harald's suggestion. Convert the voltage to digital on the mains side and use an SPI connection through some fast optocouplers to transfer the data serially across the isolation barrier.

Another option is to do your signal processing on the mains side, and pass the final voltage and current measurements across the barrier to the Arduino.

Obtaining power for the mains-side circuitry is easy because there is a mains supply available! You can use a capacitor or a large resistor to drop most of the mains voltage. This assumes that you can draw power from the mains supply. If you can't, you can use an isolated DC-to-DC converter module to pass power back across the barrier.

The more circuitry you have on the mains side, the more careful you have to be. Ideally the mains circuitry should be in a separate section of the board, and you should use an isolating transformer to power it when you're testing it.
 

OLIVE2222

Oct 2, 2011
690
Joined
Oct 2, 2011
Messages
690
Indeed as mentioned by Kris standards optocoupler will not do the job. However linear optocoupler can be part of the solution. See:

http://www.vishay.com/docs/83622/il300.pdf
http://people.ece.cornell.edu/land/courses/ece5030/labs/s2013/appn50vishay.pdf

The Kris suggestions to supply the circuit are still applicable.
If supplying the circuit from the main is allowed you can build a transformer less supply,
with the regulator, the op amps for the conditioning and the optocoupler it can be a relatively low part count solution.

And yes working with main voltage in the real world is far more dangerous than with LTSpice, be careful !!

Olivier
 

Arouse1973

Adam
Dec 18, 2013
5,178
Joined
Dec 18, 2013
Messages
5,178
Hi Roger and welcome to Electronics Point :)

Check your AC mains voltage. In LTSpice, a sinewave AC signal with an "amplitude" of 240V is NOT 240V RMS - it's 240V peak! Unexpected quirk of LTSpice. Check by looking at the voltage waveform. You'll see it's 240V peak.

The trouble with optocouplers is that their transfer characteristics are not linear, and the current transfer ratio (CTR) (i.e. the "gain" from input to output) is poorly defined and varies with temperature and age! Look for the CTR parameter in the data sheet and you'll see how poorly defined it is.

So if you're hoping to be able to measure the output voltage waveform's amplitude and calculate the input voltage from it, you're out of luck with that method, I'm afraid.

What isolation amplifiers have you been considering?
I think you will find the voltage in lt spice is + and - of your value, so 50mV sine wave is 50 mv up and 50mv down 100mv peak to peak
Thanks Adam
 

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
I was considering suggesting the IL300 but I'm not sure how accurate they are over time. I guess if the degradation is only in the LED, not the phototransistors, it should remain accurate for a long time.

Adam, re AC voltages in LTSpice, what you said is the same as what I said. The value you specify determines the peak voltage. If you double it, you will get peak-to-peak voltage.
 

rogerclark

Dec 28, 2013
3
Joined
Dec 28, 2013
Messages
3
Thanks for all the replies guys.

OK about 240V in lt spice being 240V peak, thanks for that tip. I should have noticed.

Looks like this one is a non starter.

I have looked at the IL300 but the cost is far too high,



I seen other circuit ideas which convert the mains voltage to PWM, and then feed the pulses though an opto, and reconstruct them on the LT side, but this seems overly complicated for my simple application.


I'd probably be better off just using a very small transformer e.g. http://www.ebay.com.au/itm/Epoxy-Re...Electrical_Test_Equipment&hash=item53f1a348fe

I don't even need as much as 0.5VA, I guess smaller transformers may exist, but the Chinese suppliers on eBay don't charge the large postage costs that the traditional suppliers charge, I mostly find it more cost effective to get my hobby parts from eBay etc.

Anyway, thanks again for all the replies

Cheers

Roger
 

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
Are the energy meter chipsets also too expensive? Or not suitable? There are several around, from Analog Devices, Maxim and others. If you haven't checked them out, Google energy meter chipset.
 

rogerclark

Dec 28, 2013
3
Joined
Dec 28, 2013
Messages
3
Are the energy meter chipsets also too expensive? Or not suitable? There are several around, from Analog Devices, Maxim and others. If you haven't checked them out, Google energy meter chipset.

Actually, I have some Cirrus 5460 energy meter chips, but it looks like they have now been superseded.

I did start to build a test board using one of them, but got bogged down in the programming.

At the moment I'm using the Open Energy Monitor firmware, for AVR that calculates all sorts of values including power, RMS current and power factor, and it was easy to integrate into my existing design that already uses AVR to control a triac acting as a dimmer.

Basically my whole project is a wireless (433Mhz) remote controlled dimmer unit for 240V, but I was hoping to be able to get the dimmer to output a specific power, regardless of what was connected, hence I need to measure current and voltage.

Current measurement is working OK as I'm using a hall effect current detector ACS712
(http://www.ebay.com.au/itm/1PC-New-...Electrical_Test_Equipment&hash=item2c70c82cdd)

But the firmware (not unsurprisingly) can't determine the power I haven't connected a voltage input.

In the past I have used small transformers for this job, but I though there may be a better approach.

One other more radical approach is to run the whole unit on a "transformer-less" supply, so that GND is neutral.
So I can then directly measure the 240V AC via a resistor divider etc.

However working on stuff that's not isolated from the mains is
(A) very dangerous, and
(B) a pain to debug the hardware and firmware, as taking measurements is tricky.
 

Bilal Naseer Qureshi

Oct 13, 2017
1
Joined
Oct 13, 2017
Messages
1
Your project would work, provided you choose right value of the resistor. At present, you are using 180K which is insufficient to turn on LED as it currently provides peak 1.7mA for peak 312V which is insufficient to turn on LED. for more details consider the datasheet of the optocoupler.
Also, dont forget to choose rightly the power rating of the resistor.
 
Status
Not open for further replies.
Top