Conclusion
Once you get the hang of using TRS Drawbot, experiment with the different effects you can create by changing pens, substituting in other marking tools like pencils or crayons, working on different types of paper, adjusting the hardware, and tweaking the WAVE synthesizer parameters. Pens that "bleed" into the paper can create interesting effects at slower drawing speeds. For instance, dramatically increasing the endpoint "dwell" time in the WAVE Synthesizer code to a second or longer causes an interesting "connect-the-dots" effect with a felt-tip marker.
Likewise, the amount of sliding friction under the forearm will affect line quality. If the forearm does not make contact with the page surface at all, and is resting only lightly on the pen tip, the pen's movements will be faster but less stable; sometimes a "shaking" phenomenon occurs that creates an interesting sketch-like effect. Contrariwise, if the forearm makes firm contact with the page, the pen will be less responsive, but will produce smoother lines. You can also adjust the weight of the line by setting the pen lower or higher in the cable clips. A pen set lower in the clips gets pushed harder into the page, and creates a heavier line.
Will it Work with My Device?
Almost any digital device with a headphone jack can be adapted to drive TRS Drawbot, but some will require more work than others, and some may be capable of producing higher-quality drawings. Here are some important factors to consider:
- Volume – Some devices are louder than others, meaning they produce higher voltages at maximum volume. A handy test is to download the file sine-wave.mp3 and play it through your device at maximum volume while measuring the AC voltage across either the right or left channel, and ground, using a multimeter. As a general rule, your device should produce a reading of 0.6V or greater, under these conditions, to be usable. If your device is not loud enough, you'll need to add an external amplifier, or choose another.
- Sampling rate – In theory, higher-sampling rate devices capable of 192kHz "high definition" audio output should produce more accurate drawings, since the width of a single sample at even 96kHz (the next-lowest common sampling rate) is a significant fraction of a normal servo "high" pulse width. Most current iOS devices are reportedly capable of 192kHz output. However, we have never actually observed a clear increase in drawing quality when using an HD-audio device.
- Wave inversion – Some devices actually invert an audio waveform before sending it to the headphone jack. For acoustic purposes, this inversion makes no difference whatsoever. But for controlling a servo, an "upside down" PWM signal doesn't work at all! To figure out if your device inverts audio, connect it to an oscilloscope while playing the calibration_90.wav sound file. If you don't have an oscilloscope, download and install Christian Zeitnitz's Soundcard Scope, which lets you use your PC microphone jack for this purpose. If your device is inverting the audio waveform, check the "Invert Wave" box in Drawbot WAVE Synthesizer when creating your control WAVs.
As a general rule, a modern iOS device like a Macbook Pro, an iPad 2 or Mini, or a 5th-generation iPhone or iPod is going to be the best "sure fire" choice for controlling TRS Drawbot. These devices produce plenty of power at maximum volume, have high digital sampling rates, and do not invert waves. That said, you should not shy away from the challenge of adapting your device to the task — what you'll learn along the way will likely be worth the journey.
General Troubleshooting
Early TRS Drawbot prototype test. I had the servos wired backwards.
TRS Drawbot is quite simple electrically; there's not too much that can go wrong. Here's a quick checklist of common glitches to watch out for:
- No movement – Measure the DC voltage across the rails and make sure it's at least 5V. If not, make sure the batteries are freshly charged, the battery pack power switch is on, and the wiring is correct. You can always run TRS Drawbot from a wall wart if you don't want to mess around with recharging batteries. Also make sure the volume on your device is turned all the way up, the "mute" function is disabled, and that your device is loud enough to drive TRS Drawbot (see above).
- Wildly erratic movements – Make sure you've got TRS Drawbot wired with the lower "elbow" servo connected to the TRS jack's "ring" (right channel) contact, and the upper "shoulder" servo connected to its "tip" (left channel). If the servos are wired backwards, TRS Drawbot is likely to produce wild sweeping arcs that bear little resemblance to the intended art.
- Shaking – Make sure the servo spline gears are firmly seated in the horns and that the horn mounting screws are tight (but be careful not to overtighten or strip them). Increasing the sliding fiction between the forearm and the page — either by increasing the height of the drawing surface (a stack of blank paper underneath the working page is handy for this), lowering the pen in the clips, or (in the extreme case) demounting the forearm and bending it to a steeper angle — will correct most shaking problems. They can also be caused by failing batteries and low control signal voltages.
- Skewing – If your drawings are off-center on the page or show strong "skewing" or other warping effects, it's a good bet TRS Drawbot is not properly calibrated. Check your math on the "nudge" angles and make sure you've got the positive/negative signs right. If that doesn't fix the problem, repeat the Step 7 calibration procedure in its entirety. If all else fails, try experimenting with the servo pulse width range fields in the Drawbot WAVE Synthesizer interface. We've found that some servos respond better to wider ranges than those listed on their datasheets or other sales literature.
Finally, if you encounter a problem we haven't listed here, please do leave us a comment below or send us an email at editor@makezine.com. We'll do our best to help you (and others) figure it out!
Going Further
TRS Drawbot uses an "open-loop" control system, which is a quick way of saying that neither the hardware nor the software gets any feedback about the real positions of the servos, and that the system depends on dead reckoning for accuracy. While you could certainly add positional sensors or use feedback servos, these would require a more complicated interface than the 2-channel stereo TRS connector allows. To put it another way, adding sensors or extra controls would mean building not a TRS Drawbot, but something designed to communicate over a more robust interface — perhaps a USB Drawbot. Many mobile devices now use a 3-channel tip-ring-ring-shield (TRRS) connector to provide both stereo audio output and monoaural microphone input through the same connection. Though it would require a much more sophisticated real-time control application, this interface could theoretically be adapted to provide "closed-loop" feedback and produce a TRRS Drawbot capable of improved accuracy.
That said, there are lots of ways TRS Drawbot could be added to or expanded on without changing the hardware/software communication protocol.
Software
If you're using a felt-tip or other marker that "bleeds" more into the paper the longer you hold it in one spot, you could create a more sophisticated WAVE synthesizer that would slow the pen down to create broader, more emphatic lines, and speed it up to create narrower, lighter ones. It could be written to parse the SVG "stroke-width" property (so you could specify wide or narrow lines naturally, e.g. in Inkscape) and slow down or speed up the pen's movement accordingly.
A real-time or near-real-time control application could be developed that would do more than just play prerecorded drawing files. Kazuhisa Terasaki's original Gluemotor program is an example of this kind of software; the Gluemotor app reads your finger's position on a touchscreen and converts it instantaneously to a pair of PWM signals — one that corresponds to your finger's X position on the screen, and one that corresponds to its Y position. These coordinates are mapped directly onto the angular ranges of the two servos on the right and left audio channels. Gluemotor, however, does not know anything about how the two servos are arranged with respect to each other in the physical world, and using it, for example, to manually draw a picture using TRS Drawbot would require a lot of practice to develop the hand-eye coordination to turn your input motions on the screen into the intended output motions on the page. A better solution would be a Drawbot-specific program that would map your touchscreen directly onto the TRS Drawbot page area, for instance, so that a gesture on your touchscreen was literally echoed by the Drawbot's pen on the paper.
Electronics
Though the circuitry is quite simple, the accuracy of TRS Drawbot can likely be improved by using higher-quality, more expensive servos. Digital servos and/or servos with metal gears should offer improved angular precision and accuracy, and specialized servos with wider-than-normal pulse width ranges should allow improved precision in WAV file synthesis, especially at lower sampling rates, because the width of a single "high" sample will correspond to a finer angular adjustment.
Mechanics
Mechanical play in the arm assembly will cause some inaccuracies. Longer arms lengths will tend to amplify mechanical slop. Using higher-quality servos with ball bearings would likely reduce them. Likewise, more complex arm linkages — like "parallelogram arm" arrangements — should offer more accurate positioning even over longer distances.
Finally, though there is no direct way to issue "pen up" or "pen down" commands using the TRS interface, there may be clever mechanical tricks that would allow the software to move the pen across the page with or without making a mark, as needed, and thus to create more conventional line drawings of the "non-continuous" type. One such trick would be to develop a "slow pen," which would be a pen that only makes a mark when it is moving slowly across the surface of the page. Because the TRS interface can control both the position of the pen on the page and how fast the pen moves from one position to another, a "slow pen" could be directed to move quickly between endpoints where no mark was to be made ("pen up" movements) and slowly between endpoints that are supposed to be connected by a mark ("pen down" movements). Whether such a pen could be built easily enough to make it worth the trouble remains an open question.
Controlling Other Devices
What other projects could you talk to using a headphone jack? In the simplest case, what other two-servo robots could you build and control with just a headphone jack and the right audio synthesizer software? Or, could you develop more complicated onboard electronics for processing more complex or custom-designed audio-channel signals? Is the audio interface potentially a way "around" the iOS walled garden for hardware developers? Even if you can't get Apple to approve your device, can you design it to run from the headphone jack using audio commands? After all, even a web-based app can send sounds to the speakers...
Please Share Your Experiences
If you build TRS Drawbot or a project closely based on it, or if you just have ideas, insights, or comments to share, we want to hear from you! Please leave a comment below or get in touch with us by email to editor@makezine.com.