
Another rumbling done.
Meg Blake, John Martin, Peter Martin, and I ported Tetris to the medium of sugar. A full build writeup will soon be a rumbling on John’s new site, rumblings.org.
Update: John’s post is up.
I (finally) have a project taking up the idle cycles of my brain, the first step of which involves figuring out how to use a magnetometer. The project will eventually use the digital compass, accelerometers, perhaps a gyro, and maybe absolute forms of positioning like an IR camera. I’m being slightly vague about this project both because the idea is by far the coolest thing I’ve ever come up with and because it is still somewhat short of half baked.
Anyway, Honeywell recently released a rather reasonably priced three axis magnetometer, the HMC5843, which SparkFun carries a breakout board for. It interfaces over i2c, which is conveniently supported in hardware by most AVR microcontrollers, including the ones used on Arduino. Arduino is something of paradox. On one hard, the hardware is so simple and easy to use, vastly cutting down on the amount of time I need to spend arranging parts on a breadboard. On the other hand, computations that should take a few operations instead call long functions that get compiled into hundreds, and the IDE makes me want to stab a stick of RAM into my jugular. Luckily, one can mitigate the downsides by using an external editor, communicating with cutecom/minicom, and using avr-libc instead of the Arduino libraries as much as possible. Back to the project.
The actual circuit is fairly simple. Analog pins 4 and 5 on the Arduino serve as i2c’s SDA and SDC lines, respectively. I’m using a level shifter from SparkFun to get the Arduino’s 5v lines down to the 3.3v that the HMC5843 is looking for. Note that one can skip this by using a 3.3v Arduino Pro. The FTDI chip on the Arduino outputs 3.3v, which is brought out on the headers, allowing the level shifter and the magnetometer to be powered off the Arduino.
I tried using the Arduino Wire library for i2c communication, but had no luck. Atmel made TWI, the i2c implementation on the AVR, fairly easy to use, so I read through the datasheet, looked at some examples, and wrote my own Arduino library specifically for the HMC5843. The current implementation is absolutely alpha, but it seems to read the x, y, and z values at 10 Hz correctly. Note that you probably can’t use this library at the same time as Wire or another i2c library, and that it also doesn’t support having multiple i2c devices connected. Its sole purpose is interfacing the HMC5843. Here is an example sketch using it:
#include <HMC.h> void setup() { Serial.begin(9600); delay(5); // The HMC5843 needs 5ms before it will communicate HMC.init(); } void loop() { int x,y,z; delay(100); // There will be new values every 100ms HMC.getValues(&x,&y,&z); Serial.print("x:"); Serial.print(x); Serial.print(" y:"); Serial.print(y); Serial.print(" z:"); Serial.println(z); }
Continuing the theme of a different license for each set of code I release, this library is under a two clause BSD style license. Please feel free to try it out and give me feedback/suggestions/patches/pedantic advice/flames.
Download and extract into the hardware/libraries/ folder of your Arduino directory:
HMC.zip
Know what the greatest feeling in the world is? It’s when you’re going to throw away an empty pack of Gushers Fruit Snacks and discover that there is one last one hidden in the corner.
(1)- Build a laser projector to augment a cloudy night sky. The plan here was to laser project stars, satellites, and other heavenly bodies onto the clouds in Pittsburgh, since nobody would be able to see them otherwise. I don’t think the weather will work for that in the Bay Area, but I could still project onto a ceiling or something.
- Implement a pretty basic portion of Johnny C. Lee’s thesis.
- Add Windows support to the camera module in Pygame. Linux support for webcams is finally being released with Pygame 1.9 fairly soon. Werner Laurensse is working on an OS X implementation for 1.9.1. It would be a bit strange to leave out perhaps the largest portion of Pygame’s audience.
This is what happens (best case) when geeks have too much free time. My friend John Martin and I decided to take part in Star Wars Uncut, an experiment to recreate Star Wars: A New Hope in a series of several hundred 15 second chunks, each created by random people across the internet. I chose a scene with a pleasant blend of dialog and pyrotechnics.
John has an inordinate quantity of Star Wars merchandise, so we went with stop motion animation for the scene, something neither of us was familiar with. We found the actual action figures for almost every part of the 15 seconds, and really only had to improvise on the explosions, as we would rather not blow up collectibles.
With assistance from Peter Martin and Meg Blake, we fabricated Y-wings out of soda bottles, cardboard tubes, cardboard, and spray paint. We filled each with a mixture of half potassium nitrate and half sugar, lit it with a fuse, and dragged it with a string as we took pictures. As you can see by the video above, the results are reasonable for an afternoon of filming and a $0 budget.

I’ve been trying to get as much use as possible out of these XBees before I have to return them to my department. CHDK was perhaps the main reason I paid the premium for a Canon SD870, but I haven’t had time to play around with it until now. One of the features CHDK has enabled is remote triggering via the USB port on the camera. Most solutions I’ve seen around the internet are wired or use hacked apart doorbells. I thought it would be nice to have it both wireless and computer controlled.

The entire project is almost absurdly simple, and the part count on the camera end is merely an XBee, a pin header to avoid soldering to it, a hacked apart mini USB cable, and a resistor. The XBee is powered off of the camera’s onboard lithium ion by running wires straight off of the battery contacts. Luckily, there is a hole in the battery door that I could route the ground and VCC wires through. I stuck a 7.5 ohm resistor on VCC to pull it down a little to avoid burning the XBee, but it probably isn’t necessary. The +5 line on USB is then just connected to one of the digital IO pins on the XBee, pin 7 in my case. The XBee on the camera and the one on the computer are programmed into API mode. All that is left is having a simple Python script using the python-xbee library to toggle the remote pin up and down to take a picture. The main downside is the constant 50mA draw on the battery, though you could probably use some kind of sleep mode on the XBee to save power.
Download: XBee Trigger
The title of this post is almost too thick with geeky goodness. This past week, the ECE department at CMU held the kind of event I’ve been dreaming of for years: give a bunch of students free parts and access to labs and see what happens. The event was called build_18 (sorry, no public site at the moment), and was the brainchild of Boris Lipchin. There were some pretty amazing projects, like a laser guided Nerf chain gun.
My roommate, Donald Cober, and I were planning on bringing back an old idea we never finished, a multimeter glove. We decided that wasn’t difficult enough though, and added the killer feature of being able to stream data back to a computer for logging and display. We had XBees left from the Wand project, so a serial point to point link using them was the logical choice. We planned to read DC voltage, current, resistance, and temperature, and be autoranging on the first three. Due to finals and catching up on a semester of missed sleep, we didn’t start the project until the morning before build_18 ended, so we had to drop the glove, ignore the onboard LCD (scavenged from an HP Laserjet), and focus on just getting voltage right. Donnie had planned to build a Lithium Polymer battery board for Arduino, but we ended up having to power it off of Solio solar chargers that we won at a Yahoo University Hack Day last semester. The multimeter itself is basically just a quad op amp, a few resistor networks, and some zener diodes sitting on an Arduino protoboard shield plugged into an Arduino Diecimila. It actually worked quite nicely. It is accurate from about -20 to 20 V and samples at about 2000 Hz, enough to see a nice sine wave on 60 Hz AC.

We are planning on finishing the other three data lines and getting the LCD working, so I will post again later with working schematics and an Arduino sketch. I’m not going to leave you with nothing though. The plotting app on the computer end is reasonably complete. We used matplotlib with threading to avoid losing data. It is fairly specific to our hardware, but it can at least serve as an example of how to do real time plotting in python.
Download: Multimeter Real Time Plotting Front End






