- Next »
- « Previous
The Box of Judgement
We have a Wii at work. This is very cool and progressive, but like duct tape, every good thing has its dark side. A highly competitive culture has grown around the playing of Wii Tennis, and with competition comes...yelling. People get really, really fired up. Screams of joy, groans of defeat; each exclamation of testosterone-fueled fervor resounds throughout our office. At times of particularly fierce full-court combat, it can render development work all but impossible.
Something had to be done.
Enter The Black Box. I have to give credit for this genius idea to my boss. The Box sits in silence on the Wii Table, exposing no clue to its activity or purpose except for a small light glowing green. But when the games heat up and the grunts and bellows begin to fly, the Box swings into action! Each "OHHHHH!" or "YES! YESSS!" causes the machine to buzz annoyingly and its light to go a menacing red.
Also, it sends one of these.
I don't know how long the Black Box will last before someone orders me to remove it or incapacitates it with a well-thrown Wii Remote. But I think it was a fun idea, and my friends wanted me to write up how it was made. So here goes. :)
The core of the box is an Arduino Duemilanove. Either building the Box was an excuse for trying the Arduino, or vice versa -- I'm not sure. Either way, I think the Arduino is a really cool platform (open source in both hardware and software) and I really look forward to using it in robotics projects once the Box is decommissioned. Basically, Arduino is an Atmel microcontroller in a convenient package, easy to program by plugging it into a USB port (the software runs on Mac, Linux and Windows). The aim is to bring computers into the physical world. And this we have accomplished.
Logan, Kadin and I worked on the hardware together. Several trips to Radio Shack were necessary, of course. We built an amplifier circuit and hooked up a little microphone to give the Arduino "ears." A nice three-color LED and a piezo buzzer were attached to form an alarm. I installed an XBee radio to let the Box share its complaints with the world via a second XBee plugged into my computer.
The software was easy: sixty lines of Arduino's C++ish code gave the Box its intelligence, along with a very short Ruby script to listen for XBee traffic and send a random tweet when a loud noise was detected.
Finally, all the hardware was stuffed into a project box (I should buy stock in Radio Shack) with holes drilled in it for the LED, sound and power, and installed as the centerpiece of the Wii Table. The radio link between the Box and my always-on office Mac was tested and found to be solid. At the time of this writing, I've been away for several hours (the office was too hot to work!) and the Box has tweeted four or five times. Raucous tennis games? Heated arguments? False alarms? I have no idea...but I am amused nonetheless.
One thing that struck me repeatedly as I put this project together is how awesome Open Source is. Without the building blocks I used to put this together (great examples of which include the ruby-serialport and twitter gems, and the awesomely simple amplifier circuit) the amount of code I wrote for the project could have run into the thousands and the project would have been impossible to fit into my busy life. Instead I wrote under a hundred lines of code, and it took part of a weekend. Truly, we all stand on the shoulders of giants. And when I move on to more complex projects (read: robots) this advantage will only grow.
BTW, if you liked reading this, please consider checking out the place that let me do it: Razoo. We aim to be the best way to find and donate to charity online. Maybe it's about time you do some good? :)
The following is for any total nerds who want to replicate or improve upon this project (please let me know; I'd be fascinated to hear about it!!):
- Software
- Arduino code
- Ruby code (requires ruby-serialport and twitter gems)
- Windows app for configuring XBee radios
- Parts:
- Arduino Duemilanove
- XBee radios (2)
- XBee Shield (to mate radio to the Arduino)
- XBee Explorer (to mate radio to a computer USB port)
- Amplifier circuit: x200 Mini Amplifier by Jose Pino
- Microphone
- LED
- Buzzer
- Breadboard, project box, LED mount, etc.: any good Radio Shack with a large "dork department"
If anyone would like me to post more technical details (such as the non-obvious steps to get two XBee 2.5 radios talking to each other) please comment or send me a message. Happy hacking!