New ED Tracker Sketch


User-set values are now at the top of the sketch after the copyright comments etc.

There is now an option (thanks Dan!) to have an exponential response curve for head movement rather than linear.

Uncomment #define EXPONENTIAL to enable it, e.g.



Step one

Lines 50 to 52 –  ensure the Drift Compensation values are all 0.0

    float xDriftComp =0.0;
    float yDriftComp =0.0;
    float zDriftComp =0.0;

Step 2

uncomment the DEBUGOUTPUT line;

    //comment this in if you want so see output to the serial monitor
    #define DEBUGOUTPUT 1

If you have already performed a full calibration skip to step 4

Step 3
Place the ED Tracker with the sensor as horizontal and as still as possible.
Load the Sketch and open the Serial Monitor (ctrl-shift-m)
When you see the word ‘Settling’ scrolling past press the re-calibration button briefly.
After 15 seconds or so you should see the code enter full calibration mode.
This may take several minutes to complete.  The new offsets will be stored in EEPROM and in use.

Step 4
Load the Sketch (with debug still enabled) and open the again.
After 15 seconds you should start to see x/y/z values and drift value being output every second.
Keeping the sensor stationary, press the recalibrate button. Wait 10 seconds. Press it again.

X/Y/Z 1.59 2.86 -5.24 -1.29 -0.4 0.11
X/Y/Z 1.1 4.16 -7.75 -1.26 -0.16 0.14
X/Y/Z   0.58   6.68   -7.69   -1.28   -0.74   0.19
X/Y/Z   1.4     5.41   -7.72   -1.28   -0.65   0.29
X/Y/Z   2.15   6.65   -6.4     -1.27   -0.17   0.15

Allow these value to settle for 5-10 minutes. The fourth number along is yaw drift and should be between -10 and 10.
Take this drift value and set the xDriftComp at line 50 of the sketch, e.g.

float xDriftComp =-1.27;

Step 5.

Turn debug output off;

//#define DEBUGOUTPUT 1

Load the sketch and configure head look toggle and head look axis in the game config settings menu.


At any time you can reset the view by looking straight ahead and pressing the recalibrate button. It only takes 2 seconds to adjust and you should only need to do this at most every 15 minutes and if you’re lucky, every hour.

It’s best to be wearing the ED Tracker when you plug it in but you should keep still, looking ahead, for the 1st 15 seconds while it calibrates. The red led flashes quickly during the initial ‘keep it still’ calibration phase and then slowly (3 times per second) when the device is running normally.

Alternatively if you have it taped to headphone you can place them across your knee or simply hold them steady. The MPU-6050 needs 10-15s to stabilise it’s output and too much movement during this initial phase can cause drift or worse, bouncy axis syndrome.

A good way to play with scaling value in the code is to keep Elite Dangerous running and alt-tab back to the Arduino IDE. You can edit the sketch, re-upload, and back into the game to test the changes. No need to quit or rebind controls.

There are bugs in the code. Please feedback any issues you have so I can fix them 🙂







3 thoughts on “New ED Tracker Sketch

  1. Thanks for sharing this code and giving good instructions. It’s helping me out so much and it’s just awesome any way. Please keep us updated like you are!

  2. I’m having a problem with the roll axis either not working or being seen as a duplicate of one of the other axis. Have you ever had this problem or know something I can try to fix that? I’m just using the newest code on github.

  3. Hi Pocketmoon, thanks to you and the others for all your hard work on this brilliant project. Don’t know if you caught it but I tinkered with the code and got (I think) pretty good results.

    Rather than post it all here, here’s the link to my post on the ED forums:

    The results, raw data (.xls) and a gyro drift graph are all there. Thought it was quite interesting to see that all three axes drift up and down in lock step.



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s