User Tools

Site Tools


How to Access Wii Remote Data and Control Dynamixels

Author: Fausto Vega Email:
Author: Yu Hang He Email:
Reviewed by: Jean Vaz Email:

Date: Last modified on <04/09/19>
Keywords: Dynamixels , C++ Programming, Wii Remote, QT

The objective of the tutorial is to control Dynamixel MX-28 actuators with a Wii controller. Solving this partially or completely is important because it allows one to access data from the internal sensors in the Wii to control 2 MX-28 Dynamixel which in this case are on Darwin OP. This tutorial shows you the code on how to access the data from the Wii remote, and provides a demonstration of the final result.

Motivation and Audience

This tutorial's motivation is to teach how access accelerometer data from the Wii remote and send it to the Dynamixel. We will access the values through a laptop, then send the values via a TCP network programing model. Readers of this tutorial assumes the reader has the following background and interests:

* Know how to program C++
* Perhaps also know how to use the Linux command prompt
*Familiar with QT Interface
* This tutorial may also attract readers who are interested in wii control of anything

The rest of this tutorial is presented as follows:

Other Tutorials

For a more in depth explanation of network programming (TCP client server program) refer to the following tutorial:

Wii Controller Connection

The following package was used to interface the Wii controller to a Linux device. The first step is to download this package (link below) on the laptop and connect the Wii remote via Bluetooth in the laptop settings.

Follow the instructions on the github to install the driver package.

In order to connect it, open the back cover of the Wii remote, and press the red sync button. This will make the 4 LED’s on the front of the controller flash. Once the lights are flashing, select the Wii remote on the Bluetooth device manager in the laptop settings. It should have the name Nintendo RVL-CNT-01. The controller is connected once the first LED is turned on and the others are off.

Once the package is downloaded, an additional way to check connection between the Wiimote and computer is by running the command on a Linux terminal

   xwiishow list

This command will show the device number (the device number may be different) and also confirms the connection. The output should be:

   Found device #1: /sys/devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3:1.0/bluetooth/hci0/hci0:2/0005:057E:0306.0007

Once the controller is connected, one can check the inputs of the controller with the following command:

   xwiishow (device number)

In this example the device number is 1, therefore the command is

   xwiishow 1

Press the buttons and rotate the control to see the accelerometer values change in the terminal.

Now that the controller is connected, the source code can be downloaded to access the accelerometer data and used to control dynamixels. }

Source Code

Below is the source code for the client and server used in the program. Download the folder on a lap top and the folder on the Darwin OP. The server will be receiving the Wii remote input and updating the Dynamixel MX-28 positions based off the wii accelerometer orientation.

Compiling the Client

If the xwiimote driver is successfully installed on the linux system, the library file should be installed in


The program can be compiled direclty, however, the library file and header will need to be manually included in C compiler. Using terminal, navigate to the xwiiacc folder. While inside xwiiacc, execute the following command to compile the program:

   gcc main.cpp -o xwiiacc -L/~/usr/local/lib/ -lxwiimote

The output program file is called xwiiacc.


This section gives step-by-step instructions on how to run the program.

Step 1: Run sudo su on Darwin OP (password is 111111) and navigate to the code folder with the following command;

   cd Desktop/darwin_wii/Linux/project/network_programming/

Then make the code :


Step 2

Once the program is built, make sure that both the client (laptop) and the server (Darwin OP) are connected to the same network. In this case it is “DASLWarehouse 2”

Step 3

Run the server program by accessing the command prompt, navigating to the network programming folder (Step 1) and running the following command.

   ./server 5000

In this command, 5000 is the port number used for communication between the server and client.

Step 4

Before running the client program, make sure the wii remote is laying still on a flat surface with the controls facing up.

To run the client program on the laptop, access the command prompt and navigate to the folder where the xwiiacc program was compiled in the previous section. Enter the following commands to establish connection with the server:

   sudo ./xwiiacc 5000 1

Enter the password for ubuntu system to execute the program.

Step 5

Once both server and client program is running, the Dynamixel motor on Darwin can be controlled with motion of wii remote. The Left shoulder pitch motor is controlled with the pitch motion of wii remote while the left shoulder roll motor is controlled with the roll motion. Slowly tilt and roll the wii remote for fine controls.

Step 6

To exit out of the program, press control C on the command prompt


In this demonstration, I successfully compiled and execute the program described above

Final Words

This tutorial objective was to access the wii remote data and use it to control dynamixels . The process of connecting a wiimote was explained as well as a client server model to send the data from the wii remote. Once the concepts were conveyed the reader could access data in the wii remote and use it for their project.

Speculating future work derived from this tutorial, includes implementing a nunchuck to the wii and accessing its data. In the big picture, the problem of Wii remote control teleoperation can be solved with this tutorial.

vega_wii.txt · Last modified: 2019/04/09 11:06 by faustovega