Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

does calibrateMPU6050 method push biases to hardware register? #57

Open
audi0615 opened this issue Feb 23, 2023 · 4 comments
Open

does calibrateMPU6050 method push biases to hardware register? #57

audi0615 opened this issue Feb 23, 2023 · 4 comments

Comments

@audi0615
Copy link

Hi.

I have a question regarding calibration method.

In MPU6050BasicExample.ino, I found that calibrateMPU6050 is done in setup() and the biases are subtracted to accel & gyro data again in loop().

does this mean the calibrateMPU6050 method only calculate the biases without pushing them to hardware register?

@kriswiner
Copy link
Owner

kriswiner commented Feb 23, 2023 via email

@audi0615
Copy link
Author

audi0615 commented Feb 23, 2023

Thanks Mr. Winer

But do you mean that it is supported in MPU6050 but not recommended? The calibrateMPU6050 method is pushing them to registers as shown below. If this works, then it seems there is no need to subtract them from accel and gyro data.
Please consider removing this part if it is not supported in MPU6050 to prevent confusion.

` // Push gyro biases to hardware registers
writeByte(MPU6050_ADDRESS, XG_OFFS_USRH, data[0]);// might not be supported in MPU6050
writeByte(MPU6050_ADDRESS, XG_OFFS_USRL, data[1]);
writeByte(MPU6050_ADDRESS, YG_OFFS_USRH, data[2]);
writeByte(MPU6050_ADDRESS, YG_OFFS_USRL, data[3]);
writeByte(MPU6050_ADDRESS, ZG_OFFS_USRH, data[4]);
writeByte(MPU6050_ADDRESS, ZG_OFFS_USRL, data[5]);

// Push accelerometer biases to hardware registers
writeByte(MPU6050_ADDRESS, XA_OFFSET_H, data[0]); // might not be supported in MPU6050
writeByte(MPU6050_ADDRESS, XA_OFFSET_L_TC, data[1]);
writeByte(MPU6050_ADDRESS, YA_OFFSET_H, data[2]);
writeByte(MPU6050_ADDRESS, YA_OFFSET_L_TC, data[3]);
writeByte(MPU6050_ADDRESS, ZA_OFFSET_H, data[4]);
writeByte(MPU6050_ADDRESS, ZA_OFFSET_L_TC, data[5]);`

@kriswiner
Copy link
Owner

kriswiner commented Feb 23, 2023 via email

@audi0615
Copy link
Author

Thanks Mr. Winer.

I could find a document which confirms the MPU6050 has the hardware offset registers.
https://www.digikey.com/en/pdf/i/invensense/mpu-hardware-offset-registers

I would verify which works, thanks again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants