"TTY232-TAP" RS-232 to Teletype Current Loop Interface (90-701-A) =================================================================== Dec 2000, Gil Smith, gil@vauxelectronics Also see: "TTY232" Teletype Loop Supply and RS-232 Interface (90-700-A) Contents: ========= Description Assembly Techno-poop Parts List Description: ------------ This gizmo allows an RS-232 port to tap into an externally-powered (and current-limited) teletype current loop. It is for a half-duplex single send/receive loop, using 20 to 60 mA (150V max). Auto loop polarity is provided by a bridge. The RS-232 interface is self-powered, deriving operating voltages from RTS, DTR, and/or TXD lines. The RTS and DTR lines also drive open-collector transistors, for auxilliary functions such as keying a radio. These lines are not isolated, but the TTY loop is fully opto-isolated. This is a small pc board (0.6" x 1.5") which fits into a DB9-to-DB9 adapter housing. It uses surface-mount parts in sot-23 (dual-diodes, transistors) and 1206 (resistors/caps) packages, and it uses both sides of the board. The optos, bridge, and drive transistor are through-hole parts. It can be built for about $15. It will plug directly into a PC's 232 port -- you can solder a 1/4" phone plug/cable directly to the pcb, or put a second DB9 on the other end for a cleaner finish, and access to the buffered RTS and DTR lines as well. Assembly: --------- Inspect the board for shorts/opens before starting (not likely, but it is a prototype pcb). Note that square pads denote negative pins (caps, diodes...), or pin-1 (ICs, connectors...). Use a low-wattage soldering iron with a small tip. Use a rosin-core solder -- there's no need to clean the board with chem-spray (you could goop up the connectors inside). Do the smallest to the largest parts (resistors, caps, chips...). You need tweezers, a good light, and a steady hand for the surface-mount parts. Be in a good mood (or you might smash things), and don't drink coffee if it makes you jittery. Tin one pad of a part on the board, then pick up the part with tweezers, hold it in position over the pads, melt the solder on the pre-tinned pad and drop the part into place (holding it until the solder solidifies). Then solder the other pin(s) of the part. Finally, reflow the solder on the first pad. The DB-9 connectors push over the ends of the board, and are soldered into place. OOPS! I forgot to add clamp diodes across the base-emitter of Q2 and Q3. Tack a 1N4148 on each (anode to emitter, cathode to base). Yeah, it looks cheesy. The transistors will likely be fine, but it's bad practice to reverse bias that much. I'll fix this on the next rev (if there is one); I might add a second bridge for full-duplex as well. Techno-poop: ------------ A small amount of power can be drawn from an RS-232 port for running a peripheral device -- for example, a mouse powers its circuitry this way. Both positive and negative voltage rails may be derived from a serial port, even regulated to drive a microcontroller, etc. This TTY232-TAP circuit only needs to obtain positive and negative voltage rails for sending 232 levels back to the computer on the RXD line, which is directly switched using an optocoupler from the current loop. The TXD line from the PC directly drives another optocoupler, with no intervening circuitry. For this circuit, power demands from the serial port are low. The RS-232 spec defines that a port driver should put out +/-5V to +/-15V into a 3 Kohm load. A 232 port on a typical desktop PC may provide +/-12V outputs, while a laptop may only provide +/-5V outputs on its 232 port. RS-232 drivers typically source/sink 5 to 15 mA, but the low end of the spec (5V into 3K) is only 1.6 mA, so parasitic circuits should stay below that. The RS-232 spec defines that a port receiver should be able to detect +/-3V minimum. Most RS-232 interface chips have a fail-safe input that allows an open or grounded input to be presumed negative. This allows a nice hack, since you can now use ground for mark instead of a negative supply, and drive the space to 3V or 5V logic-levels. This has some handy uses, allowing a logic gate to drive a 232 port directly (short-distance, non-production applications). While +/-5V is the minimum driver range allowed by the spec, a non-compliant driver could use a range from ground to +3V as the absolute minimum needed in special cases. Signal levels are defined as: TXD and RXD lines: Mark = Logic '1' = negative (<= -5V) Space = Logic '0' = positive (>= +5V) Control lines: Active = Logic '1' = positive (>= +5V) Inactive = Logic '0' = negative (<= -5V) There are three lines driven by the computer, that can be used to derive voltage rails: TXD, RTS, and DTR. The TXD line is marking when no data is being sent, so it is at a negative voltage (typically -5 to -12V). When data is transmitted, the TXD line drives positive for space. The RTS and DTR lines, if driven active by the host, will drive positive. TTY232-TAP uses diodes to OR all three lines (in both positive and negative directions), and small filter caps -- this provides derived V-POS/V-NEG rails. The board may be powered several ways: 1) The best way to power the board is to drive RTS and DTR to opposite levels. A typical mouse driver sets RTS active (positive), and DTR inactive (negative). This provides stable V-POS/V-NEG rails. 2) The next best case will be when the positive rail is driven by either RTS or DTR active, and the negative rail is derived from filtered TXD (which will be quite negative if it is mostly marking). If TXD is busy sending data, the negative rail will float up towards ground. Having a perfect negative rail is not particularly necessary, since most receivers will accept even ground as the negative mark. Sending data with a lot of spaces may cause the V-NEG rail to rise higher than desired. This can be improved by adding extra stop bits or inter-character delays to increase the marking time, allowing the V-NEG cap C2 to charge more. Another variation is to constantly toggle either RTS or DTR for charging both rails, perhaps changing the level between transmitted characters. 3) The least-desirable case is when only TXD is connected, and it will need to charge both rails. Since it is normally marking, the V-NEG rail will likely be fine. But to get the V-POS rail lifted, the host will need to send some data to charge up the positive cap. This means a dummy header string before sending data blocks. The RTS and DTR lines also drive open-collector transistors, for auxilliary functions such as keying a radio. When the RTS or DTR line is active (positive) the associated transistor will pull to ground and sink up to about 50 mA (40V max). If you are driving a relay (or other inductive load), be sure to add a freewheel diode across the coil (anode to transistor, cathode to v+) to protect the transistor from the di/dt spike. Parts List: =========== Mouser Electronics www.mouser.com 800-346-6873 DigiKey www.digi-key.com 800-344-4539 Jameco www.jameco.com 800-831-4242 Ref Desc Source Order Number Qty $ Each --- ---- ------ ------------ --- ------ pcb gil 90-701-A 1 3.00 case DB9 to DB9 housing Mouser 157-4001 1 1.10 C1,2 cap, cer, 1 uF, 1206 DigiKey PCC1882CT 2 0.63 D1,2,3,4 diode, dual, sot-23 DigiKey BAV99ZTXCT 4 0.39 D5 bridge-rect, 400V/1A DigiKey DB104MS 1 0.60 J1 jack, DB9-F, solder-cup DigiKey 209F 1 0.67 R1 res, 2.7K, 1206 DigiKey P2.7KECT 1 0.84/10 R2,3,4 res, 4.7K, 1206 DigiKey P4.7KECT 3 0.84/10 R5 res, 1K, 1206 DigiKey P1.0KECT 1 0.84/10 R6 res, 47, 1206 DigiKey P47ECT 1 0.84/10 Q1 xstr, npn, 300V, 0.5A DigiKey ZTX657 1 0.78 Q2,3 xstr, npn, sot-23 DigiKey MMBT3904DICT 2 0.14 U1 optoisolator, 300V DigiKey H11D2ZQT 1 0.70 U2 optoisolator, 35V DigiKey H11A817QT 1 0.28 ------------------------------------------------------------------------------------------