Pages: [1]   Go Down
Author Topic: How to connect two MPU6050?  (Read 4958 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 36
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi everybody,
...I've a problem: I connect two sensors MPU6050 and I use the AUXSCL and AUXSDA channel to read data from the second sensor. (to see the attached my circuit) But I don't know how I can read data from the "auxiliary" sensor. There aren't any problem to read data from the first sensor but how can I read the second on the serial monitor?!?

Thanks very very much!


* Layout acc&gyro.jpg (54.07 KB, 960x720 - viewed 588 times.)
Logged

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 201
Posts: 8701
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

> But I don't know how I can read data from the "auxiliary" sensor.

What does it say about it in the MPU6050 datasheet?
Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Offline Offline
Newbie
*
Karma: 0
Posts: 36
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Pag. 26 of the datasheet...

The MPU-60X0 always acts as a slave when communicating to the system processor. The LSB of the of the I2C slave address is set by pin 9 (AD0). The logic levels for communications between the MPU-60X0 and its master are as follows:
 MPU-6000: The logic level for communications with the master is set by the voltage on VDD
 MPU-6050: The logic level for communications with the master is set by the voltage on VLOGIC

Auxiliary I2C Serial Interface
The MPU-60X0 has an auxiliary I2C bus for communicating to an off-chip 3-Axis digital output magnetometer or other sensors. This bus has two operating modes:
I2C Master Mode: The MPU-60X0 acts as a master to any external sensors connected to the auxiliary I2C bus
Pass-Through Mode: The MPU-60X0 directly connects the primary and auxiliary I2C buses together, allowing the system processor to directly communicate with any external sensors.

Auxiliary I2C Bus Modes of Operation:
I2C Master Mode: Allows the MPU-60X0 to directly access the data registers of external digital sensors, such as a magnetometer. In this mode, the MPU-60X0 directly obtains data from auxiliary sensors, allowing the on-chip DMP to generate sensor fusion data without intervention from the system applications processor.
For example, In I2C Master mode, the MPU-60X0 can be configured to perform burst reads, returning the following data from a magnetometer:
 X magnetometer data (2 bytes)
 Y magnetometer data (2 bytes)
 Z magnetometer data (2 bytes)
The I2C Master can be configured to read up to 24 bytes from up to 4 auxiliary sensors. A fifth sensor can be configured to work single byte read/write mode.

Pass-Through Mode: Allows an external system processor to act as master and directly communicate to the external sensors connected to the auxiliary I2C bus pins (AUX_DA and AUX_CL). In this mode, the auxiliary I2C bus control logic (3rd party sensor interface block) of the MPU-60X0 is disabled, and the auxiliary I2C pins AUX_DA and AUX_CL (Pins 6 and 7) are connected to the main I2C bus (Pins 23 and 24) through analog switches.

Pass-Through Mode is useful for configuring the external sensors, or for keeping the MPU-60X0 in a
low-power mode when only the external sensors are used.
In Pass-Through Mode the system processor can still access MPU-60X0 data through the I2C
interface.

Auxiliary I2C Bus IO Logic Levels: MPU-6050: The logic level of the auxiliary I2C bus can be programmed to be either VDD or VLOGIC



I followed the istructions for the Pass-Through Mode:... on the chip is present an "interface bypass mux" and it shuold be the "analog switches" above cited. I don't know how I can read the aux-data.

THANKS for your reply!

* MPU-6050.pdf (1635.51 KB - downloaded 58 times.)
Logged

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 201
Posts: 8701
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The important part is: "The LSB of the of the I2C slave address is set by pin 9 (AD0).". You need to set pin 9 to different values on the to units.  Then they will have different I2C addresses so you can controll them separately. Once you do that it doesn't matter if they are on he same I2C bus or if you use pass-through.

Somewhere in your code there is an address for the first module.  To communicate with the other module you use the other address.
Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Offline Offline
Newbie
*
Karma: 0
Posts: 36
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Johnwasser, thank you very much for your advice!

I read that, of default, the address of the sensor is 0X68 IF the AD0 is linked to GND or 0X69 if it's linked to VDD. Therefore, I should desolder the jump and remake it, so that I can change the address of the second sensor.

That you know... Is there a way to change the address by SW and not HW?... For example: Can I control the MUX someway?!? Read first one and than the other.
Logged

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 201
Posts: 8701
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

That you know... Is there a way to change the address by SW and not HW?

I do not know of any way to change the address of the MPU6050 with software.
Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Offline Offline
Edison Member
*
Karma: 9
Posts: 1016
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Not possible in software.

The AD0 solder jumper is on the breadboard to select 0x68 or 0x69. And you select in software the address according AD0. See also : http://arduino.cc/playground/Main/MPU-6050

So connect them both to the normal I2C bus, with different AD0, and run the i2c_scanner : http://arduino.cc/playground/Main/I2cScanner

Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 36
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I changed the address and now I've got first sensor 0x68 and second 0x69.

I connect the two sensors in this way (scheme in attach). The I2Cscanner is OK and I see two address, but I have some problem... First of all, sometimes on the serial monitor I read "FIFO overflow" and, in particular, after few seconds (random) the TX stops (turn off TX led on Arduino). I don't understand!! Please, can you help me???

I specially modified the script so that I can read the data from two sensors. (script in attach).

* Schema.pdf (243.87 KB - downloaded 173 times.)
* script.txt (9.67 KB - downloaded 109 times.)
Logged

Spain
Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi!

I'm trying to connect two MPU6050 (GY-521 breakout board) but I have the same problems showed in this post.
I think it could be because of the libraries but I can't identify the problem yet.
My code (attached, sorry for the "spanglish") is slightly different than yours but the result is the same  smiley-sad

Could anyone connect two MPU6050?

Can anyone help me?

Thanks in advance.



* Scheme 2 GY-521.jpg (756.78 KB, 1359x1803 - viewed 482 times.)
* Code.txt (11.48 KB - downloaded 133 times.)
Logged

Offline Offline
Edison Member
*
Karma: 9
Posts: 1016
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Are you sure the INT is open collector and can be tied together ?
The 'dmp' sketch sets a default for the sample rate to be placed in the fifo. That is not ment for two devices, so perhaps you can't do all the calculations in the example. Don't add a delay in the sketch.

This all I can think of at the moment.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 35
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi everyone,
i have a question ,hoped that all of you can solve for me.
I want to connect more than 2 MPU6050 on board arduino Uno R3
what should i do?
Thanks!
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

hi
did you tried to connect two mpus to same pin ie pins from both mpu to the same pin on arduino (it will be common pin for both mpu's)
just a thought..
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi, i've tried that but the problem is there will be fifo overflow and unstable reading of the MPU 6050.  I've tried to change the dmp rate, but the problem is still there. and after 15-20 minutes run, the sensor reading will stop, I dont know what is the problem. can someone help me?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi!

I'm trying to connect two MPU6050 (GY-521 breakout board) but I have the same problems showed in this post.
I think it could be because of the libraries but I can't identify the problem yet.
My code (attached, sorry for the "spanglish") is slightly different than yours but the result is the same  smiley-sad

Could anyone connect two MPU6050?

Can anyone help me?

Thanks in advance.




Hi,

I am interested in connecting 4 MPU6050 to one arduino. By looking at your sketch, I can just connect the SDA and SCL of 4 MPU6050 to the breadboard and change the address for the other sensors. However, I am not really familiar with arduino code. Can you please help me if you had already achieve reading multiple MPU6050.

Thank you.
Logged

Offline Offline
Edison Member
*
Karma: 9
Posts: 1016
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Do you mean this new section : http://playground.arduino.cc/Main/MPU-6050#multiple
No one has tried it yet, as far as I know.

If you have a 5V Arduino, you have to adapt the selection signal to 3.3V for the 4 AD0 lines.
You can start your project with two MPU-6050 modules. Connect one AD0 line to GND, the other to 3.3V. Try to make a sketch that reads both.
Logged

Pages: [1]   Go Up
Jump to: