# Problem with interpretting and using the IMU data

I am using MPU6050 IMU for getting accelerometer and gyro data. I could read the data using the code from the I2Cdev library here, but the problem I have is that I can't use this data in a meaningful manner. As an example I want to define the motion of an object in x,y,z axis using accelerometer data. Although I get a set of values, I can't understand how to use it.

If I could convert these values to ms-2 units, I hope I would be able to achieve this

Could you provide me some advice, code or reference to work on this?

I also tried the code here to get the raw values.

• Assuming it is moderately linear, you should be able to get a rough idea of the scale by aligning the device at rest until two axis read near zero and one reads a large non-zero value, which should correspond to 9.8 m/s/s gravitational acceleration. Flipping it over would let you determine any offset error on that axis. Jul 28, 2014 at 15:25

You may want to take a look of freeimu library which take care of all needed processing and present filtered and data-fused data (not just raw data) in easy to use roll, pitch and yaw format.

http://www.varesano.net/projects/hardware/FreeIMU

see demo video in which the on screen data mirror physical motion of the sensor http://www.youtube.com/watch?feature=player_embedded&v=rFvX3vZJHTQ

hope this helps

• John, thank you very much for the information. I went through some of the projects they have provided. I can get the yaw pitch roll readings too. But the issue I am having is really in the accelerometer readings. I want to map a path using the accelerometer data. Can you suggest me a way for that? Jul 28, 2014 at 10:11
• 1. By using your said software (in original post) or getting it from inside ofthe freeimu (find out where in the code does this task), you can read the raw accelerometer data in x, y, z. You need to read the device data sheet to learn a) the range setting (says plus and minus 2g) b) the data representation. Says, for a particular device (you need specific for your chip from data sheet), reading is plus and minus 1023 for 2g. That is, for 2g, it is +1023. for minus 2g, it is -1024. That, use the scale factor to get g reading in ms-2.
– EEd
Jul 28, 2014 at 13:16
• 2. see video youtube.com/watch?v=C7JQ7Rpwn2k for excellent teaching, 200k viewing, by the factory engineer. 3. What do you want to do with "map a path". In theory, ms-2 gives speed and distance by integration. In practice, it is highly error (thousands % over short time) as explained in the later part of the video. 4. Practical solution use odometer (physical wheel touching ground or camera as optical odometer) to get speed and distance and freeIMU to get roll pitch and yaw (heading and direction of movement). Hope it helps
– EEd
Jul 28, 2014 at 13:22
• Best data accuracy is by 9 DOF (degree of freedom) using accelerometer , gyro and magnetic compass and a software to do data fusion, like freeimu. Add GPS, for best long term error. commercial air liners uses even more multiple sensors and data fusion.
– EEd
Jul 28, 2014 at 13:27