Electrical Engineering Stack Exchange is a question and answer site for electronics and electrical engineering professionals, students, and enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'd like to measure an angle between two elements on hinges using arduino. Can I use a rotary potentiometer?

If I take reading at two edge positions for calibration (0 and 90 deg.) can I assume that the resistance will change linearly between those positions?

share|improve this question
Make sure that you use a linear potentiometer and not a logarithmic one.. – m.Alin Oct 24 '11 at 21:05
@m.Alin, that is how you take away the chance for someone to have to learn to cope with coding to resolve that! Think of a perfect learning exercise. – Kortuk Oct 25 '11 at 6:53
@m.Alin - trivial?... – stevenvh Oct 25 '11 at 7:23
It's worth noting that common potmeters have a very limited life, so if this is for a robot arm moving all the time I'd suggest an optical rotary encoder. – stevenvh Oct 25 '11 at 7:42
@stevenvh That's a much more knowledgable shopkeeper than I ever encountered when I was a teenager learning about electronics. – markrages Oct 26 '11 at 4:14

I've had to do this before where the shaft was connected to a continuously rotatable pot. That's a normal pot with two wipers 1/2 turn apart.

I found that the pot was reasonably linear, but not good enough for what we were trying to do. I added a calibration procedure and ended up doing a piece-wise linear lookup. If I remember right for that pot and the accuracy we wanted, a calibration point every 20 degrees or so seemed to be good enough. Any one pot stayed pretty consistant once calibrated. I'm sure they would wear more over time and require re-calibration, but initially a single calibration adjusted the system well enough to ship. We did specify calibration at regular intervals when other maintanence was already scheduled to be performed.

Long term pots are probably not a good measure of angle unless you recalibrate regularly after a cerain amount of use. The wiper rubs against the slider, which eventually wears off material and changes the resistance.

If you need long term consistancy, get a rotary encoder.

share|improve this answer
Here's an interesting magnetic encoder: austriamicrosystems.com/eng/Products/Magnetic-Encoders/… A coworker has used it and tells me it works well. – markrages Oct 26 '11 at 4:19

There are two problems with a pot as a sensor.

  1. The wipers can generate electrical noise as the wiper scrapes along the track.
  2. A pot is a fairly high impedance sensor, and so the signal wires can pick up noise if they are long.
  3. This high impedance also causes problems if you are sampling the pot with an ADC, due to the ADC's sample and hold capacitor.

The electrical noise problem can simply be solved with a small capacitor between the wiper and ground. About 10nF should be enough. Larger values are better, but will limit the rate at which the signal can swing.

Adding a unit-gain op-amp means that you can drive the signal along a long wire. It also drives the signal nicely into the ADC's sample and hold capacitor, giving a good noise free reading.

enter image description here

share|improve this answer

Using a linear taper rotary potentiometer is a workable idea if it provides the linearity that you need. You may need top determine this experimentally, depending on what peotentiometer you choose. Higher end potentiometers that are designed to be used as angle sensors have gauranteed linearity specifications, low end pots will not.

Depending on your application, physical oreientation, accuracy needs, and budget; you could also consider an optical shaft encoder or inclinometer.

Edited to add this link to info on potentiomenter linearity.

share|improve this answer

The resistance will also change with temperate, meaning even at the beginning accuracy could be somewhat suspect even after calibration.

For example if zero ohms is at 0 degrees and 1M ohm is 90, that would affect the current and subsequently the power being dissipated over that resister (putting some resister in series is a good idea I would imagine) The difference would probably be trivial if designed right I imagine.

share|improve this answer
Most pots are 3 terminal, 2 terminals go across the entire resistor and one is in the middle on the wiper. This means that you connect power the the first two terminals and measure your output voltage from the wiper. – Kortuk Oct 25 '11 at 7:13
Increased local heating will still occur between the wiper and power terminals, though, @Kortuk. I never worry about this source of error. – tyblu Oct 25 '11 at 14:10
@tyblu, a well-designed circuit will not draw any significant current through the wiper. Therefore any heating is even along the entire pot's resistance. So the voltage output is still nicely ratiometric even with resistance change from self-heating. – markrages Oct 26 '11 at 4:17

Its a complete no-no...I tried using one for a balancing bot, attached it to a light pendulum and it failed miserably.There is definite lag due to friction, and its not sensitive enough.I strongly recommend using a gyro.One very cheap alternative is using a WiiMotion Plus( $10-$15) for

share|improve this answer
Pots don't have lag. When the wiper moves, the resistance changes immediately. There may be lag due to low pass filtering in the circuit. There may also be a small dead band, but most pots are quite "tight" in that a small rotation of the shaft does result in wiper movement. – Olin Lathrop Oct 26 '11 at 12:01
Lag, I meant was the physical lag (due to friction), and not the electrical one! – Rupin Oct 26 '11 at 14:31
What physical lag? The wiper on most pots is quite tightly connected to the shaft. When the shaft turns, the wiper moves. For it to move later it would have to deform significantly. It doesn't work that way. Also, friction is a resistive force to the rotation of the shaft, but doesn't cause lag. Friction is not a time-related thing. – Olin Lathrop Oct 26 '11 at 15:38
@OLin, just a guess, but judging from the application description, Rupin may be talking about the static friction that had to be overcome before the shaft moved at all. This would result in jerky movements that could be called "lag" if you were expecting smooth movement & measurements. – wjl Oct 26 '11 at 18:12
@wjl: Perhaps, but that's a system issue, not one inherent to pots. The OP wants to measure the angle between two hinges. With the pot connected to the hinges, it might keep the hinges from moving for small applied force. However, if the hinge moves the pot will move, and so will measure angle without lag. The OP asked for angle measurement, not change in angle as result of some force. – Olin Lathrop Oct 26 '11 at 19:33

It depends on how accurate you can measure the resistance of say , 1 degree. the larger the potentiometer diameter, more resolution you have.

share|improve this answer
Potentiometers are analog. Any carbon resistance track type will vary proportional to position regardless of diameter. A wire-wound type might have a tendency to show discrete steps but a larger diameter would probably be for higher power and would use larger diameter wire and have the same problem as the smaller one. – transistor May 15 at 9:28

The correct device to measure angle is called a rotary encoder. There are two kinds, absolute, or incremental. Incremental encoders output the increment of angle on the shaft, and used to measure angular motion. Absolute encoder output the actual position on the shaft, and are used to measure absolute angle.

A pot can be used for this, but only if you do not need a lot of precision. Pot resistances have thermal drift, resistance also drifts with wear, they get dirty, etc. Just a pot and a lookup table would need constant recalibration, unless you only want to know if a hinge is opened or closed. If that is the case, a simple pushbutton with an appropriate length shaft will work just fine. If you need to actually measure the angle, use a rotary encoder.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.