Wii Nunchuck quick guide
From DP
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.
Contents |
Interfacing
| 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.
Connections
Connection to the Wii breakout board. Thanks Scorpia!
Knock-offs, notes
Since there is a lot of struggling with reading those nunchuck's with the Bus Pirate, especially those cheap knock-off's I made a small list for myself.
This is what I found:
BUS PIRATE CODE: [0xa4 0x40 0x00][0xa4 0x00][0xa5 r:6]
- NUNCHUCK NORMALLY
BUS PIRATE CODE: [0xa4 0xf0 0x55][0xa4 0x00][0xa5 r:6]
So the startup is a few bytes different from the original one.
Cool pictures
Wii Nunchuck image: http://www.flickr.com/photos/ravanderende/ / CC BY-NC-SA 2.0



