Measuring PWM DC Voltage
I have a motor controller that controls the speed of a DC motor with
PWM. I want to measure the voltage at the motor and come up with a DC
voltage equivalent. As an example, if the supply is 12v DC and the
motor controller is at half speed, that would mean the PWM signal is
at 50% duty cycle. I would like to measure that 50% duty cycle with a
BS so that we would show 6v.
Some things that could affect this. First is the voltage is supplied
by a battery, so the input voltage will not be consistent. Second is
the PWM frequency may not be the same in every application the BS is
used in. My guess is that the frequency could vary from 2K to 10K
depending on what motor controller is used. Is there any possible to
way to do this?
I pretty much know how to make the circuit, just looking for ideas on
the programming.
Hank
PWM. I want to measure the voltage at the motor and come up with a DC
voltage equivalent. As an example, if the supply is 12v DC and the
motor controller is at half speed, that would mean the PWM signal is
at 50% duty cycle. I would like to measure that 50% duty cycle with a
BS so that we would show 6v.
Some things that could affect this. First is the voltage is supplied
by a battery, so the input voltage will not be consistent. Second is
the PWM frequency may not be the same in every application the BS is
used in. My guess is that the frequency could vary from 2K to 10K
depending on what motor controller is used. Is there any possible to
way to do this?
I pretty much know how to make the circuit, just looking for ideas on
the programming.
Hank
Comments
regular DC meter would read the voltage across the motor with fair
accuracy.
regards,
Leroy
rcvehicles wrote:
>
> I have a motor controller that controls the speed of a DC motor with
> PWM. I want to measure the voltage at the motor and come up with a DC
> voltage equivalent. As an example, if the supply is 12v DC and the
> motor controller is at half speed, that would mean the PWM signal is
> at 50% duty cycle. I would like to measure that 50% duty cycle with a
> BS so that we would show 6v.
>
> Some things that could affect this. First is the voltage is supplied
> by a battery, so the input voltage will not be consistent. Second is
> the PWM frequency may not be the same in every application the BS is
> used in. My guess is that the frequency could vary from 2K to 10K
> depending on what motor controller is used. Is there any possible to
> way to do this?
>
> I pretty much know how to make the circuit, just looking for ideas on
> the programming.
>
> Hank
>
> To UNSUBSCRIBE, just send mail to:
> basicstamps-unsubscribe@yahoogroups.com
> from the same email address that you subscribed. Text in the Subject and Body
of the message will be ignored.
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
guess is the motor is being used to integrate it and adding the RC
circuit may make the motor less efficient (most motors run best at full
voltage).
However, instead of measuring the voltage, could you measure the pulse
width of the PWM? If you only need to sample, you could use the Stamp's
PULSIN command. If you want to measure all the time (or multiple
channels) you might want a PAK-VII
(http://www.al-williams.com/awce/pak7.htm).
Regards,
Al Williams
AWC
* Floating point A/D
http://www.al-williams.com/awce/pak9.htm
>
Original Message
> From: rcvehicles [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=XjoqvtHhbdxmyGQdKU51lO7x_LaBxV_HIxpCwBEQYMpRaL6Rpo7_1f4GB9oWRZe5-TuLlGSzzFngm6Mo-jc]hankster@h...[/url
> Sent: Thursday, March 28, 2002 2:15 PM
> To: basicstamps@yahoogroups.com
> Subject: [noparse][[/noparse]basicstamps] Measuring PWM DC Voltage
>
>
> I have a motor controller that controls the speed of a DC motor with
> PWM. I want to measure the voltage at the motor and come up with a DC
> voltage equivalent. As an example, if the supply is 12v DC and the
> motor controller is at half speed, that would mean the PWM signal is
> at 50% duty cycle. I would like to measure that 50% duty cycle with a
> BS so that we would show 6v.
>
> Some things that could affect this. First is the voltage is supplied
> by a battery, so the input voltage will not be consistent. Second is
> the PWM frequency may not be the same in every application the BS is
> used in. My guess is that the frequency could vary from 2K to 10K
> depending on what motor controller is used. Is there any possible to
> way to do this?
>
> I pretty much know how to make the circuit, just looking for ideas on
> the programming.
>
> Hank
>
>
> To UNSUBSCRIBE, just send mail to:
> basicstamps-unsubscribe@yahoogroups.com
> from the same email address that you subscribed. Text in the
> Subject and Body of the message will be ignored.
>
>
> Your use of Yahoo! Groups is subject to
> http://docs.yahoo.com/info/terms/
>
and as such have caps installed to get rid of some of the noise. The noise
itself may hamper measuring the voltage. I only need to sample the voltage a
couple times a second on one channel so the PAK-VII shouldn't be needed.
I could measure the pulsein which would give me the duty cycle. Would I then
have to measure the voltage at the battery and then do some type of calculation
to come up with a DC voltage?
My guess is (no scope available) is that since the motor controller is using PWM
that the battery voltage would also vary along with the PWM output. It would be
somewhat "filtered" so it may not make that big of a difference. Under load, the
battery voltage can vary as much as 1v since the motor can draw 80+ amps.
Hank
Original Message
From: "Al Williams" <alw@a...>
To: <basicstamps@yahoogroups.com>
Sent: Thursday, March 28, 2002 3:23 PM
Subject: RE: [noparse][[/noparse]basicstamps] Measuring PWM DC Voltage
> An RC circuit will integrate the PWM and make it measurable, but my
> guess is the motor is being used to integrate it and adding the RC
> circuit may make the motor less efficient (most motors run best at full
> voltage).
>
> However, instead of measuring the voltage, could you measure the pulse
> width of the PWM? If you only need to sample, you could use the Stamp's
> PULSIN command. If you want to measure all the time (or multiple
> channels) you might want a PAK-VII
> (http://www.al-williams.com/awce/pak7.htm).
>
> Regards,
>
> Al Williams
> AWC
> * Floating point A/D
> http://www.al-williams.com/awce/pak9.htm
with a conventional meter. I know a starter on a car pulls 100-200+
amps and it's voltage my go as low as 8-9 volts on cold morning's start.
HTH,
Leroy
Hank Hagquist wrote:
>
> I would rather not add components if possible. The motors are brush type
motors and as such have caps installed to get rid of some of the noise. The
noise itself may hamper measuring the voltage. I only need to sample the voltage
a couple times a second on one channel so the PAK-VII shouldn't be needed.
>
> I could measure the pulsein which would give me the duty cycle. Would I then
have to measure the voltage at the battery and then do some type of calculation
to come up with a DC voltage?
>
> My guess is (no scope available) is that since the motor controller is using
PWM that the battery voltage would also vary along with the PWM output. It would
be somewhat "filtered" so it may not make that big of a difference. Under load,
the battery voltage can vary as much as 1v since the motor can draw 80+ amps.
>
> Hank
>
>
Original Message
> From: "Al Williams" <alw@a...>
> To: <basicstamps@yahoogroups.com>
> Sent: Thursday, March 28, 2002 3:23 PM
> Subject: RE: [noparse][[/noparse]basicstamps] Measuring PWM DC Voltage
>
> > An RC circuit will integrate the PWM and make it measurable, but my
> > guess is the motor is being used to integrate it and adding the RC
> > circuit may make the motor less efficient (most motors run best at full
> > voltage).
> >
> > However, instead of measuring the voltage, could you measure the pulse
> > width of the PWM? If you only need to sample, you could use the Stamp's
> > PULSIN command. If you want to measure all the time (or multiple
> > channels) you might want a PAK-VII
> > (http://www.al-williams.com/awce/pak7.htm).
> >
> > Regards,
> >
> > Al Williams
> > AWC
> > * Floating point A/D
> > http://www.al-williams.com/awce/pak9.htm
>
> To UNSUBSCRIBE, just send mail to:
> basicstamps-unsubscribe@yahoogroups.com
> from the same email address that you subscribed. Text in the Subject and Body
of the message will be ignored.
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
I think you're on the right track. The stamp will support measuring the high
and low duration of the PWM signal, and then you can use an A/D at the battery.
Note, however that there is probably a loss through the switching circuit. That
loss may not be constant either, so your measurement at the battery may not be
as meaningful as you'd like. One possibility is to tap into the PWM signal,
rectify it upstream of an RC circuit, and then measure that voltage. You'll
still have a voltage loss across the rectification diode, but that should be
constant as long as you're not drawing much current through the RC combination.
Note that this method should prove relatively non-intrusive and should have no
effect on the motor. Good luck.
Clark Hughes
Hank Hagquist wrote:
>
> I would rather not add components if possible. The motors are brush type
motors and as such have caps installed to get rid of some of the noise. The
noise itself may hamper measuring the voltage. I only need to sample the voltage
a couple times a second on one channel so the PAK-VII shouldn't be needed.
>
> I could measure the pulsein which would give me the duty cycle. Would I then
have to measure the voltage at the battery and then do some type of calculation
to come up with a DC voltage?
>
> My guess is (no scope available) is that since the motor controller is using
PWM that the battery voltage would also vary along with the PWM output. It would
be somewhat "filtered" so it may not make that big of a difference. Under load,
the battery voltage can vary as much as 1v since the motor can draw 80+ amps.
>
> Hank
>