Brian Hensley, an engineer by profession, is an active blogger who has contributed a lot of DIY projects on his site. One of these mentions about combining a Wii remote with a Raspberry Pi with the use of Python. This was a part of a robot project that Brian intended to develop. In this project, he wrote a program and ran it on the Pi which allowed him to connect the Wiimote through Bluetooth after which he was able to control the data with the help of Python.
Before starting the procedure, Brian acquainted himself with the know-how of connecting a Wii controller to a virtual PC. Then he used the Cwiid module to write a small program that could easily grab the data. Once the connection was established, he ported it to the Raspberry Pi. For this setup, he used parts like Raspberry Pi, Wii controller, Standard Raspberry Pi cables and a Bluetooth USB dongle.
First and foremost, the project needed the latest version of Debian to be downloaded on the Raspberry PI. After ensuring this, Brian plugged the dongle into the USB port of the PI and installed the Bluetooth package which took around 1 hour. This time, the duration can be reduced by eliminating the use of GUI. When the Bluetooth connection was established, he scanned for devices and pressed 1+2 on the controller to put it in the discovery mode.
After that, he downloaded and installed the CwiiD module that lets the user control a Wiimote in python. Then he wrote the required program into the directory and called it. At this point, he pressed 1+2 on the remote which finally connected the controller to the Pi.
Now as the buttons are pressed on the remote, related information is displayed on the screen depending upon the instructions that you had set. Here Brian had set the centre point as Position 50 with limits from 0-100. As a result, when he pointed the remote horizontally in front of the screen and pressed the left and right buttons, the values decremented and incremented respectively from 0 to 100.
Moreover, when he pressed the buttons 1 and 2 individually, the information was displayed accordingly disclosing which button was pressed. Then he pressed the left and button 1 which said it’s moving backwards while pressing right button along with 2 said that it’s moving forward. He also set the instructions for minus button which produced a rumbling sound on being pressed. Lastly, the Bluetooth connection was switched off by pressing the plus button.
Brian had prepared this project with the aim of connecting the Wiimote to his robot so that it could be controlled through Pi via Python. You can also develop this interesting project at home by referring to this video uploaded by Brian that reveals the demo of the project.
Filed Under: Reviews
Questions related to this article?
👉Ask and discuss on Electro-Tech-Online.com and EDAboard.com forums.
Tell Us What You Think!!
You must be logged in to post a comment.