BMA400 Accelerometer

Contents

Description

BMA400 chip with dimensions
Fig 1 - BMA400 sensor

The BMA400 from Bosch Sensortec is described in the datasheet (P2) as a 12 bit, digital, triaxial acceleration sensor with smart on-chip motion and position-triggered interrupt features.

Foremost it is an ultra-low power accelerometer making it very suitable for battery powered applications such as wearables and smart home applications. Included in the package is a temperature sensor with 8-bit output, possible used to compensate acceleration conversions. The temperature sensor can be read by user applications.

The BMA400 measures acceleration with a capacitive type sensor.

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

Parameter BMA400
Package and size 12 pins LGA package footprint 2mm x 2mm x 0.95mm.
Operating voltage range 1.72V to 3.6V
Supply current Typically 3.5µA to 14.5µA in Normal mode depending on oversampling.
Package alignment error Typically 0.5 degrees.
Cross axis sensitivity Relative contribution between any two of the three axis: 2%.
Measurement ranges ±2g, ±4g, ±8g, ±16g. Default is ±4g.
Sensitivity Varies from 1.0 mg/LSB (±2g) through to 7.8 mg/LSB (±16g).
Output data rate (ODR) 12.5Hz to 800Hz in Normal mode.
Resolution 12 bits in Two's Complementary format.
Serial interfaces I2C, SPI (4-wire and 3-wire).

I2C Interface

I2C and SPI (4-wire & 3-wire) are available. I2C is selected by default during chip power-up. SPI is selected by pulling the CSB (SPI chip select) pin high after the power-up sequence has completed.

I2C is available at 100kHz standard mode, 400kHz fast mode and an extended mode with a clock speed upto 3.4MHz.

There is a choice of two I2C addresses depending upon the state of the SDO (SPI serial output) pin:

  • 0x14 : SDO pin connected to GND
  • 0x15 : SDO pin connected to VDDIO i.e operating voltage.

Acceleration Sampling Options

There are a myriad of options available for the user to influence how the sensor measures acceleration. This section will only briefly touch on the subject. The reader is referred to the product datasheet for further details.

Sampling Modes

  • Sleep Mode

    Very low current consumption mode (200nA) where data conversions are stopped but the serial interface is still available.
  • Low Power Mode

    Data conversions run at a fixed 12.5Hz rate.

    Current consumption ranges between 800nA and 1200nA depending upon the amount of oversampling selected.

    This mode is designed for detection of activity rather than gathering high precision acceleration readings.
  • Normal Mode

    Output data rates (ODR) configurable between 12.5Hz and 800Hz are user selectable.

    User settable levels of oversampling are available to control signal noise.

The mode is selected by writing the appropriate 2-bit code to the ACC_CONFIG0 register.

Additional User Selections

  • Acceleration ranges

    The near universal ranges available on many accelerometers: ±2g, ±4g, ±8g, ±16g. Default is ±4g.

    Higher sensitivity is available at lower ranges but this must be balanced by the level of acceleration being experienced by the sensor.
  • Oversampling

    Oversampling involves sampling the acceleration at a higher rate than the output data rate. The additional samples are averaged to produce one sample for output.

    This can significantly increase accuracy with extra power consumption as the tradeoff.

    The BMA400 offers four levels of oversampling available in Normal mode; lowest to highest: 0, 1, 2, 3.
  • Output data rate (ODR)

    In Normal mode the ODR is user configurable between 12.5Hz to 800Hz.

    Within this range there are seven settings to choose from: 12.5Hz, 25Hz, 50Hz, 100Hz, 200Hz, 400Hz and 800Hz.
  • Low-pass bandwidth filter

    Accelerometers, like the BMA400, can be sensitive to vibrations and other high-frequency disturbances in the environment. A low-pass filter removes these high-frequency components, resulting in a cleaner signal with less noise.

    In Normal mode the user has a choice of several low-pass filter bandwidth settings; 0.48 X ODR, 0.24 x ODR and 1Hz. In the case of the 1Hz bandwidth, the ODR is locked at 100Hz.

These sampling options are selected by writing at the bit level to the sensor's configuration registers; ACC_CONFIG0 and ACC_CONFIG1.

Measuring Acceleration

The BMA400 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 12-bit raw acceleration value is read from two 8-bit registers. The binary representation is converted from its Two's Complementary format to a signed integer.

This is then scaled by simple division with the divisor depending upon the current acceleration measurement range. 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 has a total of 1024 bytes of storage.

The FIFO give the microcontroller host "breathing space" to carry on with other tasks as the sensor continues to produce acceleration samples. An 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.

Any combinations of the X-axis, Y-axis and Z-axis can be independently selected for writing to the FIFO.

Refer to the datasheet for further details of the FIFO.

Sensor Generated Interrupts

Many intelligent digital accelerometer sensors offer a rich set of functional interrupts. The BMA400 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:

  • Step detection with an associated step counter - The sensor has a sophisticated algorithm for step detection - that the user can tweak - making it an excellent wearable pedometer.
  • Activity recognition - One of Still, Walk, Run.
  • Activity changed - Sets an interrupt if the activity changes.
  • Tap sensing - Can detect single or double taps.
  • Orientation change - Optimised to detect an orientation change such as screen rotation.

Additionally the host is able to program custom rules-based interrupts defined by acceleration thresholds, hysteresis and durations then map them to the INT1 or INT2 pins.

Interrupts are enabled by writing to select bits in the INT_CONF0 and INT_CONFIG1 registers.

Measuring Temperature

As mentioned previously the BMA400 has an onboard temperature sensor. While the temperature is probably used internally to compensate acceleration conversions it can also be read by the host microcontroller.

The temperature sensor has only an 8-bit resolution. New temperature values are available from the TEMP_DATA register every 160ms. The 8-bit value is in Two's Complementary format and in °C.

BMA400 Chip ID

Genuine Bosch Sensortec chips usually have an ID value written to non-volatile memory at point of manufacture. This ID can be used to identify the sensor model.

In the case of the BMA400 sensor this value can be read from the [CHIPID] register and should return 0x90.

BMA400 MicroPython Driver for micro:bit

A BMA400 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 many of the sampling acceleration options the sensor offers including the ability to choose the power mode, the measurement ranges, amount of oversampling used and the ODR. Also included is a simple tool for measuring angles from the horizontal.

The FIFO and all interrupts (with the exception of Data Ready) are not available in this driver.