You are viewing an older revision! See the latest version
IMU Game Controller
IMU Game Controller¶
This wiki page details how to make an IMU body controller that allows you to play Pokemon using your body. An IMU is attached to the foot and the hand and gestures are used to control the game character. XBee is used to wirelessly transmit motions from the hands and feet to a third mbed connected to the computer.
Components needed¶
| Item | Quantity |
|---|---|
| LSM9DS1 IMU | 2 |
| mbed | 3 |
| Pushbutton | 3 |
| Xbee S1 | 3 |
| USB Connector | 1 |
| Battery Packs | 2 |
Wiring¶
There are three separate mbeds used on three separate breadboards.
Foot Module¶
| LSM9DS1 IMU | =mbed |
|---|---|
| GND | GND |
| VDD | VOUT |
| SCL | p26 |
| SDA | p27 |
You must also add pull up resistors on the SDA and SCL lines.
| Xbee | mbed |
|---|---|
| GND | GND |
| VCC | VOUT |
| DOUT | p10 |
| DIN | p9 |
| Battery Pack | mbed |
|---|---|
| VDD | Vin |
| GND | GND |
Pushbutton connected to p17 and ground
Hand Module¶
| LSM9DS1 IMU | =mbed |
|---|---|
| GND | GND |
| VDD | VOUT |
| SCL | p10 |
| SDA | p9 |
You must also add pull up resistors on the SDA and SCL lines.
| Xbee | mbed |
|---|---|
| GND | GND |
| VCC | VOUT |
| DOUT | p27 |
| DIN | p28 |
| Battery Pack | mbed |
|---|---|
| VDD | Vin |
| GND | GND |
Pushbutton 1 connected to p21 and ground Pushbutton 2 connected to p5 and ground
Reciever Module¶
| Xbee | mbed |
|---|---|
| GND | GND |
| VCC | VOUT |
| DOUT | p27 |
| DIN | p28 |
| USB Connector | mbed |
|---|---|
| VCC | VIN |
| D- | D- |
| D+ | D+ |
| GND | GND |
Example Code¶
Here is example code that detect inputs from walking and turn it into directional movement for movement input into a game. The hand module detects hand motions for moving through menus and two push buttons for additional input. The game used in the example is Pokemon Fire Red running on a Game Boy Advance emulator.
Import programFootModuleCode
Code to detect walking and convert to input for video game
Import programHandController
Code to detect hand movement for use in video game
Import programWirelessControllerRecieve
Code to receive input from foot and hand module and sends data to computer as a key press
The foot should be fastened securely to one foot. When powered on, hold the module still until the first LED on the mbed lights up. Then rotate the foot module at least 360 degrees until the second LED on the mbed lights up. After that, face the direction you want to be forward and press the button on the foot module.
For the hand module, it must be held still for a few seconds after powering on.
The receiving module must be connected to the computer through the added USB connector.
Set up your game emulator so that movement is controlled by the arrow keys of the keyboard and the A button is attached to the "A" key and the B button is attached to the "B" key.
To move your character, simply walk in place facing the direction you want to travel. To navigate through menus, tilt your hand in the direction you want to move the cursor, using the push buttons for selections.
