Houston, we have blinkenlights!

I built my AVR programming cable. I had to desolder the existing wires off of the connectors, and then double check the pinouts of the 10 pin in circuit programming interface, trace the leads on the Olimex board to make sure everything was kosher, figure out which wires connect to which pins in my female 10 pin ISP header, double check the parallel port pinout, and put it all together. This took a couple hours, mainly because I kept getting interrupted to read Big Max.

Parallel port with the SCK, MOSI, and MISO resistors added

Yes, that’s a solder bridge between pin 1 and pin 2 that I later had to remove. Note the hemostats holding the resistor and wire about to be soldered in place. Love my hemostats! Can’t imagine how I did without them back in the dark ages of alligator clips. (MSP locals: Axeman surplus has a crapload of hemostats in all sizes at their St. Louis Park location, at least at the time of this writing.)

Now, if you arrived at this page via google, and you want all of the pinout information in one handy place, I compiled this fine table for you. KEEP IN MIND that this table is for a PC parallel port programming cable only! I cannot be held responsible for anything you do with this information. This is how I built mine and it works fine for me, but if you blow up your parallel port it’s not my fault.

ISP pin Name Parallel port pin
1 MOSI 2
2 VCC not connected
3 LED not connected
4 GND not connected
5 RESET 16
6 GND 18
7 SCK 1
8 GND not connected
9 MISO 11
10 GND not connected

According to the Ghetto Programming: Getting started with AVR microcontrollers instructable, you don’t need protection resistors in your programming cable, but I added some in anyway. As per this article, I put a 470 ohm resistor on MOSI and SCK, and a 220 ohm resistor on MISO.

Once I made the cable it was time to upload some code! Unfortunately, I needed a method of powering my board. I didn’t order a power supply from sparkfun because they were backordered and I didn’t want to wait. Unfortunately, we don’t have a single wall wart in the house that has the right connector on it. The board will take 6-9 VAC or 9-12 VAC so I had plenty of candidates but none of them fit. At this point I got very impatient and decided to MacGyver a solution.

Back in college, I wanted a serial cable for my HP-48G. Being an intrepid Electrical Engineer (this is before I switched to Computer Science), I decided to make one. I couldn’t find a CD-ROM audio cable (CD-ROM drives being pretty rare at the time), so I hacked together a connector using wire-wrap socket pins, cardboard, glue, and easter egg grass. The rest of the guys in the dorms refused to plug my hacked cable into their precious HPs, so I would transfer the programs to my calculator, and beam them over to theirs. Of course, I still have the cable. (This is just a picture of the cable and has nothing to do with AVR programming!)

Homebrew HP-48 cable

I bet you can see where this is going. I studied my prototype board for 3 or 4 minutes, trying to figure out how I could get input power to the power supply. I looked at the + and – outputs of the bridge rectifier, and a plan began to form. First, I grabbed some pliers and pulled a couple of pins out of a wire wrap socket I had laying around.

Wire wrap socket with pin missing

Wire wrap pin

I could attach each pin of the rectifier to a single wire-wrap socket pin, and then wire wrap some leads that I could then splice on to a 9 volt battery connector.

Wire wrap pins connected to the bridge rectifier

Top view

Would it work? Only one way to find out. I used some hospital tape to tape off my non-connected cable wires, and I plugged my cable in to the back of my computer. (My electrical tape is still lost from The Move.)

I'm so hardcore I just plug resistors into the back of my computer

Although it looks like I’m super hard core and I just plugged some resistors into my parallel port, in reality those resistors are soldered on an appropriate connector. I just couldn’t get a good angle to take a picture of it because of where my computer is located. I then loaded up the sample program from the Ghetto Programming guide, uploaded it to the AVR… and didn’t get any blinking lights. Took me a minute but I figured out that the Ghetto Programming guide assumes you have an LED connected to pin 4 of Port D and the Olimex board has the LED on pin 5 of Port C. After making the appropriate code changes:

Hooray, it worked!

The blinking was a little frenetic, so I modified the code to give it a more pleasing blink rate.


I suspect that the #define F_CPU 100000UL line is wrong for my microcontroller running at 8Mhz. Bah, I want to eventually code this thing in assembler anyway, but borrowing this C code was the fastest way to get something up and running.

Alas, not all is sunshine and rainbows: at one point during the debugging process, the uploading process failed. Why? Gremlins! Who knows, maybe it’s random noise because I have a bunch of resistors hanging off the back of my PC.

Anyway, I’ve since worked out a more permanent power solution for the board. Until I get around to ordering some breakaway female headers, I basically have a light, a switch, and a serial port. Any good project ideas? Peggy said I should write an app to scrape RSS feeds and send the articles in the RSS feed a character at a time to the AVR, which would then blink the characters on the LED in Morse code. I devised a lookup table to contain the Morse code for each ASCII character but I’m not sure I’ll follow through with actually building the thing.

Leave a Reply