Wii Nunchuck + 2 servos + JeonLab mini

One of my sons has complained one day that his Wii Nunchuck didn’t work and showed it to me. The joystick was loose but all the other function seemed to be fine. So he got a new Wii Nunchuck I got my own toy.  🙂

If you search the internet with key words, “wii nunchuck arduino,” you will find many blog posts, forum posts, and video clips.   I also found those interesting posts and videos some time ago and have once tried the Arduino Duemilanove and a Wii Nunchuck and a servo motor.   It just worked as it is supposed to do.   Of course I had to return the Wii Nunchuck to my son at that time, but now I have my own part.   Although the joystick was broken, the accelerometer and two switches, C and Z, were intact.   So I started removing the broken part and unnecessary part of the PCB and switches so that only the accelerometer was left.

Separated PCB

PCB only
Wii Nunchuck PCB

The right part (joystick and button switch terminals) of the PCB has been cut.


Wii Nunchuck accelerometer and JeonLab mini v1.0  (wires: Blue-GND, Green-SDA(data), Yellow-SCK(clock), Orange-+3.3V; colors have no meaning here, I just used what I could find around)
chuck2servo_assemle 24

Since I’m going to supply +5V for servos, in order to provide +3.3V, I just simply attach a Zenner diode and a 100 ohm resister as shown below.
zenner diode for 3.3V

Before putting the JeonLab mini in a small blue box, an FTDI breakout board from Sparkfun was connected and my sketch (at the end of this post) was loaded.
chuck2servo_assemle 27

chuck2servo_assemle 29

chuck2servo_assemle 31

With a simple sketch below, it works fine to move two servos 0 to 180 degrees as responses of tilted angle of the Wii Nunchuck accelerometer PCB.

Some more pictures or video will be posted soon.

Sketch (JeonLab_Nunchuck.pde)

 * Wiichuck_2servos
 * Apr 2011, Jinseok Jeon
 * WiiChuck data read:
 *  thanks to WiiChuckDemo by Tod E. Kurt,
 *  http://todbot.com/blog/

#include "nunchuck_funcs.h"

Servo servoX;
Servo servoY;
float tempx=0, tempy=0;

void setup()

void loop()
  for (int i = 1; i   {
    tempx += nunchuck_accelx();
    tempy += nunchuck_accely();

  tempx = map(int(tempx/50.0), 74, 166, 0, 180);
  tempy = map(int(tempy/50.0), 73, 170, 0, 180);

  tempx = 0;
  tempy = 0;

Simple timer

updated: photos below (Apr. 3, 2011)

I started making a simple timer using the JeonLab mini, 2 shift registers (maybe one will be enough) and 4 digit 7-segment LED as shown below. There are buttons and buzzer are not placed and no wires connected yet. I like the size

4 digit 7-segment LED with JeonLab mini

updated photos (Apr 3, 2011)
Simple timer running

Simple timer with FTDI breakout brd

JeonLab mini right angle header for FTDI

Sketch (Simple_timer.pde)

 Simple timer with JeonLab mini v1.0

 This is a simple timer with a button to start, a pot resistor
 to adjust the time to count down up to 10 minutes, and a buzzer
 to alarm using the JeonLab mini and a shift resistor 74HC585 and
 4 digit 7-segment LED.

 Author: Jinseok Jeon (https://jeonlab.wordpress.com/)
 Date: Mar 29, 2011


byte dataPin = 9;  // connect to the data pin of 74HC595
byte latchPin = 10;  // connect to the latch pin of 74HC595
byte clockPin = 11;  // connect to the clock pin of 74HC595
byte LEDpin = 13;  // LED to turn on with alarm
byte triggerPin = 12;  // button to start
byte alarmPin = 4;  // connect to the buzzer
byte potPin = 5;  // pot resistor input
byte buttonState = 0;  // check if the button is pressed

byte digit[4] = {5,6,7,8};  // cathode pins of each digit of 7-segment
byte ms[4];  // number to show on each digit
byte numberArray[11] = {215,20,205,93,30,91,219,21,223,31,2};
 // 0-9 decimal data of 7-segment
unsigned long time;  // variable to check 1 second to count down

void setup() {
 pinMode(dataPin, OUTPUT);
 pinMode(latchPin, OUTPUT);
 pinMode(clockPin, OUTPUT);
 for (int i=0; i<=3; i++) {
 pinMode(digit[i], OUTPUT);
 digitalWrite(digit[i], HIGH);
 pinMode(12, INPUT);  // Start button switch input
 pinMode(alarmPin, OUTPUT);  // buzzer

void loop() {
// keep showing current count for 1 second
 do {
 time = millis();
 } while (millis()/1000 <= time/1000);

// calculate each digit every second
 if (ms[3] == 0) {
 ms[3] = 9;
 if (ms[2] == 0) {
 ms[2] = 5;
 else {
 else {

// alarm goes off with pin #13 LED on for 1 second
 if (ms[0] == 0 && ms[2] == 0 && ms[3] == 0) {
 digitalWrite(alarmPin, HIGH); // buzzer on
 digitalWrite(LEDpin, HIGH);
 digitalWrite(alarmPin, LOW); // buzzer off with the button pressed
 digitalWrite(LEDpin, LOW);

// multiplexing 4 digits of 7-segment LED
void LEDshow() {
 for (int i = 0; i <= 3; i++) {
 digitalWrite(latchPin, LOW);
 shiftOut(dataPin, clockPin, MSBFIRST, numberArray[ms[i]]);
 digitalWrite(latchPin, HIGH);
 digitalWrite(digit[i], LOW);
 digitalWrite(digit[i], HIGH);

// setting timer with a pot resistor
//    in order for accurate setting, using 2 digital pins will
//    be better for up/down control
void setTime() {
 buttonState = 0;
 float potRead;
 do {
 if (digitalRead(triggerPin) == HIGH) buttonState++;
 potRead = analogRead(potPin)/1024.0 * 10.0;
 ms[0] = int(potRead);  //minute, 0 to 9
 ms[2] = int((potRead-ms[0]) * 6);  //ten second
 ms[3] = int((potRead-ms[0]) * 60) - ms[2]*10;  //second
 } while (!(buttonState > 0 && digitalRead(triggerPin) == LOW)
 && (ms[0] == 0 && ms[2] == 0 && ms[3] == 0)); // press button to set time