Go Down

Topic: MPU6050/MPU6500/MPU9150/MPU9250 library over I2c (Read 11684 times) previous topic - next topic

I had the same problem as you. I renamed the original library "I2Cdev" in my libraries folder and it compiled fine.
But after the values show up on Serial monitor for about  5s, it froze. When I close and reopen Serial monitor, it shows the values and froze again after 5s. I don't know what's wrong.
Does it report something like 'READ ERROR' when it freezes? If it does, can you try to increase Serial speed to 115200: https://github.com/rpicopter/ArduinoMotionSensorExample/blob/master/AvrCopter.ino#L9

You could also try to decrese I2C speed on Line 8 to 200 to see if it helps.


I'm novice to this library. I'm looking for a way to detect acceleration also to determine the platform speed and acceleration. Is it possible to get using this library?

Platform speed is more complex than just measuring acceleration. Obviously you could derive some kind of velocity but from my experience it will not be accurate. Usually people couple more sensors to derive velocity like GPS and accelerometer or barometer and accelerometer.
However the library does not do anything like that.


Feb 02, 2015, 08:17 pm Last Edit: Feb 02, 2015, 08:28 pm by nmirod
For starters thanks for your library!

I have been trying to use your library to get data from an IMU connected to an arduino UNO. Moreover, the sketch on the arduino will work as an ROS node (don't know if you are familiar with ROS).
After some problems I was able to get the IMU to work and I was able to receive the IMU data published by the arduino. However I want to use the same arduino to control some motors using an H-bridge. When I implement the subscriber (basically a function that will get the controls from the computer and execute the necessary motor control) the IMU stopped working.

At that point the output of mympu_open() is zero, while the output of mympu_update() becomes "-1" and I'm unable to read the IMU.
Can you help me understand what might be going on?

Thanks in advance.


Hi Gregory !

Fisrt, I'm sorry for my long silence, I've had urgent problems to solve and my MPU9250 was not my priority since september !
I yesterday downloaded your last version of avrcopter, and... It doesn' work :-(

I use an Arduino UNO, just like you.
When using I2C-scanner, I can find a device at I2C adress 0x68.

I do not use the makefile, but the ide compiler... Is that a problem ?
In your code, I've add  #define MPU9250 in inv_mpu.h, and  #define MPU_DEBUG in all .h

I get this :
MPU init: 3
Free mem: 208

I've searched were the error comes from.

It happens at the very beginning of the program, at the call of ret = mympu_open(200);

I've searched a bit more...
In mpu.cpp, function mympu_open(...), call to mpu_init(NULL) returns -7

Then, I've found that comes from inv_mpu.cpp, function mpu-read_mem, in wich
st->chip_cfg.sensors equal 0

Have you any Idea of the origin of the problem ?

Many thanks !

PS : have you tryed the MPU9250 ? If not, and if you are interested, I'd be happy to send you one on a breakout board ! ;-)


Hi Dan ! Hi Greg !
Dan, you've said you have been able to run the code with an MPU9250 + Arduino MEGA ?
I've just tryed the same, but I'm unable to make it work :-(
I've been trying for months now, not every nights, but...
Would you tell me which code you used ? which libraries ?
I'm afraid there's just a little thing different and nothing works...
Tonight, I've tryed an i2c_scanner with the same arduino mega and MPU9250, with a windows 7 computer runing arduino 1.0.6, and with a windows 8.1 computer runing arduino 1.5.7.
In the first case, I get the address 0x68, and in the second case, I get 0x69 !?? Strange thing !
Would you give me your complete configuration so that I can do exactly the same ?
Thanks a lot for your help !

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131