[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”
Leave a Reply
Please be kind and respectful to help make the comments section excellent. (Comment Policy)
You know… like 3 days ago I was just thinking of doing something like this. Perfect timing HackaDay!
oh yeah, first post.
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?
This is a great little project, and I had never been to websdr. THAT is cool! great job :)
In his video, there is a Nixie clock or something in the background… on the right…
Very nice. Simple but effective.
@ 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
Yep, simple, effective. +1
@derkajames
Thanks for reminding us about the ondes Martenot.
http://en.wikipedia.org/wiki/Ondes_Martenot
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.
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.
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 :)
I can see it now a virtual amp that goes to 111. “I’ve got blisters on my fingers!”
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
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 :(
@Frogz: Jup, that’s why I use a simple passive limiter circuit to protect my sound card…