Inertial Headtracker

Demo of the headtracker prototype. I’m using it to control the view inside an in-game cockpit.

What is a headtracker?

A headtracker is exactly as the name suggests it is. It’s a device that tracks the movement of someone’s head. The headtracker can track position and orientation. They are particularly useful as devices to enhance the experience in simulators or games. For example if you are playing a flight simulator you can use a headtracker to control where you are looking in the simulator. By installing the headtracker on a headset you don’t have to worry about controlling the view since it is done intuitively and hands-free. Have a look at the demo video to see how it works.

I decided to make a headtracker myself. I wanted it to work by using MEMS (micro-electro-mechanical systems) sensors, i.e. no lights or cameras. The principle is that the headtracker should be installed on a headset, plug into a PC with a USB-cable and emulate a joystick device. It shall then track the head using sensor-data from gyroscopes, accelerometers and magnetometers. Because this was a learning project to learn more about embedded development I decided to do almost everything from scratch. This means I wrote programs such as bootloaders and device libraries for protocols such as I2C and USB. This is a continuation of a previous project about bare metal programming ARM Cortex M3 devices. You can read it here.

The source code is available in my GitHub repository.

Device Schematic

The image below is a general description of how the device works. The STM32 microcontroller reads sensor data from the MPU-9250 MEMS-device using the I2C data protocol. The data is input to the Madgwick sensor fusion algorithm that updates the device’s internal position state and orientation state. The internal state is described using quaternions. The quaternions are translated to Euler angles to update an USB report which is then transmitted through the microcontroller’s USB interface.

headtracker_schematic2.svg

Click to view enlarged device schematic