Normal people don’t have these problems

Auxilliary Input

I drive the least interesting car in the world, a gray 2004 Toyota Camry.  To stave off death from boredom while driving, I use a tape adapter connected to an A2DP receiver to wirelessly listen to music from my iPhone.  A few weeks ago, the tape deck developed an extremely irritating clicking noise.  The easy options, the ones that most Camry owners would choose, would be to turn on the radio, get an FM transmitter for the iPhone, listen to CDs, or just let the tape deck click.  Being an engineer, I refuse pick the easy option, but rather the one that seems best, which inevitably devolves into a weekend of hacking, cursing, and setting things on fire, with a best case of eventually restoring the object of interest to something resembling a functioning state.

The plan was to enable direct auxiliary input, which the Internet claimed was possible on this model.  The backup plan was to resolve the clicking noise by just unplugging the tape motor, which we assumed was unnecessary to operate the adapter.  My roommate Will and I popped the head unit out of the car with much effort and two trips to the hardware store.  Apparently stealing a radio isn’t easy, even from your own car.

Attempting to power the unit off of the 12v rail of a 350w ATX power supply resulted in it shutting off immediately.  With a 450w PSU connected to the battery and accessory voltage lines, a tiny laptop speaker from my spare parts bin connected to the massive amp, and another speaker being used as an antenna, we managed to pull in the beautiful sound of late 70’s hits on FM radio.

I’m not entirely sure what happened, but Will managed to break the tape deck in about a dozen different ways over the course of the next couple of hours.  It wouldn’t play at all without the drive gears spinning, it refused to eject tapes because it believed it was empty, and still, the clicking gear clicked.

It was then up to me to get aux in working.  Apparently, Toyotas from around my model year use AVC-Lan, a communications bus based on IEBus for the head unit to connect to things like a CD changer.  There is some pretty solid research across the web on how to emulate a device on the bus to message the head unit to use its aux input.  I used the circuit and software from SigmaObjects, as it required only parts I already had or could get from Halted.  The code there is designed for an ATmega8, but with some trial and error, I managed to port it to the current ATmega48/88/168 series.  Unfortunately, the code doesn’t mention being under any permissive license, so I can’t share my modifications.

While hooking it up to the head unit, the wire connecting the device to ground actually burst into flames, burning part of a connector and melting copper.  On later inspection, we found that the wires were extremely high gauge internally, and it is likely that only a single thin strand was carrying the current in the area that caught fire.  Miraculously, neither the radio nor the ATmega168 was damaged by the incident.  I switched to lower gauge higher quality wire, checked my car insurance terms relating to explosion due to user error, and continued.

Burnt Wire

After a few more hours of debugging, I realized that I had the two data lines backwards, and after switching them it worked instantly.  We repurposed the TAPE button to switch to aux in.  I taped the board down, put the head unit back together, and we stuck it back into the car.  There was an unnerving startup delay the first few times, but I am now the proud owner of a gray 2004 Toyota Camry with auxiliary audio input… and no tape deck.

10 Comments on Normal people don’t have these problems

XBee Enabled Arduino Based Wireless Multimeter


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.

Multimeter plot

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

1 Comment on XBee Enabled Arduino Based Wireless Multimeter

Magic Wands: ZigBee Enabled Group Gaming

Magic Wands

Over the last semester, my 18-549 group of Adeola Bannis, Claire Mitchell, Ethan Goldblum, and I has designed and prototyped a magic wand for theme park patrons to use for group games while waiting in long lines.  The initial idea of a crowd interaction device (and several thousand dollars of funding) was provided by Disney Research, but we ran with the concept, adding ZigBee wireless networking, an accelerometer, IR tracking via webcam, location based gaming, and so on.  We also wrote a few proof of concept games to go along with it.  I lost more sleep over this class than any other I’ve taken, but I learned quite a bit more as well.

The hardware is based loosely on Arduino, and we used their bootloader.  The software is a modified xbee-api-on-arduino library and code to interface the hardware.  The wand consists of an ATmega168, a 3-axis analog accelerometer, a Series 2 XBee, power and lithium ion charging circuitry, a 1400 mAh lithium ion battery, a very highly mediocre button pad, an RGB LED, an IR LED, and an incredible enclosure that Zach Ali at dFAB designed for us.  We went through a few hardware iterations before settling on this.  The prototypes we built are probably around $60 each in parts, but dropping the XBee for a basic 802.15.4 IC and buying in bulk would drop it below $20.  Our goal was to have the wand last a week long theme park visit without needing charged.  Our current implementation doesn’t put the XBee to sleep, so it would last around 24 hours of constant use.  Sleeping, we would reach about 9 days, surpassing the goal.  Swapping out the XBee would also cut current draw in half.  Wands can be charged over USB mini (yay for not using proprietary connectors!).

Perhaps the hardest part of the project was devising the network architecture and choosing where the divisions were between wand, server, and game.  In general, the underlying network is abstracted completely away from both the wands and the games.  The wands are simply advertised games that they are within range to play, and the games are sent joins when the wand joins the game.  There are wand and server side timers to make sure that wands are never stuck inside a game if someone walks out of range of the network.

The server tracks all joins and parts from games in a database, and there is a web based interface to allow for user tracking.  Perhaps my favorite simple gee-whiz feature that we added is remote battery level tracking.  Each time a wand joins a game, its battery level is logged, which is displayed in the web interface.  As the wands also have “display names” associated with them, it would be possible to tell someone, in game, that their battery level is low, if they ignore the red low battery LED on the wand.

The server is written in Java, using xbee-api to talk to wands and Google protobuf to serialize data to give to games.  We wrote client side networking libraries for Java and Python.  The games we wrote were mostly proof of concept to demonstrate the range of possible uses of the wand hardware.

The game below may look familiar.  I have stated probably multiple times that I would never touch RocketPong again, but it always manages to pull me back in.  In this variant, when a user joins the game, the star on their wand lights up with the color of their team, and their name appears next to their rocket.  They then tilt their wand up and down to control the thrust of the rocket.  The values between players on a team are averaged, so everyone on the team needs to cooperate if they want to win.  It ended up being a lot of fun, and was probably the most popular game during our final demo.  You can’t tell in the image below, but the star field in the background reacts to and collides with the ball, using the Lepton particle physics engine.

Group RocketPong

I also wrote a drawing game that uses the IR LED and a PS3 Eye modded with an IR filter.  We had originally used floppy disks for the filter, but we eventually got the correct IR bandpass filter for our LEDs.  I am really pleased with the PS3 Eye.  It is the only webcam I’ve seen that can do 60 fps VGA in Linux, and it also works beautifully with Pygame’s camera module.  The game is just a basic virtual whiteboard, allowing people to use their wand as a marker.  Pressing the buttons on the wand changes the color being drawn.  The whiteboard slowly fades away to white, erasing old drawings as the line moves on.  I had hoped to allow for multiple people to draw at the same time, but ran out of time.

During our final all-nighter, I quickly wrote a music app using the new Pygame midi module.  On joining the game, a user selects one of five instruments.  For the two percussion instruments, the user can shake the wand like a maraca or hit like a drumstick, using the accelerometer to trigger sound.  The other three instruments use the button pad to play notes.  Just because I could, this game also uses Lepton to shoot off music notes every time someone plays one.  This game is a really watered down version of a project called Cacophony that I will be developing farther when I have time.

We also had a trivia/voting game, and a cave game clone, which I did not write.

I doubt the project as a whole would be useful to anyone else out there, but individual chunks of it surely are.  You can get code, schematics, documentation, and assorted other junk for the entire project at our gitorious repo.  Note that parts of it probably don’t function, and much of it requires a very specific set of libraries.  If you are really interested, I would be happy to help you use what you want of it.  The licensing of just about everything is pretty murky, so talk to me first if you are planning on publishing anything based on this.

3 Comments on Magic Wands: ZigBee Enabled Group Gaming