ADXL335 Accelerometer

Contents

Description

ADXL335 chip, front and back
Fig 1 - ADXL335 sensor

The ADXL335 from Analog Devices is described in the datasheet as a small, thin, low power, complete 3-axis accelerometer with signal conditioned voltage outputs..

The ADXL335 measures acceleration with a capacitive type sensor.

This sensor has analog (voltage) outputs. It does not have the serial interface or interrupt engine that are common on later devices.

Out of the box it makes an excellent sensor for detecting such things as motion (activity) and orientation. With no interrupt capability the algorithms for this sensing must reside on the host microcontroller.

It could be used to gather quite accurate acceleration measurements but would require careful calibration after the circuit has been built.

As stated in the datasheet; the published zero-g-output and sensitivity (both required to convert voltages to acceleration) are indicative only. These crucial values could be expected to vary slightly across each manufactured chip.

The values in the following table have been sourced from the product datasheet.

Parameter BMA400
Package and size LFCSP (Lead Frame Chip Scale Package) package, footprint 4mm x 4mm x 1.455mm.
Operating voltage range 1.8V to 3.6V
Supply current Typically 350µA.
Package alignment error ±1 degree.
Inter-axis alignment error ±0.1 degree.
Measurement ranges ±3g.
Sensitivity Typically 300 mv/g at Vs = 3V, but is linearly dependant upon supply voltage.
Output data rate (ODR) Bandwidth is user selectable by choice of capacitor size used on the outputs.
Interfaces Analog: Voltage levels on XOUT ,  YOUT and ZOUT pins.

Pinout

The ADXL335 has 16 pin pads. There are multiple pins that perform the same function. This simply offers the circuit designer much more flexibility with layout. The pins are:

  • VS x 2 : Supply voltage (1.8V to 3.6V)
  • COM x 4 : GND
  • ST : Self test function (see the datasheet Page 11).
  • Xout , Yout , Zout : X-axis, Y-axs, Z-axis acceleration analog outputs.
  • NC x 6 : Not connected

Using the ADXL335 in a Circuit

Using the ADXL335 in a circuit is quite simple. Examine the functional block diagram from the product datasheet and shown below.

ADXL335 functional block diagram from the datasheet

Capacitor CDC needs to be around 0.1 µF and effectively decouples the ADXL335 supply pins from noise on the power supply. This decoupling capacitor is a common requirement on circuits requiring a clean power supply.

The capacitors CX, CY and CZ implement a low-pass band filter for antialiasing and noise reduction. This is particularly important on an accelerometer. The filter's bandwidth is determined by the value of these capacitors. The datasheet provides a handy table on Page 11 for design purposes.

Measuring Acceleration

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.

Acceleration is obtained from the ADXL335 by sensing the voltage on the Xout , Yout and Zout pins. These voltages are converted to digital values through Analog-to-Digital (ADC) converters (e.g. on a microcontroller) then mathematically transformed to accelerations in g units.

In order to perform the transformation from voltage to acceleration there are two pieces of information required:

  1. Zero g output

    Acceleration along a given axis (e.g. X-axis) can be either in the positive direction or negative direction.

    The datasheet states that the zero g output is nominally equal to Vs/2 at all supply voltages.

    Example: If a 10-bit ADC (0 - 1023) is being used then:
    0g = 1024/2 = 512

  2. Sensitivity

    The output sensitivity varies proportionally to the supply voltage. The datasheet gives two extremity values that can be used to calculate the output sensitivity for any value of Vs:

    At Vs = 2V sensitivity is typically 195 mV/g
    At Vs = 3.6V sensitivity is typically 360 mV/g

    Example: If a supply voltage of 3.3V is being used then sensitivity:
    = (360 - 195)/(3.6 - 2.0) x 3.3
    = 340.3 mV/g


    If a 10-bit ADC (0 - 1023) is being used then the equivalent digital value:
    = 0.3403/3.3 x 1024
    = 105.6 MSB/g
Calculating Acceleration

Acceleration in units of g is calculated using the following formula:

  • Acceleration = (Raw - Zerog) / Sensitivity

Where:
Raw : Digital value of the output pin voltage
Zerog : Digital Zero g
Sensitivity : Digital sensitivity in MSB/g

Example using the 10-bit calculations from above:

  • Raw = 800
    Zerog = 512
    Sensitivity = 105.6

    Acceleration = (800 - 512) / 105.6
    = 2.72 g

ADXL335 MicroPython Driver for micro:bit

An ADXL335 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 everything mentioned in the datasheet; i.e. measurement of acceleration in the X-axis, Y-axis and Z-axis. Additionally, oversampling options are offered and a simple angle measurement tool is provided.