Welcome to the Wii Setup Page!

This is a guide to setting up Wii Remotes (wiimotes) with Debian-flavored Linux. If you are running a different flavor of Linux, there is a good chance that this guide will not work for you. However, with that caveat out of the way, lets get down to business.

Jump to the Hardware section
Jump to the Library section
Jump to the Install section
Jump to the Test section

Hardware

The hardware requirements are not very hard to find. Wiimotes and Wii nunchucks will be sold at any store that sells video games or video game equipment, such as Best Buy, Target, or a large number of other stores. However, I think that the cheapest place to get them (new) is Buy.com, and so the links that I provide are from buy.com

Wii Remote(Wiimote)
The Wiimote is the main piece of hardware.  It contains all the communication hardware, LEDs, a speaker, three accelerometers, and a lot of buttons.
$39.99 at buy.com (and free shipping!).
Wii Nunchuck
The Nunchuck is an add-on to the Wiimote.  It plugs into the bottom of the wiimote, and has three accelerometers, a joystick, and two buttons.
$17.99 at buy.com.
Bluetooth USB Adapter
This adapter is needed if your computer does not come with built-in bluetooth, which is how the Wiimotes communicate. It plugs into a USB port, and it works with no setup on Linux.
$21.99 at buy.com.
Note that buy.com provides free shipping as long as you spend more than $25, so buying in bulk is good.

Libraries

There are only two libraries that you need to use the wiimotes, and neither is hard to install.

BlueZ
This is the standard Linux bluetooth stack.  Any Linux machine needing bluetooth will have this, and some distributions now come with it built in.
Can be found at www.bluez.org They have installation instructions there.
Cwiid
This is a relatively new library for interfacing with wiimotes. It provides a very simple and powerful API, with an active development team.
It can be found at abstrakraft.org.
If you go to their downloads page, you can see the older versions. We use version 0.5.03, because the newer versions break Debian installations. However, it provides all of the functionality that we need.

Installation

Installing these libraries is relatively simple. Once you download the tarballs, extract them and run the configure script. This will determine the locations of all of the necessary libraries and programs. Then you run sudo make install, which will install the libraries to /usr . If you want them in a different location, when running the configure script pass it the flag --prefix=PRE_DIR, where PRE_DIR is the directory you want to install your libraries to instead of /usr .

Testing your installation

Believe it or not, that's all the set up you have to do! I have included here a little C file that will test to see whether everything is set up correctly.

First, download the C file.

Second, in the directory where you downloaded it, in a terminal run g++ -o test test.c -lwiimote -lbluetooth (This should compile your code. If it doesn't, then maybe you installed your libraries to a different location than the standard /usr/lib and /usr/include. If so, then assuming they are located in the directory _LIBDIR, you should pass your compiler the -I_LIBDIR -L_LIBDIR flags so it can find your libraries.)

Third, run the program in a terminal by typing ./test . In order for the program to connect to your wiimote, you will need to put it into "search" mode, which can be done by pressing the 1 and 2 buttons on the wiimote simultaneously until the LEDs on the wiimote start flashing.

If the program ran but your wiimote was not in search mode, the program will stop searching after about 3 or 4 sec. It is easiest if you put the wiimote into search mode first, and then run the program. Try it until they connect, it shouldn't take too long.

Once the program is running, it won't stop until you press Ctrl-C. In the meantime, while you press down any of the buttons on the wiimote, the values read directly from the accelerometers will be printed to the screen. Each accelerometer sends its data as 8 bits (an unsigned char), ranging from 0 to 255. Try holding down buttons and waving the wiimote around to see how it affects the numbers.

Now you should be all set to start programming with your wiimote. Take a look at the header file wiimote.h to see which functions, constants, enums, and types you will need. Or take a look at my test file, I tried to document it well and show which functions from the wiimote library do what. Have fun hacking with wiimotes!