How to Hack a Wii Remote (on the raspberry pi)

In this tutorial, I will be telling you how to hack a wii remote. I decided to do this because of a comment:

Can You Post The Code that you used for it & how to hack or reconfigure the wii remote? That would be awesome!


Step 1: Get yourself a bluetooth adapter (you can get one easily from ryanteck) and a Wii remote.

Step 2: Install the required libraries and drivers by typing the following commands into a terminal window:

sudo apt-get update
sudo apt-get install python-cwiid bluetooth

Step 3: Put your pi in discoverable mode by typing the following into a terminal window:

sudo hciconfig hci0 piscan

The code

This will go through each bit of python code to do different things on the wii remote.

Type this in import the library:
import cwiid

Type this in to connect to the wii remote:
wm = cwiid.Wiimote()
Once you run that line of code, make sure to put your remote in discoverable mode by pressing the 1 and 2 keys at the same time.

This line can fail and raise a RuntimeError if it fails to connect to the remote, so you’ll want to handle this and keep attempting to connect until you’re successful

Type this in to tell the wii remote to report back the button state:
wm.rpt_mode = cwiid.RPT_BTN

Press a button and type this in to get its value:

You can use the values for different buttons later to compare them with the value returned by this code in a program to see if a certain button is pressed.

Type this in to change the current leds lit on the wii remote:
wm.led = replace this value with led value
The led values go up in binary, ie. led 1 is 1, led 2 is 2, led 1 and 2 is 3, led 3 is 4, ect.

Type this in to make the wii remote vibrate:
wm.rumble = True
Replace the value True in the above code with False to make the wii remote stop vibrating.


I think that hacking a wii remote is quite easy once you know how to and I really hope this tutorial helped!


3 thoughts on “How to Hack a Wii Remote (on the raspberry pi)

  1. Hey CS! Im a 11 Year old Brazilian Python programmer, and im now quite impressed with your work >.< Really, with 10 i only did know how to markup html tags haha. I think that you might like to do a WebControlled robot, with something like flask…
    Just a suggestion, tough.


    1. Hi, I think it would be cool to do a web controlled robot because it would give me more flexibility and allow me to add cool things like a display of what the robot currently sees (maybe even an option to stream from that display onto your device for later use).


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.