Library for using Particle Photon with SparkFun IMU Breakout - MPU-9250

Hello,

I have been trying to connect Particle Photon with MPU9250 breakboard from SparkFun. The figured out how to make connections, however, it looks like I am not able to get data correctly from MPU9250. I was wondering if there is any library available from community to connect “MPU9250 breakboard from SparkFun” with Particle Photon.

Thanks for your help and support.

With best regards,
Atul

@tkr1980,

The library by Sparkfun works well and i migrated it to be used in Particle:
https://build.particle.io/libs/SparkFun_MPU-9250

Let me know how it goes!

@kennethlimcp,
Thanks for sharing the library. I had downloaded the library myself, but there were some errors which precluded me to use it. Now that you uploaded the SparkFun library in Particle’s Community libraries, I just download it and used it. The code complied without an error, however it still does not seem to give me correct data. Here is the output after I flash it in Photon:

MPU9250 I AM 71 I should be 71
MPU9250 is online…
x-axis self test: acceleration trim within : 0.0% of factory value
y-axis self test: acceleration trim within : 0.0% of factory value
z-axis self test: acceleration trim within : 0.4% of factory value
x-axis self test: gyration trim within : 0.0% of factory value
y-axis self test: gyration trim within : 0.0% of factory value
z-axis self test: gyration trim within : -0.4% of factory value
ax = 0.00 ay = 0.00 az = 0.00 mg
gx = 0.00 gy = 0.00 gz = 220.70 deg/s
mx = 10309 my = 7940 mz = 647 mG
q0 = 1.00 qx = 0.00 qy = 0.00 qz = 0.00
Yaw, Pitch, Roll: -8.50, 0.00, 0.00
rate = 0.49 Hz
ax = 0.00 ay = 0.00 az = 0.00 mg
gx = 0.00 gy = 0.00 gz = 220.70 deg/s
mx = 10309 my = 7940 mz = 647 mG
q0 = 1.00 qx = 0.00 qy = 0.00 qz = 0.00
Yaw, Pitch, Roll: -8.50, 0.00, 0.00
rate = 0.53 Hz
ax = 0.00 ay = 0.00 az = 0.00 mg
gx = 0.00 gy = 0.00 gz = 220.70 deg/s
mx = 10309 my = 7940 mz = 647 mG
q0 = 1.00 qx = 0.00 qy = 0.00 qz = 0.00
Yaw, Pitch, Roll: -8.50, 0.00, 0.00
rate = 0.48 Hz

As you can see, I still get ax=ay=az = 0.00 although I moved the sensor randomly. FYI, here are my PIN connection between Particle Photon and MPU9250:

MPU9250 Photon
SCL D1
SDA D0
VDD 3V3
GND GND

What do you think could be the reason for not getting correct sensor data? Is there any change I must do in the code you shared?

Thanking you for your anticipated help.
Atul

Can you try adding SYSTEM_MODE(MANUAL) to the top of your code and see if the rate increases? Seems like the sampling rate is too low.

Hi,

I tried including SYSTEM_MODE(MANUAL) to the top of my code, but it still did not work. The issue is still same. Do you have any other suggestion? I wonder if you also have bought SparkFun IMU Breakout - MPU-9250. If you have then is it working in your case? By working, I mean is it give you the correct sensor values?

Thanks,
Atul

Hi,

I wrote a library for MPU9250 devices with I2C protocol. I uploaded it to Particle’s Comunnity Libraries.

Name :: MPU9250_I2C
Documentation: https://github.com/jdvr1994/MPU9250PhotonLibrary

I hope I was helpful.