[Introduction to accelerometer] Let's use the free fall function

In the [Introduction to Accelerometer] series, we will explain the basic usage and application methods, focusing on analog devices' accelerometers. In the previous article, I introduced how to use the "FIFO function" using the accelerometer "ADXL345" and "Arduino". This time, I would like to explain the "Free Fall function" installed in the ADXL345.

[Introduction to accelerometer] Click here for the series list

About the Free Fall feature

What is free fall

"Free fall" is a phenomenon in which an object falls only by the action of gravity without being affected by air friction or resistance. If you ignore the rotational motion and air resistance that occur when the object falls, the accelerometer experiences a phenomenon in which the inertial force balances during free fall, so the acceleration becomes "0".

 

You can experience free fall at the amusement park's free fall (gondola). You've probably experienced the sensation of floating in the air while falling. This is the "free fall" of the phenomenon in which the inertial forces are balanced.

 

Accelerometers apply a 1G gravitational acceleration in the direction of the ground in a stationary state, but the acceleration becomes "0" during free fall.

 

It is used to protect hard disks when a computer is dropped, and to detect falls when a person falls. Also, recently, I have heard that it has been applied to fall detection when a drone breaks down in the air and is used as a parachute activation switch.

About the Free Fall Function of the ADXL345

Using the program created in Let's get the acceleration data, I tried to get the acceleration data during free fall. Gravitational acceleration of 1G can be seen when the robot is supported by the hand at a distance of about 30 cm from the desk. can be confirmed.

 

For free fall detection, it is possible to create an algorithm on the host processor side by determining the "0G detection range" and "the detection period" of the acceleration effective value. However, since the ADXL345 has a free-fall function, the host processor does not need to create a free-fall detection algorithm from the acceleration data. This feature saves host processor resources and algorithm creation effort. The free fall function is one of the interrupt functions. Let's use the interrupt function of the accelerometer, which explains the interrupt function, so please check it as well.

Acceleration data during free fall
Schematic diagram of the interrupt function

Let's use the free fall function

We will use the acceleration sensor ADXL345 and the hardware open platform Arduino to create a "FreeFall function" program.

Things to prepare

Here is what I prepared to evaluate the accelerometer this time.

 

・PC with Arduino IDE installed (Download Arduino IDE from here)

・USB cable (for Arduino and PC connection)

Arduino Nano compatible board 

Accelerometer ADXL345 

・Breadboard and wire

 

Combine the above parts to form a circuit as shown in the figure below. Power supply to Arduino Nano is supplied by USB bus power from PC. The ADXL345 supports SPI and I2C interfaces, but this time we will use the I2C interface.

Connection diagram
Connection diagram

Program content

The contents of the program are as follows. Please refer to the datasheet for register details.


(1) Set the acceleration threshold and free fall duration to be regarded as free fall.
(2) Set the free fall interrupt
(3) If the free fall interrupt is enabled, the result is reflected in the interrupt pin (INT pin) and the INT_SOURCE register of the interrupt status register.
④ Display "Free Fall Detected" on the Arduino console when free fall is detected

 

First of all, in order to use the free fall function, it is necessary to set the acceleration threshold and duration for free fall.

 

・The acceleration threshold is set by the THRESH_FF register (address: 0x28). Allow a little extra leeway as rotational motion may also be added during free fall. The recommended value in the datasheet is 300mg to 600mg.

・The duration is set by the TIME_FF register (address: 0x29). The duration is considered based on the expected fall time and the sampling rate (ODR) of the accelerometer. The recommended value in the datasheet is 100ms to 350ms.

 

This time, I set THRESH_FF=0x07(450mg), TIME_FF=0x14(100msec). In addition, since ODR=100Hz (10msec), free fall is detected when the data for 10 samples is continuously within the threshold.

 

Next, set BIT[2]="1" in the FREE_FALL bit of the INT_ENABLE register (address 0: 0x2E) to enable the interrupt function.

Finally, after detecting an interrupt, output a "Free Fall Detected" message on the Arduino serial console.

 

You can download the project file created with the Arduino IDE, so if you are interested, please get it from the "Document Download" below.

 

operation check

Let's check the operation using the created program. When the accelerometer was dropped, "Free Fall Detected" was displayed on the Arduino serial console, confirming that the free fall was successfully detected. We also checked whether free fall was falsely detected in the movement (shake motion) when the accelerometer was shaken. I made a video of the operation check, so please check it out.

Download the sample code verified this time

We provide the Arduino project file that we implemented this time. Apply here and give it a try!

About Accelerometer ADXL345

The ADXL345 used this time is a 3-axis digital output acceleration sensor. The main features are as follows.

 

・A standard accelerometer that is very easy to use with built-in ADC, operation function block, and FIFO

・Acceleration data adopts general I2C/SPI in digital serial method

・The 3-axis type sensor is a rectangular coordinate (X, Y, Z), and the acceleration acting on each axis can be obtained.

・The maximum detectable acceleration can be set in the range of 2g to 16g, and the sampling range is as wide as ~3.2kHz, so it can be applied to various applications such as impact, tilt, and motion detection.

・Flexible mode to reduce current consumption

 

For more information on the ADXL345, please refer to the datasheet.

Also, this accelerometer is very easy to use, so if you want to evaluate an accelerometer from now on, please try it on the evaluation board.

At the end

If you have any questions about the contents of this article, or if you have any problems with selecting or using accelerometers, please contact us from the following.



Analog Devices Manufacturer Information Top

If you want to return to Analog Devices Manufacturer Information Top, please click the button below.