Controling a servo with a potentiometer

I want to control a servo with the analog value provided by a potentiometer. Dose it mater what potentiometer I use? How can I reed the potentiometer value? and most important, how do I connect the potentiometer?

I could go into more detail if you’re interested, but the short answer is no, it doesn’t really matter what the total resistance of your potentiometer is, since the analog voltage you measure is proportional to the position of the potentiometer regardless of it’s total resistance. In practice, you’ll probably want to pick a potentiometer in the 1Kohm to 10Kohm range.

There are lots of cheap commercial devices that generate servo pulses based on the position of a potentiometer, you can find the more common ones by searching e-bay for “servo tester”. You might be dissapointed with these though, most only generate the standard range of servo pulses (like most hobby radio controllers) so they can’t drive your servos all the way to their stops. There are a couple of more expensive controllers with more features available from ServoCity: Dual Servo Driver | 2 Servo Joystic. I’m not sure about the range of signals these can produce though.

If your project involves a microcontroller with analog-to-digital conversion (i.e. any of the Orangutans) you could read the position of the potentiometer through the A-to-D hardware and write a simple timing program to generate the servo pulses. If you’re not planning on involving a microcontroller in this project, you can build a simple pulse generator using only parts available at Radio Shack for about $8! There are lots of designs for such circuits online, but there is one particularly simple one that is by far my favorite, detailed in this thread. I prefer these two solutions since you have complete control over the range of servo signals you generate, but if you only need the standard ~90 degree range of your servo, a cheap e-bay tester is definitely the simplest way to go.


I am going to use the orangutan for thus project. how can I get the position of the potentiometer with the orangutan?

If you place a potentiometer and a resistor in series, then measure the voltage drop across the potentiometer using the A/D converter in Orangutan that should get you where you want.

For example, if you have 10K potentiometer with one lead connected to Vcc (5v) and the other to a 1K resistor and an analog pin of the Orangutan. The remaining resistor lead should be tied to ground.

If the potentiometer is at 0 ohms, or close to it, you should see 5v at the Orangutan pin, which will translate to 1024 for a 10-bit A/D converter. However, if the potentiometer is at 10K ohms you’ll see 1/(10+1) * 5 = 0.454 V (voltage divider) at the Orangutan pin, which should be about 93 from the A/D. Keep in mind the resistor is important to prevent shorting the power supply or excess current draw. In addition, potentiometers and resistors tend to have a fairly large tolerance on their value. So if you want it to be more accurate make sure you measure the resistance rather than just trusting the manufacturer’s values.

I think that’s probably the easiest way to do it, ideally you want the potentiometer value to be larger than the series resistor so you end up covering a larger voltage range which will give you more accuracy. Either way I think you’ll find it should work quite well. Once you have your A/D values you just need to convert that range into the appropriate servo pulse width, where 1.5ms should correspond to your potentiometer center value.

Thanks. But I didn’t understand the connection to the orangutan, one lead of the resistor is connected to the potentiometer, and the other one is connected to the A/D pin on the orangutan, so what goes to the GND?


Most potentiometers have three terminals, so the extra resistor lumos suggested is unnecessary. You can connect the two outer pins to Vcc and ground, and the wiper contact will move from 0 to 5V as you turn the pot.

- Jan