Introduction: Wii Nunchuk Controlled Stepper Motor | Joystick Motor Control

A while back, I came across a project which uses a Wii Nunchuk to control a model locomotive. So I decided to try using this controller with an Arduino microcontroller and made this project. So without further ado, let's get started!

Step 1: Get the Required Stuff

For this project, you will require:

  • An Adafruit Motor Shield V2
  • An Arduino microcontroller compatible with the Adafruit Motor Shield(UNO, Leonardo, and similar ones)
  • A Nintendo Wii Nunchuk
  • A stepper motor(Unipolar and bipolar, both will work)
  • 4 male to male jumper wires(For connecting the stepper motor to the motor shield)
  • A 5-12 volt DC power source(Depends on the requirement)

Step 2: Program the Arduino Microcontroller

Go through the code before uploading to understand how it works and how you can modify it later. You can get the Wii Nunchuk library here.

Step 3: Install the Motor Shield on the Arduino Board

Carefully align the pins of the motor shield with the female headers of the Arduino board and push the shield on top of the Arduino board. Make sure the shield fits securely on the Arduino board and no pin gets bent.

Step 4: Connect the Stepper Motor to the Motor Shield

Connect the jumper wires to the terminals of the shield labelled 'M3' and 'M4'. Connect two wires from 'M3' to one coil pair of the motor and connect the remaining two wires to the other coil pair of the motor. Ignore the center tap(Common) wire if a 5-wire unipolar stepper motor is being used.

Step 5: Connect the Wii Nunchuk to the Arduino Board

Check this guide to understand how to use a Wii Nunchuk with an Arduino microcontroller. Connect the +ve pin of the Nunchuck to the +3.3-volt header of the Arduino board, connect the -ve pin to the 'GND' header, connect the 'SCL' wire of the Nunchuk to either 'A5' or 'SCL' header of the Arduino board, and connect the 'SDA' wire of the Nunchuk to either 'A4' or 'SDA' header of the Arduino board.

Step 6: Power Up the Setup and Test the Controls

As seen in the video, on moving the joystick to the right, the motor will move clockwise(Can go anti-clockwise if the wiring is altered) and on moving the joystick to the left, the motor will move anti-clockwise. The motor will move faster if the joystick is far from the center and slower if it is closer.

On pressing the 'C' button, the motor will move back to the position it started from powering up the setup.

Step 7: Tinker With the Project

Try changing the maximum and minimum speed of the motor, maybe add another motor and control both of them with each axis of the joystick...., there is a lot to do. Feel free to share your creation with the community by clicking on 'I Made It!'.

All the best!