MPU6050_light icon indicating copy to clipboard operation
MPU6050_light copied to clipboard

Angle Z gyro drifting

Open Gabriel110302 opened this issue 2 years ago • 3 comments

I made the MPU6050 calibration several times and tried to change some values from the <MPU6050_light.h> library, but I cannot figure out to get the angle Z gyroscope not to drift away. Sometimes it drifts up sometimes down. I read that Earth moves 15 degree per hour so that's why it's drifts like this. What should I do to counter this?

Gabriel110302 avatar Oct 07 '22 07:10 Gabriel110302

Hello Gabriel110302, The MPU6050 is a cheap device that is subject to important noise and drift. I assume that you calibrate well your device on a flat surface as required by the library. Then the error might be due to the limited sensitivity of the sensor itself. If this issue is important for you, you may need a better sensor or couple the one you have with a magnetometer to get an absolute reference around the Z angle. Cheers, Romain

rfetick avatar Dec 03 '22 12:12 rfetick

MPU6050_light.cpp dosyasında alttaki satırı bulun

accX = ((float)rawData[0]) / ACC_LSB_2_G; accY = ((float)rawData[1]) / ACC_LSB_2_G; accZ = ((float)rawData[2]) / ACC_LSB_2_G; temp = (rawData[3] + TEMP_LSB_OFFSET) / TEMP_LSB_2_DEGREE; gyroX = ((float)rawData[4]) / GYRO_LSB_2_DEGSEC - gyroXoffset; gyroY = ((float)rawData[5]) / GYRO_LSB_2_DEGSEC - gyroYoffset; gyroZ = ((float)rawData[6]) / GYRO_LSB_2_DEGSEC - gyroZoffset;

yukarıdaki satırın altına alttaki 2 satırı ekleyin böylecee gelen parazitik sıçramaları önleyebilirsiniz. if(gyroZ>0 && gyroZ<0.4) {gyroZ=0;} if(gyroZ<0 && gyroZ>-0.4) {gyroZ=0;}

cemyasam2 avatar Sep 08 '23 14:09 cemyasam2

Merhaba Gabriel110302, MPU6050 önemli gürültü ve kaymalara maruz kalan ucuz bir cihazdır. Cihazınızı kütüphanenin gerektirdiği şekilde düz bir yüzey üzerinde iyi bir şekilde kalibre ettiğinizi varsayıyorum. O zaman hata, sensörün sınırlı hassasiyetinden kaynaklanıyor olabilir. Bu konu sizin için önemliyse, Z açısı etrafında mutlak bir referans elde etmek için daha iyi bir sensöre ihtiyacınız olabilir veya sahip olduğunuz sensörü bir manyetometreyle eşleştirebilirsiniz. Şerefe, Romain

MPU6050_light.cpp dosyasında alttaki satırı bulun

accX = ((float)rawData[0]) / ACC_LSB_2_G; accY = ((float)rawData[1]) / ACC_LSB_2_G; accZ = ((float)rawData[2]) / ACC_LSB_2_G; temp = (rawData[3] + TEMP_LSB_OFFSET) / TEMP_LSB_2_DEGREE; gyroX = ((float)rawData[4]) / GYRO_LSB_2_DEGSEC - gyroXoffset; gyroY = ((float)rawData[5]) / GYRO_LSB_2_DEGSEC - gyroYoffset; gyroZ = ((float)rawData[6]) / GYRO_LSB_2_DEGSEC - gyroZoffset;

yukarıdaki satırın altına alttaki 2 satırı ekleyin böylecee gelen parazitik sıçramaları önleyebilirsiniz. if(gyroZ>0 && gyroZ<0.4) {gyroZ=0;} if(gyroZ<0 && gyroZ>-0.4) {gyroZ=0;}

cemyasam2 avatar Sep 08 '23 14:09 cemyasam2