-
1Step 1
Connect :
- Teensy D0 to SCL
- Teensy D1 to SDA
- Teensy VCC to VIN
- Teensy GND to GND
-
2Step 2
Install Teensyduino
Then, add thoses library to IDE :
-
3Step 3
Load one of the following code :
- https://github.com/paulgreg/headtracking-from-kris : based on Kris code but with minor changes (fix and comments)
- https://github.com/paulgreg/headtracker : a "from scratch" version
-
4Step 4
The chips needs to be calibrated. Otherwise, result won’t be good.
- Clear your desk off, move away any metal object.
To be sure that you’ve got no perturbation, you can use a traditional compass. - Connect your head tracker with a nice long USB.
- Load the Calibrate sketch from LSM303 LSM303 1.4.4 library in menu : examples > LSM303 > Calibrate (https://github.com/pololu/lsm303-arduino/blob/master/LSM303/examples/Calibrate/Calibrate.ino).
- 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 paste those numbers to the top of the code "headtracking-from-kris" :
#define compassXMin -###.0f #define compassYMin -###.0f #define compassZMin -###.0f #define compassXMax ###.0f #define compassYMax ###.0f #define compassZMax ###.0f
- Clear your desk off, move away any metal object.
-
5Step 5
You can then test the device with jstest-gtk
When trying it, be sure to be far away from metal. Even a small metal object has a big influence on sensor !
-
6Step 6
Box was made from a visiting card box that I cut to make it smaller.
I first use screws to mount it inside but breakout is extremely influenced by metal. So I used a hot glue pistol to fix it inside the box.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.