Get multiple mpu6050 working without freezing

Have anyone managed to get multiple mpu6050 working(not crashing) with DPM and interrupt without freezing?


You are asking the wrong question.
The question is what you have done to make it freeze.
For example: a cable for the I2C bus; long wires for the I2C bus; a 5V/3.3V I2C voltage mismatch; something in the sketch; and so on.

I have done this and it works, you can have 2,3,4,5... many MPU's connected simultaneously.

Diagram of connections: Get Value from Multiple MPU6050 Using Arduino with Code - YouTube

Code: MuttipleMPU/MuttipleMPU.ino · master · Shuvashish Sarker / · GitLab

Credits: Shuvashish Sarker

Koepel - I am using 30 cm wires on the I2C bus directely connected to 5V(MPU6050 has voltage regulator on the GY-521 chip). What do you think of that?

paco09 - Looking at your diagram of connections, why havent you connected the VCC pin on the first sensor? I do also get the raw readings for multiple sensors, however I would like to use the DMP or filter thats when it freezes.

How many sensors do you have and which Arduino board do you use ?
I assume that you have a 5V Arduino board, then it has a 5V I2C bus. You might need a level converter for the 3.3V I2C bus of the MPU-6050.

Can you get raw values from both sensors ? That means the hardware is working ? and the problem is in the sketch ?

I got 2 sensors and a YÚN board. I got the SDA and SCL lines of the MPU6050s connected to the SDA and SCL on the YÚN. Further,

Board 1:
VCC -> 5V
AD0 -> GND

Board 2:
VCC -> 5V
AD0 -> 3V3

Yes, I get raw values, however the reading crashes/freezes after 10-15 seconds each time(when using complementary filter or DMP). I suspect the calculations could be the reasong for the crashing?

When both MPU-6050 modules have pullup resistors to 3.3V, then it might work with a 5V Arduino board (The ATmega32U4 runs at 5V). I still prefer a level shifter for SDA and SCL.

Can you give a link to where you bought the MPU-6050 modules ? Can you see the pullup resistors on the modules for SDA and SCL, what is their value ? Can you show a photo with the 50 cm wires ? How are the interrupts connected ? Do you have a schematic or drawing ? Can you show the sketch ? If you use libraries in that sketch, then please tell us where you downloaded those libraries from. Do you use a breadboard ?

Can you get the raw values without freezing/crashes ?
This is the most simple sketch: Arduino Playground - MPU-6050.
You could try it with one MPU-6050 for some time (disconnect the other), and then test the other one. After that test them with other one connected. Is that stable ? If not, then it can be a bad breadboard or a damaged MPU-6050 or there might be a batch of MPU-6050 modules that was manufactured in the wrong way and you bought two of the same batch, it has happened before.

When you do a I2C scan does two address show up or just one? Did you happen to set the alternate I2C address for one of the sensors?


I bought it at GY-521 MPU6050 3-Axis Acceleration Gyroscope 6DOF Module [GY-521] - US $1.40 : HAOYU Electronics : Make Engineers Job Easier.
Here is a picture of the schematics:

There are two pull-up resistors on 4.7K to 3V3?
I do not use interrupts in this set up. I use a breadboard to connect the two mpu6050s.

I use the same connection as paco09 referred to in Get Value from Multiple MPU6050 Using Arduino with Code - YouTube

The libraries I use:

#include "Wire.h"
#include "I2Cdev.h"
#include "MPU6050_6Axis_MotionApps20.h"

The two last ones downloaded from Jeff Rowberg.
It still crashes when I only attempt to get the raw values, I believe I may need external pull-ups?

Both addresses show up on the I2C-scan(0x68, 0x69).

I added two external 10k pullup resisotors and the raw readings are now quite stable. However, when reading the dmp data I crash after approx 30 seconds every time..

The link to shows a module with pullup resistors of "222", that 2k2.
The schematic shows to 4k7 pullup resistors to 4k7.

When you have modules with 2k2 resistors, then the total is 50k (internal pullup) // 2k2 // 2k2 = 1076 Ω. That is too low. Then there is too much current needed to pull the signal low. But you have to read which value your pullup resistors have.

What you wrote in reply #5 is okay. The video is not okay, it has AD0 connected to 5V, but it is a 3.3V chip.

The 'dmp' is used together with the FIFO and interrupts, as far as I know. Have you turned on the debug messages of "MPU6050_6Axis_MotionApps20.h" ?

I dont know which is correct, the schematics linked at the page shows 4k7 pullup resistors as well. However, I added the external pull up resistors(10k) and it seem to be working ok for the raw readings.

I am not able to compile the program with the debug messages turned on, I dont know if it takes up too much space? it should not, I only use 50% for my MPU6050_DMP6 sketch.