Go Down

Topic: MPU6050 acceleration output in m/s² (Read 163 times) previous topic - next topic

Fredie123

Mar 23, 2019, 12:14 pm Last Edit: Mar 23, 2019, 01:00 pm by Fredie123
Hey,

I want a sketch with temp, gyro and acc output.
Temp output in degrees and gyro axis output is fine. But i don't understand the Acceleration Axis output.




I'm using a library with these commands for Acceleration:

Code: [Select]
accX = ((float)rawAccX) / 2048.0;
accY = ((float)rawAccY) / 2048.0;
accZ = ((float)rawAccZ) / 2048.0;


and i'm getting this on the serial monitor if i dont move the mpu:

Code: [Select]
accX : -0.31 accY : 0.05 accZ : 8.50



How do I change the output in understandable m/s² ?
Thanks

MorganS

I use a calibration based on this set of articles: https://chionophilous.wordpress.com/2011/06/22/accelerometer-calibration-i-introduction/

The maths gets kind of hairy but the end result is a calibration program that is simple to use and very accurate.
"The problem is in the code you didn't post."

Fredie123

Thanks for the link. I also read the 6050 datasheet, so let's see if i understand it correctly:

The mpu6050 has the full-scale range between +-2 and +-16g.
So the library uses +-2 g (16,384 LSB/g), because of these lines:

Code: [Select]
accX = ((float)rawAccX) / 16384.0;
accY = ((float)rawAccY) / 16384.0;
accZ = ((float)rawAccZ) / 16384.0;


When my mpu6050 is lieing on the table, I get this output:


Code: [Select]
accX : -0.05 accY : -0.01 accZ : 1.07


So the mpu6050 reads the gravity on z-axis with 1.07 g, right? So all the data is in g.
1,07 g = 10,49 m/s²
If I multiply all the output with 9.806, I should get the wanted m/s² output?
Or am I failing in math currently?  :smiley-red:

MorganS

Once you get the output in g, then yes, just multiply by 9.806
"The problem is in the code you didn't post."

Fredie123

#4
Mar 23, 2019, 01:47 pm Last Edit: Mar 23, 2019, 01:48 pm by Fredie123
Ok, but to help me understand:

The full-scale range +-2 g (16,384 LSB/g) results in the output for 1 g on all axis if the library devides the raw data with 16384?

Does someone have a good website or explanation for this?

MorganS

Do you know what "LSB" means?

It is very simple maths after that point.
"The problem is in the code you didn't post."

jremington

Quote
When my mpu6050 is lieing on the table, I get this output:

accX : -0.05   accY : -0.01   accZ : 1.07
That output indicates you need to calibrate the accelerometer, and it is either not lying perfectly flat on the table or the table is not level.

Go Up