Microcontroller programmer taps power from PC’s serial port
A PC's serial port can supply enough power to supply a microcontroller programmer.
GY Xu, XuMicro, Houston, TX; Edited by Charles H Small and Fran Granville -- EDN, April 26, 2007
Just like a PC’s USB port, the serial port on a PC can also in some cases serve as a power supply. 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. Under Windows XP, this task requires appropriate software. You can download the listings for this Design Idea and run the program pwon.exe for this demo.
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.
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.58-MHz ceramic resonator to generate 9600 bps 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 bps and set the flow-control parameter to XON/XOFF.
You can program the firmware files in Listing 1 into the AT89C2051 using any 8051 programmer, and the listing includes one AVR sample demo file to program into the AT90S1200/2313.


















