Page 67 - Hacking Roomba
P. 67

48       Part I — Interfacing




                             for a clear representation of this. When physically laying out an LED, the flat part on side of
                             the LED corresponds to the “bar” part of the schematic.

                             Understanding MAX232 RS-232 Transceivers

                             The MAX232 transceiver IC originally developed by Maxim (not the men’s magazine, but the
                             creator of some of the coolest interfacing ICs out there) performs the magic of converting the
                             0–5V positive logic signals from the microcontroller in the Roomba to the approximately +/-
                             12V negative logic signals that are part of the RS-232 standard. Instead of accomplishing this
                             conversion with a tricky circuit using several transistors, resistors, and capacitors, you just plop
                             down the MAX232 and a few capacitors and the problem is solved.

                             Virtually every microcontroller has a serial port on it, so many hackers are familiar with the
                             MAX232. If you want your little gadget to talk to your computer, chances are you’ve used
                             a MAX232. There are many circuit schematics on the Internet and in books with the MAX232,
                             but they tend to vary regarding which value of capacitors to use. Some use 10 µF capacitors,
                             some use 1 µF, and others use 0.1 µF. Which is the right value? Why do people use different
                             values?
                             The pedantic but true answer is that the datasheet for the MAX232 tells what capacitor values
                             to use. The trick is that there are slightly different versions of these transceivers that can take
                             different capacitors. One variant, the MAX233, has internal capacitors, so no extra parts are
                             needed. (It’s expensive though.) Some parts are MAX232 clones and are also called MAX232
                             but are slightly redesigned. If you have the datasheet for the exact part being used, use the
                             capacitors described in the datasheet. If unsure, use 1µF capacitors.

                             The MAX232 works by using the capacitors to create a charge pump that boosts the input
                             voltage from 5V to either -12V or +12V. The capacitors store the charge needed to make this
                             voltage. Since it takes more charge to drive long serial cable lines, generally the longer the
                             cable, the larger the capacitors will need to be. And in RS-232, long means several hundred
                             feet, not the 10-feet cable you’ll be using here.
                             Maxim will help you use their parts by sending you free samples. Just go to the Maxim web site
                             (www.maxim-ic.com), find the part you want, and click sample. This is really handy if you’re a
                             starving student and want to try out a few interesting parts. If you’re in a hurry or need many
                             Maxim parts, it’s quicker and easier to buy them from a place like Digikey or Jameco. Most of
                             their parts are only a few dollars.


                     Building the Serial Tether

                             Now that you have some understanding of the circuit, it’s time to build it.

                             It’s easy to burn yourself with a soldering iron. Be careful, always know where it’s at, and always
                             make sure to turn it off when done. Also be sure to be properly grounded so you don’t zap any-
                             thing. See Appendix A for some guidelines on soldering techniques.
   62   63   64   65   66   67   68   69   70   71   72