Hi there,

Does anybody knows the formula for calculating the current flow through a resistanse, while a voltage source is a PWM.

Known:

1. PWM Period

2. Duty Cycle

3. Resistor Drop out voltage when PWM is at high level.

Thanks,

Michael.

Author

Message

Level: Posting Freak

Joined: Wed. May 26, 2004

Posts: 1460 View posts

Location: Thessaloniki, Hellas

Hi there,

Does anybody knows the formula for calculating the current flow through a resistanse, while a voltage source is a PWM.

Known:

1. PWM Period

2. Duty Cycle

3. Resistor Drop out voltage when PWM is at high level.

Thanks,

Michael.

Michael,

What are you seeking?

If you are applying a square pulse train to a resistor, the current will either be V/R, or 0/R, depending on the part of the pulse you look at. This assumes the pulse is V volts, and 0 volts, which it may or may not actually be.

The pulse repetition rate does not matter.

If you send a 100 % high pulse, I = V/R.

100% --> I = 1.0 * (V/R)

50% --> I = 0.5 * (V/R)

0% --> I = 0 * (V/R)

General Case:

Average current will be Duty Cycle( units 0 to 1) * (V/R).

The average current is the same for a given duty cycle regardless of the underlying repetition rate.

If you feed this through an RC filter, and want to know the voltage, it becomes a little bit more involved. There was another thread on this recently.

Others can agree with the above, or enlighten both of us if I have this wrong.

JC

OP was asking for RMS current

RMS current (or voltage) of a square pulse train would be the square root of the ((current (or voltage) squared) times the duty cycle)

RMS=sqrt((I*I)*dutycycle)

RMS=sqrt((E*E)*dutycycle)

Where does the PWM go through the resistor?

If there is a capacitor to filter out the PWM frequency, then a 50% duty would mean that the capacitor has VCC/2, and the current through the resistor would be I=VCC/(2*R), but 50% of the time the current flows into the cap and 50% of the time the current flows from the cap.

- Jani

Level: Raving Lunatic

Joined: Tue. Nov 1, 2005

Posts: 7035 View posts

Location: Hilversum - the Netherlands

Tom wrote:

RMS current (or voltage) of a square pulse train would be the square root of the ((current (or voltage) squared) times the duty cycle)

RMS=sqrt((I*I)*dutycycle)

RMS=sqrt((E*E)*dutycycle)

Nope. You need to think a bit more about it: the RMS value of a PWM-current or voltage is the on-value * duty-cycle.

It's a pitfall, I know.

Nard

tpappano wrote:RMS current (or voltage) of a square pulse train would be the square root of the ((current (or voltage) squared) times the duty cycle)

RMS=sqrt((I*I)*dutycycle)

RMS=sqrt((E*E)*dutycycle)

Nope. You need to think a bit more about it: the RMS value of a PWM-current or voltage is the on-value * duty-cycle.

It's a pitfall, I know.Nard

Nope - YOU need to think a bit more about it :-)

kevin

Quote:

Nope. You need to think a bit more about it: the RMS value of a PWM-current or voltage is the on-value * duty-cycle.

It's a pitfall, I know.Nard

No, you are describing the "average" value. RMS is not the same as average.

Level: Raving Lunatic

Joined: Tue. Nov 1, 2005

Posts: 7035 View posts

Location: Hilversum - the Netherlands

Okay, here we go:

DC voltage of 10V, resistor of 10 Ohm. Gives current of 1A. With a continuous voltage, the power is 10 Watt.

Now we go to a 50% dutycycle: when the pulse is high --> 10 Watt; when it's low: 0 Watt. Average: 5 Watt

Prove me wrong :)

Nard

Edit: the energy-approach

Watt equals Joules per second. Okay ?

When the pulse is high for 1 second, the energy in that second equals 10 Joules.

In the next second, the energy delivered = 0

Over 2 seconds: 10 Joules total energy

That makes 5 Joule per second average. And that's 5 Watt.

When the voltage is doubled, the power goes up with a factor 4. That is still true.

(bedtime over here ... I am signing off for now)

Quote:

Okay, here we go:DC voltage of 10V, resistor of 10 Ohm. Gives current of 1A. With a continuous voltage, the power is 10 Watt.

Now we go to a 50% dutycycle: when the pulse is high --> 10 Watt; when it's low: 0 Watt. Average: 5 WattProve me wrong Smile

The above is correct, obviously, and I am not saying your calculations are not valid. The OP asked about RMS. The RMS voltage in the above example would be 7.07 volts. The RMS current would be .707 amps. The power to the load is still 5 watts. I'm only trying to illustrate that there is a difference between RMS (what the OP asked about) and average (which you described).

Okay, let me have a try at this...

Irms = sqr((I1^2 + I2^2 + I3^2... + In^2) / n)

Where:

n equals the number of samples taken.

And:

I equals the Peak current - NOT Peak-Peak current.

Now, if the ADC is fast enough to sample exactly 100 samples over the entire PWM cycle, power would equal:

Prms = sqr((I1^2 + I2^2 + I3^2... + In^2) / n) * Vpeak

Or:

Prms = [sqr((I1^2 + I2^2 + I3^2... + In^2) / n)^2] * Rload for a zero to 100% PWM signal.

And yes, there could be +/- a few tenths of 1% error around the PWM transitions, but even that small error would average out over the 100 samples.

Anything other then the Root-Mean-Square (RMS ) formula will simply produce the average (or modification of the average) of the AC signal - be it a sine wave or a PWM signal.

wow..... tpappano......

now, here's the perfect example of what happens when people learn formulas, without learning the reasoning behind them.

heres some things to think about:

1) WHAT does RMS actually stand for?

2) WHY would we want to calculate the RMS of a sinusoidal AC voltage or current?? hint: what does the A stand for in AC?

3) HOW does a PWM signal differ from a sinusoidal AC voltage? in both polarity and shape? hint: you wouldn't use the term AC to describe a PWM signal, would you?

4) All that understood - HOW does the simple P-P to RMS voltage conversion equation for AC possibly apply to a PWM signal?

michael:

"Does anybody knows the formula for calculating the current flow through a resistanse, while a voltage source is a PWM. "

yes. for a voltage across a pure resistance, the current waveform in Amps, will be the the voltage waveform in Volts, scaled by 1/resistance

PS, what is a resistor drop out voltage?

Last Edited: Thu. Jun 26, 2008 - 03:16 AM

Quote:

wow.....now, here's the perfect example of what happens when people learn formulas, without learning the reasoning behind them.

It's not rocket science, where did we lose you? 8-)

you lost me when you blindly applied a formula relating to getting the mean value of an AC sinusoidal signal, to a DC biassed pulse signal.

the Vrms = Vpp * 0.707 formula is a simplification. It does not apply if you are not talking about a sinusoidal signal. full stop. if you want to measure the RMS of a single polarity pulse waveform, you'll find it's the same as doing a simple Mean calculation. ie, exactly what nard said.

Last Edited: Thu. Jun 26, 2008 - 03:20 AM

RMS is the measure of equivalent heat (power) developed with an AC voltage and/or current that corresponds to the heat (power) developed with a DC voltage and/or current using the same load.

An VACpeak voltage/current translates to VACpeak * [1/sqr(2)] = VDC equivelent voltage/current. Or, VACpeak * 0.707 = VDC equivalent.

A VDC voltage/current translates to VDC * sqr(2) = VACpeak equivalent voltage/current. Or, VDC * 1.414 = VACpeak equivalent.

There is also the sin(45) = 0.707 and cos(45) = 0.707 for the pure mathematical types.

The traditional analog meters were/are inherently averaging meters by mechanical means, calibrated to RMS. The same with the older digital multi-meters - they were averaging, calibrated to RMS. For averaging and RMS calibrated meters to read voltage and current accurately, they need to measure a pure sine wave voltage or current. The more distortion in the waveform, the less accurate they become.

For a "True RMS " meter, a fairly large (discounting true analog) number of samples are integrated over time. Integration is actually "The area under the curve " or the power consumed under the curve. The more samples (the smaller the area is sliced) the greater the accuracy of the determination of the area under the curve.

In the end, taking the integral of the area under the curve resolves into the formula called the Root-Mean-Square (RMS) equation. Basically, you sum the square some number of samples, divide that by the number of samples taken (average) and then take the Square-Root of the average of the sum of the square of the number of samples.

It's complicated enough, but really very simple - once the principal is understood.

PWN is really nothing more then an AC signal that is biased so that is only has one polarity with reference to zero potential - or common ground. Yet, PWM is extremely distorted - even at 50% duty-cycle. As the distortion is so high, any averaging method will produce errors in measurement proportional to the amount of distortion. As the RMS method is a form in integration (read, derivative), any distortion errors are no longer a factor as, it is the area under the curve that is being measured.

EDIT:

Corrected error in the formulas above.

Last Edited: Thu. Jun 26, 2008 - 04:37 AM

the Vrms = Vpp * 0.707 formula is a simplification. It does not apply if you are not talking about a sinusoidal signal. full stop. if you want to measure the RMS of a single polarity pulse waveform, you'll find it's the same as doing a simple Mean calculation. ie, exactly what nard said.

0.707 is a static averaging constant. It can only be applied to pure sine waves. Any distortion in the waveform will produce errors proportional to the distortion.

To achieve true RMS, a number of samples have to be taken over some time interval, which then need to get squared, summed, averaged and finally, the square-root is taken, producing a true RMS measurement whose accuracy is a function of the component accuracy and the number of samples integrated over that given time interval.

Anything else produces measurement errors that are proportional to the distortion in the measured signal.

It doesn't matter a hoot if the signal being measured is an AC voltage/current swinging around zero volts, or a DC signal transitioning between zero volts and 5 volts. As the samples are integrated over some time interval, the true RMS (heat equivalent) value is obtained - because it is really only the area under (read, within defined boundaries) the curve of the measured waveform that we are interested. And that is what Calculus does, it defines and determines the properties of odd, seemingly unpredictable shapes for us - accurately.

Edit:

And there is a method (possibly even more then one) where "True RMS " values can be determined using pure trigonometry, rather then simple rectangular coordinate mathematics. In doing so, there is no need to worry about bumping into the sqr(-1). Though, I don't think that is even possible when calculating "True RMS " because of the squaring of each sample. Remember: the sqr((-1 * -1)) = +1.

But for me to really engage in that level of discussion, I'd need to hit the trigonometry books.

Last Edited: Thu. Jun 26, 2008 - 03:54 AM

Ditto to everything Carl has said...

Quote:

you lost me when you blindly applied a formula relating to getting the mean value of an AC sinusoidal signal, to a DC biassed pulse signal.

I would add that the RMS method has no particular relationship with sinusoidal signals. It is a means of evaluating/calculating/measuring any time-varying signal in order to determine the amount of "work" that might be done by that signal. As shown earlier in the thread, the RMS method and the averaging method arrived at the same result for a DC pulse, as one would expect. Granted, one could say RMS measurement is more useful on complex waveforms, and simple averaging might be adequate on pulse waveforms, but RMS measurement gives a true represention of most any waveform.

Case in point...

If you take a PWM signal, and feed it into a suitable resistive/capacitive network, most individuals would say that the voltage present on the capacitor is the average of the PWM - or the ratio of the PWM Off-time to the PWM On-time , multiplied by the logic high voltage value on the PWM output pin - and at first glance, this is true.

But it is the Calculus that has provided the equation Vout = VI/O * (TOFF / TON).

In fact, it is the On-time and the Off-time that is integrated over time by the capacitor, producing your so-called average, which is then multiplied by the DC voltage when the I/O pin is a logic high - producing the output voltage that proportional to the On-time of that PWM output signal.

well, of course you can calculate the RMS of any periodic signal.

I never tried to say you couldn't.

what I said, is your simple 0.707 scale factor equation you tried using is completely irrelevant for calculating the RMS value of anything from a simple p-p measurement, except a pure sinusoidal AC signal with no DC bias....

Quote:

The RMS voltage in the above example would be 7.07 volts. The RMS current would be .707 amps

no, it would not. because the 50% pulse wave does NOT have the same shape (and hence the same area under its curve) as a sinewave.

think about it.... lets ignore single polarity waveforms, as they seem to be confusing you - so - Would a perfect AC square wave of the same p-p value as a perfect AC sinewave have the same RMS value as the sine wave? everything is the same, but the shape is different.... so... area under the waveform?? will that be the same??? hell no. therefore RMS value of these same two AC waveforms with the same P-P values will ve different.

How can you just "ditto" everything microcarl says, when it completely refutes everything you said before that?

though, I think microcarl even got the simple scaling equations backwards, if he's talking about P-P AC vs DC....

Quote:

The DC equivalent of an AC voltage/current translates to the Vdc * sqr(2) = Vdc * 1.414.The AC equivalent of a DC voltage/current translates to the Vac * [1/sqr(2)] = Vac * 0.707.

Quote:

well, of course you can calculate the RMS of any periodic signal.I never tried to say you couldn't.

what I said, is your simple 0.707 scale factor equation you tried using is completely irrelevant for calculating the RMS value of anything from a simple p-p measurement, except a pure sinusoidal AC signal with no DC bias....

Go back and look at the example of the 50% 10 volt pulse. "707" is not a "simple scale factor". 7.07 volts *is* the RMS voltage of the example signal. .707 amps *is* the RMS current delivered to the example load. If the duty cycle was different, these values would be different, but the example duty cycle is 50% and there simply is no escaping the reality of the RMS calculation.

Quote:

no, it would not. because the 50% pulse wave does NOT have the same shape (and hence the same area under its curve) as a sinewave.

You need to get away from the sinewave, as there are no sinewaves in the example, and (again) RMS has special relationship with sine waves.

Quote:

think about it.... lets ignore single polarity waveforms, as they seem to be confusing you - so - Would a perfect AC square wave of the same p-p value as a perfect AC sinewave have the same RMS value as the sine wave? everything is the same, but the shape is different.... so... area under the waveform?? will that be the same??? hell no. therefore RMS value of these same two AC waveforms with the same P-P values will ve different.

I'm confused at all, but you seem to going off target. I do not think anyone has yet suggested that the RMS values are the same for square waves and sinusoids with the same peak to peak amplitudes.

Quote:

How can you just "ditto" everything microcarl says, when it completely refutes everything you said before that?

???

though, I think microcarl even got the simple scaling equations backwards, if he's talking about P-P AC vs DC....microcarl wrote:The DC equivalent of an AC voltage/current translates to the Vdc * sqr(2) = Vdc * 1.414.The AC equivalent of a DC voltage/current translates to the Vac * [1/sqr(2)] = Vac * 0.707.

Yes, in my haste, I got it reversed. So let me re-word exactly what I mean.

A VACpeak voltage/current translates to VACpeak * [1/sqr(2)] = VDC equivelent voltage/current. Or, VACpeak * 0.707 = VDC equivalent.

A VDC voltage/current translates to VDC * sqr(2) = VACpeak equivalent voltage/current. Or, VDC * 1.414 = VACpeak equivalent.

But in a single set of samples that are only averaged, this is only an average reading - after all - and will not reflect the true power being dissipated in the circuit - unless it is a pure sine wave, or symmetrical in nature.

So if you have a PWM driving a load and doing some work, the chances of the PWM waveform being exactly 50%PWM at each and every sample taken, is pure fantasy. In fact, if the system is measuring motor current, temperature, pressure or what ever (in the form of PWM) I'd venture to say that there will be so few (if any) 50%PWM measurements over a range of samples, that your argument simply becomes meaningless.

Any waveform that has lost it's symmetry (read, any PWM waveform that is not exactly 50%PWM), will produce distortion (symmetry error) in any measuring system that uses a simple averaging technique to derive an RMS measurement, and that error will be proportional to the amount of non-symmetry (distortion) in the waveform.

EDIT:

And if motor current is what is going to be measured, then things really go afoul!

For inductive loads, "True RMS " measurements become even more important - not to mention power-factor (cos() of the angle between V & I), inductance, and a whole host of other issues.

These things just can't be accurately determined using averaging measurement techniques.

OK... just took some time and sat down and did some maths.... and I'm wrong.

Yes, tpappano, the RMS value of that particular example is indeed 0.707 x the square wave height... I just saw the 0.707 number and assumed you'd just taken the simple equation most people misuse.

sorry!

guess I'm a bit too sleep deprived today to be getting into this kind of discussion.

....but I'd still like to know what the resistor drop out voltage is all about?

Wow! I wonder where icarus1 is in all of this discussion?

Level: Raving Lunatic

Joined: Tue. Nov 1, 2005

Posts: 7035 View posts

Location: Hilversum - the Netherlands

Tom, you gave the correct answer. My answer was valid but not an answer to Icarus' question.

Thanks guys, for the heads up.

Nard

Hey, Carl--weren't things a lot easier when you couldn't connect? ;)

Lee

I can not resist,

@sgomes:

sines also don't exist, since most sines are switched

on or off at some time. :shock:

The same argument holds for DC.

Even that is an imagination, since most sources we model as DC have not existed 10 million years ago nor

will they exist in 10 million year. (I am getting

philosophical now.)

But sines are a good model the same as DC or square

waves. And all predictions are as good as the models

you use. And if the model is to complicated, nobody

can solve the math.

And then there are a lot of confusing quantities

and names :

momentary voltage/current/power,....

lots of different peak and average values

for periodic or random quantities.

Average-values and quantities for sinusoidal

waveforms in the steady state (impedance, reactive power, true power, appearent power, cos(phi) )

So its quite natural that we sometimes get confused

and have to clear up the things again.......

And its quite natural, that we sometimes simply

get lost in the language......

And its quite natural, that we often get lost in the

math.

And if we get lost, it's good to have AVR-FREAKS

:lol:

Good morning all!

Quote:

EDIT:

And if motor current is what is going to be measured, then things really go afoul!For inductive loads, "True RMS " measurements become even more important - not to mention power-factor (cos() of the angle between V & I), inductance, and a whole host of other issues.

These things just can't be accurately determined using averaging measurement techniques.

This is the exact issue that brought RMS measurement home to roost for me. When using thyristors to control induction motors, the commutation point is affected by power factor, which is affected by torque load. Knowing the RMS value you are driving the motor with is very useful for good control.

Quote:

Laughing Ah, the good old days when True RMS conversion was done by measuring the temperature rise in a heating element! This is still done for certain RF measurements.

Penzias and Wilson used a "radiometer" to detect the cosmic background radiation. I was wondering if perhaps it indeed was a thermocouple bolometer. I've never used one but with a big enough antenna I suppose it would work, especially with a super-cooled detector. Anyone know more details on how they did do it?

Hey, Carl--weren't things a lot easier when you couldn't connect? ;)Lee

Maybe...

But I didn't take it that anyone was taking anything I said as personal. It's just a hard concept to grasp, and it's an even harder concept to hold on to - especially when you don't sit and ponder it every day.

And it's an even harder concept to try to explain, especially if the receiver doesn't have an adequate math background.

Quote:

DC voltage of 10V, resistor of 10 Ohm. Gives current of 1A. With a continuous voltage, the power is 10 Watt.

Now we go to a 50% dutycycle: when the pulse is high --> 10 Watt; when it's low: 0 Watt. Average: 5 Watt

And Power = R * (I*I).

Then when duty cycle = 0.5, I(current) lowers sqrt(0.5) times.

So the answer is

I = sqrt(duty cycle) * U/R

If the PWM has negative part (negative voltage part) averaging will not let you get an idea of the power. RMS is therefore there to rectify the whole signal above ground point. For a PWM signal with no negative part average value = RMS value

incal99

Quote:

If the PWM has negative part (negative voltage part) averaging will not let you get an idea of the power.

Could you give an example? The power delivered to the load in the example situation is the same whether the pulse is ground referenced (0 to +10) or bipolar (-5 to +5, for example)

Quote:

RMS is therefore there to rectify the whole signal above ground point. For a PWM signal with no negative part average value = RMS value

Above and below ground doesn't matter, and average still is not the same as RMS. For example, calculate the average and RMS voltages of a 25% 10v pulse and see what you get.

Quote:If the PWM has negative part (negative voltage part) averaging will not let you get an idea of the power.Could you give an example? The power delivered to the load in the example situation is the same whether the pulse is ground referenced (0 to +10) or bipolar (-5 to +5, for example)

Quote:RMS is therefore there to rectify the whole signal above ground point. For a PWM signal with no negative part average value = RMS value

Above and below ground doesn't matter, and average still is not the same as RMS. For example, calculate the average and RMS voltages of a 25% 10v pulse and see what you get.

Hi Tom, I'm glad to see that at least we two agree on this subject.

I think that the solution to the problem is to let everyone have their own beliefs.

I'm sure that when they get into the theory "Proper " and the mathematics associated with deriving the True RMS equation from the Calculus, they'll come to the hard terms for themselves. That, or they'll never get it functionally or mathematically correct.

The idea behind True RMS is to be able to discount distortion (using a pure sinusoid as a reference waveform) in the waveform being measured. It's to be able to learn and know - with certain accuracy - the power consumed via a waveform that is not sinusoidal - regardless of the shape of the observed waveform.

The True RMS equation cares nothing about whether the waveform swings positive or negative, is positive only, or negative only.

The proof of this concept lay in the fact that each of the terms under the radical of the True RMS equation are squared. That is, squaring a negative number always produces a positive number. With that, the polarity of the measured waveform is transparent to the end result - the True Power consumed in a circuit that is driven by a non sinusoidal waveform.

EDIT:

And let me also state that, for a perfect (read, pure) sine wave (and read, "Zero " distortion, if there really is such a thing) there is no need for using True RMS, as 0.707 (converting from the AC to DC equivalent) and 1.414 (Converting from DC to the AC equivalent) is the exact conversion and it reflects the true power consumed in the circuit.

And also, be mindful that True RMS is NOT a peak-to-peak measurement. Rather, True RMS is a peak measurement - or 1/2 p-p when the waveform is offset from zero potential.