Searching \ for '[EE]: RMS vs Average voltage?' in subject line. ()
Help us get a faster server
FAQ page: www.piclist.com/techref/power.htm?key=voltage
Search entire site for: 'RMS vs Average voltage?'.

Exact match. Not showing close matches.
'[EE]: RMS vs Average voltage?'
2001\04\24@174848 by

Okay, I've tried to read up on RMS, and I still don't understand "when" it
should be used instead of just averaging.  Any suggestions on which I should be
using for this application (described below)?

I was originally going to do RMS measurements of an AC line, but now I'm
wondering if I should just use an average instead.  The reason being is that
without all the squaring and square rooting calculations, I may be able to run
it at 8mhz instead of 20mhz (that, and I think the FCC requires a licence on
anything running at/over 9mhz).

My circuit will be looking at a non sinusoidal waveform (a triac waveform
actually), which will also be inductive (driving a transformer with a feedback
loop).  And I've calculated that with triacs having something like 1us rise
times (I read that in some triac technical document somewhere), that an ADC
would have to be sampling at 2mhz in order to be at/over the correct nyquist
rate.  The most I can hope for from a PIC, from what I've read, is a bit more
than a 24khz sampling rate.

So, I can't just look at it in its "true form", I'll have to smooth it out at
least a little with a capacitor.  I have no idea on what value of cap to use,
although 1uf has been suggested to me in the past.  I.E., I don't want too large
of a value, as it will add too much lag time (it's for a feedback loop), but it
needs to be big enough to turn a 1us 0 to 4v (1mhz) rise time signal, into (at
most) a 83us 0 to 4v (12khz) rise time signal.  Does the amount of impedance
before the cap, make a difference on how much it spreads the signal out?  Any
canned formulas for this?

I'm using a voltage divider to get the 0 to 4volts (500k & a 10k, with surge
suppressors before them), and have been debating on using an opamp or not (for
impedance, and maybe using a dual version to have one rectify instead of using a
diodes before the voltage divider).  Someone on this list had told me that I can
get by without an opamp, if one of the two resistors was <=10kohms
(understanding opamp specs, makes PICs look like kids stuff to me).

Now I know how to go about calculating a true RMS measurement.  Is it pretty
much the same with averaging, except that I don't have to do all the squaring
and square rooting?  In other words, do I still add to the "number of samples"
to divide by; even when the sample is zero?

Gee, I wish I had gone to school for EE now, instead of programming.

Any suggestions on how to go about doing this are welcomed.

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

>
>I was originally going to do RMS measurements of an AC line, but now I'm
>wondering if I should just use an average instead.  The reason being is that
>without all the squaring and square rooting calculations, I may be able to run
>it at 8mhz instead of 20mhz (that, and I think the FCC requires a licence on
>anything running at/over 9mhz).

You'll really need to squeeze that, it's 9 kHz!

--
Dave's Engineering Page: http://www.dvanhorn.org
Where's dave? http://www.findu.com/cgi-bin/find.cgi?kc6ete-9

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

Yikes!

Drat, thought it was 9mhz.  Well, an 8mhz crystal will still be smaller and
cheaper at any rate....  Heh, yet another cost I'm going to have to incurr.....

{Original Message removed}
Hey Bob,

I like to get a general idea of the "whole system" before I let my EE training
kick in and fixate on one tiny little part.

You have something plugged into the wall. There's a triac (perhaps a lamp
dimmer) between that power cord and a transformer. There's ... /something/ ...
on the other side of that transformer.
You want to measure /something/ ( RMS voltage into the transformer ? RMS voltage
out of the transformer ? RMS current ? average power ? ) and get that data into
a PIC, and you've already figured out you need a (hopefully simple) circuit to
buffer between the (typical) 120 V(RMS) wall power and the PIC's analog input.
Then some software on that PIC takes that data and does ... /something/ with it,
within /a small/ time.

Am I anywhere close ?

Is /a small time/ within 1 cycle of the (60 Hz) power, i.e., about 16 ms ? A PIC
can do a lot of stuff in 16 ms.

If you measure the average voltage on any AC line, you will get (very close to)
0 Volts. That's why people use RMS volts rather than average volts to describe
"120 VAC" or "220 VAC" power outlets. (Given a square wave signal +7 -7 +7 -7 +7
-7 +7 etc. forever, what is its average value ? What is its RMS value ?).

and a capacitor C from the PIC analog input to ground, then you get a time
contstant T = R*C. One rule of thumb is to make C big enough so that time
constant T is at least 5 sampling times. (Software grabs a new value from the

With a resistor divider made of 2 resistors R1 and R2, the effective R to plug
into the above formula is the "parallel equivalent resistance",
R = 1/( 1/R1 + 1/R2 ) = R1*R2 / (R1 + R2). That's also the "effective
impedance" that must be below 10 KOhm (preferably below 1 KOhm) to meet
Microchip's specs.

That's about all I can help without filling in /some/ blanks.

Has anyone played with using a SA612A or SA602 analog multiplier to multiply
current and voltage in realtime to get (real) power, then filtering and
digitizing the power signal ? Is there a better chip for this application ? (I'm
looking for very low cost).

--
David Cary

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

> Okay, I've tried to read up on RMS, and I still don't understand "when" it
> should be used instead of just averaging.

There's a lot more to this, but at a high level you usually want RMS when
you ultimately care how much power the voltage source is supplying.  You
want average when the voltage itself is the "signal".  Again, there's a lot
more to it than this and all kinds of conditions apply.  I won't bother
going into them here since you can find all this stuff in standard
references.

If the waveshape is know, you can compute the ratio between the average
voltage and the RMS voltage up front.  You said your waveform was chopped by
a triac, so that doesn't sound possible in that case.  I'll also further
assume that you are trying to measure the power being dumped into a load,
and that the voltage to the load is the AC line switched by the triac.  In
that case you do need RMS, and a simple average won't get the same answer.
If you are truly trying to measure power, then you really want the average
of the instantaneous current times the voltage.

Note that if your waveform is repeating, you don't have to sample at twice
the Nyquist rate as long as the sample aperture is short.  This is how
sampling oscilliscopes get those high frequencies.

********************************************************************
Olin Lathrop, embedded systems consultant in Littleton Massachusetts
(978) 742-9014, olinembedinc.com, http://www.embedinc.com

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

Okay, here is some more detail then....

The voltage I'm looking at is the voltage gated by the triac going into a
transformer.  The voltage data is used for PID control of that same measured
voltage (something else I have to figure out yet).  Say I want 60volts to go to
the transformer....  I measure the current voltage over 1/2 line cycle (8.33ms),
and adjust the triac firing to try and get there on the next 1/2 cycle (repeat
until it settles).

The load on the transformer (off of the secondary), is extremely resistive,
almost a dead short (A short nichrome heating element, attached to a "pen",
which is attached to a 4 foot long 16 or 18 gauge cord, that is connected to the
transformer).  Nothing is rectified or filtered after the transformer (voltage
goes from about 0.4vac to 2.0vac max)   From what I've read, the waveform on the
secondary will be 180 degrees out of phase from the primaries.

At the start of this project, I was also thinking that I'd have to measure
current, in order to get an idea of the true power being consumed.  But
multiplexing the ADC slows it down a lot, and it will also cost much more in
hardware (current to voltage converter, etc...).  I thought that maybe I could
kind of cheat, by characterizing the transformer by measuring the RMS current at
different power levels, and putting that data into a table (by looking where the
triac shuts off at, I should be able to know the amount of current).  The user
range is only from 0 to 99, so that shouldn't be a problem.  However, the actual
load (the nichrome element) is user changeable, some elements draw more current
at a given setting, some draw much less.  Current draw is also dependant on
other variables, like modular jack connections (how tight they are), cord gauge
(16 or 18 gauge), solder joints, internal "pen" construction, etc....

This is how the current "analog circuit" works:  Voltage is varied via user
selection (potentiometer) and also depends on whatever the current line voltage
happens to be.  Where as the "current" drawn is determined by the particular
nichrome element in use, the cord gauge, etc... (I'm really just trying to get
rid of the uncertain aspect of the line voltage variation).  In fact, my only
core reason to look at how much "current" is being drawn, is to be able to
detect a fault condition (if a short occurs near the output of that tranformer,
usually in the modular jacks I'm using, stuff starts melting).  BTW, maximum
current output of the transformer is upwards of 16 to 20 amperes, much more if a
"fault condition" exists.

About the signal "risetime"/ red herring....  If a triac can turn on and bring
the original signal from 0 up to 205 volts (0 to 4.096 is what I'll be looking
at though) in 1us, isn't that a rise-time of 1mhz?  From what I've read about
the PIC's ADC (lets say an F876), the most I can hope for is around 24khz
sampling rate, a little more at 8 bits on other uP's.  And according to the MC's
files that I've read (many), I want to keep the signal at or below 1/2 of the
nyquist rate for accuracy reasons.  I would assume that would also apply to
frequencies within that signal.

I'll be using TMR1 in compare mode to turn on the triac from CCP1 (hardware),
CPP2 or B0 for zero crossing (interrupt), and TMR0 to do ADC interrupts (200
times every 8.333ms).  So what happens if:  The ADC sampling time is over, the
conversion starts, and timer1 matches, and is just turning on the triac?  Won't
I miss about the first 16 to 20us of the actual signal?  From what I understood
from the datasheets, the sampling capacitor isn't latched back to the signal pin
for a few tads "after" the conversion is finished.  Loosing 20us of signal
wouldn't be so bad, but that time factor can also vary, unless I were somehow
able to synchronize the ADC to start sampling just as the triac was being turned
on, or immediately before (would be tricky I think).

I guess I don't understand what you mean by "how much of the waveform's energy
is present" (what do you mean by "energy"? watts?).  Would the rise time be
greatly reduced because it is a transformer (inductive load)?  The Triac/SCR
waveforms that I seen on my buddy's scope (same inductive load conditions on an
analog circuit), looked like they were going "straight up" to the top of the
waveform when the triac was turned on during each half cycle.

Thank you for you comments, waiting to hear more.

{Original Message removed}
The average of a symetrical AC waveform is zero!  The squaring in an RMS
measurement effectively transforms all the negative cycles to positive
cycles, so you get a non zero result.

Mike

> {Original Message removed}
Bob <op1cwkflashmail.com> wrote...

>Okay, here is some more detail then....
>
>The voltage I'm looking at is the voltage gated by the triac going into a
>transformer.  The voltage data is used for PID control of that same measured
>voltage (something else I have to figure out yet).  Say I want 60volts to go to
>the transformer....  I measure the current voltage over 1/2 line cycle (8.33ms),
>and adjust the triac firing to try and get there on the next 1/2 cycle (repeat
>until it settles).

PID control isn't that complicated; a web search should turn up lots
of references.

>The load on the transformer (off of the secondary), is extremely resistive,
>almost a dead short (A short nichrome heating element, attached to a "pen",
>which is attached to a 4 foot long 16 or 18 gauge cord, that is connected to the
>transformer).  Nothing is rectified or filtered after the transformer (voltage
>goes from about 0.4vac to 2.0vac max)   From what I've read, the waveform on the
>secondary will be 180 degrees out of phase from the primaries.

4 feet of 16 or 18 gauge cord to carry 20 amps to a load that runs at
only a couple of volts... I'd suggest heavier wire, or most of your
power is going to be wasted heating the cord.

Question: are you trying to regulate the temperature of this "pen"?
If so, it'd simplify things a lot if you got your feedback by sensing
the temperature itself, rather than the applied voltage.

[snip]

>Current draw is also dependant on
>other variables, like modular jack connections (how tight they are), cord gauge
>(16 or 18 gauge), solder joints, internal "pen" construction, etc....

"Modular jack"?  You don't mean an RJ11 or RJ45 phone/LAN type jack,
do you?  If so, the currents you're working with are **WAY** beyond
what these connectors are rated for.

[snip]

>In fact, my only
>core reason to look at how much "current" is being drawn, is to be able to
>detect a fault condition (if a short occurs near the output of that tranformer,
>usually in the modular jacks I'm using, stuff starts melting).  BTW, maximum
>current output of the transformer is upwards of 16 to 20 amperes, much more if a
>"fault condition" exists.

Hmmm...  If all you're trying to do with these measurements is detect
a short, why not just use a circuit breaker or a fuse?

>About the signal "risetime"/ red herring....  If a triac can turn on and bring
>the original signal from 0 up to 205 volts (0 to 4.096 is what I'll be looking
>at though) in 1us, isn't that a rise-time of 1mhz?  From what I've read about
>the PIC's ADC (lets say an F876), the most I can hope for is around 24khz
>sampling rate, a little more at 8 bits on other uP's.  And according to the MC's
>files that I've read (many), I want to keep the signal at or below 1/2 of the
>nyquist rate for accuracy reasons.  I would assume that would also apply to
>frequencies within that signal.

If your goal were to digitally reproduce the 60 Hz triac output
waveform with "fidelity" down to the microsecond level, then this
would be the case; obviously you'd need to sample at several
megahertz.  But if what you're trying to do is measure the waveform's
RMS value, you simply don't need to sample that fast.  It isn't
necessary unless you're shooting for extreme accuracy.  Sampling at
only a couple of kilohertz should introduce only a percent or two of
error.

{Quote hidden}

Again: you simply don't need to sample this fast.

>I guess I don't understand what you mean by "how much of the waveform's energy
>is present" (what do you mean by "energy"? watts?).  Would the rise time be
>greatly reduced because it is a transformer (inductive load)?  The Triac/SCR
>waveforms that I seen on my buddy's scope (same inductive load conditions on an
>analog circuit), looked like they were going "straight up" to the top of the
>waveform when the triac was turned on during each half cycle.

These questions relate to the general topic area of "digital signal
processing", and I think at this point a little reading might help a
lot.  Most DSP texts are extremely painful to read (for me, anyway),
on the web can be found at the Analog Devices, Inc. web site, at:

http://www.analog.com/industry/dsp/dsp_book/

Give it a try, it'll explain all these things for you.

>Thank you for you comments, waiting to hear more.

Wish I could help more; you've got a lot of design issues here, and I

Dave

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email listservmitvma.mit.edu with SET PICList DIGEST in the body

> Note that if your waveform is repeating, you don't have to sample at twice
> the Nyquist rate as long as the sample aperture is short.  This is how
> sampling oscilliscopes get those high frequencies.
>
> Olin Lathrop, embedded systems consultant in Littleton Massachusetts
> (978) 742-9014, olinembedinc.com, http://www.embedinc.com

Watch out! This isn't necessarily true.  Here is a counterexample:

Input frequency: 60Hz

Sampling frequency: 120Hz

If the first sample is at a zero crossing of the input, then every sample
will also be at a zero crossing. It will look like you have no signal.

Bob Ammerman
RAm Systems
(contract development of high performance, high function, low-level
software)

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email listservmitvma.mit.edu with SET PICList DIGEST in the body

> The voltage I'm looking at is the voltage gated by the triac going into a
> transformer.  The voltage data is used for PID control of that same
measured
> voltage (something else I have to figure out yet).
> ...
> The load on the transformer (off of the secondary), is extremely
resistive,
> almost a dead short (A short nichrome heating element, attached to a
"pen",
> which is attached to a 4 foot long 16 or 18 gauge cord, that is connected
to the
> transformer).  Nothing is rectified or filtered after the transformer
(voltage
> goes from about 0.4vac to 2.0vac max)

I think you need to start from scratch with the original problem statement.
You are chasing design problems do to an inappropriate architecture.

The problem as I understand it is this:  Provide user control over the power
to a heating element.  The power must be regulated to compensate for power
source fluctuations, changes in the heating element, variations between
interchangeable elements, and some amount of unpredictable additional
influences (oxidized connectors, different guage wires, etc).  The power
source is the AC line.  The load must be isolated from the hot side of the
AC line for safety.  (See how you can state your problem in one little
paragraph?)

A triac on the input to a transformer is only one way of achieving this.
Note in this case that if the AC line voltage is reasonably sinusoidal, you
can measure its voltage easily.  If you know the triac firing times
accurately, you can compute a reasonably good approximation of the RMS
voltage delivered at the output of the triac.

However, I think you ultimately need to measure the power into your load.  I
wouldn't be too interested in the RMS voltage going into the transformer.

A totally different approach would be to run the AC line directly into a
transformer to get an isolated low voltage high current out.  You could then
would now be on the same side of the transformer, making direct measurements
of voltages and currents easier.  There are a number of choices on how to
chop the voltage into the load.  You could rectify the secondary voltage
first and use a single switching element driven from the PIC PWM output, or
you could use a triac on the AC.  In either case, I think you will need to
measure or compute both the load voltage and current to know the power.
Your load looks like a resistor over the short term, but that resistance
will change quite a bit with temperature.

I don't know if you have any control over the plug in tips.  It would be
useful if these had 4 wires instead of 2.  2 of the wires would carry the
power to the load as usual.  The other two wires could be much thinner and
would connect accross the load close to the load.  These last 2 wires would
be used for sensing the true voltage accross the load, thereby eliminating

********************************************************************
Olin Lathrop, embedded systems consultant in Littleton Massachusetts
(978) 742-9014, olinembedinc.com, http://www.embedinc.com

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email listservmitvma.mit.edu with SET PICList DIGEST in the body

{Quote hidden}

The Olin left out an important part of sub-sampling.  That is for sub
Nyquist sample rates, the triggering has to be jittered to ensure the same
points on the waveform are not continuously measured.

Mike

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email listservmitvma.mit.edu with SET PICList DIGEST in the body

>The problem as I understand it is this:  Provide user control over the power
>to a heating element.  The power must be regulated to compensate for power
>source fluctuations, changes in the heating element, variations between
>interchangeable elements, and some amount of unpredictable additional
>influences (oxidized connectors, different gauge wires, etc).  The power
>source is the AC line.  The load must be isolated from the hot side of the
>AC line for safety.  (See how you can state your problem in one little
>paragraph?)

Actually that is somewhat incorrect.  I only want to compensate for line voltage
variations.  I only listed the other variables involved (I was asked for
details), to give you an idea of why I don't even want to go there as far as
trying to measure the current to get the "true power" (too many variables
involved, at too high of a cost).

>
>A triac on the input to a transformer is only one way of achieving this.
>Note in this case that if the AC line voltage is reasonably sinusoidal, you
>can measure its voltage easily.  If you know the triac firing times
>accurately, you can compute a reasonably good approximation of the RMS
>voltage delivered at the output of the triac.
>

I already went over that method of control (open loop).  From what I understand,
not too many DSP designers would even try it, as the calculations are
transcendental in nature (extremely compute intensive).  Yes, I've been told
that I could put some data into a table, but nobody has been very forthcoming
with how "exactly" one goes about doing that (i.e., an example).  Besides, what
happens if the user happens to put the unit on an inverter (sawtooth or triangle
waveform, or worse a square wave inverter).

{Quote hidden}

Well, lets see.  If I rectify the 2.0 volts, that'll leave me with about 1 volt
after the diode voltage drop, hot running diodes (will need an open frame box
plastic and heatsinks, or an all aluminum box).  And from what little experience
I've had with high amperage hexfets, they too will tend to get hot.  Again, I'm
not too interested in really knowing the amount of current a given load is
drawing, except when it is excessive (indicating a fault condition).  Because of
the high amperage output of the transformer, I would not want voltage going
through it 24/7....   Transformers like this tend to have high coupled
capacitance characteristics, which can cause overheating when idling with no
load for extended periods of time (I should be able to see if a load is
connected by looking how far after ZC the triac shuts itself off, after a set
time with no load I could shut the power to the transformer off).  Although the
cord will heat up a bit, causing it to flow less amperage, the characteristics
of the heating element connection design tend to make it run hotter over time
(they cancel each other out).

>
>I don't know if you have any control over the plug in tips.  It would be
>useful if these had 4 wires instead of 2.  2 of the wires would carry the
>power to the load as usual.  The other two wires could be much thinner and
>would connect across the load close to the load.  These last 2 wires would
>be used for sensing the true voltage across the load, thereby eliminating

I have no control over the heating elements, as they vary too much (two elements
that are "suppose" to be the same may not draw exactly the same amount of
current).  Two wires are already too bulky in 16 gauge wire, even two more
"thin" wires would cause problems with how flexible the cord is (and is yet
something else that can fail).  Yes, a lot of power is lost in the cord, and
there is no way of neatly getting around that design wise (unless you wanna
spend the big bucks for all silver conductors).  Besides that, a two wire
connection is the industry standard, for everybody, even our current product
(there is a lot to be said for backwards compatibility, and cross brand
compatibility).  Direct voltage or temperature measurement of the heating
element is not practical, or even needed for that matter.  BTW, the availability
of current to the load, acts as passive compensation in relationship to external
forces that draw heat out of the heating element.

I don't think I'd want to put even more power out to compensate for a bad solder
joint, frayed wire, or a loose connection, as that can actually cause more
problems.  For example, a loose RCA jack will warm up more than a tight one, and
may cause the heating element to "surge".  By trying to compensate for that,
you'll heat the jack up even more (which could then cause catastrophic failure,
as in melting stuff), or make the surging even worse.  If the user goes out and
gets a 22 gauge radio shack cord (because his original cord failed or
something), upping the voltage to compensate for that would just cause that RS
cord to melt (literally).

Lets look at the subject again.  I only want a recommendation on whether I
should be calculating an RMS or an Average voltage for this PID feedback
control.  Again, I am "only" wanting to compensate for the uncertainty of the
line voltage (line voltage can vary from wall jack to wall jack, even in the
same building).

{Quote hidden}

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email listservmitvma.mit.edu with SET PICList DIGEST in the body

>I don't know if you have any control over the plug in tips.  It would be
>useful if these had 4 wires instead of 2.  2 of the wires would carry the
>power to the load as usual.  The other two wires could be much thinner and
>would connect accross the load close to the load.  These last 2 wires would
>be used for sensing the true voltage accross the load, thereby eliminating

I would have thought the best trick would be to use a small thermistor as a
heat sensor on the load itself. I did this once for a spa pool heater and
with a lamp bulb across the heater so one could see when it is turned on it
was obvious the sensor was controlling the temp to quite close tolerances.
The sensor was wired to a CA3059 Triac controller, and although this is no
great device it still gave very accurate control.

I seriously doubt that you need to have such extremely rapid control that
the 100mS or so thermal lag for a physically small thermistor is a problem.

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email listservmitvma.mit.edu with SET PICList DIGEST in the body

PID control isn't that complicated; a web search should turn up lots
of references.

I'm writing most of this app in PBP (Pic Basic Pro), except for the interrupt
routine, which has to be in ASM.  I haven't found too many good examples of PID
control in a language (or pseudo code) that can be easily understood by myself.
Not to mention all the various techniques in tuning a PID control ;-)..

>The load on the transformer (off of the secondary), is extremely resistive,
>almost a dead short (A short nichrome heating element, attached to a "pen",
>which is attached to a 4 foot long 16 or 18 gauge cord, that is connected to
the
>transformer).  Nothing is rectified or filtered after the transformer (voltage
>goes from about 0.4vac to 2.0vac max)   From what I've read, the waveform on
the
>secondary will be 180 degrees out of phase from the primaries.

4 feet of 16 or 18 gauge cord to carry 20 amps to a load that runs at
only a couple of volts... I'd suggest heavier wire, or most of your
power is going to be wasted heating the cord.

Yep, I already know that happens with the current analog circuit (you lose at
least 1/2 of the power).  Ain't no way around it, unless you got deep pockets
and can afford silver wire.  Imagine holding a small pen like tube, that has a 4
foot 16 gauge cord attached to the end of it (it's already pretty bulky and
unwieldly).

Question: are you trying to regulate the temperature of this "pen"?
If so, it'd simplify things a lot if you got your feedback by sensing
the temperature itself, rather than the applied voltage.

No!!!  That is not practical, design wise or money wise.  Besides that, the line
voltage can change much quicker in magnitude than the heating element can (AC
can go from 90VAC to 120VAC in a matter of a few line cycles, these elements can
go from 72F to 2000F in about 5 or 6 seconds at best, and several more seconds
to "stablize").  Temperature feedback control would be slow, expensive, and
pointless.  Besides that, temperature control (what I refer to as "heat
recovery") is already taken care of by designing and building the power flow
components (cords, jacks, etc) to carry the maximum amount of current possible
(no bottlenecks).  This gives the heating element a kind of passive heat
recovery system, in that when it is cooled by external forces (wind, etc), it
tends to draw a bit more current (which heats it right back up again).  I know
it sounds strange, but this is a tested (tried and true) method for this
particular application.

[snip]

>Current draw is also dependant on
>other variables, like modular jack connections (how tight they are), cord gauge
>(16 or 18 gauge), solder joints, internal "pen" construction, etc....

"Modular jack"?  You don't mean an RJ11 or RJ45 phone/LAN type jack,
do you?  If so, the currents you're working with are **WAY** beyond
what these connectors are rated for.

No, we're using very solidly built RCA jacks, and we solder the outside leads on
them for better current conduction.  Don't laugh, one of my competitors uses a
1/4" mono phono jack (can you say "bottleneck"?  Thought you could ;-).

[snip]

>In fact, my only
>core reason to look at how much "current" is being drawn, is to be able to
>detect a fault condition (if a short occurs near the output of that tranformer,
>usually in the modular jacks I'm using, stuff starts melting).  BTW, maximum
>current output of the transformer is upwards of 16 to 20 amperes, much more if
a
>"fault condition" exists.

Hmmm...  If all you're trying to do with these measurements is detect
a short, why not just use a circuit breaker or a fuse?

At 16+ amps on the secondaries, it's too expensive, and it also impedes a design
prerogative ("no bottlenecks allowed!!!", which a fuse or breaker inherantly
"is").  At around 1/3 amp on the primaries (nominal maximum, 1/2 amp in a fault
condition), it would still be cheaper to just have the PIC do it.  Again, by
detecting where the signal shuts off after the next ZC (triacs shut off when the
"current" crosses zero, not voltage), I should be able to know with reasonably
accurately if the current draw is excessive.  We're talking about a difference
of 16~20 amps (max) off of the transformer verses 30~50 amperes when in a fault
condition.  I would think/assume that the phase angle of the current vs voltage
would be much larger during fault conditions.

>About the signal "risetime"/ red herring....  If a triac can turn on and bring
>the original signal from 0 up to 205 volts (0 to 4.096 is what I'll be looking
>at though) in 1us, isn't that a rise-time of 1mhz?  From what I've read about
>the PIC's ADC (lets say an F876), the most I can hope for is around 24khz
>sampling rate, a little more at 8 bits on other uP's.  And according to the
MC's
>files that I've read (many), I want to keep the signal at or below 1/2 of the
>nyquist rate for accuracy reasons.  I would assume that would also apply to
>frequencies within that signal.

If your goal were to digitally reproduce the 60 Hz triac output
waveform with "fidelity" down to the microsecond level, then this
would be the case; obviously you'd need to sample at several
megahertz.  But if what you're trying to do is measure the waveform's
RMS value, you simply don't need to sample that fast.  It isn't
necessary unless you're shooting for extreme accuracy.  Sampling at
only a couple of kilohertz should introduce only a percent or two of
error.

>I'll be using TMR1 in compare mode to turn on the triac from CCP1 (hardware),
>CPP2 or B0 for zero crossing (interrupt), and TMR0 to do ADC interrupts (200
>times every 8.333ms).  So what happens if:  The ADC sampling time is over, the
>conversion starts, and timer1 matches, and is just turning on the triac?  Won't
>I miss about the first 16 to 20us of the actual signal?  From what I understood
>from the datasheets, the sampling capacitor isn't latched back to the signal
pin
>for a few tads "after" the conversion is finished.  Loosing 20us of signal
>wouldn't be so bad, but that time factor can also vary, unless I were somehow
>able to synchronize the ADC to start sampling just as the triac was being
turned
>on, or immediately before (would be tricky I think).

Again: you simply don't need to sample this fast.

Well simply telling me so, doesn't help me understand "why".  Please look at the
example I gave in the above paragraph, and explain to me "why" loosing the first
20us or so of the signal wouldn't make much of a difference (or if there is a
flaw in that analogy).  On a 0 to 99 user scale that I'm using, on a nominal
120VAC line, each setting is only about a 1.2 volt difference from the next, and
the current ADC result will be 0 even though the actual voltage could now be as
high as 205VAC (and possibly dropping) for upwards of 20us.  Yes, for a 50 or
60hz, a few khz sampling is more than fast enough.  But when a triac turns on,
it can make the voltage go from 0 to upwards of 205vac (120vac line) in about
1us (A 1 MHZ SIGNAL).

>I guess I don't understand what you mean by "how much of the waveform's energy
>is present" (what do you mean by "energy"? watts?).  Would the rise time be
>greatly reduced because it is a transformer (inductive load)?  The Triac/SCR
>waveforms that I seen on my buddy's scope (same inductive load conditions on an
>analog circuit), looked like they were going "straight up" to the top of the
>waveform when the triac was turned on during each half cycle.

These questions relate to the general topic area of "digital signal
processing", and I think at this point a little reading might help a
lot.  Most DSP texts are extremely painful to read (for me, anyway),
on the web can be found at the Analog Devices, Inc. web site, at:

http://www.analog.com/industry/dsp/dsp_book/

Give it a try, it'll explain all these things for you.

fritz.

I think your getting into too much of the specifics of this application (I'm
having to explain things about the application, that have no bearing on what I'm
asking).  Assuming that I don't care about how much current draw there is to a
given load, should I use an RMS method, or just simple Averaging to calculate
the voltage going to the transformer?

>Thank you for you comments, waiting to hear more.

Wish I could help more; you've got a lot of design issues here, and I

Dave

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email listservmitvma.mit.edu with SET PICList DIGEST in the body

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email listservmitvma.mit.edu with SET PICList DIGEST in the body

Um, since we're all talking about the same uP's here (PIC's), and PICS can only
see a POSITIVE signals on their ADC's (from what I understood from the
datasheets), I assumed that everyone understood that the signal would already be
"rectified" prior to even dropping the voltage to usable ADC levels (although I
think I did mention that it was on my 2nd post).  Looking at a non-rectified
signal doesn't make sense to me, as you'd go from using 1024 steps on a 10 bit
converter, to using only 512 steps (9 bits).  Since a PIC's ADC can only really
see positive values, you'd have to first subtract 512 from each sample to get
those "negative values" in the first place (yet more processing time).

Am I missing something here?!?

Yes the signal can be symmetrical (nominally it will be), but it may not be if
the line voltage fluctuates and/or I'm adjusting the triac turn on time to match
user settings.  I'm basing calculations on 1/2 of each line cycle, as the
incoming AC voltage is assumed to be symmetrical to begin with (so the next one
"should" be the same any ways), and it cuts the amount of response lag in half.

>The average of a symetrical AC waveform is zero!  The squaring in an RMS
>measurement effectively transforms all the negative cycles to positive
>cycles, so you get a non zero result.
>
>Mike
<<Snip>>

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email listservmitvma.mit.edu with SET PICList DIGEST in the body

Hello David, Mike et all,

> The average of a symetrical AC waveform is zero!  The squaring in an RMS
> measurement effectively transforms all the negative cycles to positive
> cycles, so you get a non zero result.

you could simply average the *absolute* value of your AC waveform.

You might want to rectify your AC waveform before sending it to the ADC
input. Then you could do your averaging. I've done some experiments both
averaging and doing RMS of a rectified AC cycle and have very good results.

Best regards,

Brusque

-----------------------------------
Edson Brusque
Research and Development
C.I.Tronics Lighting Designers Ltda
(47) 323-2685  /  (47) 9993-6453
Blumenau  -  SC  -  Brazil
http://www.citronics.com.br
-----------------------------------

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email listservmitvma.mit.edu with SET PICList DIGEST in the body

The RMS voltage of an AC (or any) voltage is the equivalent DC
voltage required to produce the same amount of power over a load as
the AC voltage does.

It could be measured by integrating the rectified voltage over one or
several (whole) periods. Perhaps You could rectify the voltage You
want to measure, scale it down to a suitable value, convert it to a
current which is used to charge a capacitor. The charging of the
capacitor should be gated by the pic to only last for the duration of
n cycles of the measured voltage. When the capacitor is charged
either a) measure its voltage and convert this to a corresponding RMS
value (not a linear value, use a lookup table) or b) discharge the
capacitor with a constant current and measure the time it takes to
discharge it. This value will be directly proportional to the RMS
value of the measured voltage. It also has the advantage of not
needing an A/D converter. In any case the capacitor has to be
discharged before next measurement is done.

I haven't tried this, but I am sure I will be corrected if I have
missed something.

Date sent:              Tue, 24 Apr 2001 16:54:01 -0500
From:                   Bob <op1cwkFLASHMAIL.COM>
Subject:                [EE]: RMS vs Average voltage?
To:                     PICLISTMITVMA.MIT.EDU

{Quote hidden}

==============================
Ruben Jvnsson
AB Liros Elektronik
Box 9124, 200 39 Malmv, Sweden
TEL INT +46 40142078
FAX INT +46 40947388
rubenpp.sbbs.se
==============================

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email listservmitvma.mit.edu with SET PICList DIGEST in the body

Bob <op1cwkflashmail.com> wrote...

>I'm writing most of this app in PBP (Pic Basic Pro), except for the interrupt
>routine, which has to be in ASM.  I haven't found too many good examples of PID
>control in a language (or pseudo code) that can be easily understood by myself.
>Not to mention all the various techniques in tuning a PID control ;-)..

OK, well for what it's worth, here are my PID bookmarks:

www.mcjournal.com/main/vol1num2/articles/tutser2/tutser2.htm
http://www.expertune.com/tutor.html
http://www.expertune.com/artCE87.html
members.aol.com/pidcontrol/pid_algorithm.html
rclsgi.eng.ohio-state.edu/matlab/PID/PID.html
http://instserv.com/pid.htm
http://www.jashaw.com/pid/

Maybe one of those will help.

[snip]

{Quote hidden}

I think the key here is to low-pass filter the triac-gated sine wave
first, THEN do your sampling.  I fiddled around with SPICE a bit, and
with a 60 Hz sinewave gated 50% by a triac, low-pass filtering the
output waveform with a 1 kilohertz, 2-pole filter introduces about a
1.5% error into the RMS value of the waveform.

>I think your getting into too much of the specifics of this application (I'm
>having to explain things about the application, that have no bearing on what I'm
>asking).  Assuming that I don't care about how much current draw there is to a
>given load, should I use an RMS method, or just simple Averaging to calculate
>the voltage going to the transformer?

Perhaps I am, but your original post asked a question for which there
really isn't any pat answer; it's hard to tell what's the best thing
to do without getting some insight into the particulars- as well as
into what you're trying to accomplish overall.

In another of your posts, I noticed a comment to the effect that all
you want to do is compensate for variations in AC line voltage.  If
that's so, I'd suggest not bothering with RMS: instead, you could take
the input AC voltage, divide it down to a couple of volts peak, run it
into an opamp/diode absolute-value circuit, low-pass filter the
result, and periodically perform A/D conversions on the filter output.
From the conversion result, you now have a good indication of any
variations in the AC line voltage and can then apply some correction
to the triac firing angle (maybe doing it by a table lookup or
something).

Does this sound like it's on the right track?  I'm getting the
impression here that whatever you're trying to accomplish, going to
all the bother of calculating RMS may be overkill.

Trying to help...

Dave

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email listservmitvma.mit.edu with SET PICList DIGEST in the body

> I think your getting into too much of the specifics of this application
(I'm
> having to explain things about the application, that have no bearing on
what I'm
> asking).  Assuming that I don't care about how much current draw there is
to a
> given load, should I use an RMS method, or just simple Averaging to
calculate
> the voltage going to the transformer?

RMS.

I did a quick calculation to see what a reasonable sampling rate is.
Suppose you sample at 1.8KHz.  That gives you 30 samples per cycle.  You
can think of the cycles as being broken into 30 chunks, with each chunk
assumed to have a constant voltage.  The energy into a resistive load will
be proportional to the square of the voltage for each chunk.  For a 60Hz
sinusoid, a chunk at the peak of the waveform will contain about 6.7% of the
energy of the whole cycle.  This is the worst case error due to an
instantaneous voltage transition at the worst time.  The error goes down
proporitionally as the sampling frequency goes up.  If you can manage 5KHz
sampling rate then the maximum energy in any one time slice is 2.4%.  How
accurate do you need it?

********************************************************************
Olin Lathrop, embedded systems consultant in Littleton Massachusetts
(978) 742-9014, olinembedinc.com, http://www.embedinc.com

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email listservmitvma.mit.edu with SET PICList DIGEST in the body

> Um, since we're all talking about the same uP's here (PIC's), and PICS can
only
> see a POSITIVE signals on their ADC's (from what I understood from the
> datasheets), I assumed that everyone understood that the signal would
> "rectified" prior to even dropping the voltage to usable ADC levels
(although I
> think I did mention that it was on my 2nd post).  Looking at a
non-rectified
> signal doesn't make sense to me, as you'd go from using 1024 steps on a 10
bit
> converter, to using only 512 steps (9 bits).  Since a PIC's ADC can only
really
> see positive values, you'd have to first subtract 512 from each sample to
get
> those "negative values" in the first place (yet more processing time).

Big deal.  That's an easy calculation.

Quantizing the line voltage into 1000 levels peak to peak doesn't produce
much error, especially compared to everything else going on in your system.
The difference between 500 and 499 is only 0.4% power.

********************************************************************
Olin Lathrop, embedded systems consultant in Littleton Massachusetts
(978) 742-9014, olinembedinc.com, http://www.embedinc.com

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email listservmitvma.mit.edu with SET PICList DIGEST in the body

Thanks for the info on the web sites, I'll look them up.

Yes, low pass filtering is something I touched on in my first post, a little.  I
just don't know the best way to go about doing it (opamps are a mystery).  The
"simple" way is to use a capacitor, but that also induces a bit of lag time.
I'm not sure what an opamp low pass filter would do to the singnal, as far as
accuracy (how close to the ground rail can it get), and what, if any, lag it
might induce.  I don't much about PID controls, but I know enough to know that
lag can't be a benificial thing (I want to be able to start adjusting within one
or two half cycles if possible).

As to RMS vs averaging, that's what the original question was about.  I just
didn't know if doing an RMS calculation had any benifits over just averaging the
input signal (better noise immunity, more accurate, more linear, etc....).

Bob <op1cwkflashmail.com> wrote...

>I'm writing most of this app in PBP (Pic Basic Pro), except for the interrupt
>routine, which has to be in ASM.  I haven't found too many good examples of PID
>control in a language (or pseudo code) that can be easily understood by myself.
>Not to mention all the various techniques in tuning a PID control ;-)..

OK, well for what it's worth, here are my PID bookmarks:

www.mcjournal.com/main/vol1num2/articles/tutser2/tutser2.htm
http://www.expertune.com/tutor.html
http://www.expertune.com/artCE87.html
members.aol.com/pidcontrol/pid_algorithm.html
rclsgi.eng.ohio-state.edu/matlab/PID/PID.html
http://instserv.com/pid.htm
http://www.jashaw.com/pid/

Maybe one of those will help.

[snip]

>example I gave in the above paragraph, and explain to me "why" loosing the
first
>20us or so of the signal wouldn't make much of a difference (or if there is a
>flaw in that analogy).  On a 0 to 99 user scale that I'm using, on a nominal
>120VAC line, each setting is only about a 1.2 volt difference from the next,
and
>the current ADC result will be 0 even though the actual voltage could now be as
>high as 205VAC (and possibly dropping) for upwards of 20us.  Yes, for a 50 or
>60hz, a few khz sampling is more than fast enough.  But when a triac turns on,
>it can make the voltage go from 0 to upwards of 205vac (120vac line) in about
>1us (A 1 MHZ SIGNAL).

I think the key here is to low-pass filter the triac-gated sine wave
first, THEN do your sampling.  I fiddled around with SPICE a bit, and
with a 60 Hz sinewave gated 50% by a triac, low-pass filtering the
output waveform with a 1 kilohertz, 2-pole filter introduces about a
1.5% error into the RMS value of the waveform.

>I think your getting into too much of the specifics of this application (I'm
>having to explain things about the application, that have no bearing on what
I'm
>asking).  Assuming that I don't care about how much current draw there is to a
>given load, should I use an RMS method, or just simple Averaging to calculate
>the voltage going to the transformer?

Perhaps I am, but your original post asked a question for which there
really isn't any pat answer; it's hard to tell what's the best thing
to do without getting some insight into the particulars- as well as
into what you're trying to accomplish overall.

In another of your posts, I noticed a comment to the effect that all
you want to do is compensate for variations in AC line voltage.  If
that's so, I'd suggest not bothering with RMS: instead, you could take
the input AC voltage, divide it down to a couple of volts peak, run it
into an opamp/diode absolute-value circuit, low-pass filter the
result, and periodically perform A/D conversions on the filter output.
From the conversion result, you now have a good indication of any
variations in the AC line voltage and can then apply some correction
to the triac firing angle (maybe doing it by a table lookup or
something).

Does this sound like it's on the right track?  I'm getting the
impression here that whatever you're trying to accomplish, going to
all the bother of calculating RMS may be overkill.

Trying to help...

Dave

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email listservmitvma.mit.edu with SET PICList DIGEST in the body

--
http://www.piclist.com hint: To leave the PICList
piclist-unsubscribe-requestmitvma.mit.edu

>I think your getting into too much of the specifics of this application
(I'm
>having to explain things about the application, that have no bearing on
what I'm
>asking).  Assuming that I don't care about how much current draw there is
to a
>given load, should I use an RMS method, or just simple Averaging to
calculate
>the voltage going to the transformer?

It seems to me that as you are just trying to compensate for the change in
mains voltage once the system is set up, then all you need to do is measure
the peak voltage and do your calculations relative to the peak voltage of
the set up point. It will involve a square root function, but that should
not be a problem as you should have plenty of computation time, and then
have the triac trigger on a rolling average of the calculations.

If the triac is triggered by the interrupt routine and the calculation done
as a background task even a small PIC should handle this perfectly

--
http://www.piclist.com hint: To leave the PICList
piclist-unsubscribe-requestmitvma.mit.edu

I think it is a waste of time and energy trying to adjust energy through a
heater within a half cycle. At whatever speed you change this, if the system
that is being controlled does not respond (Normally real systems will not
respond within the 10mSec of a half cycle) it is no use trying to vary the
amount of energy pumped into the heater back and forth every small part of
the half cycle.
It would be a good idea to find out the time constant of the entire system
and design the controller accordingly.

Regards,
Real Time Embedded Systems,
Tata Consultancy Services,
Pune 411013
INDIA.

Phone:          91 20 6871058 Extn: 514
Mobile         9823038718
Residence   91 20 5282370
Fax:              91 20 6810921
Email            ashutoshppune.tcs.co.in
Website      http://www.tcs.com

{Quote hidden}

--
http://www.piclist.com hint: To leave the PICList
piclist-unsubscribe-requestmitvma.mit.edu

Bob wrote:

> Question: are you trying to regulate the temperature of this "pen"?
> If so, it'd simplify things a lot if you got your feedback by sensing
> the temperature itself, rather than the applied voltage.
>
> No!!!  That is not practical, design wise or money wise.  Besides that, the line
> voltage can change much quicker in magnitude than the heating element can (AC
> can go from 90VAC to 120VAC in a matter of a few line cycles, these elements can
> go from 72F to 2000F in about 5 or 6 seconds at best, and several more seconds
> to "stablize").

Bib, I would suggest a compromise between feedback from
final element (heat sensor) and your early element
(main transformer) seems that an easy thing to get
feedback from, and will give good response, is the
final current to the element.

if you sense average current, you gain:
* fast response for mains fluctuations
* pretty good regulatioon
* very easy to do
* eliminates all phase problems
* closest thing to final heat sensing
* no need for secondary rectification
* no need to rectify sensor signal

Imagine a sense resistor in series with your
no problems. Use the PIC ADC to measure both
ends of the resistor, then any difference gives
you instantaneous current. It should then
be easy to keep the final current constant
with very little calculation needed.
Secondary current control should give better
regulation than your suggested system of
regulating voltage into the transformer,
especially as you mentione the load is very
resistive. This way would also compensate for
those minor resistance changes you always get
in plugs and cabling too. I also suggest
automotive plugs too, these are good for 30A
and much better than Canons.
:o)
-Roman

PS. if you don't like the drop from a series
R, you can get magnetic current sensors using
hall devices, these have almost no volts drop.

--
http://www.piclist.com hint: To leave the PICList
piclist-unsubscribe-requestmitvma.mit.edu

Bob <op1cwkflashmail.com> wrote...

>Yes, low pass filtering is something I touched on in my first post, a little.  I
>just don't know the best way to go about doing it (opamps are a mystery).

Suggestion: if you want a way to get a lot more mileage out of your
programming abilities, invest the time and effort to supplement them
with some electronics.  The combined knowledge will be a LOT greater
than the sum of its parts.  I'm not talking years and years of study;
a few well-chosen books and some fiddling around on the bench
practicing with basic "textbook" circuits would suffice.
In any case, opamps shouldn't be a mystery: they should be a tool.

>The "simple" way is to use a capacitor, but that also induces a bit of lag time.
>I'm not sure what an opamp low pass filter would do to the singnal, as far as
>accuracy (how close to the ground rail can it get), and what, if any, lag it
>might induce.  I don't much about PID controls, but I know enough to know that
>lag can't be a benificial thing (I want to be able to start adjusting within one
>or two half cycles if possible).

I think cycle-by-cycle compensation for line voltage is overkill for
this application, because of the thermal mass of your heating element.
Whether you do this line-voltage compensation by using feedforward
correction based on a measurement of the incoming AC line voltage
(i.e., what I suggested in my earlier post) or a feedback loop based
on a measurement of the triac output (likewise absolute-valued and
filtered), I think you'll find that a control bandwidth of only a few
hertz is all that's needed for good results.

>As to RMS vs averaging, that's what the original question was about.  I just
>didn't know if doing an RMS calculation had any benifits over just averaging the
>input signal (better noise immunity, more accurate, more linear, etc....).

That became more clear when you told another respondent that all you
wanted to do was compensate this gizmo for line voltage variations.
That clarified things.

Best of luck with this; I'd like to know how it turns out.

Dave

--
http://www.piclist.com hint: To leave the PICList
piclist-unsubscribe-requestmitvma.mit.edu

Roman Black wrote:

> Bib, I would suggest <snip>

Sorry Bob!! Of all the typos that one looks
pretty awful. Sincerely sorry, heck I only
got 2 fingers! (for typing that is)
:o)
-Roman

--
http://www.piclist.com hint: To leave the PICList
piclist-unsubscribe-requestmitvma.mit.edu

> The RMS voltage of an AC (or any) voltage is the equivalent DC
> voltage required to produce the same amount of power over a load as
> the AC voltage does.
>
> It could be measured by integrating the rectified voltage over one or
> several (whole) periods.

No, that will yield average(abs(V)), not RMS(V).

********************************************************************
Olin Lathrop, embedded systems consultant in Littleton Massachusetts
(978) 742-9014, olinembedinc.com, http://www.embedinc.com

--
http://www.piclist.com hint: To leave the PICList
piclist-unsubscribe-requestmitvma.mit.edu

> > The RMS voltage of an AC (or any) voltage is the equivalent DC
> > voltage required to produce the same amount of power over a load as
> > the AC voltage does.
> >
> > It could be measured by integrating the rectified voltage over one
> > or several (whole) periods.
>
> No, that will yield average(abs(V)), not RMS(V).
>

Yes, You are right...

I would have to square the voltage before integrating it and take the
squareroot of the result, right?

==============================
Ruben Jvnsson
AB Liros Elektronik
Box 9124, 200 39 Malmv, Sweden
TEL INT +46 40142078
FAX INT +46 40947388
rubenpp.sbbs.se
==============================

--
http://www.piclist.com hint: To leave the PICList
piclist-unsubscribe-requestmitvma.mit.edu

> I would have to square the voltage before integrating it and take the
> squareroot of the result, right?
> Ruben Jvnsson

Yep, RMS = root mean square

Sort of a reverse polish notation:

First you sqaure it

Then you average it (mean)

Then you square root it

Bob Ammerman
RAm Systems
(contract development of high performance, high function, low-level
software)

--
http://www.piclist.com hint: To leave the PICList
piclist-unsubscribe-requestmitvma.mit.edu

Okie dokie, now you have me thoroughly confused.

I have an application where I take a voltage and a current measurement,
multiply the two together with an analog multiplier, and then average
the output.  I am seeking average power, such that over time I will know
the energy invested (1W = 1J*1S). This appears to work. I am working
with a tank circuit (ultrasonics) where a portion of the energy is
bouncing back.  The multiplier generates a signal that is mostly
positive and a little negative.  I run a low pass filter, and I get a
positive DC value.  I could not use an RMS to DC converter, because the
negative portions of the wave must subtract, not add in more.  And the
square part of the RMS would already be done.

I firmly believe that the V*I is the square part of the challenge, and
the low pass filter is the averageing part of the task, but now I have a
DC voltage.  Do I have to square root that result to get an accurate

Confused in Pittsburgh,
Chris~

Bob Ammerman wrote:
{Quote hidden}

--
http://www.piclist.com hint: To leave the PICList
piclist-unsubscribe-requestmitvma.mit.edu

Hello Bob,

> As to RMS vs averaging, that's what the original question was about.  I
just
> didn't know if doing an RMS calculation had any benifits over just
averaging the
> input signal (better noise immunity, more accurate, more linear, etc....).

RMS would give you a *more number.

Let's say you have a dimming application, where your circuit is
connected to mains power @ 220V and you're firing the triac at 90º. You're
measuring the voltage going to the load. If you average your measuring, it
will say 110V. RMS will say about 155V. Now, if you rectify and "regulate"
the energy going to the load (with full-cycle rectifying, 4 diodes and a
capacitor) and measure it with a voltmeter, it will give you a value very
close to that 155V.

Hope you understand what I mean. Some things are a bit hard to explain.
:)

Best regards,

Brusque

-----------------------------------
Edson Brusque
Research and Development
C.I.Tronics Lighting Designers Ltda
(47) 323-2685  /  (47) 9993-6453
Blumenau  -  SC  -  Brazil
http://www.citronics.com.br
-----------------------------------

--
http://www.piclist.com hint: To leave the PICList
piclist-unsubscribe-requestmitvma.mit.edu

> I have an application where I take a voltage and a current measurement,
> multiply the two together with an analog multiplier, and then average
> the output.  I am seeking average power, such that over time I will know
> the energy invested (1W = 1J*1S).

Sounds like your are doing everything right.

> I firmly believe that the V*I is the square part of the challenge, and
> the low pass filter is the averageing part of the task, but now I have a
> DC voltage.  Do I have to square root that result to get an accurate

No.  The multiplier output is instaneous power.  The filter output is an
"averaged" power value.  The other discussion was how to find RMS voltage,
which is different from finding average power.

********************************************************************
Olin Lathrop, embedded systems consultant in Littleton Massachusetts
(978) 742-9014, olinembedinc.com, http://www.embedinc.com

--
http://www.piclist.com hint: To leave the PICList
piclist-unsubscribe-requestmitvma.mit.edu

> > > The RMS voltage of an AC (or any) voltage is the equivalent DC
> > > voltage required to produce the same amount of power over a load as
> > > the AC voltage does.
> > >
> > > It could be measured by integrating the rectified voltage over one
> > > or several (whole) periods.
> >
> > No, that will yield average(abs(V)), not RMS(V).
> >
>
> Yes, You are right...
>
> I would have to square the voltage before integrating it and take the
> squareroot of the result, right?

Right.

********************************************************************
Olin Lathrop, embedded systems consultant in Littleton Massachusetts
(978) 742-9014, olinembedinc.com, http://www.embedinc.com

--
http://www.piclist.com hint: To leave the PICList
piclist-unsubscribe-requestmitvma.mit.edu

> I have an application where I take a voltage and a current measurement,
> multiply the two together with an analog multiplier, and then average
> the output.  I am seeking average power, such that over time I will know
> the energy invested (1W = 1J*1S). This appears to work. I am working
> with a tank circuit (ultrasonics) where a portion of the energy is
> bouncing back.  The multiplier generates a signal that is mostly
> positive and a little negative.  I run a low pass filter, and I get a
> positive DC value.  I could not use an RMS to DC converter, because the
> negative portions of the wave must subtract, not add in more.  And the
> square part of the RMS would already be done.
>
> I firmly believe that the V*I is the square part of the challenge, and

Ok, V*I is actually the "POWER", which, with a resistive load, is of course
proportional to V*V (the square of the voltage).

> the low pass filter is the averageing part of the task, but now I have a

Yep this is an average.

> Do I have to square root that result to get an accurate

What you have is an averaged _power_, not voltage. This is actually probably
what you are looking for.

I am sure that is all clear as mud.

Bob Ammerman
RAm Systems
(contract development of high performance, high function, low-level
software)

--
http://www.piclist.com hint: To leave the PICList
piclist-unsubscribe-requestmitvma.mit.edu

The RMS calculation comes from these relations:

P = Urms^2/R  (for constant R)
P = (U1^2 + U2^2 + ... + Un^2)/R (for instantaneous voltages U1..n in ac)

whence:

Urms = +sqrt((U1^2 + U2^2 + ... + Un^2) / Nsamples_per_second)

(assuming that the samples are equal, otherwise they need to be scaled
in the sum by their lengths).

When R is not constant you obtain the power by multiplying Uinstananeous
and Iinstantaneous in a multiplier obtaining instantaneous power Pi. The
real power is the sum of the Pi divided by the Nsamples over one second.
However there is no such thing as negative power so any negative output
from the multiplier needs to be thrown away before adding (it is the
reflected or reactive power). You can measure and display reflected power
by adding the negative outputs and processing as above.

hope this helps,

Peter

--

You can calculate RMS using fast sampling of the rectified unfiltered AC,
square each sample and add each to an accumulator, for one second. Then
divide the accumulator by the number of samples taken. At the end extract
the square root of the result. By arranging for a number of samples that
is a power of 2 and by other shortcuts the implementation can be made more
efficient.

Peter

--

Edson Brusque wrote:

> > As to RMS vs averaging, that's what the original question was about.  I
> just
> > didn't know if doing an RMS calculation had any benifits over just
> averaging the
> > input signal (better noise immunity, more accurate, more linear, etc....).
>
>     RMS would give you a *more number.
>
>     Let's say you have a dimming application, where your circuit is
> connected to mains power @ 220V and you're firing the triac at 90º. You're
> measuring the voltage going to the load. If you average your measuring, it
> will say 110V. RMS will say about 155V. Now, if you rectify and "regulate"
> the energy going to the load (with full-cycle rectifying, 4 diodes and a
> capacitor) and measure it with a voltmeter, it will give you a value very
> close to that 155V.

This is wrong, with 90' switching there is exactly
half the voltage average and half the rms voltage.
(and how do you make that "degrees" symbol??) :o)

So now i'm confused! Isn't RMS just calculating the
AC average?? I was taught that the only point to
squaring this and then doing a square root is that
this is only math way of making negative values
positive for averaging.

As programmers we have more power than mathematicians,
we are not limited to:
1. square it
2. average it
3. unsquare it

We can just do the following:
1. convert - values to +
2. average it

Or have I missed something?? Does anyone think we
MUST do square and square-root calcs in our PICs
and why??
-Roman

--

Roman Black <fastvidEZY.NET.AU> wrote...

{Quote hidden}

Half the power and half the average absolute voltage, but not half the
rms voltage: you get 0.707 x the original rms voltage.

>So now i'm confused! Isn't RMS just calculating the
>AC average??
Absolutely not.

>I was taught that the only point to
>squaring this and then doing a square root is that
>this is only math way of making negative values
>positive for averaging.

I don't think he understood the significance of rms, then.

>As programmers we have more power than mathematicians,
>we are not limited to:
>1. square it
>2. average it
>3. unsquare it

>We can just do the following:
>1. convert - values to +
>2. average it

These two processes produce TOTALLY different results.  The first
calculates the rms value of an AC signal, the second calculates the
average absolute voltage.

>Or have I missed something?? Does anyone think we
>MUST do square and square-root calcs in our PICs
>and why??

You do if you want to actually calculate rms; if all you want to find
is the average of the absolute value, then no.

Several companies make analog ICs that process an input waveform and
produce a DC output voltage proportional to the rms value of the
input; the Analog Devices AD736 is one of these, and if you go to
their website and read the datasheet for that part it has a simple,
but good discussion of the math.

Dave

--

{Quote hidden}

This was also my assumption in an earlier mail on this thread. This
simplification only works with a DC value, which is of little use
when calculating RMS.

A simple example will show the difference:

Given 5 samples of a rectified voltage: 2, 5, 5, 2, 1.

Which gives the average value of (2+5+5+2+1)/5=3.

But the RMS value of this is: sqr((2^2+5^2+5^2+2^2+1^2)/5)=3.435.

This has to do with the fact that the RMS value for a voltage is the
same value that a DC voltage would have to be to produce the same
power over the same load. Power is the key word here, since
increasing the voltage gives a squared increase in power over the
==============================
Ruben Jvnsson
AB Liros Elektronik
Box 9124, 200 39 Malmv, Sweden
TEL INT +46 40142078
FAX INT +46 40947388
rubenpp.sbbs.se
==============================

--

> However there is no such thing as negative power so any negative output
> from the multiplier needs to be thrown away before adding (it is the
> reflected or reactive power).

Negative power in this context is perfectly valid because it means the load
is producing, as opposed to sinking, power.  This is normal for capacitive
or inductive loads over part of the power cycle.  The positive and negative
values need to all be considered when computing the average power consumed
by the load.  You do not want to throw away the negative power readings.

********************************************************************
Olin Lathrop, embedded systems consultant in Littleton Massachusetts
(978) 742-9014, olinembedinc.com, http://www.embedinc.com

--

> So now i'm confused! Isn't RMS just calculating the
> AC average??

No.

> I was taught that the only point to
> squaring this and then doing a square root is that
> this is only math way of making negative values
> positive for averaging.

Sorry, but that was wrong.

One way of thinking about RMS is that the RMS of any repeating voltage,
whether it ever goes negative or not, is the equivalent DC voltage that
would deliver the same power into a resistor.

For example, consider 1V DC into 1 ohm.  That obviously dumps 1 watt into
the resistor.  Now consider a 0 to 2 volt square wave.  Half the time the
voltage is 0, resulting in 0 watts.  The other half of the time the voltage
is 2 resuting in V**2 / R = 4 watts.  The average is therefore 2 watts.
Even though both waveforms have the same average voltage, the square wave
puts twice the power into a resistor.

Note that if we do the square it, average it, square root it thing we get a
value that can be used to predict the power into a resistive load.  For the
square wave we have SQRT(AVE(0*0, 2*2)) = SQRT(AVE(0, 4) = SQRT(2) = 1.41
volts RMS.  Now calculate power = V**2 / R and you get 2 watts which we

********************************************************************
Olin Lathrop, embedded systems consultant in Littleton Massachusetts
(978) 742-9014, olinembedinc.com, http://www.embedinc.com

--

> (and how do you make that "degrees" symbol??) :o)

Hold down Alt while typing 0176 on the numeric keypad.

The "Character Map" Application included with Windoze shows the key sequence
for the selected character in the lower right corner.

Paul Hutchinson

--

Thanks Dave, Ruben and Olin for setting me straight
on the RMS vs average issue. Especially Olin's
square wave example. Checking my memory the times
I wanted to find average voltage I have always used
an averaging system, and the odd occasions I needed
real power measurements I always measured instantaneous
volts and amps and averaged the result.

So can someone clear up two points, why do I remember
being taught about RMS=average (20 years ago now!),
is this true for sinewaves maybe?

And if I get voltage samples and use the RMS calc to
get the overall RMS value of the volts, would this
be usable to calc power in a load directly?? What if
the load was inductive or capacitive?
-Roman

Olin Lathrop wrote:
{Quote hidden}

--

> So can someone clear up two points, why do I remember
> being taught about RMS=average (20 years ago now!),

Your instructor may have been confused.

> is this true for sinewaves maybe?

No, sorry.

> And if I get voltage samples and use the RMS calc to
> get the overall RMS value of the volts, would this
> be usable to calc power in a load directly??

Yes, if the load is resistive and the resistance is known.

> What if the load was inductive or capacitive?

Then it depends on frequency too.

********************************************************************
Olin Lathrop, embedded systems consultant in Littleton Massachusetts
(978) 742-9014, olinembedinc.com, http://www.embedinc.com

--

Roman Black <fastvidEZY.NET.AU> wrote...

>Checking my memory the times
>I wanted to find average voltage I have always used
>an averaging system, and the odd occasions I needed
>real power measurements I always measured instantaneous
>volts and amps and averaged the result.

Good; what you computed, in those instances, was truly the real power.

>So can someone clear up two points, why do I remember
>being taught about RMS=average (20 years ago now!),
>is this true for sinewaves maybe?

Negatory.  It isn't true for sine waves or ANY other waveform, except
in the trivial case of square waves, in which rms = peak = average.  I
think either your teacher was confused (this does, unfortunately,
happen) or your memory was faulty (hey, 20 years is a long time).

>And if I get voltage samples and use the RMS calc to
>get the overall RMS value of the volts, would this
>be usable to calc power in a load directly??
If the load is resistive, yes; and if what you're interested in is
power (not the equivalent rms voltage) then the square-root step is
superfluous.

>What if
>the load was inductive or capacitive?

In that case, integrating the product of  [e(t) * i(t)] over one or
more full cycles gives you a measure of the real (as opposed to
reactive) power delivered to the load.

Dave

--

> So can someone clear up two points, why do I remember
> being taught about RMS=average (20 years ago now!),
> is this true for sinewaves maybe?

Perhaps you are remembering that for a regular (not true RMS) meter, the
meter responds to average value but is calibrated to indicate RMS value for
a sinewave.

Cheers,
Ken Kaarvik

--

Olin Lathrop <olin_piclistEMBEDINC.COM> wrote:
> Negative power in this context is perfectly valid because it means the
> load is producing, as opposed to sinking, power.  This is normal for
> capacitive or inductive loads over part of the power cycle.  The
> positive and negative values need to all be considered when computing
> the average power consumed by the load.  You do not want to throw away

Why average power ? The load cannot produce power, it can reflect some of
the input power back. So you are right, the power delivered to the load is
the difference between delivered and returned power, and you do not need
to substract. (I was reading wattmeter related project info when writing
this ;-) ).

Peter

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics

Roman, did you miss my previous posting ? It deduces the formula for RMS
calculation using several samples. It all comes from the definition of the
RMS voltage: A DC voltage that dissipates the same power in a probe
resistor as the AC voltage (of arbitrary waveform) that you want to
measure. The two equations in P are the relevant power equations, the
lower being an approximation by rectangles of the power in the arbitrary
waveform (Riemann sum integral).

When the waveform is a clean sine then the equivalent RMS voltage is
related by a fixed simple equation to the peak or average ac voltage.
Since this shortcut is almost always used in (cheap, common)

Peter

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics

> It isn't true for sine waves or ANY other waveform, except
> in the trivial case of square waves, in which rms = peak = average.

This is absolutely, positively wrong.

********************************************************************
Olin Lathrop, embedded systems consultant in Littleton Massachusetts
(978) 742-9014, olinembedinc.com, http://www.embedinc.com

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics

Peter L. Peres wrote:
>
> Olin Lathrop <olin_piclistEMBEDINC.COM> wrote:
> > Negative power in this context is perfectly valid because it means the
> > load is producing, as opposed to sinking, power.  This is normal for
> > capacitive or inductive loads over part of the power cycle.  The
> > positive and negative values need to all be considered when computing
> > the average power consumed by the load.  You do not want to throw away
> > the negative power readings.
>
> Why average power ? The load cannot produce power, it can reflect some of
> the input power back. So you are right, the power delivered to the load is
> the difference between delivered and returned power, and you do not need
> to substract. (I was reading wattmeter related project info when writing
> this ;-) ).

What about DC servomotors? It's a big problem the
amount of power they produce when decelerating a
moving mass. Yes maybe that power has previously been
added into the system but this is not on a per-cycle
delay, it could be seconds later.
-Roman

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics

Peter L. Peres wrote:
>
> Roman, did you miss my previous posting ? It deduces the formula for RMS
> calculation using several samples. It all comes from the definition of the
> RMS voltage: A DC voltage that dissipates the same power in a probe
> resistor as the AC voltage (of arbitrary waveform) that you want to
> measure. The two equations in P are the relevant power equations, the
> lower being an approximation by rectangles of the power in the arbitrary
> waveform (Riemann sum integral).
>
> When the waveform is a clean sine then the equivalent RMS voltage is
> related by a fixed simple equation to the peak or average ac voltage.
> Since this shortcut is almost always used in (cheap, common)

Thanks Peter, I definitely had a brain fart
there re the RMS issue! :o)
Most of the things I have been working on
lately (stepper PWM drivers etc) have been
averaging the current values by measurement
etc. Like I have been measuring motor current
via series resistor (makes a voltage), then
simply averaging this voltage via RC network,
or software, to get average current values
which is what these motors need.

Somewhere there I think I confused averaging
this sense voltage (which is really current)
with actually averaging a voltage. It's been
too long since I did AC Machines theory... :o)
-Roman

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics

Olin Lathrop <olin_piclistEMBEDINC.COM> wrote...

>> It isn't true for sine waves or ANY other waveform, except
>> in the trivial case of square waves, in which rms = peak = average.
>
>This is absolutely, positively wrong.
>

Hmmm.  This early on a Saturday morning, the only waveform I recall
whose rms value is equal to the average of its absolute value is a
simple square wave alternating between +V and -V.  If you know of
others, it would be interesting to hear about them.

Dave

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics

Hi Olin and Dave,

I think Dave is right. Olin, were you perhaps thinking of a square wave
with an offset (going between 0 and +V)? That's what I was thinking of at
first when I did a double-take at the "rms=peak=average" statement but then
I realized that he is right (as long as you take average to mean average of
the absolute values).

I think he is also right that a square wave is the only waveform with this
property. I think this comes from the Schwartz (sp?) Inequality which says
that, for any function, the average of the squared function will always be
greater than or equal to the square of the average of the function. If you
consider taking the abs value of a function first, and then applying this
inequality, (IIRC) it can be shown that this means that any change in the
amplitude of the function (any up and down movement in the abs value of the
function) will increase the average of the squared values more than it
increases the square of the average. This means that the waveforms whose
abs value results in a perfectly flat line (DC) are the only ones which
will make the average of the squares equal to the square of the average.
The only waveforms I can think of which give DC when you take abs are DC
and 50% duty cycle symmetrical square waves.

Sean

At 02:44 PM 4/28/01 +0000, you wrote:
{Quote hidden}

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics

"Sean H. Breheny" <shb7CORNELL.EDU> wrote...

>I think Dave is right. Olin, were you perhaps thinking of a square wave
>with an offset (going between 0 and +V)? That's what I was thinking of at
>first when I did a double-take at the "rms=peak=average" statement but then
>I realized that he is right (as long as you take average to mean average of
>the absolute values).

Thanks for pointing this out; reading back, I can see I should have
been more explicit in my earlier statement about square waves, and
should have made it clear that I was referring to square waves with no
DC offset.

Dave

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics

> I think Dave is right. Olin, were you perhaps thinking of a square wave
> with an offset (going between 0 and +V)? That's what I was thinking of at
> first when I did a double-take at the "rms=peak=average" statement but
then
> I realized that he is right (as long as you take average to mean average
of
> the absolute values).

I was thinking of exactly what the statment said, a square wave.  Yes, parts
of this statement are true for some square waves, but not all of it and not
for square waves in general.  A square wave that goes from 0 to +V is one
example of where the statement is clearly false.

> I think he is also right that a square wave is the only waveform with this
> property.

Again, only for the special case of square waves that are symmetric about 0,
and if you change the statement by replacing "average" with "average(abs)".

********************************************************************
Olin Lathrop, embedded systems consultant in Littleton Massachusetts
(978) 742-9014, olinembedinc.com, http://www.embedinc.com

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics

> >> in the trivial case of square waves, in which rms = peak = average.
> >
> >This is absolutely, positively wrong.
>
> Hmmm.  This early on a Saturday morning, the only waveform I recall
> whose rms value is equal to the average of its absolute value is a
> simple square wave alternating between +V and -V.  If you know of
> others, it would be interesting to hear about them.

When I said "absolutely, positively wrong", I was referring to the totally
bogus statement RMS = PEAK = AVERAGE.  Yes, in the special case of a square
wave centered around 0, PEAK does equal RMS and AVERAGE(ABS), but not
AVERAGE (which is 0) as the original post asserted.  Furthermore, even this
does not hold true for square waves in general.  Consider a 0 to 2 volt
square wave.  RMS = 1.14, PEAK = 2, and AVERAGE = 1.  AVERAGE(ABS) = 1,
which doesn't equal RMS or PEAK either.

********************************************************************
Olin Lathrop, embedded systems consultant in Littleton Massachusetts
(978) 742-9014, olinembedinc.com, http://www.embedinc.com

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics

On Sat, 28 Apr 2001 07:44:37 -0400 Olin Lathrop
<olin_piclistEMBEDINC.COM> writes:
> > It isn't true for sine waves or ANY other waveform, except
> > in the trivial case of square waves, in which rms = peak =
> average.
>
> This is absolutely, positively wrong.
>

But, it IS true of DC...

Harold

________________________________________________________________
GET INTERNET ACCESS FROM JUNO!
Juno offers FREE or PREMIUM Internet access for less!
Join Juno today!  For your FREE software, visit:
dl.http://www.juno.com/get/tagj.

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

>What about DC servomotors? It's a big problem the
>amount of power they produce when decelerating a
>moving mass. Yes maybe that power has previously been
>added into the system but this is not on a per-cycle
>delay, it could be seconds later.

There is a difference between reactive power and active power but both are
instantaneous properties of the AC circuit analyzed, and are tied together
(by conventions ;-). If a motor is turned by its load (inertia) it becomes
a generator and produces both active and reactive power. What exactly it
produces depends on its *load*, and not on the generator (previously known
as the load), which can be the mains network or something else. When there
is more than one generator in a circuit then Kirchhoff's laws must be
applied to analyze the circuit. By definition a circuit element is
*either* a generator *or* a load at any given point in time. There are no
provisions for treating both at the same time in the math apparatus that
analyzes/describes AC and DC circuits. Perhaps at the quantic level there
would be a probability between an element being a generator or not at some
point in time, depending on whether a cat is present or not in another
room <g>.

See some clues in my postings about mains-slaved electronic generators
(solar panel etc). Reactive components exist at the same time as the
active components of an AC waveform. They cannot appear 'later'. By
definition in a sine-based world everything repeats after 2PI rad (or 360
degrees if you prefer). Things that propagate across one period are
treated separately where they occur (in the next or Nth period) and follow
the same rules. The math apparatus that describes AC circuits relies on
this all the time.

Peter

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email listservmitvma.mit.edu with SET PICList DIGEST in the body

> Somewhere there I think I confused averaging
> this sense voltage (which is really current)
> with actually averaging a voltage. It's been
> too long since I did AC Machines theory... :o)

Well, as long as the circuit is driven by mains AC (which is a sine wave)
and you do not mangle the waveform too badly (triac pwm chopping is
mangling it badly) you can rely on Vef ~= 0.707 Vpeak and Ief ~= 0.707
Ipeak. It is better to use the average rectified voltage (and a different
coefficient) to reduce influence from peaks and glitches. The easiest way
is to load a peak detector with a resistor and add a small resistor in
series with the rectifier diode. By choosing the resistors 'right' the
reduction coefficient will be 'built in'. There will also be some ripple
on the output (larger cap required). This method is often used in cheap
audio VU-meters (VU units are Vef of audio signals expressed on a log
scale).

Peter

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email listservmitvma.mit.edu with SET PICList DIGEST in the body

More... (looser matching)
- Last day of these posts
- In 2001 , 2002 only
- Today
- New search...