Read slow moving shaft position

After searching, this might be a unique question.

Need to sense in arduino the position, in degrees, of a shaft that only turns a range of 180 degrees. There is a motor on a smaller gear that my arduino, via relay, can turn in either direction, one speed.

Accuracy isn't an issue, as it is turning a display of sorts, so any resolution below 5deg is fine.
The display can move freely 360 without harm, but the intended range is 180degrees.

Perhaps a device on a gear that can resolve by # of turns? Motor on small gear, larger gear for display shaft, so motor can just be on or off. No need for speed control if positions are reasonably repeatable. Solutions I found involve higher speeds.


An encoder geared to the motor or shaft would do the job just fine. You can get much better resolution that you need.

Using a stepper motor would eliminate the need for a sensor (you might want a single switch or sensor to give you a "home" position).

If you want cheap and dirty glue magnets around the shaft and use reed switch(es), or make a wheel with teeth that push on a micro-switch as it rotates.

A reflective photo-sensor and a custom target wheel would do it.

Only analog computers can think in "degrees" and then not very well. We humans have been trained to think in degrees. Whatever you program in your Arduino will be in discrete "steps", whether in counting how many steps your shaft has rotated, or counting how many steps you have commanded the shaft to rotate.

If you want a display to show you degrees, you will have to program to convert steps to degrees.


Sounds like a servo. There's only a few million of them in the world. 180 degrees is about standard.

Most use a potentiometer on the output shaft. Even the so-called digital servos.