Home > Ideas > Other Project Ideas > Wii Nunchuck as general purpose controller via Arduino board

Wii Nunchuck as general purpose controller via Arduino board

Summary of Wii Nunchuck as general purpose controller via Arduino board


This article details how to interface a standard wired Wii Nunchuck with an Arduino board to create a versatile controller. The setup utilizes the Nunchuck's joystick, two buttons (C and Z), and 3-axis accelerometer to generate variable voltage outputs. These signals can be smoothed via an RC filter to control external devices like robots or electric skateboards, allowing users to switch between joystick steering and tilt-based steering depending on button presses.

Parts used in the Wired Nunchuck Controller Project:

  • Wii Nunchuck (wired)
  • Arduino board with 328 processor
  • Digital Pin 9
  • Digital Pin 10
  • Digital Pin 11
  • Resistor
  • Capacitor
  • RC filter components

Background:

I made a self-balancing electric skateboard which is steered using a Wii Nunchuck by either using the thumb joystick on the top or by tilting it left or right, depending on which of the two buttons on the end are being pressed.

A simplified self balancing board is described in the instructable here:
www.instructables.com/id/Easy-build-self-balancing-skateboardrobotsegway-/

However people are asking me how the Nunchuck steering control used on one of my earlier boards can be used.
The wired Nunchuck can be seen in use as a steering control in the second half of this video:
www.youtube.com/watch

It can also be seen in use controlling a set of LED’s attached to the Arduino ouputs here:
www.youtube.com/watch

I have another instructable on interfacing a wireless Nunchuck to an Arduino but that is quite tricky and only works with a few specific wireless nunchucks. If starting out I strongly suggest going for the wired standard Nunchuck to begin with as described here.

Purpose:

The purpose of this instructable is to describe how to interface a completely standard Wii Nunchuck (i.e. with a cable) with an Arduino board. The Nunchuck is low cost but powerful with a fully proportional thumb joystick, 2 buttons on the end and a 3 axis accelerometer (position sensor). It is ideal for controlling things with.

The Arduino has been set up to output variable voltages between 0 and 5V which can be used as, for example, steering control inputs for another project such as a robot. You can use the (proper propotional) thumb joystick or the embedded accelerometers (tilt the chuck left right forward or back).

By modifying the code you can easily make it do other things.

I am using an Arduino with a 328 processor (i.e. a recent one) and version 17 of the Arduino software.
The Arduino sketch is attached below.

This is all derived from code developed by Chad Phillips and others, see:  http://windmeadow.com/node/42
For more info on wiring up the chuck to the Arduino, download Bionic Arduino Class 4 tutorial which is excellent from TodBot blog:
http://todbot.com/blog/2007/11/24/bionic-arduino-class-notes-3-4/

There is plenty more on this on the net, there is even someone with a Nunchuck controlled electric canoe here:
www.youtube.com/watch

I am just presenting this all together in one place as a way to get started with something that should work OK.

Step 1: View of Nunchuck buttons

Here are the “c” and “z” buttons on front of the Nunchuck.

Step 2: Arduino board inputs and outputs

Outputs:
The outputs from the Arduino are arranged as follows;
Digital Pin 9: outputs +5V when either of the end buttons are pressed. This can be used as a go/stop control signal. If controlling a vehicle / robot or similar, then letting go of the Nunchuck will create a 0V at this output and so can be used to kill power to motors and so on.
Digital Pin 10: PWM (pulse width modulated) output on pin 10 gives 2.5V most of time. NOTE: This is not a smooth 2.5V but a series of pulses at 500Hz where half the time there is 0V and half the time there is +5V. If you smooth them out using a resistor and a capacitor (called an RC filter) you can use the resulting (now smoothed) voltage as a control input signal for some other device (another arduino or whatever).
Output is 2.5V when joystick in neutral position.
It climbs to +5V or drops to 0V when joystick moved forwards or backwards.
Digital Pin 11: PWM (pulse width modulated) output on pin 11 gives 2.5V most of time (in similar way to Pin 11 above) when joystick in neutral position. If z button is pressed, then joystick left/right will make it go down to 0V or up to 5V.
BUT: If both z and c buttons pressed (or just c button alone) then this Pin 11 output becomes controlled by Left/Right TILT of the nunchuck (via embedded accelerometer) and the L/R joystick component is disabled.
So: The output voltage (smoothed with an R/C filter) can be used as a steering input to some other device. If pressing z button, they you steer with joystick, if c button (or both) is being pressed, then you steer by tilting Nunchuck left or right.

Quick Solutions to Questions related to Wired Nunchuck Controller:

  • What is the purpose of Digital Pin 9?
    It outputs +5V when either end button is pressed to serve as a go/stop control signal.
  • How does Digital Pin 10 function?
    It provides a PWM output that averages 2.5V at neutral, rising to 5V or dropping to 0V based on forward/backward joystick movement.
  • What happens to Digital Pin 11 when the C button is pressed?
    The pin output becomes controlled by the left/right tilt of the Nunchuck rather than the joystick.
  • Can I use this setup for steering a robot?
    Yes, the smoothed voltage from the pins can be used as a steering input signal for other devices.
  • Why is an RC filter necessary?
    An RC filter smooths the PWM pulses into a stable analog voltage suitable for control inputs.
  • Which Arduino processor version is recommended?
    The author uses an Arduino with a 328 processor and software version 17.
  • What are the two modes of steering described?
    Steering can be done using the thumb joystick or by tilting the Nunchuck left and right.
  • Does letting go of the buttons stop the motors?
    Yes, releasing the buttons creates a 0V signal at Pin 9, which can kill power to motors.

About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter
Scroll to Top