Article

Drive an RC Servo from Analog Voltage

ABOUT: This is a circuit I designed to generate a PWM signal for an RC servo given an analog voltage or high frequency PWM.  It has no microcontroller and can be built with one quad op-amp and passive components. The op-amp I used in my implementation is a NJU7034D-ND, available from digikey, but any rail-to-rail quad op-amp will do. Since the input stage has a low pass filter built in this circuit will accept a high frequency (>~5kHz) PWM as an input in addition to analog voltages.

PARTS:

  • 1 Quad  Op-amp (I used NJU7034D-ND)
  • 1 10K resistor
  • 1 50K resistor (or 2 100K resistors in parallel)
  • 7 100K resistors
  • 1 0.47 uF capacitor
  • 1 0.047 uF capacitor
  • 1 10K potentiometer (can be subbed with 100K pot, makes calibration trickier)
  • 1 100K potentiometer

HOW IT WORKS:

Linear Ramp Generator:

This is the beating heart of the system, literally.  This is an integrator and a hysteretic comparator hooked into a feedback loop that produces an oscillator with a linear ramp as output.

Low Pass Filter and Buffer:

This is simply a stiff RC low pass and an op-amp follower.  The RC low pass removes high frequency noise from the input.  The follower drives current to the calibration stage, which requires current that the RC low pass can’t deliver.

Calibration:

Every servo is a little different.  These two potentiometers map the full swing of the input voltage to a small range of voltages feeding into the comparator stage.  These have to be set properly for the servo to swing through its full range of motion.  For calibration instructions, see the CALIBRATION INSTRUCTIONS section.

Comparator:

This generates the PWM that is sent to the servo by holding its output high when the input from the calibration stage is higher than the linear ramp from the oscillator and vice versa.  The width of the pulse is directly related to the voltage coming in from the calibration stage.

CALIBRATION INSTRUCTIONS:

  1. Connect power and ground.  Connect the servo you want to use to the output.  Connect the input of the circuit and set it to Vcc/2.  The servo should swing to a position, probably one of its physical stops.
  2. Adjust the pot labeled ‘Amp Adjust’ all the way to one side so that its output is directly connected to the output of the ‘Bias Adjust’ pot.
  3. Rotating the ‘Bias Adjust’ pot should rotate the servo.  Position the servo in the center of its range of motion.  The closer to the center the better.
  4. Set the input of the circuit to 0V.  Now adjust the ‘Amp Adjust’ pot until the servo is hitting one of its hard stops.
  5. Your circuit is calibrated.  The full range of input voltages from 0V-Vcc should now map linearly to the position of the servo from one hard stop to the other.

NOTES:

  • If your PWM frequency to the servo is too low or too high, decrease or increase (respectively) the value of the capacitor labeled ‘freq adjust’.
  • You can use 2 100K resistors in parallel as the 50K resistor, reducing the number of different resistor values you need from 3 to 2.
  • You can use a 100K pot instead of a 10K pot, reducing the number of different pot values you need from 2 to 1.  This does make calibration trickier, just play with the pots until the range of motion is right.
Good luck! ~James

4 Comments

  • After searching the net a few days now this looks like the first design that may work with my one cell Lipo 3,7 volt power source. I need to convert an analogue motor power signal (voltage to drive the engine) to a servo signal. I will give this a try.
    Hans

  • Great, let me know how that goes for you! I neglected to mention that you can build a simpler (though less linear and more noise susceptible) 2 op-amp version. Let me know if you want a schematic.

  • Hi, James

    Thanks for posting this. I need to control a servo from a microcontroller, but the pwm outputs can’t put out a good signal at the low frequencies required of the servo. Is there some way I can get the simpler 2 op-amp version?

  • I would like the simpler version. Trying to drive RC servo with 1-5 volt analog signal from PID temperature controller to automate smoking pit.

Leave a Comment

Your email address will not be published. Required fields are marked *

Subscribe to our newsletter
GoogleSidebar Office365Sidebar DellSidebar MicrosoftSidebar auth