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

ItemQuantity
LSM9DS1 IMU2
mbed3
Pushbutton3
Xbee S13
USB Connector1
Battery Packs2

Wiring

There are three separate mbeds used on three separate breadboards.

Foot Module

LSM9DS1 IMU=mbed
GNDGND
VDDVOUT
SCLp26
SDAp27

You must also add pull up resistors on the SDA and SCL lines.

Xbeembed
GNDGND
VCCVOUT
DOUTp10
DINp9
Battery Packmbed
VDDVin
GNDGND

Pushbutton connected to p17 and ground

Hand Module

LSM9DS1 IMU=mbed
GNDGND
VDDVOUT
SCLp10
SDAp9

You must also add pull up resistors on the SDA and SCL lines.

Xbeembed
GNDGND
VCCVOUT
DOUTp27
DINp28
Battery Packmbed
VDDVin
GNDGND

Pushbutton 1 connected to p21 and ground Pushbutton 2 connected to p5 and ground

Reciever Module

Xbeembed
GNDGND
VCCVOUT
DOUTp27
DINp28
USB Connectormbed
VCCVIN
D-D-
D+D+
GNDGND

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.


All wikipages