You will need to buy a HMC5883L 3-axis magnetometer as well and use it together with the MPU-6050. Note that "GY-521" is just the name of the breakout board and not the sensor. The sensor on the "GY-521" is the MPU-6050.
Hi Lauszus, can you post a video in which you lay the board flat and slide it in x and y directions? I wanna to see if your code is susceptible to linear accelerations. I wanna see if pitch and roll change as you accelerate the board. Thanks!
Tim
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?
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:
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?
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 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.
Hi,
We know that: The default sensitivity is high, and the sensor returnes 16 bits,a variation of 50 is just a very small variation.
So, when we calculate the angle base on the raw data, what is the resolution of sensor (smallest angle that the sensor can detect)?
Thanks!
@Lauszus
No, I'm using a Arduino Uno. It seems that the problem lies in the fact that I can't access directly the magnetometer. Then I found that I should access it through the MPU6050 using it in the by-pass mode. But I'm not sure of the code I add.
// Bypass mode
while (i2cWrite(MPU6050, 0x6A, 0x00, true));
while (i2cWrite(MPU6050, 0x37, 0x02, true));
Using that extra code, I'm able to get values of yaw, pitch and roll. But the yaw seems to be drifting. I don't know if it could be linked with the by-pass mode and if I can use another method to get those values.
@Geoffroy
It seems weird that you can't access both sensors on the same bus, but yes your code looks good to me if you want to use it in bypass mode.
You should be able to simply connect both sensors to SCL and SDA at the same time. Maybe try adding a pullup resistor to 3.3V and see if that solves the problem.
I recently bought a 10 DOF IMU GY-86 (MPU6050 gyrometre & accelerometre + HMC5883 magnetometre + MS5611 altimetre ) and use arduino mega 2560.
But I get the following error : i2cWrite failed 2. I attached Screen Shot for my problem.
I have changed the address of the MPU6050 to 0x69 as the comment, but didnt change anything.
Could everyone solved this? Or maybe have some experienced as me?
I am currently trying to read my digital IMU, the "6 Degrees of Freedom IMU Digital Combo Board - ITG3200/ADXL345" from Sparkfun with my Arduino Due and I am facing some trouble since it's my first time working with Arduino and Microcontrollers at all. My coding skills are the ones of a typical Mechanical Engineer: I know how code looks like.
I read through this blog and saw, that you and Kashif already solved that particular problem but that was a few years ago and I didn't become smarter by reading your exchange of replies.
I do get some data in the Serial Monitor by using the code from the late Fabio Versano (varesano.net -) but it doesn't work 100% and I can't find the mistake. The newer FreeIMU Version doesn't work either, because the Due doesn't support EEPROM.
The code I like the best is yours but unfortunately it is for analog IMUs and even though I tried to combine the code of Versano and yours I couldn't get it work.
If there is an easy way to change your code to work with digital IMUs or even better, if you still have some working code for that problem I would be super appreciative if you could send it to me.
Thanks in advance and thanks for the great blog you're having here!
Barsil