16/05/2014 – There is a bug is the Calibration Sketch which prevent it doing what it’s supposed to to. So until I get a fix out (tonight) it’s eye candy only. The yaw drift calibration can still be performed in the main sketch but the in-game experience isn’t as drift free as it should be.
This is a work in progress so all feedback welcome.
N.B if you want to play with this you’ll need to install the InvensenseMotionDriver (available in above link) in the Arduino lib folder.
[Edit 14/May] If you’re doing this from scratch (never having played with the older MPU6050Joy sketch) then you will need to drop in a couple of modified files (USBAPI.h & HID.cpp ) from https://github.com/pocketmoon/MPU-6050-Arduino-Micro-Head-Tracker/tree/master/Arduino%20Library Instructions on the github page.
I’ve been working on a couple of major changes and additions to the ED Tracker software; A Windows based UI and a move away from the I2CDevLib libraries to a port of the ‘fresher’ Invensense code base.
The UI is written using the Processing IDE (which is a familiar Uncle to the Arduino IDE). It provides a much friendlier way for ED Tracker users to perform calibration and drift compensation calculations. No need for serial monitor windows and changing code variables.
One benefit of Processing is that it very quick to develop in. It’s also cross-platform (being java). It does look a bit 1990’s though :)
There is a spirit level on the right hand side to enable the sensor to be positioned flat for calibration. It’s also useful to confirm you have your headphones positioned correctly (with the sensor above your heads pivot point). The UI sends a command to the Arduino Micro to start talking to it. You can also force this to happen by hitting 1 to toggle monitoring.
N.B At the moment you cannot load a sketch to the Pro Micro while the UI is running (it hangs onto the com port). So quit the UI when uploading sketches.
Due to memory constraints there still two sketches; Calibration and EDTracker. There are still optimisations and space savings to be made so I still aim to combine all the functionality into a single sketch eventually.
When the main ED Tracker sketch is loaded the area at the bottom of the UI shows the output from the DMP (yaw and pitch) along with current yaw drift. You can scale the drift axis to ‘zoom in’ and visually check how drift is behaving over time.
The code base is designed to operate with a top mouted sensor. You can use option 5 ‘Rotate Mounting Axis’ to adjust which way is ‘forward’. Stick your EDTracker on your head and ensure the head in the UI acts like it’s in a mirror. Just hit 5 to cycle through the available moutings. The orientation is saved in EEPROM so you only have to do it once.
- Load up the Calibration Sketch to the Micro
- Run the UI.
- Monitoring should kick in after 15 seconds or so (hit 1 to force it if not)
- Position the ED Tracker so that the sensor is as flat/horizontal as possible.
- Allow to warm-up/settle for a minute or two
- Hit 9 to recalculate the bias values. New bias values will be displayed and saved to EEPROM.
- Hit 2 and check that the bias info read back from the tracker matched the bias values reported above.
- A BUG prevents the recalibration having any visible effect on the red dot in the spirit level. Fixed in next release
Yaw Drift Compensation
- Load the main EDTracker sketch
- Run the UI
- Allow the tracker to settle and warm up (2 – 3 minutes)
- The current ‘in use’ drift compensation value in displayed
- The current measured (actual) drift value is also displayed
- Hit 3 to reset the view (straight ahead) and reset drift tracking
- After 5 minutes hit 8 to calculate a new drift comp value
- The new value is automatically writted to EEPROM
- Hit 3 and wait another 5 minutes.
- The reported Yaw Drift value should tend to a value less than 1.0, usually less than 0.5 is achievable
- Once you’re happy with the Yaw Drift hit 8 to save it to EEPROM.
There are still user configurable settings which need to be in-code, i.e linear/non-linear response curve & response scaling. It’s on my TODO list to add these to the UI.
There are still lots of things to be implemented – dynamic drift compensation (does it change with temperature?), ‘crotch look reset’ – looking straight down will perform a re-centering, magnetometer integration (MPU-9150 or separate device).