calculate G-FORCE using an accelerometer GY-521 (MPU-6050) & ARDUINO DUE

hi everyone,

in my project i need to measure G-FORCE in a car accident.
i'm finding it very hard to build a code for this process.
i'm using ARDUINO DUE & GY-521.

someone help please.. :roll_eyes:

maor.

You use the x,y,z values of the accelerometer and calculate the resulting vector.
vector = sqrt ( xx + yy +z*z );
However, the MPU-6050 can not be used to measure impact G-forces. You need a specific accelerometer for 100 G or 200 G.

hi peter,
first of all thanks for your answer.
but i just need to measure about 2-3G.
this sensor can measure it. see here: http://4tronix.co.uk/store/index.php?rt=product/product&product_id=147

i'm still struggling to find a code at the global network, or even something similar..

maor

Only 2G or 3G, that is very low, I would not even call that an impact or accident.
Most code is developed for the Arduino Uno and other Arduino boards with the ATmel microcontroller. I don't know if everything works with the Arduino Due.
You should have at least the newest BETA Arduino IDE.

This is simple code to test the sensor :
http://playground.arduino.cc/Main/MPU-6050

This is a complete library :
http://www.i2cdevlib.com/devices/mpu6050
You need two libraries, the i2cdevlib and the mpu6050 library.
This is the i2cdevlib forum about the MPU-6050 with the Arduino Due:

hi peter,

3G is enough for my experiment.
I have already tested the sensor with this code (Arduino Playground - MPU-6050) and it seems fine.
I downloaded the libraries you named..
also took the code from MPU_DMP6 with Arduino DUE (TWBR not declared) - MPU-6050 6-axis accelerometer/gyroscope (InvenSense) - I2Cdevlib Forums
and it did nothing.

maybe you have another direction for getting any help?...

The sketch in the playground shows the x,y,z for acceleration.
Those values represent a certain g-force, but I forgot how to calculate it, it is somewhere in the datasheet.
If the z-axis is pointing up, you meausure earth gravity, which is 1G.
You can calculate the resulting 3D vector with x,y,z.
At least that way you have a start, and you can do some real tests.

Is some filtering needed ? If you accidently hit the sensor, the g-forces go way up, although for a very short time.
Or perhaps you want only the peak value ?

You could ask on the i2cdevlib forum to make the library Due compatible.