PWM to Analog


Thread Starter

Danny Kent

Looking for a off-the-shelf method to convert a servo controller from a R/C airplane to an analog +/- 5V to interface with a computer-based control system.

Anyone know anything?

Robert Scott

If by "off-the-shelf" you mean plug compatible, I
don't think you will find a solution that simple.

Simply averaging the PWM signal with an R-C (that's resistor-capacitor, not radio-controlled) low-pass filter will give you an analog version of the signal which can be scaled and shifted as required. This may not work for you, though, if you have tight response-time requirements or if you are bothered by the residual carrier frequency after the filtering. The fastest response and best carrier suppression can be obtained by a dual sample and hold circuit. Trigger a ramp at the beginning of the PWM pulse and sample and hold that ramp at the end of the PWM pulse. On the opposite edges of the trigger pulse, sample the first sample and hold with a second sample and hold. This will totally elimiate the carrier without incurring any unnecessary demod response time.

David Wooden

I took the liberty of posting this to a group which uses R/C servos frequently. Here are the responses so far:

From: "Eddy Wright"
To: <[email protected]>
Sent: Wednesday, February 27, 2002 3:53 PM
Subject: Re: [ChiBots] COMM: PWM to Analog

Have you looked at the output from a standard servo motor controller (the part inside the servo)? It should be producing a +/- 5v PWM signal assuming your power to the servo is about 5v. Attach a scope or multimeter to the motor leads and see what you get. You could probably
feed that to a MCU or take it through a voltage averaging circuit, then to an ADC port on the MCU.


From: "Eddy Wright"
To: <[email protected]>
Sent: Wednesday, February 27, 2002 4:48 PM
Subject: Re: [ChiBots] COMM: PWM to Analog

Revised: you should see 5v PWM on one motor lead for one direction,
5v PWM on the other motor lead for the reverse direction.


From: Tony Nowakowski on 2/27/2002 at 7:58 PM

If RC servo=A0PWM is "standard" PWM (I'm not an RC guy), there is a way to hook up a simple R/C filter to change the PWM to analog. The R and C values would depend on the PWM frequency.

You would choose the R value high enough to not strain the controller's output current capacity, then, choose the C value to get the filtering
(averaging) you want.

Input o---/\/\/--+--o Output
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0V (gnd)

Depending on the analog input's impedance, this may work, or, you may have to add a buffer to supply extra current. On second thought, you may
just want to use an active filter versus this passive one.

Let me know if you need more.

hi, it is not necessary to use two sample and hold circuits. we can use one integrator and one
sample and hold circuit. and two monoshots