Massima

Joined 26 March 2020
1,860 bytes added ,  26 March 2020
no edit summary
No edit summary
No edit summary
Line 41: Line 41:


<big>'''TRICKS:'''</big>you could have problem flashing the code on board try, while you press load, to reset the board connecting for a while RST with GND (windows and linux), remove modemmanager (linux). Perhaps if arduino IDE doesn’t start you need to  make the main binary executable with ''“chmod +x /path/filename”''(linux).
<big>'''TRICKS:'''</big>you could have problem flashing the code on board try, while you press load, to reset the board connecting for a while RST with GND (windows and linux), remove modemmanager (linux). Perhaps if arduino IDE doesn’t start you need to  make the main binary executable with ''“chmod +x /path/filename”''(linux).
<big>'''CONNECTIONS'''</big>
A visual scheme is available on the edtracker site, anyway you need the following connections:
{| class="wikitable"
|-
! MPU9250 !! Arduino Board !!  !! button !! Arduino Board
|-
| VCC || 5V ||  || || RST
|-
| GND || GND ||  ||  || GND
|-
| SDA || SDA (pin 2 for micro)* ||  ||  ||
|-
| SCL ||SCL (pin 3 for micro)* ||  ||  ||
|}
*  pins change for different boards.
[[File:My headtrack built.jpg|thumb|my headtrack built]]
<big>'''THE CODE'''</big>
I would say thanks to @hideakitai for his library (https://github.com/hideakitai), it is the only that gives us pitch, roll, yaw. I traslate them in a binary format used by hatire. So install its library in the library manager.
<big>'''CALIBRATE THE MPU9250 (be aware from EM sources)'''</big>
The first step needs to open the sketch called “calibration” (file→ examples→ MPU9250), load it and open the serial console:
1. Keep the MPU9250 on the table, horizontal, don’t move it!! so it will calibrate the accelerometer and gyroscope;
2. soon you will read “Mag Calibration: Wave device in a figure eight until done!”. Now rotate it for 360° describing a sphere, fast, rotate it in every position;
3. at the end save datas like these:
''
< calibration parameters >
  accel bias [g]:
13.85, 68.24, -206.36
  gyro bias [deg/s]:
-5.79, -3.03, -2.47
    mag bias [mG]:
-39.82, 77.82, -422.38
    mag scale []:
1.04, 1.02, 0.94
''
4. Open my  sketch “mpu9250-hatire” and change values, with yours:
'''
  mpu.setGyroBias(0, -5.79);
  mpu.setGyroBias(1, -3.03);
  mpu.setGyroBias(2, -2.47);
  mpu.setMagBias(0, -39.82);
  mpu.setMagBias(1, +77.82);
  mpu.setMagBias(2, -422.38);
  mpu.setMagScale(0, +1.04);
  mpu.setMagScale(1, +1.02);
  mpu.setMagScale(2, +0.94);''
DO NOT ENTER DATA FOR THE ACCELEROMETER, they are commented in that file.
18

edits