trsonic / nvsonic-head-tracker

Spatial Audio 3DOF Head Tracker (requires Arduino Pro Micro + MPU-9250 / MPU-9150)
GNU General Public License v3.0
83 stars 11 forks source link

Not getting any motion data #1

Closed meta-meta closed 5 years ago

meta-meta commented 5 years ago

I've wired an MPU-9250 to an Arduino Pro Micro as described in the readme. I uploaded the sketch and the serial monitor is logging the following repeatedly: 0.0000, 0.0000, 0.0000, 0.0000;

I did a bit of digging through the code and changed the #define in inv_mpu.cpp to

#define MPU9250
//#define MPU9150

saved, then re-compiled, uploaded the sketch.

Still only 0 values in both serial monitor and when I connect to the OSC bridge. Any ideas on how to troubleshoot?

This project is brilliant. Thank you for creating it!

trsonic commented 5 years ago

Looks like there is a problem with wiring, or the MPU-9250 doesn't work properly. Could you post a close picture of your head tracker?

meta-meta commented 5 years ago

image image

I wired them through the hole and soldered to the top. Do you think I need to solder both sides of the board?

I spent a good amount of time looking through the code, adding some logging. I consistently get 1 (no packet available) from mympu_update.

I always get some error code returned from mympu_open if I have debug enabled. If the hardware is functioning properly, can I expect that to return 0?

trsonic commented 5 years ago

I will have a look at the debugging tomorrow.

I usually solder on the bottom, but I don't think this would matter (the vias should do the job in interconnecting both sides of the pcb). Maybe check once again if there is no bridging between any of the adjacent soldering points.

Are you sure it is 9250 not 6500 chip? The label printed on PCB is little confusing.

meta-meta commented 5 years ago

Here's what I ordered: https://www.amazon.com/gp/product/B07KQ65HXQ/ref=ppx_yo_dt_b_asin_title_o02_s00?ie=UTF8&psc=1

From what I understand, 9250 is the 6500 with the addition of the compass. So if you're looking for 6500, you can use a 9250 in place of it and ignore the compass feature.

trsonic commented 5 years ago

mympu_open(200) should give 0.

The code in the loop function could be restructured for higher frame rate, but it doesn't really matter. Your device should work without any modifications. I've been using identical MPU boards as the one you bought without any problems. I would just resolder the devices, maybe try putting solder joints on the bottom side of the PCBs.

meta-meta commented 5 years ago

mympu_open(200) should give 0.

What if you add #define MPU_DEBUG? It returns 0 without MPU_DEBUG defined but when I define it, it returns -7.

I resoldered and checked that there were no bridging between points. I also wired up a second one with larger gauge wires. Both boards have the same behavior.

trsonic commented 5 years ago

What if you try a totally different library, like this one: https://github.com/hideakitai/MPU9250

I've just run the simple.ino example successfully.

meta-meta commented 5 years ago

Thanks, I was thinking that too. I'll give it a go!

meta-meta commented 5 years ago
I2C ERROR CODE : 2
ax = -4966.80 ay = 5949.22 az = 353.52 mg
gx = 14.89 gy = 26.92 gz = -79.41 deg/s
mx = 0 my = 0 mz = 0 mG
q0 = 1.00 qx = 0.00 qy = 0.00 qz = 0.00
Yaw, Pitch, Roll: -7.51, 0.00, 0.00

Well, this is a start! I guess the compass is not working?

meta-meta commented 5 years ago
MPU9250 WHO AM I = 78
Could not connect to MPU9250: 0x0
I2C ERROR CODE : 2
ax = 8031.25 ay = -1558.59 az = -291.02 mg
gx = -27.22 gy = 34.06 gz = -12.82 deg/s
mx = 0 my = 0 mz = 0 mG
q0 = 1.00 qx = 0.00 qy = 0.00 qz = 0.00
Yaw, Pitch, Roll: -7.51, 0.00, 0.00
< calibration parameters >
accel bias [g]: 
0.00, 0.00, 0.00
gyro bias [deg/s]: 
0.00, 0.00, 0.00
mag bias [mG]: 
0.00, 0.00, 0.00
mag scale []: 
1.00, 1.00, 1.00
roll  (x-forward (north)) : 0.00
pitch (y-right (east))    : 0.00
yaw   (z-down (down))     : -7.51
trsonic commented 5 years ago

This is what I get:

ax = -791.99 ay = -16.11 az = 648.93 mg
gx = 0.37 gy = -0.55 gz = 0.31 deg/s
mx = -37 my = 393 mz = 626 mG
q0 = -0.39 qx = -0.01 qy = -0.92 qz = 0.07
Yaw, Pitch, Roll: 174.67, 45.84, -170.90
< calibration parameters >
accel bias [g]: 
0.00, 0.00, 0.00
gyro bias [deg/s]: 
0.00, 0.00, 0.00
mag bias [mG]: 
0.00, 0.00, 0.00
mag scale []: 
1.00, 1.00, 1.00
roll  (x-forward (north)) : -170.90
pitch (y-right (east))    : 45.84
yaw   (z-down (down))     : 174.67

It looks like something is wrong with your MPU. Maybe try experimenting with Kris Winer's library (https://github.com/kriswiner/MPU9250). There might be some issue with magnetometer addressing. Or maybe your chip is faulty. I'm afraid I can't help.

meta-meta commented 5 years ago

Thank you. You've been a tremendous help already. I'll take a look. This is 2 different chips so an addressing issue sounds more likely.

BTW to catch this portion

MPU9250 WHO AM I = 78
Could not connect to MPU9250: 0x0
I2C ERROR CODE : 2

I had to add a while(!Serial) in the setup.

meta-meta commented 5 years ago

Just curious, is there a reason you went with https://github.com/rpicopter/ArduinoMotionSensorExample over other libraries? If you were to start this project today, would you choose a different library?

trsonic commented 5 years ago

Yes, there is a good reason. It uses the Invensense Digital Motion Processor, which performs the sensor fusion very well. There is no need for any calibration steps done by the user. The only thing is that the horizontal reading will drift during the first minutes of operation, until the temperature of the device will stabilize.

trsonic commented 5 years ago

Let me know if you work it out! Good luck!

meta-meta commented 5 years ago

https://github.com/kriswiner/MPU9250/issues/378

Turns out it was the chip. Thanks for your help!