Hello. So I wrote a simple code, which uses raw gyro values from MPU6050, calculates the offset and integrates them. It is far from ideal, but the drift is surprisingly small. However, the problem is that I get rotation angles around all three axes, which move together with the MPU6050 itself. I want to get roll, pitch and yaw values from that, but I can't seem to figure out how. I have servos attached for visualization.
After some though I realized I need to convert angular velocities directly into roll pitch and yaw, and depending one the orientation, integrate them differently. Still no idea how. Also I realized that integration (x=x+gx-bx thing) needs to be done at precise fixed intervals, so it is consistent.
I modified the code, so it takes timing between measurements into account, and gives me how much has the board been rotated since the last measurement in degrees.
But aren't the formulas you gave me are for an accelerometer?
If you just integrate gyro values, you get what seems to be yaw pitch and roll, but it is not. If you pitch up, then yaw, arduino will think it is pitched up, but while due to yaw, it will be rolled, and not pitched up. However, i'm only thinking about doing basic stabilization (i.e. resisting various angular movements), so I might not need some complicated integration after all.
I have this code lying around for my testing of my MPU6050 I have it documented well and it should work nicely
This should save you time if you want the actual angles. and it also resolves issues I faced with other examples floating around out there
Wiring Note pin 2 must be attached to int on the mpu6050
zhomeslice:
I have this code lying around for my testing of my MPU6050 I have it documented well and it should work nicely
This should save you time if you want the actual angles. and it also resolves issues I faced with other examples floating around out there
Wiring Note pin 2 must be attached to int on the mpu6050
// supply your own gyro offsets here, scaled for min sensitivity use MPU6050_calibration.ino <<< download to calibrate your MPU6050 put the values the probram returns below
but where can I download MPU6050_calibration.ino ?
// supply your own gyro offsets here, scaled for min sensitivity use MPU6050_calibration.ino <<< download to calibrate your MPU6050 put the values the probram returns below
but where can I download MPU6050_calibration.ino ?