Go Down

Topic: Guide to gyro and accelerometer with Arduino including Kalman filtering (Read 313 times) previous topic - next topic



I just finished reading the whole thread  XD
As a project for a university course, we are making a 3 axis camera stabilizer. We are using a 6DOF IMU MPU6050 accelerometer and gyroscope. I'm using your code to control the pitch and the roll of the camera (huge thanks by the way for the code and all those explanations you gave to everybody that helped me). As it is impossible to calculate the yaw with this code, I'm trying to combine it with the I2Cdevlib by means of the quaternions.

My idea would be to combine both and so to be able to control the corrected pitch and roll and the non-drifting yaw. But I'm having FIFO overflow problems.
Does anyone try this kind of combination?

Thanks in advance for your reply.


Jun 01, 2014, 08:24 pm Last Edit: Jun 01, 2014, 08:28 pm by ozzie2005 Reason: 1

I just updated the MPU-6050 code. The changes newest code can be found in the Github repository: https://github.com/TKJElectronics/Example-Sketch-for-IMU-including-Kalman-filter/tree/master/IMU6DOF/MPU6050.

Hi Lauszus,

The link above seems to be broken, is there anyway you can fix the link?

I searched for your MPU6050 library in google and got the your code for the MPU6050 but I don't know if that is the most recent version. There is something I don't understand from your code:

 accX = ((i2cData[0] << 8) | i2cData[1]) + 2000.0;
 accY = ((i2cData[2] << 8) | i2cData[3]) + 3319.84;
 accZ = ((i2cData[4] << 8) | i2cData[5]) + 664.48;
Where did you get these values in red from? I checked the MPU-6050 datasheet and could not find any of these values. Is there any reason why you add them to the ACCs? and if so, why these values?

I really appreciate your help.
Thank you,


You obviously didn't read the thread very carefully,   because only a few posts ago,   it was stated that those values are to compensate for the zeroing error of his particular device.    Your device will be different.      If you think that the zeroing error,  or asymetrical response,  of the device matters,   you can do you own experiments to measure it,   and then put those numbers into the equation.


I must've missed that post but thank you for your time explaining the reason for these values.



I recently bought a 10 DOF IMU from Drotek (MPU6050 gyrometre & accelerometre + HMC5883 magnetometre + MS5611 altimetre )

I wanted to use the library with Kalman filter  you provided for this board (MPU6050_HMC5883L) with my Arduino Uno.
But I get the following error : i2cWrite failed 2.
So I suspect it's a problem of address (I changed the address of the MPU6050 to 0x69 as mentioned by Drotek without success).
Let's acknowledge that I can run the MPU6050 code without a problem setting the address to 0x69.

Does anyone experienced and solved that problem?

Thanks in advance for any reply.

Go Up