Make: Projects

Wii Nunchuk Mouse

Bring console-style motion control to your PC.

Wii Nunchuk Mouse

Today, more and more devices are using motion control. From tablets to cellphones to game consoles, people are getting used to interacting with electronics using gestures. Personal computers, however, have lagged behind a bit. Unable to find a suitable gestural controller for my Windows PC on the consumer market, I set out to build my own.

I based my design on the Wii Nunchuk controller for several reasons. First, it’s a versatile, comfortable, well-designed controller; second, it‘s cheap and easy to find; and third, its native I2C serial protocol is easy to interface with Arduino. As a bonus, the connector will accept standard jumper wires, so there’s no need to cut up the cable or use a dedicated adapter.

The Arduino runs a sketch that reads data from the controller and prints to the computer’s serial port. The computer runs a Python script, which receives serial data and emulates a mouse.


Step #1: Install the Software

Wii Nunchuk Mouse
  • Download the Arduino IDE for Windows at Extract the arduino-1.0 folder to your hard drive. Inside this folder you’ll find arduino.exe.
  • Download the Arduino Nunchuk library at Extract the ArduinoNunchuk folder to your hard drive.
  • Open theArduino IDE and select File → Preferences. Note the folder under Sketchbook folder and open it in Windows Explorer. Look for a folder named libraries. If there isn’t one, you should create it. Move the ArduinoNunchuk folder into libraries.
  • Download Python 2.7.2 for Windows at and run the installer. You can find IDLE, the Python IDE, atStart → Python 2.7 or launch it at C:Python27Libidlelibidle.pyw.
  • You should not download Python 3. The script used in this project won’t work with this version.
  • Download the pyserialmodule at Extract the pyserial-2.6 folder to C:. Launch the command prompt window at Start → Accessories → Command Prompt. Type cd /d c:pyserial-2.6 and hit enter. Now type c: Python27python install and hit enter again.
  • Download pywin32 at and run the installer.

Step #2: Connect the controller to the Arduino.

Wii Nunchuk MouseWii Nunchuk MouseWii Nunchuk Mouse
  • We’ll use 4 colors of jumper wires to simplify the instructions. Insert the jumpers into the Wii Nunchuk’s connector.
  • On your Arduino, connect the red wire to +3.3V and the black wire to GND. Connect the green wire to A5 and the yellow wire to A4

Step #3: Upload the arduino Sketch

Wii Nunchuk Mouse
  • Connect your Arduino to your computer via USB. If this is the first time, you’ll need to install the required driver. Windows will not be able to install it automatically, so you’ll need to select it in arduino1.0/drivers.
  • Open the Windows Control Panel and search for the Device Manager. You can find the port in which your Arduino is inserted under Ports (COM & LPT). Open the Arduino IDE and select the correct port under Tools → Serial Port.
  • Relaunch Arduino. Select your Arduino model under Tools → Board.

Step #4:

Wii Nunchuk Mouse
  • Open the Serial Monitor. At the bottom right, change 9600 baud to 19200 baud and wait a few seconds. You should see 7 columns of values that change if you move the Wii Nunchuk, move the analog stick, or press a button. If it’s working correctly, close the serial monitor.
  • The ArduinoNunchuk library that you’ve installed has an example sketch that prints the data from the Wii Nunchuk to the computer’s serial port. Open the example file by selecting File → Examples → ArduinoNunchuk → ArduinoNunchukDemo. Upload this sketch to your Arduino.
  • If you can’t find the example sketch, try relaunching the IDE. If this doesn’t fix the problem, you probably didn’t install the library correctly.
  • If you don’t see the numbers, you probably did something wrong or skipped a step. Make sure that the wires are connected properly and the baud rate and serial port are set up correctly.
  • If you get an error when trying to run the file, make sure that the port was correctly set up and both pyserial and pywin32 installed. If this doesn’t solve the problem, try restarting IDLE and your Arduino. If it still doesn’t work, restart your computer.

Step #5: Set up the script.

Wii Nunchuk Mouse
  • Download the Python script at
  • 4b. Open it with IDLE (Rightclick → Edit with IDLE). Look for the line which says port = ‘arduino_port’ and write the correct port (leave the quotes). It should look like port = ‘COM10’ (use the same port as set up in the Arduino IDE). Save the script (File → Save or Ctrl+S).
  • Press F5 to run the file and wait a few seconds. Enjoy using the Wii Nunchuk as a computer mouse!


This project first appeared in MAKE Volume 33, page 118.

Gabriel Bianconi

Gabriel Bianconi

Gabriel Bianconi is a high school student in São Paulo, Brazil. He is interested in technology, especially programming, and wants to study computer science in college.

  • will

    the download link for the python script wont work is there a alternative link?

    • http://Aniston Vanessa

      Hello, where can I get those jumper wires?

      • Adam

        You can get them from ebay. Get a big cheap pack from China.

        • jaden

          No they’re better from the maker shed. the delux jumper wire kit. they really work well.

  • Jake Spurlock

    The download worked for me. I have mirrored the script over on Github:

  • wade

    Can’t get the pyserialmodule to work. any tips?

  • Anthony

    I need help I keep on getting a Syntax error any advice.

  • lou

    can I use a duemenilove for this?

    • lou


  • npetrie3

    I can’t get the pyserial-2.6 to work. It says “Could not find path specified” (or something like that) in the cmd prompt. And now the script won’t work because it says it can’t find a serial module.

  • rah1236

    Where is the download for the library?

  • Eric

    Will this work for a macbook? Are there any tutorials for this on the Mac OS?

  • Joey

    I’m on step 4c. When I press f5 to run NunchukMouse_release, I get the message “Traceback (most recent call last):
    File “”, line 2, in
    import math, string, time, serial, win32api, win32con
    ImportError: No module named serial”

    Can someone please help? I’m so close!

  • john

    I just get
    “Please set up the arduino port”

  • Ptrip3

    Guys pay attention to the lines of code. Instead of “cd /d c:pyserial-2.6” type in “cd /d C:pyserial-2.6”.Also the part after it doesn’t make sense in the command prompt. The author needs to rewrite that. I think the second part may be “C:Python27pythonsetup.pyinstall”, just a guess don’t quote me on it.

    • Ptrip3

      Figured it out. It’s “ install”. Like I said he really needs to rewrite that.

  • Bob H

    Great article but needs a MEGA update as most of the software is very outdated and some of the links are pooched

  • A.Maruthi Indresh

    urgent reply please!!!!! i pressed f5 but i am unable to figure out what to do after that. can anyone help????? i am just a beginner in arduino and python lanuages

  • Patrick Felder

    I’m hoping someone here can help, it seems as though I can’t connect to or read the serial port. I’m getting the following error:

    Traceback (most recent call last):

    File “”, line 2, in

    import math, string, time, serial, win32api, win32con

    ImportError: No module named serial

    I’m not using IDLE because it gave me some weird issues, so I switched over to Sublime Text 2, which I’ve seen work, so I don’t think that’s the issue.