Inertial sensors are used to detect linear and rotational motion of an object. There are two types of inertial sensors – accelerometers that detect linear acceleration and gyroscopes that detect rotational motion. Accelerometers and gyroscopes are widely used in a variety of applications, including aerospace, military, automotive, cell phones, and consumer electronics. For example, in mobile phones, gyroscope and accelerometer sensors are used for screen rotation, gaming, virtual reality and augmented reality applications. In automobiles, accelerometer and gyroscope are used for vehicle rollover detection, airbag release control, ABS, active suspension, traction control, and seat belt control. Many military applications like smart ammunition, flight control, etc. also make use of these sensors. In aerospace applications, these sensors are used to measure microgravity and monitor the movement and rotation of equipment/devices.
Each application requires an accelerometer or gyroscope with specific specifications. No accelerometer or gyroscope sensor can meet all applications. These sensors are always used in some electronic control systems, as mere acceleration and rotation values of an object are useless.
ADXL345 is a small 3-axis accelerometer with +/- 16g dynamic range with 13-bit resolution, maximum bandwidth of 3200 Hz and maximum data transfer rate of 3200 times per second. It is a digital accelerometer sensor and produces digital acceleration values in three axes. The sensor generates data formatted as 16-bit two's complement that is accessible via SPI or I2C interfaces. This sensor has ultra-low power consumption and consumes only 23 uA in measurement mode and 0.1 uA in standby mode.
ADXL345 has user selectable resolution and measurement ranges that can be selected by passing serial commands to it. The sensor also supports flexible interrupt modes that can be mapped to either of its two interrupt pins. ADXL345 has several built-in detection functions that can be mapped to the interrupt pins. Type, it has free fall detection and touch detection functions. The ADXL345 can detect the presence or lack of movement by comparing acceleration values to user-defined thresholds.
The ADXL345 measures static acceleration due to gravity as well as dynamic acceleration resulting from motion or shock. The sensors come in a 14-lead LGA package with dimensions of just 3mm x 5mm x 1mm. This sensor can be used in mobile device applications such as cell phones, smartphones, gaming devices, pointing devices, personal navigation devices, hard drive protection, medical and industrial instrumentation.
Understanding ADXL345 Technical Specifications
The ADXL345 accelerometer sensor has the following technical specifications –
Measurement Range – The ADXL345 sensor can measure acceleration in three axes using a user selectable range of +/-2g, +/-4g, +/-8g and +/-16g. The wider the measurement range, the greater the acceleration an accelerometer can detect. With a +/-2g measurement range selected, the ADXL345 can measure acceleration of up to 19.6 m/s 2 (2 * 9.8 m/s) in any direction along each axis. With a measurement range of +/-16g selected, the ADXL345 can measure acceleration of up to 153.6 m/s 2 (16 * 9.8 m/s) in any direction along each axis.
Output Resolution – ADXL345 supports output resolution of 10 bits for +/- 2g measurement range, 11 bits for +/- 4g, 12 bits for +/- 8g and 13 bits for +/- 16g. The default resolution is 10 bits for all measurement ranges.
Sensitivity – At standard 10-bit resolution, the ADXL345 has typical sensitivity of 3.9 mg/LSB for standard measurement range (i.e. +/- 2g), 7.8 mg/LSB for +/- 4g, 15 .6 mg/LSB for +/- 8g and 31.2 mg/LSB for +/- 16g measurement range. This means that ADXL345 with default 10-bit resolution selected can detect minimum acceleration change of 3.822 cm/s 2 (3.9 * 9.8/1000 * 100) for +/- 2g, 7.64 cm/s 2 for +/- 4g, 15.28 cm/s 2 for +/- 8g and 30.57 cm/s 2 for +/- 16g range.
Output Data Rate and Bandwidth – The output data rate and sensor bandwidth are selectable. The output data rate can range from 0.1 Hz (once every 10 seconds) to 3200 Hz (3200 times per second).
Operating voltage and current – The sensor requires an operating voltage of 2.5 V which can vary from 2.0 V to 3.6 V. It consumes approximately 30 uA for data transfer rates less than 10 Hz and approximately 140 uA for data transfer rates above 100 Hz.
Operating Temperature Range – ADXL345 has an operating temperature range of -40˚C to +85˚C.
Maximum ratings – ADXL345 can tolerate shocks or acceleration of up to 10,000 g (98 km/s 2 ). It can tolerate voltages up to 3.9V and withstand temperatures up to +105˚C.
ADXL345 pin description
ADXL345 comes in a 14-lead package with the following pin diagram:
The ADXL345 accelerometer sensor has the following pin description:
The sensor may be available as a module where all or few pins may be available for interfacing with a circuit. In the sensor module shown below, only the pins required to interface with a circuit (I2C, SPI, interrupts, and power supply) are available for use. Other pins are connected to the module, such as pull-up resistors for I2C lines.
It can be noted that the acceleration axes are indicated on the module. Otherwise, the acceleration axes can be found in relation to the top view of the sensor, as shown below:

Example of ADXL345 accelerometer sensor shaft.
The ADXL345 sensor is sensitive to both static acceleration (acceleration due to gravity) and dynamic acceleration (acceleration resulting from movement or shock). The sensor has the output response, as shown in the image below, relative to its orientation with respect to gravity.

ADXL345 output response to gravity orientation.
ADXL345 performance characteristics
ADXL345 performance characteristics are available as graphs for zero g offset, sensitivity, and self-test response. Graphs are provided for sensor response for all axes. For example, the following graph shows the zero-g offset on the x-axis 25˚C, 2.5V.

ADXL345 performance characteristics
On the graph, the Zero-g displacement is indicated in mg (0.98 cm/s 2 ) and the population percentage indicates the percentage of sensor samples under test. Similarly, sensitivity is shown as the number of LSBs per g for each axis.

ADXL345 performance characteristics.
With the output resolution of the ADXL345 defaulting to 10 bits, we can conclude that the change in acceleration of the object on which the ADXL345 is mounted must be at least 3.822 cm/s 2 to +/- 2g or 7.64 cm/s 2 for +/- 4g or 15.28 cm/s 2 for +/- 8g or 30.57 cm/s 2 for +/- 16g measurement range for 1 bit change (LSB) in sensor response.
How the ADXL345 sensor works
ADXL345 is a 3-axis accelerometer that detects static acceleration (due to gravity) and dynamic acceleration (due to motion or shock). Thus, it can be used as a tilt sensor or to detect free fall. It is a MEMS accelerometer that consists of a micromachined polysilicon surface structure built on top of a polysilicon wafer. It is a capacitive accelerometer sensor. Polysilicon springs suspend the proof mass and differential capacitors are used between the proof mass and the fixed structure to measure acceleration. Any acceleration along an axis deflects the test mass and unbalances the differential capacitor, resulting in a sensor response that is directly proportional to the acceleration. Phase-sensitive demodulation is used to determine the magnitude and polarity of acceleration.
The sensor can be connected to an embedded controller/computer using I2C or SPI interface. Using serial interfaces (I2C/4-wire SPI/3-wire SPI), a controller/computer can read and write to the sensor's internal registers. ADXL345 has the following functional block diagram.

ADXL345 accelerometer sensor functional block diagram.
The sensor has the following registers that a controller/computer can read/write on serial interfaces:
When writing data to the loggers, the controller/computer can select measurement range, data format, resolution, and control interrupts and detection functions (tapping, free fall, and limits). A controller/computer can read the acceleration by reading values from registers 0x32 to 0x37.
Configuring ADXL345 and reading acceleration values
Listed below are some simple steps to read the acceleration of the ADXL345 sensor.
- Set the power mode and data transfer rate by writing to register 0x2C. This register has the following bits:
If the LOW_POWER bit is set to 0, the ADXL345 operates in normal mode, and if it is set to 1, the ADXL345 operates in reduced power modes, in which there is greater noise. Bits D3 to D0 select the data transfer rate as per the following table:
- Set the data format by writing to register 0x31. This register has the following bits:
If the SELF-TEST bit is set to 1, a self-test force will be applied to the sensor, causing a change in the output data. If set to 0, self-test strength will be disabled. If the SPI bit is set to 1, the ADXL345 will use 3-wire SPI mode; otherwise, if set to 0, it will use 4-wire SPI mode. If the INT_INVERT bit is set to 0, it sets the interrupts to active high, and if it is set to 1, it sets the interrupts to active low. If the FULL_RES bit is set to 1, the sensor outputs the full resolution value (10 bits for +/- 2g; 11 bits for +/- 4g; 12 bits for +/- 8g; 13 bits for +/- 16g) , otherwise, if it is set to 0, the 10-bit default will be used. If the justification bit is set to 1, the acceleration values in registers 0x32 to 0x37 are left justified; otherwise, if it is set to 0, the values will be right-justified. The following image shows the data format of data value registers with left and right justification and the position of LSB or MSB accordingly for different measurement ranges:

Examples of left and right justified output response of the ADXL345 accelerometer sensor.
Range bits D1 and D0 select the measurement range according to the following table:
- If the link bit is set to 1, the activity and inactivity functions are linked in series (the activity function is delayed until the inactivity function is detected). Otherwise, if it is set to 0, both functions will be simultaneous. The idle function refers to a situation where the acceleration is below the THRESH_INACT value (register 0x25) for at least the time indicated by TIME_INACT (register 0x26). Set power saving features by writing to register 0x2D. This register has the following bits:
If the link bit is set and the AUTO_SLEEP bit is set to 1, it enables the auto-sleep functionality. In this mode, the ADXL345 automatically switches to sleep mode if the sleep function is enabled and inactivity is detected. If activity is also enabled, the ADXL345 automatically wakes up from sleep upon detecting activity and returns to operation at the output data rate defined in the BW_RATE register. If the AUTO_SLEEP bit is set to 0, it disables automatic switching to sleep mode. If the link bit is not set, the AUTO_SLEEP feature is disabled and setting the AUTO_SLEEP bit will have no impact on device operation.
If the measurement bit is set to 1, the ADXL345 will operate in measurement mode. Otherwise, if it is set to 0, the ADXL345 operates in standby mode. If the Sleep bit is set to 1, the ADXL345 will operate in sleep mode; otherwise, if it is set to 0, the ADXL345 will operate in normal mode. Sleep mode suppresses DATA_READY, stops data transmission to FIFO, and changes the sample rate to that specified by the enable bits. In sleep mode, only the activity function can be used. The enable bits control the read frequency in sleep mode according to the following table:
- Read the acceleration along the x-axis by reading registers 0x32 and 0x33; acceleration along the Y axis by reading registers 0x34 and 0x35; and acceleration along the Z axis by reading registers 0x36 and 0x37.
Mask the register values according to the selected data format (register 0x31) and interpret the acceleration value according to the selected measurement range.
Using ADXL345 Acceleration Values
Acceleration values along the X, Y, and Z axes of the ADXL345 accelerometer sensor can be used to detect tilt, free fall, and dynamic motion of an object. The sensor must be mounted on the object under study. Acceleration values can be used simply to detect motion or even to determine the object's trajectory.
The velocity along each axis can be determined by integrating the acceleration values. Double integration of acceleration values can determine the displacement of the object along each axis. It should be noted that integration and double integration of acceleration values can only be done using scientific computing tools like the SciPy library in Python scripts. Even so, we have to consider errors as there can be multiple sources of error such as inconsistent sampling of data, errors in sampled data, errors due to computation, etc. Generally, displacement or velocity values can be predicted with limited accuracy and with a limited range in a user program with the ADXL345 sensor.
However, the acceleration values from the ADXL345 sensor can be perfectly used in electronic control systems where mere acceleration values are used for decision making.