From Kyle's Wiki
Jump to: navigation, search

WiiJenga is a python program I wrote in order to view the physics behind Jenga. It uses pygame, cwiid, and a Wii Balance Board to achieve this. Here are the instructions on how to reproduce my work:



These instructions assume you are using Ubuntu Lucid 10.04, adjust to your distribution as necessary.

Apt-Get Away!

This should get you everything you need to build the program:

apt-get install git-core build-essential python-numpy python-pygame
apt-get build-dep python-cwiid
#We are going to build our own cwiid, no conflict please
apt-get remove python-cwiid libcwiid1 libcwiid1-dev libcwiid-dev

Build Cwiid

You will need to install cwiid. At the time of this writing, Ubuntu Lucid 10.04's version of cwiid was not new enough to interpret the balance board data, so we need the trunk version:

git clone http://github.com/abstrakraft/cwiid.git
cd cwiid
sudo make install

My Code


Get the code:

svn co http://dev.xkyle.com/wiijenga
cd wiijenga

Check out system.ini and look at the values to see if you want to change any. If you want to get your MAC of your balance board, run the lswm command.

vi system.ini

The cwiid that you just built is going to be in /usr/local/lib/python2.6/site-packages/, which is not in the normal python path:

export PYTHONPATH=/usr/local/lib/python2.6/site-packages/
python wiijenga.py

Running the Program


The first thing you need to do is tare the scale. Press F11 after it starts to do this. Then put the Jenga board in the center, and play!

The Balance board is not that accurate. I'm doing some heavy averaging and smoothing, so the read dot will lag behind real time. Also the block counter will fluctuate away from the normal 57 blocks.

Have Fun!

Personal tools