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.
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