Author Topic: Measuring mains AC  (Read 3485 times)

0 Members and 1 Guest are viewing this topic.

Offline dan3460Topic starter

  • Frequent Contributor
  • **
  • Posts: 326
  • Country: us
Measuring mains AC
« on: January 09, 2017, 03:42:16 pm »
I'm working on a project were I need to measure AC voltage that will vary from 0 to mains. Whatever I get will put a voltage to a pin on a microcontroller, that part I'm fine with.
I have looked at a differential amp that takes AC and output a voltage reference, here is the link http://microcontrollerslab.com/ac-voltage-measurement-using-microcontroller/
I saw others where one side of the AC was tied to ground, I didn't like that.
My concern is tying the AC with the circuit that have the MCU on it, even when there are hefty resistors separating the opamp and the AC.
Is there any other way to do this? it has to be as inexpensive as possible.
 

Offline Alex Nikitin

  • Super Contributor
  • ***
  • Posts: 1166
  • Country: gb
  • Femtoampnut and Tapehead.
    • A.N.T. Audio
Re: Measuring mains AC
« Reply #1 on: January 09, 2017, 04:27:46 pm »
I'm working on a project were I need to measure AC voltage that will vary from 0 to mains. Whatever I get will put a voltage to a pin on a microcontroller, that part I'm fine with.
I have looked at a differential amp that takes AC and output a voltage reference, here is the link http://microcontrollerslab.com/ac-voltage-measurement-using-microcontroller/
I saw others where one side of the AC was tied to ground, I didn't like that.
My concern is tying the AC with the circuit that have the MCU on it, even when there are hefty resistors separating the opamp and the AC.
Is there any other way to do this? it has to be as inexpensive as possible.

First of all I would use a small mains transformer to isolate your circuit from the mains and to reduce the voltage down to a manageable level, the rest depends on the accuracy and specifications you need to achieve (i.e. true RMS or not etc).

Cheers

Alex
 

Offline TiN

  • Super Contributor
  • ***
  • Posts: 4543
  • Country: ua
    • xDevs.com
Re: Measuring mains AC
« Reply #2 on: January 09, 2017, 04:41:49 pm »
Look on some datasheets and reference designs of energy metering ICs, such as Analog Devices ADE. Some of them are simple and cheap enough to be suited as AC monitoring blocks.

This question fits "Projects and designs" section better however, unless TS desire to discuss errors and measurement accuracy for mains voltage, etc.
YouTube | Metrology IRC Chat room | Let's share T&M documentation? Upload! No upload limits for firmwares, photos, files.
 

Offline dan3460Topic starter

  • Frequent Contributor
  • **
  • Posts: 326
  • Country: us
Re: Measuring mains AC
« Reply #3 on: January 09, 2017, 05:27:20 pm »
I'm not monitoring AC, the voltage will vary from 0 to mains (which is around 120V here). It doesn't need to be really accurate, will grab the voltage and make a rough calculation of the power consumption, that is why the circuit linked at the OP attracted me. A wallwart sometimes have electronics in there and lit will not track the changes on the supply line.
I thought about a transformer that the cheapest one that I found is about US$5.
Answering to TiN, the cheapest IC metering that I found, I think it was from Analog Devices, was around $8.

Thanks for the answers.
 

Offline Seekonk

  • Super Contributor
  • ***
  • Posts: 1938
  • Country: us
Re: Measuring mains AC
« Reply #4 on: January 09, 2017, 06:53:15 pm »
I would use an opto isolator.   On the LED side use a 47K or higher 1W feeding a full wave bridge into the opto.  On the other side connect the collector to +5 or whatever.  Emitter reeds a resistor in parallel with a 10uF cap.  Resistor depends on transfer ratio and voltage measured, start with 1-2.2K.  Don't go lower.  If too high, increase 47K resistor.  Isolation and cheap.  Transfer is pretty linear.  Worth a try and you will not have to worry about overloading A/D.
 

Offline bson

  • Supporter
  • ****
  • Posts: 2269
  • Country: us
Re: Measuring mains AC
« Reply #5 on: January 09, 2017, 06:56:22 pm »
I'd pass on that scary circuit and use a transformer.  A small mains transformer.  Some reasons: no fusing, connected directly to mains, mains polarity dependent, not earth referenced.  The worst is probably the fact that the author expects a noob to wire up mains to a potentially grossly unsafe small-signal circuit and figure out the details.  Not beginner territory.  (Are you familiar with concepts like arc distance?)  This is how houses burn down.
« Last Edit: January 09, 2017, 06:59:15 pm by bson »
 

Offline LukeW

  • Frequent Contributor
  • **
  • Posts: 686
Re: Measuring mains AC
« Reply #6 on: January 10, 2017, 06:05:52 am »
Do you need galvanic isolation in your system, and where do you need the galvanic isolation barrier to be?

Many mains energy meter consumer-type appliances don't use any galvanic isolation at all, they don't need to, and they use stuff like transformerless power supplies and the local DC ground (or positive rail) defined as the hot AC line, but if you want to do things like plug the system into a PC or other devices or have it exposed for human contact with the electronics then you will need to isolate it. You just use a voltage divider and a differential amplifier, energy-metering IC etc. These sorts of chips, the Analog Devices ones, Cirrus ones etc typically use something like an SPI interface to a microcontroller (pulse output sometimes) and you can put isolation in that link, using good old optocouplers or iCoupler ICs etc.

You can use a potential transformer (or just an ordinary step-down transformer which is the cheap alternative to a "real" instrumentation-style potential transformer), and this is potentially the "easy" approach since you don't have to worry about any electronics on the non-isolated side, any design or PCB layout creepage distance or anything like that.

There are some chips from Silicon Labs that do line power metering + galvanic isolation in a single IC.
 

Offline dan3460Topic starter

  • Frequent Contributor
  • **
  • Posts: 326
  • Country: us
Re: Measuring mains AC
« Reply #7 on: January 10, 2017, 12:46:19 pm »
I have been working with electricity and electronics all my life and i'm old, just recently started to meddling with microcontrollers. On this device the circuitry is powered from a step-down transformer and I'm monitoring another connection that can have from 0 to 120VAC.
The ICs that I saw that can measure voltages are pretty expensive in the order of $10 to $20. This drives up the unit cost.

After considering all what has been said, I think the best solution is to use a transformer.

Thanks for the comments.
 

Offline SeanB

  • Super Contributor
  • ***
  • Posts: 16276
  • Country: za
Re: Measuring mains AC
« Reply #8 on: January 10, 2017, 03:47:25 pm »
If you are using a transformer order a 220V primary version, and use it on 115VAC. The reason is that you will have less distortion in the sense voltage, as in most cases transformers are run at a primary magnetisation that is close to saturating the core, and this makes it non linear. Running at reduced voltage means the core runs in a lot more linear region and you do not have voltage compression at the top end.

In 220VAC areas you just take 2 identical 2VA transformers, put the primaries in series and the secondaries in parallel, giving the same result of improved linearity.
 
The following users thanked this post: orolo

Offline dan3460Topic starter

  • Frequent Contributor
  • **
  • Posts: 326
  • Country: us
Re: Measuring mains AC
« Reply #9 on: January 10, 2017, 05:40:18 pm »
Thanks Sean, measuring the exact voltage is not a priority. Probably main priority is space and cost. I going to look for the cheapest transformer I can find.

 

Offline Kleinstein

  • Super Contributor
  • ***
  • Posts: 14181
  • Country: de
Re: Measuring mains AC
« Reply #10 on: January 10, 2017, 06:15:51 pm »
The really small transformers, like less than 1-2 VA can be rather close to saturation and thus the output voltage note really linear connected to the input. I would expect errors up to 50% for a small 115 V transformers. So it is not just a little less accurate.

So the especially for a small cheap transformer get one made for 2x110 V or similar this really helps and also keeps the power dissipation down. Small could be tricky, as the ones below 1 VA can be really crappy and they might not even work well at half there nominal voltage.

So if it has to be really small the opto-coupler version might be really the better way. If low voltages (e.g. < 10 V) are important one might use a diode in parallel instead of a bridge rectifier. Also a capacitor could replace much of the high power resistor, if power dissipation is important.

The is also the option to use a capacitor (e.g. the kind that is normally used for EMI suppression) for current limiting and than a smaller current transformer for the isolation.
 

Offline dan3460Topic starter

  • Frequent Contributor
  • **
  • Posts: 326
  • Country: us
Re: Measuring mains AC
« Reply #11 on: January 10, 2017, 11:59:00 pm »
I Have a couple of small transformers to do the test. This transformer will have almost no load on it as it is only use to measure the incoming voltage, don't understand why you say that could be close to saturation, do you mean magnetic saturation? I will make tests and report.

Thanks for the advice
 

Offline Marinated

  • Contributor
  • Posts: 27
  • Country: nz
Re: Measuring mains AC
« Reply #12 on: January 11, 2017, 12:14:50 am »
Test the resulting waveforms, firstly with only a scope (high impedance) across the transformer secondary, secondly with the lowest value resistor the transformer's rating comfortably allows. You will see a much cleaner waveform in the second scenario because it is closer to ideal operation.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf