In this article, I will cover what I believe to be the Swiss Army knife of modern electronic peripherals. I can't tell you how often these are needed and has proven to be indispensable to me in the past on more than one occasion. For instance, DFI, a popular car computer manufacturer, charges 80$ for a “special” cable that connects your personal computer to their computer. Similarly, SuperChip, an electronic car tuner that I own, charges 75$ for their “special” cable. Even without looking at the cables, I had a pretty good idea what was inside of these “special” cables. My suspicions were confirmed five minutes after testing one. I will show you how easy it is to build one for only 5$ worth of parts!!!! (DFI and SuperChip, among many others, are only marking up the price 1600%)
The RS232, also more commonly known as the serial, specifications specifies that a logic '1' is represented by +12.5V and a logic '0' is represented by -12.5V. (Technically, the specifications define it as above 3.0V or below –3.0V, but most manufactures use 12.5V. However, some laptops have been using –5V and 5V lately.) This obviously presents many problems for microprocessors that are running at +5V or even 3.3V. That is where the level translator comes into play; it translates -12.5V to 0V and 12.5V into 5V, standard TLL logic levels. This makes interfacing with the microprocessor extremely easy since most have built in UART’s (Universal Asynchronous Receiver/Transmitter).
The schematic below shows the simplicity of the design by using one of Maxim IC’s level translators. The Max233 does everything all in one convenient package. Many people are more familiar Max232, but the Max232 requires four external capacitors for the internal charge pump whereas the Max233 has these capacitors built-in. Now I will explain the other parts on the board. This design offers two methods to power the Max233, from the serial port and from an external supply.
That’s right, we can steal power from the serial port to power the level shifter. Most programs do not make use of the handshaking lines on a serial port which help with flow control. We are specifically interested in DTR (Data Terminal Ready) and RTS (Request To Send). These two handshaking lines are mutually exclusive, that is, one is always high and the other is always low. Using this, we can construct a simple diode OR gate. D1 and D2 form the logic OR gate on the signals. R1, R2, and D3 form a very simple voltage regulator with a Zener Diode. For those of you not familiar with a Zener Diode, it is a diode that operates in the reverse breakdown region (hence why it looks backwards) and breaks down at a very controlled voltage. As an interesting side note, most “Zener” Diodes don’t actually use the Zener effect because it is only applies for very low voltages, instead they use the Avalanche effect, but that’s a lesson in solid state for another day.
Alternatively, if you would rather use an external supply, simply connect the zero ohm jumper and do not solder on R1, R2, D1, D2, and D3 (more on why later). The decoupling capacitors C1 and C2 are necessary for both designs to filter out noise on the supply rail. As a word of advice, DO NOT ATTEMPT TO USE BOTH SUPPLIES. It could result in truly disastrous results. If both supplies are hooked up, there is a very low resistance (just the PCB traces and wire) connecting these two supplys. A very small voltage difference would require a tremendous amount of current to drop the voltage difference across the resistance created by the traces. Also, note that the serial port is current limited, typically around 10mA. So don’t expect to power much more than the RS233 with it.
The board layouts are shown below: