Rotary Encoding With Your Soundcard

[Stefan] sent in this project writeup to show us how he used a stepper motor as a rotary encoder. Using a stepper motor as an encoder isn’t really that new, as [Stefan] points out, we’ve seen it several times before. He wanted to use this in the quickest simplest way with his computer though. Instead of doing any decoding on a separate microprocessor, he’s connected the stepper directly to his sound card and written code to do the rest. You can download that code and see a video of some practical applications on his site.

14 thoughts on “Rotary Encoding With Your Soundcard

  1. I see great potential to use this setup in constructing a French Connection-style Ondes Martinot controller for max/msp. Through a decent quality audio interface, the resolution would be nice and high! I know I certainly don’t have the chops to make it all play nicely. Any takers?

  2. @ derkajames:

    You wouldn’t need an expensive audio interface as only the edges of the motor’s signals are detected, so signal/noise ratio etc. doesn’t really matter. I successfully tested the circuit/soft with a noisy AC97 on-board sound, a cheap old sound card (both in my linux pc) and the internal audio of my macbook.

    @ markii:

    Yes, it’s a nixie clöck in the background. Some pics:
    http://dl.dropbox.com/u/574699/clock/index.html

  3. Nice work – excellent hack!!

    Let me just re-emphasize the importance of those diodes… without them, you can easily generate > 50v by spinning the stepper motor by hand — that would blow out the audio card, and possibly more.

  4. wow…
    no one posted the 1 obvious thing…
    a unloaded stepper can generate significant voltages at fairly low speed
    my little 5 volt .1 amp 1 can generate 20 volts at less than 100 rpms
    my BIG stepper can generate 60 volts turned with a gear box from a powerwheels and its also rated at 5 volts

  5. hm…
    i’d actually be willing to try this with 1 of those $3.99 shipped chinese “5.1 hd” audio dongles
    but instead of a dedicated program, why not a intermediate dll that loads the regular driver and takes data from it
    bleh….
    guess i know my next project :(

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.