« Probe Swarm - updated thesis idea | Main | Headphone Heterotopia - tech notes »

Pizza Pong

For the Pong assignment, I wanted to make a wireless controller, using a pair of XBee radios to connect the sensor/microcontroller assembly to the XPort (and hence, the Internet and the shared Pong server).

pizza pong

I was at a loss regarding how to package the whole thing, however, a brief lunchtime excursion yielded the solution: a pizza box.

Click for a picture of the pizza box pong controller in action (Courtesy of David Overholt).

pizza pong

You play Pong by turning the pizza box one way and another, which moves the paddle on the screen. The connect and power buttons are set in the side, and the status LEDs shine through the dot in the "i" in "pizza". Keep reading for more info on how this miracle is achieved.

The box contains a simple circuit mounted on a breadboard, including a 3-axis accelerometer, an Arduino Mini and an XBee radio. (The photos show a USB-Serial adapter as well, this is used for programming the Arduino.) A carrier for 4 AA batteries supplies 6V of power, which is regulated down to 3.3V for the benefit of the XBee. An RGB LED is used to give feedback on the system status, and shines through a translucent window in the pizza box.

pizza pong

In order to connect to the network, the circuit in the pizza box uses its XBee radio to talk to a network bridge, made of another XBee connected to an XPort network adapter.

pizza pong xport xbee bridge

Fortunately, both the XBee and the XPort need regulated 3.3V power, so they can share a common power bus. I am using the USB-serial adapter for power only.

Using the XBee radios turned out to be quite convenient for debugging: since they were set in broadcast mode, it was possible to eavesdrop on the system using a 3rd XBee connected to my computer. This helped establish that overall communications between the Xbees and Xport were working. However, at first, it wasn't possible to connect to the server.

I had a number of issues, regarding the microcontroller software, the XPort configuration, and throughput of the XBee radios.

The Pong client software, as originally specified, is designed to keep trying to connect if it does not get a successful acknowledgement. However, since radio communications may be unreliable, this could lead the system to hang, sending a connect message and never receiving input. I modified the software so that if it fails to connect, it stays in a disconnected state, and allows the user to manually issue the reconnect command.

The second issue was that I had incorrectly configured my XPort, and it was not sending the correct status messages back to the Arduino microcontroller. This was easily fixed through the XPort setup menu (with considerable assistance from Rob Faludi, as always).

Finally, and to my surprise, the XBees are not 100% transparent to communications. When they are close to their throughput limit, they start packetizing characters, waiting for a buffer to fill before sending them all at once. Delaying the main program loop in the microcontroller slowed communications enough that the XBee would send individual characters.

Rob mentioned that broadcast mode is not necessarily ideal for these applications: when XBees send a broadcast packet, they will not wait for acknowledgement, and hence packets may be lost. By specifying explicit destination addresses, the XBees start using much more thorough flow-control and error management techniques.

Having made these changes, the Pizza Pong controller is now fully functional. Time and energy allowing, it would be interesting to vary responsiveness based on the degree to which the pizza box is tilted.

TrackBack

TrackBack URL for this entry:
http://itp.nyu.edu/~gpv206/cgi-bin/mt/mt-tb.cgi/112

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)