Measuring 120 VAC from an AVR

Go To Last Post
19 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello Everyone,

I'm developing a project that requires me to monitor standard household 120VAC from an AVR. If there is a solution, it must be cost efficient(no more than $15) and if possible, easy to implement.

Is there a solution that fits my needs? Could someone point me in the right direction? Any help would be gratefully appreciated.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Atmel has an AVR note about directly connecting mains to an AVR using a 1Mohm resister ( http://www.atmel.com/dyn/resourc... ) Personally, I wouldn't connect my AVR directly to mains (I'd use a step-down transformer and surge protection), but you might want to read Atmel's application note to learn more about monitoring mains directly with an AVR.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Consider using the AC transformer powering the AVR.
Before turning the AC into DC, you could put up a measuring point; for instance a few serialized resistors.

Say, your AVR runs at +5V, you have an AC transformer transforming from 120VAC to 12VAC, then a bridge rectifier and a few capacitors to stabilize the DC, a 7805 to get the voltage down to +5V.
On the point before the bridge-rectifier, you'd probably want a ladder; something like..

220kOhm + 10kOhm + 10kOhm + 220kOhm

The two 220k is connected directly to the two 12VAC points (the bridge rectifier inputs), the point, where the two 10k meet is the ground/zero voltage point; connect this directly to your GND.
Now make a measuring point between just one of the 220k and 10k resistors; it'd measure something like -12*10/230V...12*10/230V = approx. -0.52V...+0.52V.

If I didn't make a mistake, that should work; however, it's up to you, to verify what I've written is true. Always use a multimeter or an oscilloscope before you add the AVR.

You should be able to get a complete 5VDC power supply for less than $5.

Unfortunately, I'm not very much into programming the AVR yet; other people must assist you there (setting up and using the ADC, etc).

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Is this a "stand alone" monitor that does not need to be connected to anything else? If so, an Avr can be paired with a LCD display, powered directly from the line *without* a transformer, and could accurately display true RMS line voltage. This minimum parts count/minimum cost arrangement would of course need to be in an insulating enclosure, since all the parts would be at line voltage potential. You would basically have the Avr chip, display module, a diode, a zener, four caps, five resistors, and the box.

Tom Pappano
Tulsa, Oklahoma

Tom Pappano
Tulsa, Oklahoma

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm planning to integrate the 120VAC Monitor with an LCD and UART/USART.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It looks like it's going to cost a lot more than $15!

Leon

Leon Heller G1HSM

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
I'm planning to integrate the 120VAC Monitor with an LCD and UART/USART.

If you are going to connect to other devices via a serial line, then a transformer would be the way to go. Measuring line voltage from the transformer secondary would not be the most accurate method but may be good enough for your purposes. You could perhaps use resistive dividers direct to the line and make differential measurements of the true line voltage, but you would want to be sure you had a good ground connection so the low voltage side could remain ground referenced.

Tom Pappano
Tulsa, Oklahoma

Tom Pappano
Tulsa, Oklahoma

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You can get an idea how to make transformerless device here:
http://www.h-kloosterman.nl/dimm...

but be VERY VERY CAREFUL !!! , otherwise it could really cost you much more than 15$ :)

Best regards,
Gintaras

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

benjaminvm wrote:
Hello Everyone,

I'm developing a project that requires me to monitor standard household 120VAC from an AVR. If there is a solution, it must be cost efficient(no more than $15) and if possible, easy to implement.

Is there a solution that fits my needs? Could someone point me in the right direction? Any help would be gratefully appreciated.

http://focus.ti.com/lit/ds/symli...

Digikey lists single qty cost as $15.70/ea

Ta da!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If you don't need the power (for the AVR) from the AC you can make a little circuit on the hot side, that is feed form the AC and make a freq. that change as the AC voltages change (that can be made for under $1) then send that freq over a opto coupler and have the AVR to calc the voltages (from the freq) and send it over RS232 and show it on a & seg display.
That should be less than $5 so your box and connectors will be the expensive part.

Jens

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Jens has a good idea. I would use one Avr on the "hot" side to do RMS voltage measurement and squirt the data through an opto to a second Avr on the "cold" side which has the display and external data interface. Very inexpensive and would perform quite well.

Tom Pappano
Tulsa, Oklahoma

Tom Pappano
Tulsa, Oklahoma

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Why wouldn't an AC transformer be accurate? A simple wall wart with AC output should do.

Once it's calibrated, what would cause inaccuracies?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

sparrow2 wrote:
If you don't need the power (for the AVR) from the AC you can make a little circuit on the hot side, that is feed form the AC and make a freq. that change as the AC voltages change (that can be made for under $1) then send that freq over a opto coupler and have the AVR to calc the voltages (from the freq) and send it over RS232 and show it on a & seg display.
That should be less than $5 so your box and connectors will be the expensive part.

Jens

Can you elaborate a bit on how to make this (VCO?)? Seems like a great way to have a nice isolated measurement.

Clancy _________________ Step 1: RTFM Step 2: RTFF (Forums) Step 3: RTFG (Google) Step 4: Post

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
Why wouldn't an AC transformer be accurate? A simple wall wart with AC output should do.

Once it's calibrated, what would cause inaccuracies?

I'm probably just being too picky 8-) The OP did not say what kind of accuracy he needed. The problem with a small transformer would be changes in its secondary voltage with changes in load, and distortion of the wave form caused by the capacitor input filter. These errors may be of little concern to the OP.

Tom Pappano
Tulsa, Oklahoma

Tom Pappano
Tulsa, Oklahoma

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

The problem with a small transformer would be changes in its secondary voltage with changes in load, and distortion of the wave form caused by the capacitor input filter.

Exactly, in my experience--a lightly-loaded secondary will float about 10% higher than when a representative load is applied.

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

tpappano wrote:

The problem with a small transformer would be changes in its secondary voltage with changes in load,
Tom Pappano
Tulsa, Oklahoma

Why would the load change? All it would be used for is to sample the voltage.

One concern would be if the "sinewave" of the AC power changed to something not quite a sinewave. That could be caused by things like switching power supplies. But any device plugged in to the mains would experience that, so maybe that's not bad.

If you really want to get sophisticated, I guess there are several things you could measure. Phase shift or power factor, and any variation in the ratio between peak voltage and RMS voltage, which would indicate the wave shape changed.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

Why would the load change? All it would be used for is to sample the voltage.

Aaah, I get it, a transformer added just for monitoring. Our typical setup is a 24VAC secondary "control transformer", which also powers our circuit board, relays, and the like. I'd still check the response, and/or add a small load.

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

Can you elaborate a bit on how to make this (VCO?)? Seems like a great way to have a nice isolated measurement.

_________________
Clancy


First because I didn't plan on a micro on the high side I would make a high DC voltages(30V or so) on the hot side so it would something like this :
A RC to make a lower voltages
One 1A diode (1N400x) to make DC
A Cap to remove riple
If needed a Zener diode (or cheap volt reg 50mA).
Now we have DC.
The freq will be a two trans Astablemultiviprator where the two basic res voltages is take from the uregulated DC
I think it can be done simpler because if you can make a tone AC voltages change will change the freq, but the problem would be that your 50/60 HZ will add some noise and the res in the opto easy could be a part of the freq.

If you need AC power you could change the opto to a cheap transformer and the get the power + AC voltages (freq) that way !!!

Jens

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Just an other way to do it.
Make a 50V voltages compare on the high side, and when over then turn the opto on, and then calc the % of time the signal is on. :)

Jens