1
\$\begingroup\$

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.

\$\endgroup\$
  • \$\begingroup\$ If it is not too late: use a rotary encoder instead. That will save you the analog circuit to bring the stepper pulses up to something the parallel port can detect. \$\endgroup\$ – Wouter van Ooijen Jan 7 '13 at 6:34
  • 2
    \$\begingroup\$ Neither a stepper nor a rotary encoder will allow measurement of angle, only change in angle. Either the title needs clarification, or the wrong problem is being solved here. \$\endgroup\$ – Seemingly So Jan 7 '13 at 7:13
  • \$\begingroup\$ @WoutervanOoijen I have hobby stepper motor when hand rotated generates spikes around 14 volts, and much more when rotating quickly. So analog circuit may not be required for just pulse counting, but maybe clamping diode required. \$\endgroup\$ – ExcitingProjects Jan 7 '13 at 7:40
  • \$\begingroup\$ The most common rotary encoders are also incremental and would also require and index device for zeroing. Absolute encoders do exist. But for a hobbyist application you might look at just using a potentiometer as an angle input - you can potential even read it with a game port (/USB joystick adapter) or the ADC on a USB enabled microcontroller. \$\endgroup\$ – Chris Stratton Jan 7 '13 at 16:45
  • \$\begingroup\$ @ChrisStratton I just read up on potentiometer answers.yahoo.com/question/index?qid=20061024060733AAa4OfT seems the whole thing is awfully simple; Thank You! Wondering about how to convert the "output" voltage of the pot into digital values to be fed into the parallel port. \$\endgroup\$ – user17643 Jan 7 '13 at 16:54
3
\$\begingroup\$

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.

\$\endgroup\$
  • \$\begingroup\$ Thank you! What does energising the stepper motor mean? How can I do it? \$\endgroup\$ – user17643 Jan 7 '13 at 7:02
  • 1
    \$\begingroup\$ @SenthilKumar Pass a current through each coil (assuming bipolar stepper, hence 2 coils). In this application, a fixed DC current would work well - Something like you would do to light up an LED. Simplest way: From your device supply rail (say 5 Volts) connect a resistor in series to each coil, then to ground. The resistor would be calculated such that adding in the coil DC resistance would result in around 5 to 10 mA flowing through the coil. Of course, not knowing what your stepper current rating is, this 5 to 10 mA figure could be badly off. \$\endgroup\$ – Anindo Ghosh Jan 7 '13 at 7:09
  • 1
    \$\begingroup\$ My issue with this approach: There is no sure way to know when "Angle = 0" and thus, when to reset and start counting pulses. Fine for a hobbyist toy, not so fine for real world applications. \$\endgroup\$ – Seemingly So Jan 7 '13 at 7:16
  • \$\begingroup\$ @SeeminglySo What approach can I take to find out when 360deg is completed? would a rotary encoder help? Or is there something else I should try? \$\endgroup\$ – user17643 Jan 7 '13 at 8:54
  • 1
    \$\begingroup\$ @SenthilKumar The most deterministic approach would be to use rotary cam switch, or for a DIY project, a limit switch triggered by a cam or something attached to the shaft, rather than any encoder / counter approach. Search for "rotary limit switch", many results come up. \$\endgroup\$ – Seemingly So Jan 7 '13 at 9:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy