Using a stepper motor as a rotary encoder

I won’t ruin the surprise on what I’m working on. No laser printer, or CNC machine for me (for now?). I borrowed the concept of using a stepper motor from this: website link.  I used a LM339 for my comparator because that’s what I had, it worked fine. I have some more testing but I’m pretty sure my low resistance coils on the stepper cause my direction accuracy to be wrong as single stepping about 20% of the time. At a slow speed it works fine. I’ll test my theory out this weekend sometime. Also shown on that 44 pin vector board as I mentioned is a SR flip-flop and some logic to latch the direction and accept a reset from a MCU once the state it read. I didn’t want to deal with any clocks. I realize I could have put that all in software but I didn’t feel like it and I have a lot of vector board to fill up 🙂   The back end of the circuit can be found on the second photo. I had put a OR gate in my written schematic to automatically reset the SR (74LS279) but I dropped it in prototyping. I just got my stepper driver for the NEMA23 stepper mounted there so that’ll make a “fun” Friday night tomorrow as it’s suppose to be rainy and a little chilly out…

Another Work-In-Progress shot.. I just got my stepper driver from eBay today shown to the left. Tomorrow I'll test it out and write some code for the encoder.
Another Work-In-Progress shot.. I just got my stepper driver from eBay today shown to the left. Tomorrow I’ll test it out and write some code for the encoder.
A stepper motor encoder with directional latch (SR Flip-Flip with MCU reset) This works okay with some minimum rotation. Single stepping isn't the best but it's likely because of the low resistance coils.
A stepper motor encoder with directional latch (SR Flip-Flip with MCU reset) This works okay with some minimum rotation. Single stepping isn’t the best but it’s likely because of the low resistance coils.

Leave a Reply