by on Dorkbot

Last week Eric (dr twist) and I got carried away and scored 100 Really Bare Bones Boards (rev A) from wulfden ( for $1.10 a board with shipping, along with the last group order which we ordered enough parts to make the 100 into “kits”. In order to program the 168s I built a programmer around Dean Camera’s “Buttload” ( butterfly based programmer and the 28 pin ziff socket that Paul Stoffregen ( offered to loan us.

Unfortunately I miss-wired the socket so I couldn’t program the chips last night. This was a good thing because I actually got to interact with the rest of the group. Our group is growing surprisingly interesting.

The programmer has 3 modes. In the first mode it simply acts as a programmer. In the second mode it pretends to be a programmer but stores the programs and fuse bits settings in its on board eeprom. This can then be programmed independently of the host. This third mode was the reason that I chose to use this software. I can loan the programmer with the arduino to anyone in th group who needs it.


The programmer has 3 major components. The ftdi FT232R, the Atmel Butterfly, and the “Buttload” software. Looking Dean Cameras Buttload site; and a site by Nard Awater which talks about turning the butterfly into a usb device I grabbed one of my 3 butterflies, my last unused ftdi breakout board and figured (along with Paul’s offering to loan us a ZIF socket) I would have a programmer by Monday.


Butterfly/FTDI connection

The butterfly contains an on-board level shifting circuit that inverts the RS232 signals and provides the negative swing by charging a capacitor. The technique used by Nard Awater to communicate with the butterfly is to short the capacitor to ground and then program the ftdi chips to invert the txt and rxd signals. Like many hardware utilities this requires an OBSCENING windows machine. Since I had to dig up an old laptop to upgrade the flash on my Xbee radios I was able to do it. The utility on the FTDI web site is called MPROG and it lets you invert the signals, configure the behavior of the CBUS lines, and rename the chip to something you can remember (in this case my butterfly shows up as /dev/tty.usbserial-MYBUTT01).

I shorted the capacitor (c300) on the butterfly connected the TXD, RXD and Ground directly to the serial port (grey cable in photo).

Even though windows was required I still prefer this method to removing the level shifting circuit (Though I hear Nick Lott has done it I have destroyed butterflies and never succeeded in this method). It also beats building both ends of the rs232 standard to move serial less than 2 inches.


I also wired the 3.3v out on the FT232 board to the butterfly to provide power.

upload name portion of the standard butterfly firmware. It took me a while to figure out that the firmware requires that you set up the baud rate to 19200 baud and I wound up modifying 2 butterflies in the process.


The firmware for the programmer is on avrfreaks
and like all avrfreak’s downloads you will need to register and log in.
The butterfly bootloader has a magic handshake going on that I can never figure out right but it goes something like select jump to bootloader on the board, load startup avrdude. Press and the joystick on the board until it starts and then let go. (it was pretty late by the time I got to this part so I will have to revisit this when I do another butterfly firmware upgrade).

Connecting the socket.

I adapted the generalized circuit described in Awaters zip file.

In order to use the ISP programmer the socket also requires a VCC AVCC and ground to be wired. While the BUTTLOAD programmer can produce the xtal1 signal it is extremely slow and Dean doesn’t recommend it except for foobared fuze recovery (thats why its called recovery mode). So I wired a 16mhz ceramic resonator to the socket as well.


I wasnt able to test my wiring until I went to the dorkbot meeting (we meet every two weeks) and Paul brought his 28 pin Zif. I plugged it in and put one of our brand new atmega168s in it. Before I could get the cabling done and fire up a window to program it I touched the new chip and burned my finger. I pulled the chip and went back to the conversation I was having until I could get the burner home and check my work. If anyone really demanded a bootloader, I could have done it the old way by plugging the new chip into my Arduino and burning it with my Avrisp-mkII.
Once I got it home I noticed that the socket I had installed was not cut down to 28 pins but 32! On the right side I had counted from the top end. Once this was remedied I went to checking out the software.

No Really

When I fired up avrdude I began to get sync errors. I went back to the lists and the manual and tried varying the programming speed and the baud rates. I finally decided to test the programming to the memory and this worked fine. So I went back to the output side of the circuit and found that the SCK and the MISO lines were reversed. When I tried the actual chip again it said no chip was present. I reread the manual made notes for myself and called it a night.
In the morning it was pretty clear. I had assumed for some reason that the programmer would provide a complete reset but then realized that most targets would have a 10 k pullup and indeed the reset in the default configuration tristates so that it can be left in place.The 10k pullup resitor on the reset line can be omited as long as you remember to set the RESET mode to LOGIC in the settings menu on the programmer. Things worked fine after that.

by on Thing A Day 2008

(Archive of:

Today I “made” my 12 year old son program his own robot on his own computer.

It’s not a thing necissarily but a culmination of things (1,10,24,and,26). I didn’t take photographs of him doing it but I had him download the arduino platform and then walked him through running the blink example program and then he modified it to blink for random times. After that we wrote a program together which tested the touch sensor (thing 24) by driving slowly until it touches something.

After which we were exausted and he went to sleep.

It was good way to end the month.

by on Thing A Day 2008

(Archive of:

Today I made the software for some hardware that I built a while ago.

The origional question was if I got 15000 leds for next to nothing and it costs 4-15 per 8×8 array (with the 4$ solution also needing 4 to eleven additional parts) to drive them are we getting anywhere? I looked at 2 solutions before realizing that the leds were to dim to do much of anything that interested me. One solution was to drive the led rows with cmos shift registers and sink the columns using TPIC6 based shift registers.

The other solution is called charlyplexing.

The idea is to multiplex a series of leds in a way that maximizes the leds per io pin avaliable. The led connections are paired and driven one at a time depending on the direction of the output pins. The remaining pins are tri-stated out of the way. It is a pretty intense software complexity vs hardware problem.

As only one led in the array is on at a given time, multiplexing the leds into an array reduces the brightness significantly making my near free leds impractical for this application. (These are 5×6 array, the fonts i used were for 5×7 displays)

by on Thing A Day 2008

(Archive of:

Since Aidan’s main computer is my old Del Lattitude running XP I realized that I should build a programmer for his system as it has a serial port. Basically its a max232 in a translucent plastic box with a buffer to drive some blinking lights so you know things are transmitting and recieving. Like my usb based programmer it has a cap on the DTR line to reset the board. The biggest problem I had building this was fining a db9 cable where pin4 was actually wired. The one I found was a bit bulky. The leds are “amplified” using a couple of chunks of plastic tubing.

by on Thing A Day 2008

(Archive of:

I went to radio shack about a month ago and bought an utrasonic distance sensor made by parallax called a ping))).

I have been feeling cranky and anti social lately so I thought I should make something that didnt want to be bothered.

I am considering adding an air horn for people who dont respect its limits but think that the neighbors might not appreciate it much.

by on Thing A Day 2008

(Archive of:

Two weekends ago Aidan and I went to radio shack and he was looking at these $9 bug bots which have a sound sensor, two touch sensors (antennae) and 6 legs. He was very interseted in both the walking mechanism and the touch sensor. We decided that we should add one of those to his arduino based mouse (A168).

by on Thing A Day 2008

(Archive of:

After the last two days of disaster I got a new board in the mail.

It has one of the new atmel USB avrs on it which I would like to work with instead of the the ftdi chipset for programming avrs and arduinos. Rather than attempt to do another complicated and ambitious project I decided that my first project with this board should be to run the example keyboard code that atmel provides and modify it to send a “<shift><command>B” sequence followed by a “<CR>”. The sequence I use to “bounce” the 5o or so pieces of e-mail that get past my already overambitious mail filters.

I needed a button!

So I used the rem from resin for the displays to cast this one.

I thought a “Display” might not be a bad idea either.

by on Thing A Day 2008

(Archive of:

Since I had so much trouble yesterday porting with getting the bootloader on a new processor I though I should try something easier (these are things that I have been meaning to do for some time so it seemed appropriate to try them on a timeline).

Recently someone published the code for an Stk500v2 based bootloader for the new wiring platform. I have wanted to run wiring on several of the systems I have using the mega128 and the olimex header board that sparkfun sells. Between sparkfun and Ebay my per board cost is about 11 bucks. With the ftdi ft232rl usb to serial chip at $4 that would make the wiring platform affordable :)

On top of the latest wiring platform not running at all on my g4 I could not get the bootloader on either the sparkfun board or the et-avr-stamp that I had on the bench.

It turns out that part of the solution to this was in the next rev of the wiring software which fixed the bootloader issue. Once I got the bootloader to work with wiring I realized that the wiring platform requires a 32khz clock crystal to be connected to tosc1 and tosc2. Once this was added to both boards things started working.

by on Thing A Day 2008

(Archive of: )

I wound up on the bus for much of the day so I took my laptop and ported the arduino “Core” to atmel’s Mega644 which has 4 times the memory of the new arduino as well as almost twice the number of pins avaliable. When I got to the bootloader I failed. This was a bit ambitious so I suppose I shouldnt be suprised. I will do another thing and post it here if I don’t get the bootloader working by the end of the month.