Looking for ways to measure AC line voltage with a uP

Measure its resistance. Measure nominal line voltage. P = e^2/r. It won't change much.

John

Reply to
John Larkin
Loading thread data ...

On a sunny day (Sat, 25 Nov 2006 12:44:42 -0800) it happened John Larkin wrote in :

The resistance of a light bulb changes a factor 10 between cold and hot, why should the resistance of a heater wire not change much?

Reply to
Jan Panteltje

NiCr has very low TC.

But it'll stretch when it heats up. When I used hot wire cutting/bending of plexi I used a spring support on one end.

...Jim Thompson

--
|  James E.Thompson, P.E.                           |    mens     |
|  Analog Innovations, Inc.                         |     et      |
|  Analog/Mixed-Signal ASIC\'s and Discrete Systems  |    manus    |
|  Phoenix, Arizona            Voice:(480)460-2350  |             |
|  E-mail Address at Website     Fax:(480)460-2142  |  Brass Rat  |
|       http://www.analog-innovations.com           |    1962     |
             
I love to cook with wine.      Sometimes I even put it in the food.
Reply to
Jim Thompson

Because it runs at a much lower temp and, as Jim says, nichrome has a low TC. But if that's a concern, measure the running amps.

My point is that there's not a lot of reason to measure the power of a simple heater load in real time.

John

Reply to
John Larkin

On a sunny day (Sat, 25 Nov 2006 14:19:25 -0700) it happened Jim Thompson wrote in :

OK, got it, thank you.

Reply to
Jan Panteltje

John Larkin wrote in news: snipped-for-privacy@4ax.com:

You could just look at the label. The listed wattage should be, on average, quite close.

----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----

formatting link
The #1 Newsgroup Service in the World! 120,000+ Newsgroups

----= East and West-Coast Server Farms - Total Privacy via Encryption =----

Reply to
me

formatting link

--
"I\'m never wrong, once i thought i was, but was mistaken"
Real Programmers Do things like this.
http://webpages.charter.net/jamie_5
Reply to
Jamie

I just found this chuip on Analogs web site today. Looks like fun.

Now to get a sample....

Reply to
Donald

No, we're not selling it. I suppose that's a possibility if there was enough interest.

If your uC has an ADC, one simple way is to just measure the voltage at the peaks. You can eliminate offsets by taking the difference between the positive and negative peaks. If you need isolation, you can use a transformer, but if the line isn't too far off ground (e.g., if it's a reasonably well balanced 240V), you can just use a one op amp diff amp to get a low voltage AC waveform to measure. Use something like

4*100kohms (for protection from at least moderate transients) from the line to each op amp input, and 5.11k or so feedback and from the op amp noninverting input to your ground reference. No need to muck around with a rectifier, if you sample on the voltage peaks. A bit of capacitance across each of the two 5.11k's will give some noise immunity. If you want RMS voltage, use the uC to sample fairly frequently and take the square root of the sum of the squares. Square root is easy if the voltage is within a fairly narrow range: (1+delta)^2 = 1 + 2*delta + delta^2; and if delta is small, you can drop the delta^2 term with little loss of accuracy.

Recommend you use a current transformer for measuring the current. With 1000:1 turns ratio, you should be able to put an appropriate load on the secondary to get about 2V peak. Then return the secondary to a voltage equal to the midpoint of the ADC range, and you can get the current.

If you really want power, you can sample the voltage and current together--simultaneously, or as nearly so as you can practically do--and multiply them together and average. Or you could add up all the V*I samples to get the total energy used.

How many samples per cycle you need to use to get accurate results depends on the degree to which you are unsure of the waveform. It's likely not a pure sinewave, but may not be enough different from a sine to matter to you. Then you would only need to sample the peaks of voltage and current, and determine the phase difference between them to calculate true power. Note that the peaks of a sinewave come midway between zero crossings.

Cheers, Tom

Reply to
Tom Bruhns

On a sunny day (Sat, 25 Nov 2006 17:06:02 -0600) it happened me wrote in :

quite close.

One reason to measure current is to test for a defective heater. The other reason could be, what I have here, where the PC logs the power consumption, and the heater has a switch with 3 settings, off, 1kW, and 2kW. You cannot get the switch status without modifying the heater. The heater is controlled by the PC via a triac. You can see the system live here:

formatting link
Well 'live' I switched it of in March :-) Winter has not come yet (it is summer temperatures in November here.....) and the heater is now running on its own thermostat (no PC logging), as I was afraid to see the real value now the electricity prices went up... However it seems I needed to pay _less_ while prices went _up_ and I uesed _more_ kwh, them electrons love me.

Reply to
Jan Panteltje

Use resistor divider to get mains voltage to levels acceptable for the builtin adc. Add some zener diodes for transient protection. Then let the pic sample/calculate and send it off via rs232 that is routed through a optocoupler.

One could extend it by useing another pic to send via rs485 to allow for multidrop operation. Budget decides I guess ;)

Reply to
pbdelete

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.