Using a Wii Nunchuk


Wii Nunchuks are cheap and simple devices that are useful for Game controllers as they have a joystick, 2 buttons and a 3D acceleration sensor. They use a simple i2c protocol. You write zero to register x40 to initialize them, and then read 6 bytes from register zero to get the input data. This requires an i2c master module. I am using a breadboard adapter for the Nunchuk. They are very cheap on ebay.

I have used a Digilent 7 segment Pmod to display the data coming from the Nunchuk. When used on a breadboard, it is upside down so the hex digits needed to be adjusted for that.

I am currently showing the joystick x value in hex. I am not currently using the button, but I plan to use it to choose which input value to display by cycling through the 7 values coming from the Nunchuk.

Here is the code:

The interface to the i2c master module needs improvement.