Gabriel Bianconi : ArduinoNunchuk

ArduinoNunchuk is an open-source Arduino library that interfaces the Wii Nunchuk.


The Arduino project caught my attention in late 2011. Soon, I bought my first board, an Arduino Mega 2560. Yeah, probably an overkill for a beginner, but it’s an awesome board.

For my first real project I wanted to use a Wii Nunchuk. However, Arduino 1.0 had just come out and most existing libraries were either outdated or too complex (though some have been updated by now). Knowing it would be a great learning experience, I set out to write my own library.

While writing it, I had two things in mind: it had to be simple and efficient. By using a better initialization method than existing solutions, my library became compatible with a few third-party controllers. I also made sure to implement all the data provided by the Nunchuk, thus increasing the precision of the accelerometer.


The library is very simple to use. First you instantiate it:

ArduinoNunchuk nunchuk = ArduinoNunchuk();

Then, you initialize it in setup():


And lastly, you update the values in loop():


The data from the Wii Nunchuk will be available in the following format:



The library is available at GitHub under the Creative Commons license. It can be installed like any other Arduino library and contains an example for your reference.

  • Ender Ossel

    TNX now i can use my old nunchuk form my wii(that i trashed with my own chennel and throw away after even let a pro look to it) IN MY OWN PROJECTS jeeej ps i will give you credits for the library THANK YOU SO MUCH now i dont need to write evrything myself or buy a stupid nochunk adapter :)

    • GabrielBianconi

      You’re welcome!

  • rodrigo2

    Hi Gabriel,

    Will your library work for the wireless Nyko Kama control?

    • GabrielBianconi

      Hi Rodrigo,
      I’m not sure. The library works with some third-party controllers, but not all. Let me know if you get them to work together.
      Best regards,

    • Danny Oakley

      Hi I have a wireless Nyko Kama and just confirmed this works!

      • GabrielBianconi

        Thanks for the contribution!

      • rodrigo2

        Thank you!

  • Shreetron

    Hi Gabriel,
    I have been trying to use your code to get my Arduino to read values from the Wii nunchuck. The code works just fine but it doesn’t print anything on serial monitor. I tried to see how far along the processor gets before getting stuck and found out that it doesn’t even go beyond the nunchuck_init() line. I used Serial.print(“message”); to do that.
    I am a total novice to the coding world so I would appreciate if you can help me out here.

    • GabrielBianconi

      It only prints to the serial port if you are using the sketch example. Are you using it?

      • Shreetron

        It was a bad connection. It does print on the serial monitor the kind of values it’s supposed to but those values don’t really change while I move the nunchuck which makes me think that something isn’t going as it’s supposed to. I’ll go back to the lab and connect everything back and post the the values down here tomorrow.
        Did you mean to ask if I was uploading the .ino file or not?

        • GabrielBianconi

          Are you uploading the sketch example: File > Examples > ArduinoNunchuk > ArduinoNunchukDemo ?

          Also, is your nunchuk original?

  • Gregg Levine

    I just tried your latest material for the device. It was indeed stuck in the libraries area, but here goes:
    ArduinoNunchuk nunchuk = ArduinoNunchuk();
    As in:

    ArduinoNunchukDemo:15: error: ‘ArduinoNunchuk’ does not name a type

    ArduinoNunchukDemo.ino: In function ‘void setup()’:

    ArduinoNunchukDemo:20: error: ‘nunchuk’ was not declared in this scope

    ArduinoNunchukDemo.ino: In function ‘void loop()’:

    ArduinoNunchukDemo:25: error: ‘nunchuk’ was not declared in this scope

    • GabrielBianconi

      This means that the library wasn’t installed correctly. Most people put “ArduinoNunchuk-master” instead of “ArduinoNunchuk” (located inside the former) in the “libraries” folder. Let me know if this solves your problem.

      • Gregg Levine

        This may be a duplicate.
        I did indeed install it as a typical library, remembering to remove the “-master” from the name. Was it written using an earlier version? A number of header entries and function names in the I2C library were updated to follow the styles in the others.

        • GabrielBianconi

          You shouldn’t rename the “ArduinoNunchuk-master” folder, but place the folder that was inside it (“ArduinoNunchuk”) in the libraries folder.

      • Gregg Levine

        Okay. That makes sense. I’ve done that now. And it all works. Well building it does, next will be to try it out on the target device. Suggestion is to include your instructions in the readme files.

        • GabrielBianconi


  • Gregg Levine

    It did not. That is how I installed it at first. It turns out that the others that also were discussed on the playground were easily fixed. It seemed to be a case of bitrot. The author there worked with an earlier copy of the IDE. What version was yours tested on? I’m using 1.05.

    • GabrielBianconi

      The library has been tested with recent versions of the IDE (>1.0, including 1.05) on several operating systems (Windows XP, Vista, 7, and 8; OSX 10.7 and 10.8).

  • chrisward

    hey there,
    Ive been following this project and trying to get it working on a mac, Is there a different method when it comes to the pywin32 install stage? last step and can’t find a mac alternative, any help would be much appreciated :)