Miscellaneous‎ > ‎

Wii peripherals in research


The Nintendo Wii is a popular gaming console having sold millions of devices.  It's success has also made available peripherals with accelerometers, gyroscopes and pressure sensors at a relatively low cost. This has given a group of enthusiasts easier access to these devices and has even spurred their use in clinical and research settings.  The examples are numerous at this point, but one particular use in a motor control setting is from Konrad Kording's group.

Currently one of the best remaining sites for information is Wii Brew. This has a lot of useful information about the hardware and necessary interfacing required for hooking up the peripherals to a computer.

Wii-mote and Wii-fit Board

The peripherals communicate with the Wii through blue-tooth, which is a lucky stroke because that means that they will talk to a computer as well.  Another interesting fact is that they communicate through the blue-tooth stack by means of the HID protocol, which computer peripherals such as mice and keyboards use.

A number of libraries have been written to interpret the wii-mote commands sent through blue-tooth so that a user can utilize the information from the accelerometers, IR camera and buttons.  A google search will supply you with the major players, but for a multi-platform solution I have found that WiiRemoteJ seems to provide the best option. It actually has some documentation!  It also is one of the few cross-platform solutions that I have found that actually worked on OSX without a major hassle. Downloads of the library can be found at the author's site and a forum for support questions can be found here.

WiiRemoteJ, Java and You

To me, a bonus of using the WiiRemoteJ library is that it makes it relatively straightforward to getting the Wii peripherals set-up and working with Processing and Matlab, two "programming" environments that I use frequently.  The common theme of this is that these environments are natively Java applications, so if you despise Java there are definitely other options, but this isn't one of them.

So in order to use WiiRemoteJ to connect a Wii peripheral as an input device to that snazzy Java application you have been writing you need to download the following:
It is probably wise to try and build the test Java program that comes with WiiRemoteJ (WRLImpl.java), which may need the following line added to the WRLImpl.java file (add in the bolded text):


public static void main(String args[])
    System.setProperty("bluecove.jsr82.psm_minimum_off", "true");


Now opening up a terminal window you can compile the java file just as you normally would including the WiiRemoteJ and Bluecove jar files in the classpath.  In OSX you can do this with the following command:

javac -classpath .:core.jar:bluecove-2.1.0.jar:WiiRemoteJ.jar WRLImpl.java

and you can run the test example using the following command:

java -classpath .:core.jar:bluecove-2.1.0.jar:WiiRemoteJ.jar WRLImpl

When running this example you should be able to connect your Wii-mote by pressing the 1 and 2 buttons simultaneously.  You should then see the output from the accelerometers plotted to the screen.

WiiRemoteJ and Processing

If you are familiar with the Processing language attached to the bottom of this page is a zip file containing an example of how you can incorporate Wii peripherals and Processing using Java.  If you aren't familiar with using Processing in a pure Java environment you should probably check out this page and read this chapter from Ira Greenberg's book first.  Remember that your compiler command on the terminal will look like:

javac -cp .:core.jar:bluecove-2.1.0.jar:WiiRemoteJ.jar Controller.java

If you are interested in packaging your results into a jar file check out this link.

Jeff Bingham,
Jan 10, 2010, 11:22 AM
Jeff Bingham,
Jan 10, 2010, 11:20 AM
Jeff Bingham,
Jan 10, 2010, 11:20 AM
Jeff Bingham,
Jan 10, 2010, 11:26 AM