Electronic – find out the change in angle between two wooden sticks connected to each other with a stepper motor

stepper motor

I have two wooden sticks/rulers (Length: 1 ft; Width: 1 inch; Thickness: 8 mm;)

  1. I have fixed the stepper motor to the end of ruler#1

  2. I have attached one end of ruler#2 to the shaft of the stepper motor.

  3. I have fixed the free end of ruler#1 to the edge of a table; The whole setup is pointing out in the air, perpendicular to the edge of the table.

When I move the second ruler through an arc, I want to detect the angle through which it moved. (How) can I do it, using the stepper motor?

Assumed Restrictions:

  • Movment will be at such a rate that it covers 90deg in 1 sec

  • The range of angle between rulers will be from 15deg to 180deg

I am planning to send this data to my software code through a parallel port in my PC. How should I decode the data/pulses provided by the stepper motor so that it can be sent through the port?

Above question is an extension of Best sensor for measuring rotation angle?. but I just want to know how to go ahead and implement it using stepper motor.

Best Answer

A stepper motor can certainly be used as a rotary encoder, with the caveat that both reliability and precision will be questionable at low rotation speeds and small numbers of steps.

  • Question indicates need for absolute angular movement detection, i.e. a "zero detection"
    • No convenient way to detect zero from a stepper
  • Question does not specify angular resolution of stepper motor, nor angular precision required.
    • A stepper with more steps (not microsteps) per rotation will provide greater precision
  • Speed of rotation of arm not specified
    • Slow rotation will result in weaker step signal, hence greater likelihood of missed steps

Now, working towards a solution:

  • Energize the stepper motor's coils with current-regulated DC at a small fraction of the rated operating current for the stepper. For a 3 Ampere rated stepper motor, 10 mA per coil is ample, step detection should work at even less.
  • Read the voltage pulses (back-EMF) generated across the stepper coils, as the stepper is rotated.
  • The sequence of the pulses indicates direction of rotation, the pulse count is the number of angular steps traversed, and the amplitude of the pulses relates to the angular rotation speed.
  • Some calibration will be required if anything other than number of steps traversed is to be detected
  • Do not expect lab-quality rotary encoder reliability from this solution: Occasionally steps may be missed, and some spurious steps may get detected due to EMI picked up by the coils.

This YouTube video demonstrates the use of a Hard Drive motor as a rotary encoder.

This article discusses the use of stepper motors as rotary encoders in some detail.