November 21, 2024

Virtual Gesture Input Device Hack using Wiimote

 This projects aims at designing a low cost gesture based input device for computers using a Nintendo Wii Remote(Wiimote). This work is inspired by the virtual whiteboard projects done by Johnny Lee of Carnegie Mellon University. He had used windows based bluetooth stack & wiimote interface library with Visual C#. Here I made use of Cwiid library for python and implemented in Linux environments too. 
Components used:
  • Wii-remote
  • USB Bluetooth dongle*
  • Infrared-LED
  • Python Libraries – Cwiid, Pygame
*If your computer has built-in bluetooth, a dongle is not necessary.

WIIMOTE:

 Wiimote is a hand-held primary controller for Nintendo’s Wii console. Besides just being a joystick, it has multiple features as follows:
  • 3-axis accelerometer
  • Infra-Red Camera
  • Piezo Speaker
  • Rumble-Vibration feedback
  • Player LEDs (also indicate battery level)
  • Buttons
  • Bluetooth connectivity
  • External I2C port

IR CAMERA:

 The wiimote has a 128×96 resolution Infra-Red camera in front that can track upto 4 IR sources. The resolution of the camera is extrapolated to 1024×768 by the built-in processor with a response rate of 100Hz (100 frames/second). The camera is covered with Infra-Red filter for better sensitivity. The IR camera has a field of view of around 33 degrees horizontally and 23 degrees vertically. The python-cwiid library is used to access the x and y co-ordinates of the IR sources.

INFRA-RED LED PEN:

 An infra-red LED is connected in series with 100 Ohm resistor and a switch. This arrangement is placed inside an empty pen with the LED facing outwards and taped together.

WORKING:

 Firstly, the pairing between Wiimote and the host PC is established. Then, the input reporter is initiated so that the joystick’s buttons,accelerometer or IR camera data can be retrieved. Since we are tracking an Infrared LED, we need to initialize the IR camera.
 After initializing the IR camera, in the basic mode,one among the three modes of operation, we get around 5 bytes for 2 IR sources combined. Each position is 20-bit wide;10-bit for X and 10-bit for Y coordinate. The format of data for two IR sources detected by camera is given as follows: 

Image Source: wiibrew.org
 So, the Byte[0] can be combined with Byte[2]<9:8> to form a 10-bit data which corresponds to the x-position of first IR source. Similarly, the y-position is also determined. So by mapping these coordinates to those of the computer screen, we can make the IR-LED’s motion to be sensed and tracked in real time.

RESULTS:

The following image is drawn using the IR pen.

VIDEO DEMO:

Author Profile

Bharathi