Using the MPU9250 to get Real-time Motion Data

Code and explanation for getting directional and motion data from the raw sensor outputs.

Nov 7, 2016

192236 views

22 respects

Components and supplies

1

Arduino Mega 2560

1

SparkFun IMU Breakout - MPU-9250

Apps and platforms

1

Arduino IDE

Project description

Code

Github

https://github.com/kriswiner/MPU-9250

Github

https://github.com/kriswiner/MPU-9250

Downloadable files

RTPT - MPU connections

RTPT - MPU connections

RTPT - MPU connections

RTPT - MPU connections

Comments

Only logged in users can leave comments

Image
Image

Anonymous user

2 years ago

hi, i want to get roll, pitch and yaw data by using MPU-9250. Is it possible that mpu9250 is interfacing with stand alone micro controller and i don't want to use any development board like arduino, raspbery e.t.c. if possible, please tell me how ? is there any sample code('C' language) for getting roll, pitch and yaw using mpu9250

Image
Image

Anonymous user

2 years ago

Hi, I've tried the code but my yaw always converges back to a fixed value. When I rotate the mpu9250, the yaw changes value momentarily but it goes back to the original value after I stop moving it. Do you know what may cause the error?

Image
Image

Anonymous user

2 years ago

Does the I2C have internal pull-up resistors or do I have to connect external pull-up resistors? I am getting this error for a brand new sensor running at VCC:3.3V MPU9250 9-DOF 16-bit motion sensor 60 ug LSB MPU9250 I AM FF I should be 71 Could not connect to MPU9250: 0xFF Could this be because of the lack of external pull-up resistors?

Image
Image

paulplusx

2 years ago

External Pull-up resistors might fix the issue.Most of the time this error occurs when the wires are not properly connected or are in a bad shape.Personally I didn't have to use pull-ups (maybe because my breakout board had internal pull-ups)

Image
Image

Anonymous user

2 years ago

Hi I'm having the same issue as yours. Were you able to get it connected?? and if yes then how?

Image
Image

Anonymous user

2 years ago

I have to change #define ADO 1 to #define ADO 0 because my MPU9250 address is 0x68 and AK8963_ADDRESS 0x0C (magnetometer). I have a generic MPU 9250, not the breakout.

Image
Image

lambert5l

2 years ago

What a fabulous post this has been. Never seen this kind of useful post. I am grateful to you and expect more number of posts like these. Thank you very much.

Image
Image

lambert5l

2 years ago

What a fabulous post this has been. Never seen this kind of useful post. I am grateful to you and expect more number of posts like these. Thank you very much.

Image
Image

Anonymous user

2 years ago

What changes would i have to incorporate if I'm using an Arduino Pro Mini? I simply get this as the output: MPU9250 9-DOF 16-bit motion sensor 60 ug LSB Please help.

Image
Image

Anonymous user

3 years ago

Hi, I've tried the code but my yaw always converges back to a fixed value. When I rotate the mpu9250, the yaw changes value momentarily but it goes back to the original value after I stop moving it. Do you know what may cause the error?

Image
Image

Anonymous user

5 years ago

hi, i want to get roll, pitch and yaw data by using MPU-9250. Is it possible that mpu9250 is interfacing with stand alone micro controller and i don't want to use any development board like arduino, raspbery e.t.c. if possible, please tell me how ? is there any sample code('C' language) for getting roll, pitch and yaw using mpu9250

Image
Image

Anonymous user

5 years ago

It is just printing pitch, roll, and yaw 12 times, how to resolve that?

Image
Image

Anonymous user

8 years ago

What changes would i have to incorporate if I'm using an Arduino Pro Mini? I simply get this as the output: MPU9250 9-DOF 16-bit motion sensor 60 ug LSB Please help.

Image
Image

Anonymous user

8 years ago

Does the I2C have internal pull-up resistors or do I have to connect external pull-up resistors? I am getting this error for a brand new sensor running at VCC:3.3V MPU9250 9-DOF 16-bit motion sensor 60 ug LSB MPU9250 I AM FF I should be 71 Could not connect to MPU9250: 0xFF Could this be because of the lack of external pull-up resistors?

Image
Image

Anonymous user

2 years ago

Hi I'm having the same issue as yours. Were you able to get it connected?? and if yes then how?

Image
Image

Anonymous user

2 years ago

I have to change #define ADO 1 to #define ADO 0 because my MPU9250 address is 0x68 and AK8963_ADDRESS 0x0C (magnetometer). I have a generic MPU 9250, not the breakout.

Image
Image

paulplusx

2 years ago

External Pull-up resistors might fix the issue.Most of the time this error occurs when the wires are not properly connected or are in a bad shape.Personally I didn't have to use pull-ups (maybe because my breakout board had internal pull-ups)