필터 지우기
필터 지우기

How to connect multi MPU6050 to matlab?

조회 수: 6 (최근 30일)
Tran Trung
Tran Trung 2021년 10월 1일
답변: Gayatri Menon 2022년 1월 6일
Hi everyone.
Can i connect 3 MPU6050 at the same time and please tell me how.
Thank you.

답변 (1개)

Gayatri Menon
Gayatri Menon 2022년 1월 6일
Hi,
If you are using Arduino or RaspberryPi board, you could use mpu6050() to connect MPU6050 sensor
You can connect 2 MPU6050s on the same I2C bus by changing the I2C Address of one of the sensor.
This can be done by connecting AD0 pin of one of the sensor to high, making the I2C Address of that sensor 0x69 and connect the AD0 of the other sensor to Low, making the I2C Address of the sensor 0x68.
Now create mpu6050() by specifying I2C Address of one as 0x69 and other as 0x68.
a = arduino;
sensor1 = mpu6050(a,'I2CAddress','0x68');
sensor2 = mpu6050(a,'I2CAddress','0x69');
sensor1.readAcceleration;
sensor2.readAcceleration;
Now if you want to connect three, you will need to use a board with multiple I2C Bus (e.g Arduino Due) ans use the bus name value property of the sensor to specify the bus number
a = arduino;
sensor1 = mpu6050(a,'bus',0,'I2CAddress','0x68');
sensor2 = mpu6050(a,'bus',0,'I2CAddress','0x69');
sensor3 = mpu6050(a,'bus',1,'I2CAddress','0x68');
sensor4 = mpu6050(a,'bus',1,'I2CAddress','0x69');
You can also use multiple Arduino boards to do this.
Hope this helps
Thanks
Gayatri

카테고리

Help CenterFile Exchange에서 I2C Devices에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by