Introduction: Controlling a Robot With a Wii Remote

This is a fun little project that uses a Raspberry Pi, a Finch Robot, and a Wii Remote (AKA Wiimote), to show some of the things you can do with a raspberry pi and/or a Wii remote. It uses Python and the CWiiD library to receive input from the Wii remote over Bluetooth. I bought the robot, called a Finch, Here. On their website, they have their own tutorial on how to connect their robot to a raspberry pi, I just took it a few steps further.


UP: Forward

DOWN: Backward

LEFT: turns left

RIGHT: turns right

A: turns the LED a series of different colors for a few seconds

B: Stop

Minus: turns the LED Cyan

Home: turns the LED Green

Plus: turns the LED Pink

1: turns the LED Red

2: turns the LED Blue

B + LEFT: spins in doughnuts counter-clockwise

B + RIGHT: spins in doughnuts clockwise

Minus + Plus: shuts the program down

If you don't have a Wii remote or would rather use a keyboard, I wrote a Java program that does the same as the python code, and a few extra things too. However, this requires a few different steps, so that will be in a separate Instructable.

Now lets get to the How-to part of this How-to.

Step 1: What You Need!

What I used:

4. Battery: It doesn't have to be this powerful, but it needs to have at least 2 USB ports, and one of those has to have an output of at least 2 Amps.

7. Finch Mount: I 3D Printed this part, the STL file can be downloaded here. It can also be found in the official Finch website.

8. Wi-Fi Dongle: This is an optional part, it just makes the Pi easier to remote into when its all put together.

9. Bluetooth Dongle:

10. 2 to 1 USB adapter: This is to power the robot, the Raspberry Pi can't output enough power to run it, so one USB has to be plugged into the battery.

The A-B USB cord can be found almost anywhere that sells electronics, and the Velcro straps at a hobby shop.

A Windows computer is recommended because of the software used in the next step.

Step 2: Software for Configuring the Finch on the Pi

Because the Raspberry Pi is a tiny, multi-purpose computer, you can't just plug in any piece of hardware and expect it to work without some kind of set up. To set up or configure the finch for the Pi, there are two options; plugging a keyboard and monitor into the Pi and setting it up directly, or a remote connection over SSH. We will be using the latter option in this step, so if you are using a keyboard and monitor, you can skip to the next step.

This is where the Wi-Fi dongle comes in, and you might have to use a keyboard and monitor to set this up. Like I said earlier, this is optional, it will still work if you use an Ethernet cord, then unplug it when you are ready to drive it.

1. Find the IP address of your Pi. If you don't know what it is already, then you can use a tool called Advanced IP Scanner. This will, obviously, scan your local network and give you the name and IP address of all devices connected. Unless you have set up a static IP, then it will most likely be something like 192.168.X.XXX.

2. Once you have your Pi's IP address, you need a way of connecting to it over SSH. I used Putty. You just put the IP address in the text bar, then click "Open".

3. We will need to transfer a file from your computer to the pi, I used WinSCP.

Once these are ready to go on your computer, continue to the next step.

Step 3: Configuring the Finch on the Pi

First of all, like I said in the last step, both the Finch and the Pi are not "plug and play". To set up the Pi to control the Finch, we need to download and unzip the file here. The name of the file is "BBTechSoftwareForPi".

After the file is unzipped, copy it over to the pi using WinSCP, or if you are not using a remote connection, then you can copy the file to a flash drive, then move it to the Pi's main directory, as in the picture above.

You can now run the finch from the raspberry pi, and there are some example programs in several languages in the file. For our purposes though, we will be using the FinchPython file. To run a python program on the pi, you need to get to the python directory, (FinchPython). so you would type:

"cd BBTechSoftwareForPi

cd FinchPython


Step 4: Installing CWiiD and Bluetooth

now we need the python library that makes using a Wii remote possible.

to configure Bluetooth, enter in the following commands into the terminal:

"sudo apt-get install --no-install-recommends Bluetooth"

This is important, the "no-install-recommends" keeps it from installing a bunch of other stuff like Bluetooth printing, which stops the stuff you need from installing, this command only installs the part you need: simple Bluetooth communication drivers.

Bluetooth should be running right now, but to test it, type:

"sudo service bluetooth status"

it should say "Bluetooth is running", if not, restart your Pi and try again.

Now to install CWiiD:

type the following commands into the terminal:

"sudo apt-get install python-cwiid"

to test it:

"hcitool scan"

if you press 1 + 2 on your Wii remote when you typed it, then the Pi will see it, and say:

"Scanning ... 00:1E:02:8A:CD:A1 Nintendo RVL-CNT-01"

If you get this, then it was successful, and you are ready to move to the next step.

Step 5: The Python Code

Download the code I wrote here.

Once that is downloaded, open up WinSCP again, you need to copy the file to the FinchPython folder, inside the BBTechSoftwareForPi folder, which you should have copied to the Pi's main directory earlier.

To run the program, in the terminal, type:

cd BBTechSoftware

cd FinchPython


it should then instruct you to "press 1 + 2 on your Wii remote now..."

all the software for this is now finished and ready to go. Now we need to get all the hardware ready.

Step 6: The Finch Mount

If you didn't download the STL file already, then download it now and print it.

When I printed it, something went wrong and I couldn't punch out the holes, so I cut them out myself with a dremel. Also: unless you have a way to edit STL files, you will need to add a 4th hole for the Pi's power input, it needs to be about 1.5 centimeters from the flat part (top), .5 inches across, and .25 inches from the edge of the side. these are estimations, feel free to modify the measurements; but it does need to fit the micro-USB cord that gives power to the Pi.

Step 7: Placement of the Pi and Battery

We need the Raspberry Pi, the finch mount, the battery, and one of the Velcro straps now. Place the Pi inside the mount with the micro USB port facing the hole for the power. Then put the battery underneath the mount, so that the flat side of the mount is on top of the battery, and the Pi is inside resting on the flat part. Follow the pictures for greater detail. Next we thread one of the Velcro straps through the two smaller holes over the Pi. While holding the strap tight so that the Pi doesn't fall out, flip the mount upside down with the battery, and secure the strap over the battery. Make sure that it is tight, so that the battery wont fall out or slide around too much.

Step 8: Connecting the Pi to the Battery

Your battery should have come with a USB to micro USB cord, we need this cord to power the Pi from the battery. We will also need the 2 to 1 USB adapter. Feed one of the USB plugs from the adapter out of the larger hole below the hole you used with the Velcro strap; take this plug and plug it into the 2 Amp USB port on the battery. Take the other end and plug it into an open USB port on the Pi. Then take the micro USB cord, and plug the micro USB end, and plug it into the power input of the pi through the power hole; then take the USB A end of it and plug that into the remaining the USB port on the battery. Both the battery and the Pi should light up now. If you are using a wired internet connection, you will have to plug in a network cord to the pi now.

Step 9: Connecting the Finch to the Pi and Battery

Get out your Finch, and your A to B USB cable, and plug the USB B end into the Finch. Then take the USB A end and plug it into the USB port on the adapter. The adapter has 2 usb cords, one is both power and data, the other is only power, to make sure that the right cord is going to the right port, unplug the part of the adapter that goes into the Pi. The finch's lights should stay on, if they turn off, then that means that the data cord is plugged into the battery, if this is the case, then switch the adapter cords.

Step 10: Packing It All Together

If you are using a wired connection, then you should have a network cord already plugged into the pi now, remote into the Pi, and run the program, using the commands from step 5; After making sure the program is running, and you have pressed 1 + 2 on your Wii remote to connect it, unplug the network cord.

Feed the second Velcro straps through the same holes as the first one , then pack all the wires inside the mount/shell, be careful not to fold a wire too sharply, or to put too much pressure on a plug, then put the mount on top of the finch. Use the Velcro strap to secure the mount so it will stay on by wrapping it under the finch as seen in the pictures. If you are using a Wi-Fi connection, then now is the time to run the program using the terminal commands from Step 5. Remember to press 1 + 2 on your Wii remote when prompted to connect the remote and the Pi.

Congratulations! You can now drive a Finch robot around with a Wii remote!

Raspberry Pi Contest 2016

Participated in the
Raspberry Pi Contest 2016

Hack Your Day Contest

Participated in the
Hack Your Day Contest