Problems Using two MPU6050 Arduino Uno

Good afternoon, im new in arduino and i have a problem what i dont know how to fix it, i dont have any more ideas.

Im using two MPU6050 with an Arduino Uno, the problem is that readings only are perform while 2 to 15 min, same times just for 1 to 5 min. I need it work for more time. It just stop to run without any other message. At the beginning i worked with one MPU6050 and it o it really good, with out any problem, later i used two, for first time it run well too but for same reason i have problems later. I tryed different configurations increasing or reducing the Wire.setClock() and the bits rate, i discovered that it is more stable in low bits rate like 2400 coming at last more than 30 min and it run less time with 9600 or 115200 coming at last 1,2 or 5 min. Im using a code based in MPU6050_DMP by Jeff Rowberg modified for use two MPU6050. At last i used the original code MPU6050_DMP for discart the configuration or codification erros but it still falling in short time, for that reason i think that samething more in bad, perhaps samething in the hardware. The code MPU6050_raw run without any problem for long time.

Please i need help, i dont have idea about what more i would do for fix it.

Thaks for all posible help.

Post your (complete) code and post a wiring diagram (including cable lengths)!

Thanks for the fast answear, here is the code that im using. The wiring is defined in the code too

MPU_2_lecturas1_2.ino (18.2 KB)

The wiring is defined in the code too

Not completely. For example there a no pull-ups specified and the length of the cables are not defined. If you use the internal pull-ups your chips may die as section 6.9 of the datasheet specifies that the voltage level must be below Vcc+0.5V, so below 3.8V in your case while the UNO's internal pullups go to 5V. Also the internal pull-ups are usually to weak for more than one device on the I2C bus.

You are using two interrupt pins, but only one of them is set as input in setup(). Why?

Yes, I know that pins default to INPUT, but YOU should be consistent, too.

       dmpReady = true;

Does this refer to device 1 or device 2?

Im not shure if i change that would interfer with the library operations, do you know if that would happen ?

Pylon answearing you:

pylon: Not completely. For example there a no pull-ups specified and the length of the cables are not defined. If you use the internal pull-ups your chips may die as section 6.9 of the datasheet specifies that the voltage level must be below Vcc+0.5V, so below 3.8V in your case while the UNO's internal pullups go to 5V.

Sorry but i didnt do a wiring diagram, but i connected all like i specified in the code, without the pullups or level voltages. I wired with those things at the begening but i see it runs connecting the componenets directly then i used them in that way. Would that damage my components with the time ?

The tolal wire lenght with i connected my componenets is 180 cm. Including all the wire and connections.

pylon: Also the internal pull-ups are usually to weak for more than one device on the I2C bus.

Then what i have to do for connect two components in the I2C bus ? I did what i see in same tutorials and that run for me but it would be not the correct form for work with that.

I wired with those things at the begening but i see it runs connecting the componenets directly then i used them in that way. Would that damage my components with the time ?

It doesn’t have to but it might do. Driving components outside the maximum voltages specified in the datasheet may result in any unexpected behavior.

The tolal wire lenght with i connected my componenets is 180 cm. Including all the wire and connections.

Does that mean your I2C bus has a length of 1.8m? That’s to much. It should be always below 0.5m otherwise the capacitance of the wires alone may be higher than the max capacitance allowed for the complete bus.

Then what i have to do for connect two components in the I2C bus ? I did what i see in same tutorials and that run for me but it would be not the correct form for work with that.

The tutorials are not always as complete as you would expect them. We often see tutorials that are at the edge of what the specs allow and changing only a minor item in them makes the complete setup not working anymore.

I would start by installing pullups (2k2) from both bus lines (SDA and SCL) to 3V3. This may push the bus idle voltage to acceptable values.