Ambitious, but rubbish

Flash Arduino sketches on the move via Zipit Z2

written by Gia Ferrari on 2011-06-11

One thing I've found annoying with Arduinos is the relative lack of options when flashing sketches. A PC is pretty much required. Flashing in the field requires lugging around a laptop. I came up with a solution using the Zipit Z2 instant messenger client. It's a tiny device similar in form and size to one of those newer foldable GameBoy Advance handlelds. It's an interesting platform because of ability (Can run Debian Linux, has built-in WiFi), cost ($30), and battery life (around 5 hours). Unfortunately, it has no external serial port. Fortunately, it's easy to add. Just see this blog post by Geordy Rostad: Adding a Serial Port to the Zipit Z2. I did exactly what he did, except I omitted the level converter, connecting the serial lines directly to the new connector (such a converter would be superfluous when interfacing with an Arduino). Now, my Arduinos are generally at 5V, but the Zipit works with 3.3V. This isn't a problem with data going from the Z2 to the Arduino - 3.3V is plenty to drive the inputs of a 5V device. The other way around requires a voltage divider so we don't harm the Z2. Here's a quick schematic of my converter built into the cable:

Z2->Arduino cable

As for the OS I used on the Zipit: z2sid. It's my distro of choice because it's Debian (meaning apt-get works!) and gcc works. To get avrdude (the flashing program), I just did apt-get install avrdude. I whipped up this little script so I don't have to type out the rather long avrdude commands:

avrdude -v -patmega328p -cstk500v1 -P/dev/ttyS2 -b57600 -D -Uflash:w:$1:i

Save that as, chmod +x, and use (./ my-sketch.hex). You might want to change the -patmega328p to whatever is appropriate for you. Note that the Z2 doesn't have a DTR line, meaning auto-reset won't work. You'll have to reset the Arduino manually, then run avrdude. Timing takes a bit of practice.

The product: