I Need to Write Something here so.....yeah how should I do it?
Welcome to the forum
The MPU6050 uses the I2C interface, so multiple units can share the same bus pins (A4 and A5 on a Uno). To differentiate between the devices when communicating with them each must have a unique I2C address. On MPU6050 modules it is common to be able to select one of 2 addresses so connecting 3 of them is not practical, but there may be alternatives
Exactly which MPU6050 modules have you got and have they got any options to set their address, often by means of bridging solder pads on the PCB
Using the MCU's GPIO pins and the alternate Address selection one could do the thing.
Set all the I2C address to the alternate by enabling the alternate address pin using the MCU's GPIO pins. To address a specific thingy bring the device address to the primary address by changing the alternate address pin state. Talk to the thingy and then set its address pin back to the alternate address. Use the same scheme to talk to the other thingies.
Normally, two MPU6050 could be connected with UNO using AD0 (address selection pin). To connect more that two, I2C Mux (Fig-1) could be helpful.
Figure-1:
You can easily connect and use three MPU-6050s with one Arduino Uno. Use three Uno output pins to control the AD0 lines on the modules. Set them all HIGH so that the I2C address is 0x69.
To address one particular MPU-6050, set its address line LOW, and that module will respond to I2C address 0x68. Collect some data, set AD0 HIGH for that module, then proceed to the next module.
This 0x68 is 8-bit (01101000) I2C (bus) address or 7-bit (1101000) slave address?
7 bit, as required for the Arduino Wire library.
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.