Even with the serial port's limited capacity, serial-port power can still be a convenient power source for today's electronics. Here's a simple way to tap its power.
Just like a PC's USB port, the serial port on a PC can also in some cases be a source of power. A USB port can provide as much as 500 mA at 5V, but a serial port provides less power. Even with the serial port's limited capacity, serial-port power can still be a convenient power source for today's electronics. One obvious example is to light up an LED. Figure 1 shows a simple way to tap the serial port's power.
*Figure 1: With the aid of a simple PC program, you can tap a PC's serial port for enough power to light an LED.*
A far more useful case is to provide a power supply for the microcontroller programmer, which has no wall wart. Today's microcontrollers consume less current than their predecessors, so you can easily tap the serial port's power for an Atmel AVR programmer (figure 2). The programmer uses only two chips: IC1, a Maxim DS275 for the RS-232 interface between the programmer and the PC, and IC2, an Atmel AT89C2051 firmware microcontroller, which is the heart of programmer and handles all programming chores and communications with the PC. IC3 is the AVR microcontroller, an AT90S1200/2313. You can also substitute an eight-pin AT90S2323/2343 or a 40-pin AT90S4414/8515. The SPI (serial-peripheral-interface) bus performs the device programming.
*Figure 2: This microcontroller programmer gets its power from the PC's serial port.*
The basic requirement is that the circuit's total current consumption must be less than 10 mA. The programmer uses two RS-232 pins: DTR (data-terminal ready) and RTS (request to send) as a minuscule power source. The outputs from these pins arrive at a pair of Schottky diodes, D1 and D2, which cause a forward-voltage drop of only 0.3V, and then to VR1, an LM2936 low-dropout-voltage regulator. Capacitors C1 and C2 smooth the output voltage. To reduce current consumption, LED1 uses a 1-kΩ current-limiting resistor, and the control firmware turns it on only after the programming task completes; otherwise, LED1 is off.
The circuit for the programmer is easy to build. The 8051-like AT89C2051 has 2 kbytes of flash program memory. It needs no components connected to the reset (Pin 1), and it uses the 3.58MHz ceramic resonator to generate 9600 bit/s for communication with the host PC. In addition to eliminating an external power supply, the programmer needs only firmware design. The programmer uses the Windows HyperTerminal program to communicate with the programmer firmware. You configure the HyperTerminal to use a COM port with 9600 bit/s and set the flow-control parameter to XON/XOFF.
This article is a Design Idea selected for re-publication by the editors. It was first published on April 26, 2007 in EDN.com.