Truncated match.
PICList
Thread
'Measuring AC volts: Circuitry'
1999\02\08@174318
by
Thomas McGahee

Andres,
A half wave rectifier will drop .7 volts. A full wave bridge will
drop 1.4 volts. I recommend that you rectify the voltage *before*
reducing it with a resistor divider circuit. That way you will
lose .7v out of 120 volts instead of .7 volts out of 5 volts!
As to filtering using a capacitor, that is useful *if* you can tolerate
a response time of a fraction of a second or so. (You would *not*
want to alter the response time in any way if you are specifically
looking for voltage droputs, line glitches, etc.)
I take it you just want to monitor the line voltage and give a
readout that tells the approximate RMS voltage. As long as the
waveform is a sine wave, you can actually monitor the PEAK DC
and convert this directly (via your lookup table) to the
corresponding RMS value.
120 VAC >>*
(Hot)  
 R2 150K
+   25K pot
1 ufd === POT>
250 vdc  
 R1 5.00K
 
120 VAC >**>
Let's assume you want to be able to read voltages from 0 to 127.5 volts
AC RMS. (255/2=127.5)
127.5*1.4142135=180.3122213 PEAK
Subtract one diode drop to get the actual peak output
180.3122213.7=179.6122213 or 179.61 is accurate enough.
If we want the max output to the PIC A/D input to be 5.00 volts
when there is 179.61 peak dc volts, then we need two resistors
that have the ratio (179.615.00):5.00
Since it is difficult to get resistors having the ratio 172.61:5.00
it makes sense to form the R2 resistance from TWO resistors, one of which
is variable. I would use a 150K resistor in series with a 25K
multiturn potentiometer for R2, and a 5.00K resistor for R1.
I would take the output from the wiper of the pot.
[When calibrating the unit later, apply a known AC RMS value
and adjust the pot for the closest displayed value. Note that
in this case the increments are in .5 volt steps, so don't
expect greater than +/ .5 volt accuracy!]
Scaling is very straightforward: 127.5 V AC RMS in will yield a count
of 255 from the A/D converter. This corresponds to .5 volts per count.
In this case a lookup table can be dispensed with, since you can
arrive at the correct value by shifting the count to the right,
and masking the MSB. This will divide the value by two. (If the
original LSB is a "1", then the decimal point value is ".5"
otherwise it is ".0")
[If you decide to use a lookup table, you can then correct for the
.7 volt diode drop within the table. In this case I would recommend
coding the decimal point portion in the MSB immediately. That
will save you the shift operation later.]
The algorithm for the RMS input value corrected for .7 volt diode
drop is:
InputRMS=(MeasuredPeak+.7)/1.4142135 Again, you can code the
portion after the decimal point into the MSB or LSB as desired.
**************
There is another kind of meter that is also quite useful, and that
is the expanded range meter. Let's say you are really interested
in the range from 100 to 125.5 That is a VARIATION of
25.5 volts and we can use 255 counts to represent 25.5 with
an accuracy of .1 volts.
This type of expanded range meter requires that you have some
method of "removing" the initial 100 volts. There are a number of
ways this can be done using op amps and "scaled down" voltages
so that the output will go from 0 to 5.00 volts for an
input change from 100 to 125.5 volts. (by the way, I choose
voltages that scale well to the value 255 on purpose, so that
we can get a scaling factor that maps well to the inherent
0255 count of the 8 bit A/D. Other scale factors can be chosen,
but they are not as clean and simple)
There is also a simple method using a Zener diode, but it is
limited to the accuracy of the Zener, and it has a certain amount
of sloppiness in the output depending on the sharpness of the
Zener at the chosen current level.
Regardless of which method is used to remove the 100 volts,
the hardware/software simply adds it back in by displaying a
leading "1" in the hundreds position. This digit can be
blinked when there is an under or over voltage condition.
I have to get something to eat, so I will terminate this post
now, but if there is interest in the expanded range method,
I could write some more about that later. Of course, if there
is no interest, then I will just save myself the trouble
and do something else with my time.
Fr. Tom McGahee
1999\02\09@075301
by
Andres Tarzia
Thomas,
Thank you for your excellent post.
Please, go ahead with the full explanation on the expanded range method.
A further quirk: to simplify the discussion, I wrote about measuring 115V
AC, but we really have 220V AC down here in South America. Nevertheless, you
can just assume 115V AC, and then I will recalculate the circuit for 220V
AC.
In fact, I was thinking about building an "autoranging" 110to240V AC meter
by trying 220V first and if I find out that I get only halfscale
measurements, flip a small relay to short some resistor or to select a
different one and start measuring in 115V mode. I will wait for your post on
the expanded range method to see how can I do that with your circuit.
Regards,
Andres Tarzia
Technology Consultant, SMART S.A.
email: spam_OUTatarziaTakeThisOuTsmart.com.ar
{Original Message removed}
1999\02\09@080100
by
Harrison Cooper
I hadn't been following this thread...but....isn't there already DVM's with
RS232 interfaces? Seems a bit simpler..
1999\02\09@094952
by
Andres Tarzia
Sure there is!
I even own a Fluke "tester" with dozens of functions, including very
accurate AC measurements. But I am trying to build something to be mounted
on a standard wall receptacle (the one used to mount light switches and
outlets). I intend display not only AC volts, but frequency too (that is
rather easy with a PIC).
Apart from that, I am doing that just for the fun of it.
Regards,
Andres Tarzia
Technology Consultant, SMART S.A.
email: .....atarziaKILLspam@spam@smart.com.ar
Original Message
From: Harrison Cooper
Sent: Tuesday, February 09, 1999 10:00
To: PICLISTKILLspamMITVMA.MIT.EDU
Subject: Re: Measuring AC volts: Circuitry
I hadn't been following this thread...but....isn't there already DVM's with
RS232 interfaces? Seems a bit simpler..
1999\02\09@110703
by
Wagner Lipnharski

Andres, looks like you just need nothing fancy or special, just a "wall volts an
d frequency meter" that just shows some change in the distributed power. Sounds
that it doesn't
need to show from zero to 220Vac, but some range close to 220Vac.
The best solution I can see, is to use few zener diodes to cut aprox 180 Volts,
so it will has real 40Vac. Dividing it by 10 you will get 4 Vac, rectify and fi
lter it to be
measured. It will give you a resolution at least 5 times better than divide 220
directly with resistors.
220Vac >oZ<Z<Z<Z<Z<Z<+ ~40Vac
6 x 30V Zener Diodes 

3k 1W 1N4007 
5Vdc <oooRRRR<o
to processor +   
max 10mA ===== .' R
 A Zener#1 5Vdc R 33k 1/4W
Cap   R
330uF   Zener #2 5V 
 o>Zo
  
Neutral >oooRRRoo>
  3k6 1/4W  Frequency
  5uF +  Measurement
 oo<+
   1N4007
CIRCUIT +RRRRoo>
GOUND 20k 1/8W Voltage Dc
Measurement
05Vdc ~ 180230 Vac
Zener #2 is to avoid the 4Vac to go higher than 5V and to clamp
the negative swing to 0.6.
The R + C (20k + 5uF) provides the correct DC filtering
to about 100ms, what is enough for DC measurement and fast
response to the AC outlet changes.
The 6 x 30V Zener diodes will dissipate a max of 300mW, so a
1/2 Watt diodes can do, but I would go for 1W for safety.
A simple power transformer 220 x 6 Vac would do the same job,
but then you lose the wide scale from 180230Vac...
If your processor current consume is less than 10mA, change
3K resistor value accordingly, it would reduce the zeners
power dissipation.
have fun,
Wagner Lipnhraski
UST Research Inc
Orlando, Florida
http://www.ustr.net
1999\02\09@114812
by
Stefan SczekallaWaldschmidt
Hi,
why not use a small transformer 2XX V to e.g. 6V , a half wave recifier
and a kind of limiter to save PIC ADPort.
one benefit is that you don4t have to deal with deadly high voltages
in your circuit.
Kind regards
Stefan
More... (looser matching)
 Last day of these posts
 In 1999
, 2000 only
 Today
 New search...