wii-overview.ii

Scorpia shared his experience interfacing a Wii Nunchuck with the Bus Pirate I2C library. He used Seeed Studio’s breakout board that brings all the Nunchuck signals to an easy-to-tap header. Here’s some alternatives to the breakout board.

Bus Pirate Wii Nunchuck breakout
MOSI/SDA D (SDA)
CLOCK/SCL C (SCL)
+3.3volts +
GND – (GND)

Connect the Bus Pirate to the Wii Nunchuck breakout board as shown in the table. The nunchuck is powered from the Bus Pirate’s on-board 3.3volt regulator. The nunchuck has very small value internal pull-up resistors on the I2C bus pins, so the Bus Pirate on-board pull-up resistors aren’t needed.

Open the mode menu (m) in the Bus Pirate terminal and select the software I2C library (4). Enable the Bus Pirate’s power supplies (big ‘W’).

I2C>[0xa4 0x40 0x00]<<<Wii Nunchuck initialize
I2C START CONDITION
WRITE: 0xA4 GOT ACK: YES<<<write address
WRITE: 0x40 GOT ACK: YES<<<write location (?)
WRITE: 0x00 GOT ACK: YES<<<write 0 to location 0x40 (?)
I2C STOP CONDITION
I2C>

Initialize the nunchuck, this only has to be done once. See also this example Arduino code.

I2C>[0xa4 0x00]<<<setup the read pointer
I2C START CONDITION
WRITE: 0xA4 GOT ACK: YES<<<write address
WRITE: 0x00 GOT ACK: YES<<<pointer to 0
I2C STOP CONDITION
I2C>[0xa5 r:6]<<<read nunchuck measurements
I2C START CONDITION
WRITE: 0xA5 GOT ACK: YES<<<read address
BULK READ 0x06 BYTES:<<read back 6 bytes
0x78 ACK 0x7A ACK 0x2F ACK 0x7D ACK 0x6E ACK 0x17 NACK
I2C STOP CONDITION
I2C>

Reading data from the nunchuck takes two steps. First, set the read pointer. Next, read six values to get the measurements, decoding guide here.

wii-connections

Connection to the Wii breakout board. Thanks Scorpia!

wii-nunchuck

Wii Nunchuck image: http://www.flickr.com/photos/ravanderende/ / CC BY-NC-SA 2.0

Advertisements