Free Fall Detection Using 3-Axis Accelerometer

Free Fall Detection Using 3-Axis Accelerometer © GPL3+

The easy method to determine free fall detection with the help of a simple 3-axis accelerometer.

  • 18 views
  • 0 comments
  • 1 respect

Components and supplies

Apps and online services

Android Sensors
Available for android as free app. The free version contains ads but it is fully functional. Please buy an ads-free version if you find it helpfull.

About this project

Free Fall Detection

The state of falling under the influence of gravity is considered as free fall, where gravity is the only force acting on the body. Detection of such situations is so much advantageous in many conditions like a multi-rotor or an radio-controlled aircraft.

Methodology

To begin with, I needed some data to understand the free fall. The easiest way I found was that to log the data from an existing accelerometer. Our smart phones have all the Inertial sensors built in.

So, I downloaded an app from google play store on my phone called "Android Sensors" by "LP Ellis," although after installation it is shown as "SensorLab." You can find the app at: Google play store SensorLab

You can read about the features of this app there on store, but I liked that the app allows to log the data of sensors of your phone and saves it to your device. You can then find the logged file as a zip archive in the "Android > data > com.lpellis.sensorlab > files > data" , which when extracted gives you a number of CSV files - one for each sensor supported in your phone - which you can open in Microsoft Excel or any spreadsheet software.

On one such occasions, I started the data logging by pressing the record button and then allowed my phone to fall freely twice. Then I stopped the recording by pressing stop button. I located the zip file of my recording and extracted it. Then I opened the "accelerometer.csv" file from the extracted folder. I plotted the 3-axis accelerometer data available with time in that file, and you can see the results below.

At beginning you can see I am holding the phone with screen facing up, almost horizontally and minor fluctuations in acceleration due to shaking of hands. As you can see the acceleration about z-axis is ~ 9.8 m/s^2 - the acceleration due to gravity. Then I drop the phone, the acceleration goes to zero about all three axis for a short time. Then at the end of the free fall the phone strikes the surface and feels sudden deceleration and comes to rest, evident from the spike. Note that this spike can occur about any axis depending upon the orientation of your phone at the instance of strike. After the strike to surface the phone is resting steadily, so the acceleration lines are straight horizontal suggesting the absence of even the minor fluctuations. Then I pick up the phone and repeat the procedure for one more time.

So. it is for sure from the above data is that the acceleration about all 3 axes drops close to zero during free fall. Magnitude of total acceleration is given by :

Hence, if acceleration about all the 3 axes are closer to zero than the total acceleration would also be closer to zero. It is the idea behind detecting the free fall.

Please, be careful while dropping your phone. Drop your device from not more than 1.5 feet high, and drop it on a soft surface.
Many of the people consider it as a criteria of free fall that a great deceleration occurs during free fall, they are not wrong but this large deceleration is a post free fall phenomena. If you are designing a system not only to detect the free fall but also to prevent this free fall, then why wait till the free fall lasts !!, why not to detect it the moment it begins.

So... Where's the Code?!

I have already tested free fall condition on my phone which has InvenSense MPU-6050. So, I wanted to test it with something different.... Arduino Esplora.

The diiference between MPU-6050, MPU-9250 and Esplora is that the former two give output of acceleration in m/s^2, while the latter one gives output of acceleration in the range of 0 to (+/-)1023 depending on your acceleration.

So........Again data logging...........this time on serial monitor!

We can read the acceleration from Esplora by following code:

long int xa = Esplora.readAccelerometer(X_AXIS);   
long int ya = Esplora.readAccelerometer(Y_AXIS);
long int za = Esplora.readAccelerometer(Z_AXIS);

Total Acceleration is found using the formula stated above:

float at = sqrt(xa*xa + ya*ya + za*za);
I am using long keyword because during the strike the value of any of ax, ay, or az may reach upto 250-500, the square of this number is such large that can't be stored in the -32768 to +32767 range of integer. If you will keep it simply int than in Serial monitor you would see the "nan- Not A Number" at many places. Try it by your self.

Then I printed all the values in Serial Monitor using:

 Serial.print(xa);
 Serial.print('\t');
 Serial.print(ya);
 Serial.print('\t');
 Serial.print(za);
 Serial.print('\t');
 Serial.print(at);
 Serial.println();

Observing the serial monitor, when the esplora was placed on horizontal surface by keeping the X and Y axes of its accelerometer horizontal and Z axis vertical - The values about X and Y axes were in range of 10-20 and ~150 about Z axis.

When I dropped the Esplora from about 5-10 cm freely on my desk the total acceleration value during free fall were in the range of 25-45. So, I came up with following control structure to turn on the red colour of RGB LED present on esplora board whenever a free fall occurs.

   if (at < 50) {
       Esplora.writeRGB(255,0,0);
   }
   else {
       Esplora.writeRGB(0,0,0);
   }

and the most important delay of 10 milliseconds for fast detection.

delay(10);

You can do all this stuff with MPU-6050, MPU-9250, ADXL345 or any other IMU with three axis accelerometer. All you have to change is that give condition in above if statement as total acceleration should be less than 1 m/s^2 for free fall, since you are getting accelerometer output in such IMUs in m/s^2. like for Uno or Mega:

if (at < 1) {
       digitalWrite(13,HIGH);
   }
   else {
       digitalWrite(13,LOW);
   }

Applications

  • In multi-rotors to design a fail safe condition, in case if the free fall occurs.
  • To determine if the free fall has occurred during handling of the delicate or fragile cargo. You can use an ATtiny85 along with an ADXL345 accelerometer and a battery to create such a low cost standalone system and count the free falls and display the number as blinks of LED at some regular intervals.

Code

Esplora_free_fall.inoArduino
The main code to sense free fall
#include <Esplora.h>

void setup()
{
  Serial.begin(9600);        
}

void loop()
{
  long int xa = Esplora.readAccelerometer(X_AXIS);   
  long int ya = Esplora.readAccelerometer(Y_AXIS);
  long int za = Esplora.readAccelerometer(Z_AXIS);
  float at = sqrt(xa*xa + ya*ya + za*za);           // total acceleration
  Serial.print(xa);
  Serial.print('\t');
  Serial.print(ya);
  Serial.print('\t');
  Serial.print(za);
  Serial.print('\t');
  Serial.print(at);
  Serial.println();  
    
    // since esplora accelerometer output is in 0 to 1023 range, we can assume that the acceleration during free fall will drop below value 50.
    
    if (at < 50) {
        Esplora.writeRGB(255,0,0);
    }
    else {
        Esplora.writeRGB(0,0,0);
    }


  delay(10);         
}

Schematics

Esplora Sensors
The locations of various sensors on Arduino Esplora.
Esplora sensors sxtuntc3ss
Accelerometer Data
Complete Annotations to easily understand the free fall.
Freefallannoted2 wpilgaan49

Comments

Similar projects you might like

Accelerometer Using Arduino 101

by Jefferson Paredes

  • 3,945 views
  • 0 comments
  • 4 respects

Level Platform Using Accelerometer

Project tutorial by Mark Tashiro

  • 20,519 views
  • 19 comments
  • 36 respects

8×8 LED and Accelerometer

Project tutorial by Team Brink.IO

  • 1,414 views
  • 0 comments
  • 3 respects

Smoke Detection using MQ-2 Gas Sensor

by Aritro Mukherjee

  • 265,178 views
  • 46 comments
  • 166 respects

Coolest Motion Detection Sensor Ever

by remnis

  • 11,508 views
  • 2 comments
  • 11 respects

Visual Accelerometer

Project tutorial by Reid Paulhus

  • 5,103 views
  • 1 comment
  • 14 respects
Add projectSign up / Login