Wii Classic Controller Kit Getting Started Guide

This guide will teach you how to connect the Wii Classic Controller to your Geekduino using the Wii Adapter Board.

This guide will refer to the RobotGeek Geekduino, the Arduino Compatible microcontroller recommended for use with RobotGeek products. However this kit will also work with the Arduino Uno, or other Arduino variants like the Seeeduino.

The Wii Classic Controller uses the I2C protocol to communicate. The controller runs on 3.3v, so we've designed the Wii Adapter Board to handle the logic level conversion to 5v for your Geekduino/Arduino.

We've tested the Wii Adapter board with our Wii Classic Controllers and Wii Nunchuks. The board should work with standard nunhucks/classic controllers, though we cannot guarantee compatibility. If your board is not compatible with your controller, you can return it for a refund.

Contents:

  1. Arduino Setup
  2. Wiring
  3. Testing
  4. Library and Examples
  5. Advanced Use
  6. RobotGeek 101

Setting up the Arduino Software

Geekduino Getting Started Guide

If you have not already set up your Geekduino/ Arduino compatible board, please see the Geekduino Getting Started Guide. This guide will assist you in getting set up with the Arduino software as well as install libraries and test sketches for RobotGeek Robots and this controller.

The WiiClassy Library for the controller is included in the RobotGeek Libraries and Tools Download that you setup in the Geekduinio Getting Started Guide.

Back to Contents

Wiring the Controller

The Wii Adapter Board is electronically compatible with any microcontroller with a 5v I2C connection. Here are several examples of wiring the Wii Adapter.

Make sure the orientation of your Classic Controller is correct when connecting to the Wii Adapter. Plugging the unit in the wrong way will cause it to malfunction. The flat black plastic should point upwards and the clear plastic piece should face downwards. You can also remove the clear plastic piece by remving the screws.

b_500_500_16777215_00__images_tutorials_wii_wii-adapt-instruction-1.jpg b_500_500_16777215_00__images_tutorials_wii_wii-adapt-instruction-2.jpg
Sensor Shield

This Wii Adapter was designed for use with the RobotGeek Sensor Shield. The Wii Adapter will connect directly to the Sensor Shield's I2C port using a 4 Pin Sensor Cable.

Sensor Shield Pin Wii Adapter Pin
SCL SCL
SDA SDA
5V VCC
G GND
b_500_500_16777215_00__images_tutorials_wii_sensorShieldAdapator_bb.png
Direct Geekduino /Arduino Connection

The Adapter can be connected directly to a Geekduino / Arduino using a combination of 4-pin Squid Cables and 2-pin Couplers . Put the couplers into the female sockets on the Geekduino/Arduino, and connect the 4 single ends into the correct pins on the Geekduino/Arduino. The single 4-pin end of the cable plugs right into the Adapter Board

Geekduino Pin Wii Adapter Pin
5 SCL
4 SDA
5V VCC
Gnd GND
b_500_500_16777215_00__images_tutorials_wii_sensorShieldAdapator_bb.png
ArbotiX-M Robocontroller

The Wii Adapter can be connected to the ArbotiX-M Robocontroller using a 4-pin Squid Cable.

ArbotiX-M Robocontroller Wii Adapter Pin
D17 Signal Pin SDA
D16 Signal Pin SCL
D17 5V Pin (or any 5V pin) VCC
D17 Ground Pin (or any GND pin) G
b_500_500_16777215_00__images_tutorials_wii_arbotixAdapter_bb.png

Back to Contents

Testing the Controller

When you installed the RobotGeek Tools and Libraries, you installed the library and examples for the Wii Adapter. You can find the WiiClassicDemo sketch in the 'Examples' menu.

File -> Examples -> WiiClassy -> WiiClassicDemo

Now load the sketch onto your Geekduino. Once the sketch has uploaded, open your Serial Monitor

Tools -> Serial Monitor

Make sure the monitor is set to '9600' from the drop-down menu. You should start to see data coming in from the Serial monitor that corresponds to your controller. As you press buttons and move joysticks you should see data changing on the screen.

Back to Contents

Library Documentation

Setup Functions

classy.init(); - the init function must be called once in setup() to initialize the Classic Controller. In order to not overload the Classi Controller, the WiiClassy Library will limit the update rate of the controller to 30Hz (once every 33ms). See the Advanced Section for more information.

classy.update(); - the update function must be called before reading the classy variables to make sure you have the latest values.

In order to limit the processing time spent on updating the controller, the variables in the classy class will only be updated if a minimum amount of time has passed since the last data read (33ms be default) If this function is called faster than the update rate then the data will not be updated. For most applications, you can call classy.update(); as often as you'd like and let the library take care of the rest. See the Advanced Section for more information.

Accessing Data

b_500_500_16777215_00__images_tutorials_wii_wii-classic-controller-labeled.png

The Wii Classic Controller has 4 analog inputs you can access through the classy class. The left joystick provides higher resolution feedback (0-63) while the right joystick provides a lower resolution feedback (0-31)

Input Variable Left/Down Value Centered Value Right/Up Value
Left Joystick X / Horizontal classy.leftStickX 0 32 63
Left Joystick Y / Vertical classy.leftStickY 0 32 63
Right Joystick X / Horizontal classy.rightStickX 0 16 31
Right Joystick Y / Vertical classy.rightStickY 0 16 31

The Wii Classy Library supports reading the left/right shoulder buttons as an analog 'pressure' value using classy.leftShoulderPressure / classy.rightShoulderPressure. However our Classic Controller hardwaredoes not support this functionality and only reports the data as an digital value, giving 0 for unpressed and 31 for pressed. We recommend using the classy.leftShoulderPressed / classy.rightShoulderPressed variables below.

The Wii Classic Controller has 15 different digital inputs you can access through the classy class.

Input Variable Unpressed Value Pressed Value
Left Shoulder Button (L) classy.leftShoulderPressed false true
Right Shoulder Button (R) classy.rightShoulderPressed false true
Left Z Shoulder Button (LZ) classy.lzPressed false true
Right Z Shoulder Button (RZ) classy.rzPressed false true
Left Direction Pad Button classy.leftDPressed false true
Right Direction Pad Button classy.rightDPressed false true
Up Direction Pad Button classy.upDPressed false true
Down Direction Pad Button classy.downDPressed false true
Select / - Button classy.selectPressed false true
Home Button classy.homePressed false true
Start / + Button classy.startPressed false true
x Button classy.xPressed false true
y Button classy.yPressed false true
a Button classy.aPressed false true
b Button classy.bPressed false true

Back to Contents

Library Documentation and Other Examples

File -> Examples -> WiiClassy -> WiiClassicLED

This examples will turn an LED on pin 13 on/off when you press a/b. An LED on pin 3 will change intensity via PWM when you move the left joystick up/down.

File -> Examples -> WiiClassy -> WiiClassic1Servo

This Sketch will show you how to control 1 servo from a single joystick. Plug your servo into digital port 3, then use the left x stick to move the servo.

File -> Examples -> WiiClassy -> WiiClassic5Servo

This Sketch will show you how to control 5 servos from the classic controller, like the RobotGeek Snapper Arm. Plug your servos into digital ports 3, 5, 6, 9, and 10.The 2 joysticks will control the first 4 servos (3,5,6,9) while the left and right shoulder buttons will control the last servo (pin 10)

Back to Contents

Advanced Use

Changing the Update Rate

classy.init(int updateRate); - It is also possible to manually set the update rate by passing an integer to the init() function with the minimum time between reads. For example

classy.init(1000);

would limit the controller to updating one per second.

classy.init(0);

would have the controller to update as fast as possible

3.3v Systems

If you're using a 3.3v system, you can solder a 4-pin male header onto the open solder points on the board - this will allow you to connect directly to the controller's pins, without the logic level conversion.

Logic Level Shifter

In a pinch, the Wii Adapter board can be used as a general purpose 5v-3.3v logic level converter. You can solder a 4-pin male header onto the open solder points on the board for the 3.3v side logic and connect to the standard pins for the 5v logic.

Back to Contents

RobotGeek 101

Are you ready to dive even deeper into the world of Arduino? Then take a look at Robotgeek 101! RobotGeek 101 is a step by step guide that will teach you how to build, wire, and program your Geekduino/Arduino. Through RobotGeek 101 you will learn the basics of Arduino like digital input and output, and move on to more advanced topics like PWM and servo control. By the end of RobotGeek 101 you'll be well equipped to start modifying our demo code and creating your own custom applications.

RobotGeek 101

Feedback Form


Search