Electronic – arduino – How to measure servo potentiometer

adcarduinoservo

What's a reliable method of getting a clean measurement of the potentiometer in a hobby servo?

I've modified a servo for directly polling its position by soldering a wire onto its potentiometer's center lead, as described here. I then wired this lead to an Arduino's ADC pin, but I'm finding the readings to be extremely noisy even when the servo isn't moving. I tried using a moving average to smooth the signal, but even that results in jittery value.

Is this just the nature of a servo's potentiometer, so is there a better way to wire to clean the measurements?

Edit: By "noisy", I mean even when the servo wasn't moving, the ADC measurement taken by the Arduino could vary by ±50 units between readings.

Best Answer

What is connected to the other two leads of the pot?

The linked page is vague about how that's handled. If it's power and ground, how clean is the power in question - if it's the same power that's being supplied to the motor, it may be a bit filthy when the motor is running, anyway. If you were "following" that vague page and the center pin is the only thing you connected - well, there's your problem - give it clean power and ground and things will get much better.

Try some capacitance (aka, a low pass filter) between the ends of the pot on the one hand, and between your signal input pin and ground on the other.

If you have access to an oscillosope, look at the signal from the wiper (center pin), and at the supply (across the end pins of the pot.)