Connect the Wii Nunchuck Breakout Adapter as shown below using the STEMMA QT connector or a solderless breadboard.
- Connect board VIN (red wire) to Arduino 5V if you are running a 5V board Arduino (Uno, etc.). If your board is 3V, connect to that instead.
- Connect board GND (black wire) to Arduino GND
- Connect board SCL (yellow wire) to Arduino SCL
- Connect board SDA (blue wire) to Arduino SDA
There are existing Arduino libraries you can use with the Wii series of devices. We'll be using the popular WiiChuck library which has support for the following devices
- Nunchuk
- Classic Controller
- Guitar Hero Guitar
- Guitar Hero Drums
- DJ Hero
- Drawesome Tablet
- Taiko Drums
Install it by searching the Arduino Library Manager for WiiChuck
You can use this sketch, again it barely fits on a 32u4 or 328 Arduino but it will connect and display data from a Nunchuk type controller!
#include <WiiChuck.h> Accessory nunchuck; void setup() { Serial.begin(115200); nunchuck.begin(); if (nunchuck.type == Unknown) { nunchuck.type = NUNCHUCK; } } void loop() { nunchuck.readData(); // Read inputs and update maps Serial.print("X: "); Serial.print(nunchuck.getAccelX()); Serial.print(" \tY: "); Serial.print(nunchuck.getAccelY()); Serial.print(" \tZ: "); Serial.println(nunchuck.getAccelZ()); Serial.print("Joy: ("); Serial.print(nunchuck.getJoyX()); Serial.print(", "); Serial.print(nunchuck.getJoyY()); Serial.println(")"); Serial.print("Button: "); if (nunchuck.getButtonZ()) Serial.print(" Z "); if (nunchuck.getButtonC()) Serial.print(" C "); Serial.println(); delay(100); }
Open the serial console at 115200 baud to see data streaming out, you can see the X Y Z accelerometer data (ranges from 0 to 1023), X and Y from the thumbstick (ranges from 0-255, with ~127 in the center position), and the two trigger buttons Z and C
Page last edited March 08, 2024
Text editor powered by tinymce.