Arduino Wii nunchuck and Wii motion plus with updated code for IDE 1.0.2 and LEDs

So, I was trying to hack my Wii nunchuck because I want to control motors and lights with the Wii nunchuck.

The first problem that I found was how to connect the control without an adapter, I was planning to make one, but
when I was searching for the nunchuck I also found the Wii motion plus accesory then I did notice that it haves a
Male interface it haves holes to put wires, I did a search for Wii motion hacks with arduino and I found some code.
Arduino Wii nunchuck

Second problem I found was that the code to hack both nunchuck and wii motion plus are outdated and you have
to change some commands, like Serial.begin, Wire.write instead of Wire.send  etc,

So I had to fix the code and also I added leds!

Step 1: Materials

1 Arduino
1 Breadboard
1 Wii motion Plus
1 Wii Nunchuck
6 Resistors 220 ohm
6 Leds (any color)
Solid core jumper wires

Step 2: Build it

Wii motion plus


|                      |
|      6 4 2       |
|       —–        |
|      5 3 1       |

From the Wiimote side
Pin  Cable color  Description
1  Green  SDA. I²C Serial Data
2  Orange  Ground
3  –  Not connected.
4  –  Not connected.
5  Red  3.3V
6  Yellow  SCL. I²C Serial Clock. (400 kHz)

Get 4 cables, and put them in the correct place, in the photo the orange wire is ground, is very important to notice
that the powerline  uses 3.3V, dont use the 5V powerline it will not fry your control, but is better to play Safe.

Connect Pin 5 Green cable to Analog 4(A4) and Pin 2 Yellow cable to Analog 5(A5) to the arduino, Pin 1 Red cable to Power 3.3V
and Pin 6 (in the photo the cable is orange) to ground.

Step 3: Build the led array

The led array is easier to make, remember the anode witch must be connected to the power(digital pin) is the longer leg, and the shorter one must be connected with a 220 ohm resistor to the ground, the pins that you must use are from 7 to 12.

Step 4: The Code

First you must test the Wii motion Plus, if it works then you just need to connect the Wii nunchuck and it will work too.
NOTE: I got the original code from this webpage:,8507.0.html
I did not make the code I just fixed it to be able to run in the new Arduino IDE 1.0.2. and I added new code for the
leds, all the credits are for knuckles904.

Ok first you need to go to your arduino library and find the Wire carpet then go to Utility and find the archive twi.h open it
with wordpad and delete the lines from //#define ATMEGA8 to #endinf and paste these lines instead:
#define ATMEGA8

#ifndef CPU_FREQ^M
#define CPU_FREQ 16000000L

#ifndef TWI_FREQ^M
#define TWI_FREQ 100000L

Save the twi.h archive and now open your arduino IDE and copy and paste the code:

#include <Wire.h>
byte data[6]; //six data bytes
int yaw, pitch, roll; //three axes
int yaw0, pitch0, roll0; //calibration zeroes

void wmpOn(){
Wire.beginTransmission(0x53); //WM+ starts out deactivated at address 0x53
Wire.write(0xfe); //send 0x04 to address 0xFE to activate WM+
Wire.endTransmission(); //WM+ jumps to address 0x52 and is now active

void wmpSendZero(){
Wire.beginTransmission(0x52); //now at address 0x52
Wire.write(0x00); //send zero to signal we want info

void calibrateZeroes(){
for (int i=0;i<10;i++){
for (int i=0;i<6;i++){
yaw0+=(((data[3]>>2)<<8)+data[0])/10; //average 10 readings
Serial.print(” Pitch0:”);
Serial.print(” Roll0:”);

void receiveData(){
wmpSendZero(); //send zero before each request (same as nunchuck)
Wire.requestFrom(0x52,6); //request the six bytes from the WM+
for (int i=0;i<6;i++){
//for info on what each byte represents
void setup(){
Serial.println(“WM+ tester”);
wmpOn(); //turn WM+ on
calibrateZeroes(); //calibrate zeroes

pinMode(11, OUTPUT);
pinMode(12, OUTPUT);
pinMode(10, OUTPUT);
pinMode(9, OUTPUT);
pinMode(8, OUTPUT);
pinMode(7, OUTPUT);

void loop(){
receiveData(); //receive data and calculate yaw pitch and roll
Serial.print(“yaw:”);//see diagram on
Serial.print(yaw); //for info on which axis is which
Serial.print(” pitch:”);
Serial.print(” roll:”);

if (pitch >= 1000){


else if (pitch <= -1000){

else if (yaw >= 1000){


else if (yaw <= -1000){

else if (roll >= 1000){


else if (roll <= -1000){

else {

Major Components in Project

1 Arduino
1 Breadboard
1 Wii motion Plus
1 Wii Nunchuck
6 Resistors 220 ohm
6 Leds (any color)
Solid core jumper wires

For more detail: Arduino Wii nunchuck and Wii motion plus with updated code for IDE 1.0.2 and LEDs

This Post / Project can also be found using search terms:

  • arduino projekte mit Nunchuk
  • wii u and arduino
Clip to Evernote

Leave a Comment

(Spamcheck Enabled)

Read previous post:
The Creator C120 dev Board

Although originally announced back in August, the Creator C120 development board from Imagination Technologies can now be pre-ordered for delivery...

Scroll to top