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.

Comments

  1. Jay says:

    You know… like 3 days ago I was just thinking of doing something like this. Perfect timing HackaDay!

    oh yeah, first post.

  2. derkajames says:

    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?

  3. mess_maker says:

    This is a great little project, and I had never been to websdr. THAT is cool! great job :)

  4. markii says:

    In his video, there is a Nixie clock or something in the background… on the right…

  5. MS3FGX says:

    Very nice. Simple but effective.

  6. Stefan Rehm says:

    @ 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

  7. Roly says:

    Yep, simple, effective. +1

    @derkajames
    Thanks for reminding us about the ondes Martenot.

    http://en.wikipedia.org/wiki/Ondes_Martenot

  8. morcheeba says:

    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.

  9. lwatcdr says:

    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.

  10. nubie says:

    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 :)

  11. Hacksaw says:

    I can see it now a virtual amp that goes to 111. “I’ve got blisters on my fingers!”

  12. Frogz says:

    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

  13. Frogz says:

    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 :(

  14. Stefan Rehm says:

    @Frogz: Jup, that’s why I use a simple passive limiter circuit to protect my sound card…

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

Follow

Get every new post delivered to your Inbox.

Join 94,572 other followers