iainmckay / jollyi2c

3 stars 2 forks source link

Does the DMP code work for the MPU6050? #1

Open jcramer opened 9 years ago

jcramer commented 9 years ago

The README files suggest raw data is only available from the MPU6050 sensor, but the c# code has the ported DMP code. So my question is can the DMP values be read if I utilize an interupt pin on my netduino 2?

iainmckay commented 9 years ago

Funny you ask. InvenSense released their own code for working with the sensor, I've ported that and I have it (the DMP) working.

You can find it here, https://github.com/iainmckay/jollyi2c/tree/migration, I still have some kinks to work out as the sensor seems to flip out then settle back down.

The branch is subject to change but you're free to use it and feedback would be appreciated.

jcramer commented 9 years ago

Great, thanks. It was meant to be, or something... So, I loaded this code and it works. Now I'm trying to figure if the YPR values are accurate. I would assume the units are in degrees, but when I move the sensor around I experience a discontinuity in values. For example, as I rotate the sensor about one axis I will be reading 44, 45, 46 and then jump to 0, 1, 2 degrees. Is this what you experience? I am also wondering why there are YPR and YPR2?

iainmckay commented 9 years ago

Yes, this is one of the kinks I referred to in my previous reply, I experience the same. The YPR2 values are an artifact of some testing I was running to try to determine why this is happening.

I think the problem lies in the math that computes the YPR values. I have more testing to do and I hope to solve the issue soon.

Thanks for the feedback, it's good to know it (sort of) functions on another device.

jcramer commented 9 years ago

You may know this, but the DMP feature called "calibrate gyro" is turned on which calibrates the gyro after 8 seconds of no movement. So I see the gyro values jump and zero nicely after this 8 second period. Before this period the gyro is not zeroed when still.

I also noticed that when testing the gyro values displayed in your debug print line, they are about a factor of 10 higher than the deg/sec. I basically move the sensor 45 degree over a duration of 5 seconds and should expect to see a gyro value of 9 deg/sec. Instead I am seeing values around 90 deg/sec.

On Sat, Oct 3, 2015 at 11:45 AM, Iain Mckay notifications@github.com wrote:

Yes, this is one of the kinks I referred to in my previous reply, I experience the same. The YPR2 values are an artifact of some testing I was running to try to determine why this is happening.

I think the problem lies in the math that computes the YPR values. I have more testing to do and I hope to solve the issue soon.

Thanks for the feedback, it's good to know it (sort of) functions on another device.

— Reply to this email directly or view it on GitHub https://github.com/iainmckay/jollyi2c/issues/1#issuecomment-145260036.

iainmckay commented 9 years ago

I've been doing some investigating and I think the issue is down to the lack of bias/offsets being set.

There's a few threads I've come across where people put this problem down to bad chips, I have a number of MPU6050's so I'll solder a few more up and see if they exhibit the same behaviour.