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

Calibration? #3

Open
chrisspen opened this issue Jul 11, 2016 · 7 comments
Open

Calibration? #3

chrisspen opened this issue Jul 11, 2016 · 7 comments

Comments

@chrisspen
Copy link

How do you enter the offsets acquired during calibration? Otherwise, the values read from the device are raw and meaningless.

@m-rtijn
Copy link
Owner

m-rtijn commented Jul 11, 2016

Because no procedure for calibration of the hardware is given in the datasheet, there is no calibration implemented.

What this module does lack is an implementation of the self test procedure (7.12 of the datasheet).

@chrisspen
Copy link
Author

I'm not asking how to calibrate it. This Arduino sketch explains how to do that http://wired.chillibasket.com/2015/01/calibrating-mpu6050/

I'm asking how to enter the 6 offsets (three for the accelerometer and three for the gyroscope). These are registers on the device:

MPU6050_RA_XA_OFFS_H
MPU6050_RA_YA_OFFS_H
MPU6050_RA_ZA_OFFS_H
MPU6050_RA_XG_OFFS_USRH
MPU6050_RA_YG_OFFS_USRH
MPU6050_RA_ZG_OFFS_USRH

If you don't enter these, the values read from the device will be useless.

@m-rtijn
Copy link
Owner

m-rtijn commented Jul 11, 2016

While developing this module I used the MPU-6050 Register Map and Descriptions file (Document number: RM-MPU-6000A-00, release date: 4.2, Release date: 2013-08-19) which does not include information about the offset registers. Because of this, there is currently no option to use these registers in this module, since I only just learned about their existence (thanks to you because you pointed this out).

@m-rtijn
Copy link
Owner

m-rtijn commented Aug 16, 2016

I've decided that because for most applications calibrating the MPU-6050 is not necessary, since the factory calibration will be precise enough, that I won't add support for these calibration features.

If you want to add these features to this project, you're welcome to do so.

EDIT (2023-04-27): I think it would be a useful feature to add, but I currently don't have working MPU6050 chips to test any code. If anybody is interested to add this via a PR, it would be really welcome :)

@byapparov
Copy link

@m-rtijn I am not sure if I am doing something wrong, but I get bias of 16 d/s on the X gyro data. that makes it pretty much unusable without calibration.

Would be great to understand what is the way to overcome this, right now I have done a wrapper that adjusts for errors

@Artoria2e5
Copy link

Artoria2e5 commented Apr 27, 2023

@byapparov The Arduino-MPU6050 library (linked from the official site) does basically what you do: the readNormalizeGyro() function subtracts a fixed offset and performs thresholding, both set from calibration at program start calibrateGyro(). It has not been updated for the new registers, so that could be why.

@m-rtijn
Copy link
Owner

m-rtijn commented Apr 27, 2023

It seems that there also exists a Linux kernel module that implements interfacing with the MPU6050, that code can also be used as inspiration: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/iio/imu/inv_mpu6050?h=v6.3

It can even be used directly I think. You can follow for example the steps here: https://petermolnar.net/article/linux-i2c-iio-collectd/#detecting-i2c-devices (just ignore the part about using the USB i2c adapter, since the Raspberry Pi has i2c built-in).

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

No branches or pull requests

4 participants