Get power out of PC RS-232 port

Copyright Tomi Engdahl 1997-2000

This text tries to clear out the mystery of how to get power out of PC serial power. There are quite many small circuit which take all their operating power from serial port, where there are no real power output pin. Examples for this type of circuits are PC mouse and software protection dongle. You might wonder how this is possible.

There is one way to get some power out of serial port: steal it from signal lines. When you are developing you own circuit which connects only the PC, then the only line which can be used are the output signal lines from PC serial port: DTS, RTS and TD.

In normal operation situation DTR and RTS are raised so they give positive voltage output (about +12V when not loaded). TD pin is in logic 1 when no data is sent which means that it is most time at negative voltage (-12V when not loaded) most of the time. The voltage at these outputs drop quite fast when load current is increase, because they are designed to drive normally only RS-232 input circuits (3-7 kohm resistance). The voltage drops about 1-2 volts every every 1 mA of load current increase. Usually the short circuit current flow is 7-10 mA (this depends on the circuit types used in PC serial port).

PC serial mouse

PC serial mouse uses typically DRT and RTS lines for generating +5V power for microcontroller circuit in the mouse. Because typical optomechanical mouse also needs power for 4 leds in the optocoupler movement detectors, there is not much power to waste. Typical PC mouse might can have the following power requirements: "+15V 4mA -15V 4mA" (taken from Microsoft mouse bottom).

A typical approach make the power for microcontroller is to use diodes to take current from DTR and RTS lines and then feed it through resistor to all of the (infrared) leds in the movement detectors. All four (infrared) LEDs are connected in series, which gives about +5V voltage drop over all leds (typical to IR LEDs used in mouse). This +5V is adequate power for low power mouse microcontroller. The serial data transmitting circuit consists of simple discrete transistor circuit to make it consume as little power as possible. The positive power supply usually taken from RTS and DRT lines (just after the diodes and before the resistor going to LEDs). The negative supply for transmitter is taken from TD pin. Typical PC serial port mouse takes 10 mA total current and operates at voltage range of 6-15V. For more information about PC mouse operation check my PC mouse protocol document. Some schematics of working PC mouse impelementation can be found from PC Mouse Implementation Using COP800 (AN-681) from National Semiconductor and Implementing a Simple Serial Mouse Controller using PIC16C5x (AN519) from Microchip.

My circuit

The following circuit is an example how to get power from RS-232 serial port. It gives regulated +5V power for logic circuits and also unregulated positive and negative power supplies for RS-232 transmitting circuit. The circuit gives only few milliampres power output because the power available from serial port is limited (and resistors R1, R2 and R3 limit current more).

Circuit diagram

Modification idea: Use the circuit with 9 pin serial port

Modern PCs have typically 9 pin port instead of this older 25 pin port. If you want to use this circuit with such PC you have two options: use a 9 to 25 pin adapter or modify the circuit to 9 pin port. To do the conversion you have to make the following modifications to the circuit pinout:

 25 pin    9 pin

   2         3
   4         7
   7         5
  20         4

Modification idea: Get more current

You can get a little bit more current from the circuit if you leave out the resistors (R1, Rs, R3) and replace them with short piece of wire. 78L05 regulator takes 3-4 mA current all the time and needs at least 2V voltage drop, so if you can find a similar regulator which takes less current and has lower voltage drop, you get more current for your circuit. One this kind of circuit can be found at http://www.epanorama.net/counter.php?url=http://www.ee.washington.edu/eeca/circuits/serialpower.txt.

Other circuits

Some small circuits signal input circuit I have seen have taken positive and negative supplies for simple operational amplifier circuit just by using DTR and RTS lines. Just by driving one of them to 1 and other to 0 using suitable software routine, there are available positive and negative voltages from those pins.

Some simple circuit which does not take much power (less than 2 mA) can take their power simply from one serial port line (DRT, RTS or TD). I have used this approach at my Serial Port A/D-converter circuit, where is have taken power from DTR line and regulated it to +5V with 1 kohm resistor and 5.1V zener diode.

David Tait has designed a regulator circuit which takes port from RS-232 port and gives out regulated +5V. That circuit is based on two standard transistors and few other components. You can download the circuit at http://www.epanorama.net/counter.php?url=http://www.ee.washington.edu/eeca/circuits/serialpower.txt

How much do I really get power ?

How much you can really draw from a serial port depends on the circuit technology used in the serial port. B&B Electronics Connection Newsletter number 2 has a good article "Tips For Using Port Powered Converters" about how much you can really get power from different serial ports. The following data is extracted from the article text:

Type of   State of   Voltage     Voltage/current     Power available from 
Driver    Line       at no load  per driver (max)    3 driver outputs

1488      positive   +9..11V     +5V @ 6.5 mA        98 mW
1488      negative   -9..11V     -5V @ 6.5 mA        78 mW *
MAX232    positive   +7.5V..8V   +5V @ 5 mA          75 mW
MAX232    negative   -7.5..8V    -5V @ 3.5 mA        42 mW *
EIA-562   positive   +3.7..5V    +4.5V @ 1.5 mA      none
EIA-562   negative   -3.7..5V    -4.5V @ 1.5 mA      none
NOTE: The power ratings are what can be obtained used the methods B&B Electronics uses in their circuits. The values marked with * are the power available after the negative power is converted to positive +5V with extra electronics in the circuit connected to serial port.

Here is another table how much power is available from different computers form RS-232 port RTS line and how the load affect the available voltage. Information is collected from the RS-232 powering articles posted to sci.electronics.design newsgroup. I have not verified those results but those seems to be quite similar values what I have found in my RS-232 experiments and should be applicable to also to other RS-232 port lines in PCs (TXD and DTR).

Computer           no load      8mA load

Toshiba Laptop      8.4V        4.0V
Pentium 133 bd     11.5V        7.0V
Pentium 90 bd      11.5V        6.0V
286 Computer       11.5V        3.6V
The choice of processor does not affect the RTS line drive, they are only listed to distinguish between the different machines. The only thing which affects the output current capability is how the serial port interfaces implemented in motherboard or in I/O card (which driver IC is used).

Beware of combining pins for more output because using two pins does not necessarily give double the power. Many modern RS-232 output buffers use charge pump circuit to generate the RS-232 voltages form +5V source and it will often be a charge-pump converter which limits things (i.e. on all pins) rather than the individual pin drivers, especially on laptops.

Driving relays using RS-232 port power

If the serial port is used for no other purpose then to operate one or two devices use the RTS and the DDR line. They can be set and reset by simple I/O commands to the serial port chip (UART).

Using a 3-8VDc Solid State Relay

If the solid state relay operates at 5 mA input current range you can run it directly using the following circuit:

        1N4148
 RTS-----|>|------[ + SSR input - ]---------GND
If the 5 mA is not enough for the semiconductor relay then you can can combine the power from two RS-232 output lines together using the following circuit
        1N4148
 RTS-----|>|-+----[ + SSR input - ]---------GND
             |
 DTR-----|>|-+ 
When using this combination circuit you must remember that both RTS and DTR lines are controlled at the same time. If you have only one line activated at the time there is no guarantee if the relay is activated or not if it takes more than 5 mA.

Micro Electronic Relays

Using a 3 mA Input 'Micro Electronic Relay' or 'Photovoltaic Relay' The exact terminology depends on manufacturer. They are basicaly very sensitive opto couplers that have a MOSFET transistor output. ( DC ) Or thet have 2 MOSFETS back to back for switching AC.

       1N4148     R
RTS-----|>|----/\/\/\/\----[ + opto inp. - ]------GND 
The resistor R value should be calculated so that the current flowing through the "relay" is around 3 mA.

Sensitive reed relays

You can drive directly a sensitive 12V reed relay that has a minimum coil resistance of 1200 Ohm.

DTR--------( 1200 ohm 12V reedrelay coil )-----------TXD
Internal current limiting in the RS232 drivers will give a combined voltage of 0 or about 12V to the relay depending on the level of the DTR line. When the DTR and TXD lines are at different potential the relay gets energized and when they are at same potential relay gets no power. TXD line is normally at negative potential when no data is sent so the relay gets energized when DTR line is raised.

Controlling the relays with software

The serial port DTR and RTS pins can be controlled by directly writing to the I/O-port address which is the RS-232 port base address + 4.

The bits what you should set to that port are following:

In the relay controlling circuit examples above +12V energizes the relay and -12V does not nergize it. Here is a short table of different values you send to serial port and the states different pins get:

Value    DTR     RTS
sent     state   state

 0       -12V    -12V        
 1       +12V    -12V  
 2       -12V    +12V
 3       +12V    +12V 

The standard I/O port addresses for different COM ports are following (in some systems are are some different one used sometimes):

Serial   Typical I/O    Memory location (in DOS) where
port     address        I/O address in use can be read

COM1      3F8h          0040:0000
COM2      2F8h          0040:0002
COM4      378h          0040:0004
COM4      278h          0040:0006
Straigt controlling the I/O ports if the serial port controlling chip is usually the mist straightforward way to do the relay controlling.

For actual programming code examples take a look at my Parallel port interfacing made easy article program examples. Just change the I/O port addresses and the values uou send to the port to match the one tols this article and the examples are usable.

Tips for designing RS-232 powered devices

Remeber that different RS-232 drivers provide differing voltages and currents. You'll probably wind up having to check which driver chip is being used in the system you want to tap (if power's really tight) or make sure your requirements are so low that it doesn't matter.

In IBM PC world RS-232 ports use typically the MC1488 drivers. They are current limited to +/-10ma. The "equivalent schematic" on datasheet shows 300 ohms in series with the output, and additional 70 ohms in series with the driver transistors. Typical Vcc and Vee are +/- 12V +/- 10%. This is at a junction temperature of 20 Celcius.

If you are using all outputs, you may be able to count on only 7.5 ma per output in the typical pcb thermal environment. The data sheets have a curve of the value of this current versus junction temperature.

If you are going to combine outputs to get more current, try to use drivers from different 1488s, so that you do not unduly shorten their life by overheating them. And put diodes in series with the leads so they don't try to fight each other.

Possible problems with new computers

In the last few months there have been increasing notification of problems on lap-tops and a few desktop computers because the serial port signals are only driven to +-5V (rather than 12V nominal current limited on PC's etc.). So if you go for such a design make sure it will work on +3 and -3V - all you may have left. Longer term USB may be taking over - something to think about if you are going into production.


Addition 05/2004:

There are better regulators chip for this application than the 7805. For example the LM2931 from National Semiconductor has a very low voltage drop and a very low quiescent current. I think this IC would be worth to try for this circuit. Datasheet for this IC can be found at http://www.epanorama.net/counter.php?url=http://www.national.com/ds.cgi/LM/LM2931.pdf.


Tomi Engdahl <then@delta.hut.fi>