Sean sent in his great project that he posted over at Make. Thanks for sending this in Sean!
The servos in your R/C car, plane, boat, or ‘copter are controlled by a stream of electrical pulses sent from the onboard receiver. The length of these pulses tells the servo what angle to turn to. You can connect your R/C receiver to an audio input on your stereo or computer and listen to this control signal directly — it sounds like a harsh, rasping buzz pitched near the low “G” on a piano keyboard.
This trick works the other way, too: Plug a servo into an audio output (like a headphone jack), then play the right sound, and you can control the servo’s position directly, without a receiver. A “mono” signal can control a single servo, and a stereo feed can control two — one on each channel.
We first learned about this clever hack at Bay Area Maker Faire 2012, from exhibitor Kazuhisa Terasaki. Kazuhisa would go on to write Smartphone Servo for us in MAKE Vol 34. His Gluemotor app, which allows you to directly control the rotational positions of two standard hobby servos through your device’s headphone jack, is available as a free download for both iOS and Android. Here we’ve adapted the same basic idea to drive a super simple robot arm with two degrees of freedom.
CAUTION: Kazuhisa’s original schematic includes two 0.1μF ceramic capacitors — one between each servo and the headphone jack. He believes these capacitors should be included as a precaution to protect the controlling device from electrical damage. We have found that running the audio signal through these capacitors badly distorts the PWM waveform and limits both the variety of servos with which TRS Drawbot can be built and the accuracy of the drawings it can produce. We have built five prototypes and used them to create dozens of drawings from four separate devices without any problems. We believe that running TRS Drawbot, even without capacitors in the circuit, is very unlikely to damage your device, but we cannot guarantee that it won’t. Proceed at your own risk.
On a standard headphone plug, the left channel comes through the outer “tip” contact, the right channel through the middle “ring” contact, and the ground connection through the inner “sleeve” contact. The acronym for these so-called “tip-ring-sleeve” connectors is where TRS Drawbot gets its name. It has no microchips or circuit boards and uses free software to turn line graphics into sound files that make almost any audio device into an on-the-go robot controller.
HOW IT WORKS
Because we have only two channels to work with, we can’t send “pen up” or “pen down” commands to TRS Drawbot, and are thus confined to single- or continuous-line artwork. In practice, this is not as much a limitation as it might seem.
There are several ways to produce continuous line art, but perhaps the most interesting is to start with a normal raster image, create a “stippled” version (which represents the image as a large number of dots), then use a traveling salesman algorithm to find the shortest (or near-shortest) single path that connects them. This type of continuous line art is sometimes called “TSP art” (for Traveling Salesman Problem). Our pals over at Evil Mad Scientist Laboratories have produced a wonderful, elegant, easy-to-use program called StippleGen that makes producing TSP art from raster image files a breeze.
The Drawbot WAVE Synthesizer software reads in an ordered list of 2-dimensional Cartesian points from an SVG file (like those output by StippleGen) and scales it to fit the real dimensions of your paper. Then, using some simple trigonometry (plus basic user-defined data like the lengths of your Drawbot’s arm segments) it converts those points into a series of angles for the servos. It also adds an adjustable “easing” delay (to make sure new angles aren’t sent to the servos faster than they can react) and automatically interpolates points as needed, so that two distant endpoints will end up connected with a straight line (instead of the curved arc the servos would otherwise naturally produce). Finally, it encodes the servo angles as a series of PWM pulses and saves the result as a raw WAV sound file.
See the full tutorial here.
Have an amazing project to share? Join the SHOW-AND-TELL every Wednesday night at 7:30pm ET on Google+ Hangouts.
Join us every Wednesday night at 8pm ET for Ask an Engineer!
Learn resistor values with Mho’s Resistance or get the best electronics calculator for engineers “Circuit Playground” – Adafruit’s Apps!
Maker Business — Lessons Learned Scaling Airbnb 100X
Wearables — Start with a sketch
Electronics — When do I use X10?
Biohacking — Project Peri – Translates Sound into Light for the Hearing Impaired
Sorry, the comment form is closed at this time.