Elite Dangerous Headtracker

Headtracker built with a Teensy 2.0 and an Adafruit 9-DOF IMU Breakout
Based on work from WebKris & Michael Baker

Similar projects worth following
That project is based on Kris one ( which is also based on Michael Baker’s one (
I built it for Elite Dangerous (

View all 6 instructions

Enjoy this project?



Ki Nguy wrote 08/22/2017 at 20:37 point

Hi Folks,

I finally built and got it working. Am able to visualized the data. Similar with the  link

I used Teensy2.0 and Pololu miniIMU-9 v3 and utilize the following sketch(program) MiniIMU9AHSR/or Pololu_Open_IMU. (included calibrate)

My only problem is that I couldn't get OpenTrack to recognize the data. I have tried to set it,

as a USB type,  Serial, Keyboard+Mouse+Joystick and Serial Keyboard+Mouse+Joystick. Could this be the Teensy2.0 issue?

  Are you sure? yes | no

Brian wrote 03/31/2016 at 18:48 point

I have another use for the tracker, navigation gear for simulator program. The visual device is on a gimbal and view needs to change as you move the device. Very much the same, just not a "head tracker". My program requires the clicking of a button to activate the joystick. I see the Joystick.button Action from the sub joystick example, but being New to this... I am not sure where to insert it to avoid creating a proble.   Are there digital pins to stay away from?  Wher in the sketch should the button lines  Be safely added?

We built one without buttons and as soon as we removed the screws in the case and pointed toward north, calibration was much More fluid.  Once the Joystick has buttons we can test.

Thanks for any advice

Update - ok I took a couple stabs at it and now have the buttons added to the breadboard version. Hopefully will be able to add them to our prototype and test on Monday

  Are you sure? yes | no

Kristopher Marciniak wrote 01/16/2016 at 22:45 point

Hmm... I tried to upload to Git hub, but I'm not going to make changes to your existing.
Grab code from here:

  Are you sure? yes | no

Grégory Paul wrote 01/16/2016 at 22:52 point

Ok, it is the original code from your blog (minus some changes on fscale parameters). I thought it was something else.

  Are you sure? yes | no

Kristopher Marciniak wrote 01/16/2016 at 22:55 point

Exactly. Give Opentrack a shot!

  Are you sure? yes | no

Grégory Paul wrote 01/17/2016 at 11:34 point

I’ve added the configuration to the github project : (and I’ve added you as contributor too)

  Are you sure? yes | no

Grégory Paul wrote 01/16/2016 at 22:22 point

Hello @webkris ! Thanks a lot for those advice.

I’ll try to calibrate the breakout as you say then give a try to OpenTrack.

Just a question, when you say "I uploaded my code (for use with opentrack)", where did you upload it ? :-)

  Are you sure? yes | no

Kristopher Marciniak wrote 01/16/2016 at 21:08 point

Okay - I had a lot more success tuning this when I dropped all the smoothing off of the Teensy - and moved to using
This allowed me to set up my preferences in Opentrack while the game was running, and you basically leave the teensy to report 1:1 movement in space. I found this much more accurate. I uploaded my code (for use with opentrack) and the opentrack.ini to get you started.

"Just mapped the joystick 1:1.

Once your head tracker loads this code it will do all of the graphing and transformation on Opentrack. Or work like a REALLY SLOW joystick. :p

The Roll and Yaw axis are switched, and all of the inputs are inverted.
Load the ini into Opentrack 2.2-stable /install/settings

Plug in tracker.
Open the code with arduino and upload.
Give it 10 seconds to reset.

Start Opentracker - load settings - hit start and try it out!
Then you can get crazy with all your curves and filtering.

Open Elite - make sure to UNBIND the head look from the Joystick (original config).
It'll be a totally blank config for "Headlook Mode" under elite.

Start a trainer and check it all out.
You can tweak the settings while the game is running!"

Give it a shot!

- Kris

  Are you sure? yes | no

Kristopher Marciniak wrote 01/16/2016 at 20:51 point

Hello from PlanetKris :)
Saw your comments about the headtracker and would be delighted to continue the conversation here. First off - let me start by saying - I only wish I wrote any of the code. This the the work of Michael Baker (the Pololu_Open_IMU using the Madgwick algorithm).

Originally I had tried to use the Adafruit library, but unfortunately, they took the calibration program out of their examples and code and their customer service was like "Techniques for solving the problem do exist, but they're proprietary and valuable to the companies that have them." - even small magnets are powerful to this device... blah blah bla:

But the answer is this: Every single one of these chips needs to be calibrated to run with your program. I built 3 of these and ALL 3 needed manual direct calibration. So, how do we do that?

Clear your desk off, connect your head tracker with a nice long USB, and load the Calibrate program from the LSM303 1.4.4 Library:
Open Serial Monitor
Rotate your IMU slowly 360 degrees in the X, Y, and Z axis.
I usually start flat on the table and rotate 360 - going slow about 10 seconds.
Then without jarring (NO high G load) I slowly pick up the IMU and rotate Left to Right 360.
Then Front to Back... You are trying to get the device to "see" magnetic north in every orientation.

You'll notice the MIN / MAX on the serial output will begin to settle out.
Copy pasta those numbers to the top of the code:

#define compassXMin -###.0f
#define compassYMin -###.0f
#define compassZMin -###.0f
#define compassXMax ###.0f
#define compassYMax ###.0f
#define compassZMax ###.0f

  Are you sure? yes | no

Grégory Paul wrote 01/17/2016 at 11:27 point

You're right, after a slow calibration process, results are much better ! I’ve updated steps to reflect that.

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates