ADXL345 Accelerometer
Contents
Description
The ADXL345 from Analog Devices is described in the datasheet (P2) as a small, thin, ultralow power, 3-axis accelerometer with high resolution (13-bit) measurement at up to ±16 g.
.
With its low power requirements this accelerometer is described as being suitable for mobile device applications. Its low power modes enable activity sensing and active acceleration management at extremely low power dissipation
.
The ADXL345 measures acceleration with a capacitive type sensor.
The values in the following table have been sourced from the product datasheet.
| Parameter | ADXL345 |
|---|---|
| Package and size | 14-lead plastic package, footprint 3mm x 5mm x 1mm. |
| Operating voltage range | 2.0V to 3.6V |
| Supply current typically |
Output Data Rate ≥ 100Hz = 140 µA Output Data Rate < 10Hz = 30 µA |
| Package alignment error | Typically ±0.1 degrees. |
| Cross axis sensitivity | Relative contribution between any two of the three axis: 1%. |
| Measurement ranges | ±2g, ±4g, ±8g, ±16g. Default is ±2g. |
| Resolution (Two's Complementary format) | Normal : 10-bit all ranges. Full : ±2g = 10-bit, ±4g = 11-bit, ±8g = 12-bit, ±16g = 13-bit. |
| Sensitivity (10-bit resolution) | Varies (typically) from 3.9 mg/LSB (±2g) through to 31.2 mg/LSB (±16g). |
| Sensitivity (full resolution) | Typically 3.9 mg/LSB for all ranges. |
| Output data rate (ODR) | 0.1Hz to 3200Hz. |
| Serial interfaces | I2C, SPI (4-wire and 3-wire). |
I2C and SPI (4-wire & 3-wire) are available. I2C is selected by tying the CS pin to High.
I2C supports standard (100HkHz) and fast (400kHz) data transfer modes.
There is a choice of two I2C addresses depending upon the state of the SDO (ALT ADDRESS) pin:
- 0x53 : SDO pin connected to GND
- 0x1D : SDO pin connected to VDDIO i.e operating voltage.
Acceleration Sampling Options
This accelerometer has a simple range of user options unlike some of the more complicated devices available from other manufacturers.
Power Modes
-
Standby Mode
Very low current consumption mode (typically 0.1 µA) where data conversions are stopped but the serial interface is still available. This is the default mode after the power-up sequence has completed. -
Low Power Mode
If this mode is selected then power savings are made over Normal Mode if (and only if) the output data rate (ODR) is between 12.5Hz (34 µA) and 400Hz (90 µA). There is a sample noise increase in this mode over Normal Mde. -
Normal Mode
Output data rates (ODR) configurable between 0.10Hz and 3200Hz are user selectable.
Noise and power consumption increases with increasing ODR. The default is 100Hz.
Additional User Selections
-
Acceleration ranges
The near universal ranges available on many accelerometers: ±2g, ±4g, ±8g, ±16g. Default is ±2g. -
Output data rate (ODR)
The ODR is user configurable between 0.10Hz to 3200Hz. Within this range there are 16 discrete settings to choose from; see Table 7 in the datasheet. Default is 100Hz. -
Output Resolution
There are two user selectable resolutions available:
Normal Resolution is 10-bit for all ranges.
Full Resolution depends upon the g-range; ±2g = 10-bit, ±4g = 11-bit, ±8g = 12-bit, ±16g = 13-bit.
Measuring Acceleration
The ADXL345 measures both static and dynamic acceleration. Acceleration is reported in units of g where 1g = 9.81 m/s2 i.e. the acceleration due Earth's gravity.
Static acceleration is that which is imparted upon the sensor by the Earth's gravitational field. If the sensor is laid horizontally on a (perfectly) flat surface and is completely motionless then the acceleration along the X-axis and Y-axis will be 0g. The z-axis acceleration will be 1g.
Dynamic acceleration refers to the component of acceleration resulting from the motion or changes in velocity experienced by the sensor over time.
The raw acceleration value is read from two 8-bit registers. The two bytes are combined, according to the output resolution, to a single binary representation. This is converted from its Two's Complementary format to a signed integer.
This is then scaled by simple division with the divisor being the sensitivity (LSB/g). The sensitivity depends upon the measurement range and/or output resolution. The float type result is the acceleration value in units of g.
FIFO Queue
The FIFO feature is a queue mechanism (First In - First Out) that when activated automatically begins storing data records containing raw acceleration values.
The FIFO stores X-axis, Y-axis and Z-axis acceleration values. Unlike other accelerometers on the market The ADXL345 does not offer any selectivity options i.e. all three DOF values are always stored. The FIFO can hold up to a maximum of 32 complete X, Y and Z samples.
The FIFO give the microcontroller host "breathing space" to carry on with other tasks as the sensor continues to produce acceleration samples. A configurable interrupt is available that will alert the host when the FIFO is near full. At this time the entire FIFO contents can be burst read and processed.
Refer to the datasheet for further details of the FIFO. It's operation is quite simple compared to some of the ADXL345's competitors.
Sensor Generated Interrupts
Many intelligent digital accelerometer sensors offer a set of functional interrupts. The ADXL345 is no exception.
The chip has two interrupt pins; INT1 and INT2. The sensor's interrupts can be mapped to either of these pins. Host microcontrollers can define which interrupts are assigned to these pins then monitor the pins for the assigned activities.
Interrupts available include:
- Data Ready - Set when new data is available and is cleared when no new data is available.
- Single Tap - Set when a single tap is detected.
- Double Tap - Set when a double tap is detected.
- Activity - Set when activity (i.e. dynamic acceleration) is detected.
- Inactivity - Set when inactivity (i.e. no dynamic acceleration) is detected.
- Free Fall - Detects a very specific form of inactivity; see the datasheet for details.
Most of these interrupts have user selectable parameters that can be used to control the conditions under which they will fire.
ADXL345 Chip ID
ADXL345 chips have a product ID value written to non-volatile memory at point of manufacture.
This value can be read from the DEVID register and should return 0xE5.
ADXL345 MicroPython Driver for micro:bit
An ADXL345 MicroPython driver specifically written for the BBC micro:bit has been developed as part of this series on MicroPython for the microbit. The driver webpage also provides a detailed description of the driver's methods and properties with sample code.
The driver implements the base functionality (i.e. acceleration measurements) offered by this sensor. Also included is a simple tool for measuring angles from the horizontal.
The driver uses Full Resolution mode.
The FIFO and all interrupts (with the exception of Data Ready) are not available in this driver.
Inertial Measurement, Magnet Field Sensing
How they work
Weather Station Sensors
How they work
Pressure, Humidity, Temperature
Distance Sensors
Images
ADXL345 breakout board
Micrograph of the ADXL345 sensor
Voltage regulator (3.3V) on ADXL345 breakout board
ADXL345 breakout board's 4.7kΩ pullup resistors