Function MPU6050 - I can not change the sensibility
Show older comments
I am using the MPU6050 function with the Sensor Fusion and Tracking Toolbox. I get the acceleration data, but that data is only +-2g of the amplitude sensitivity. How do I change this sensitivity? I've tried using writeRegister, but with the mpu6050 function it doesn't work. For example:
First, if I use the device function:
a = arduino('COM7', 'MEGA2560', 'Libraries', 'I2C');
sensor = device(a,'I2CAddress','0x68');
I can read ou write register, for example:
readRegister(sensor,28)
Matlab returns:
22
But, when I use the function from MPU5060:
a = arduino('COM7', 'MEGA2560', 'Libraries', 'I2C');
sensor = mpu6050(a,'I2CAddress','0x68');
So, if I try to read or write a register:
readRegister(sensor,28)
matlab shows:
Check for incorrect argument data type or missing argument in call to function 'readRegister'.
Just only I use the function device, I can write or read the register, but I don´t have the benefits from MPU6050 function and Sensor Fusion and Tracking Toolbox.
If anyone can help me, I appreciate it.
Marlon.
Answers (2)
Walter Roberson
on 25 Mar 2021
0 votes
You use read() for that, not readRegister(). See for example
Or you can use readAcceleration() or readAngularVelocity()
You cannot supply the register number; the mpu6050 object automatically supplies the register number to the arduino.
MARLON MARCHI
on 25 Mar 2021
0 votes
2 Comments
Gayatri Menon
on 26 Mar 2021
Hi,
The methods readRegister/writeRegister is not valid for mpu6050 object. Please refer to this documentation for supported properties and methods for mpu6050 object.
Thanks
Gayatri
Walter Roberson
on 26 Mar 2021
It looks to me as if you will need to configure the sensitivity using readRegister() and writeRegister() on the arduino object, before starting the mpu6050 session.
Categories
Find more on Programming in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!