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. Coolhack but reading a rotary encoder with a PIC or an ARM is really not hard and they come with USB interfaces. Still a great hack if you have the parts laying around.

  5. That is neat, you can get USB soundcards inexpensively (~$3-$5) for this.

    Who wants to build a giant (4-8 foot) knob with a car alternator?

    I do, that is for sure :)

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

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

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s