Home > News & Updates > Arduino News > FROM THE MACGYVER FILES: USING A STEPPER MOTOR AS AN ENCODER

FROM THE MACGYVER FILES: USING A STEPPER MOTOR AS AN ENCODER

Summary of FROM THE MACGYVER FILES: USING A STEPPER MOTOR AS AN ENCODER


When supplies are scarce, [Tech Build] repurposes an old printer's stepper motor as a rotary shaft encoder. This DIY solution involves connecting the motor coils to op-amps configured as positive feedback comparators to generate clean square waves from noisy inputs. The setup requires identifying coil connections via an ohmmeter if the motor's wiring is unknown, mounting the circuit on a prototyping board instead of a breadboard, and reading the resulting pulses with an Arduino.

Parts used in the Stepper Motor Encoder Project:

  • Old printer stepper motor
  • Op-amps (operational amplifiers)
  • Ohmmeter
  • Breadboard (initial version)
  • Prototyping board (final version)
  • Arduino microcontroller

It isn’t hard to imagine a scenario where you are stuck at home all day with nothing to do and certain items are in short supply. Sure, bathroom tissue gets all the press, but try buying some flour or a freezer and see how far you get. Plus online shopping has given up on next day delivery for the duration. Not hard to imagine at all. Now suppose your latest self-quarantine project needs a rotary shaft encoder. Not having one, what do you do? If you are [Tech Build] you go all MacGyver on an old printer and pull out a stepper motor.

How does a stepper motor turn into an encoder? Well, that’s the MacGyver part. We are not big fans of the physical circuit diagrams, but it looks like [Tech Build] borrowed (with credit) from an earlier post and that one has a proper schematic.

Looking at [Andriyf1’s] schematic, you can see each coil connects to an op-amp wired as a positive feedback comparator. The result should be a fairly clean square wave from a noisy input. The real trick is how to connect the coils, which depends on how the stepper is wired. If you have a stepper motor of unknown provenance, grab your ohmmeter and read how to sort the wires out.

https://youtu.be/YhS-Sx-2is4

The initial version was on a breadboard, but the final was on a prototyping board. Of course, an Arduino reads the pulses. We love using things for unintended purposes. Speakers and microphones are often interchangeable. Generators and motors, too. Then there’s the paperclip.

Source: FROM THE MACGYVER FILES: USING A STEPPER MOTOR AS AN ENCODER

Quick Solutions to Questions related to Stepper Motor Encoder Project:

  • How does a stepper motor turn into an encoder?
    Coils connect to op-amps wired as positive feedback comparators to produce clean square waves.
  • Can you use a stepper motor without knowing its wiring?
    Yes, you can use an ohmmeter to read and sort out the wires.
  • What type of board was used for the final project version?
    The final version was built on a prototyping board rather than a breadboard.
  • Does the Arduino read the pulses generated by this setup?
    Yes, an Arduino reads the pulses produced by the modified stepper motor.
  • What is the result of using op-amps in this circuit?
    The result is a fairly clean square wave derived from a noisy input.
  • Can motors be used for purposes other than their intended function?
    Yes, generators and motors are often interchangeable or usable for unintended purposes.
  • Where did the schematic for this project originate?
    The schematic was borrowed with credit from an earlier post by Andriyf1.
  • Why might someone need a rotary shaft encoder during self-quarantine?
    Items like rotary shaft encoders may be in short supply when stuck at home.

About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter
Scroll to Top