Home Code Arduino and BMA400 acceleration sensor example

Arduino and BMA400 acceleration sensor example

by shedboy71

In this article we look at another acceleration sensor – this time its the BMA400

The BMA400 is the first real ultra-low power acceleration sensor without compromising on performance. Featuring 12-bit digital resolution, continuous measurement and a defined selectable bandwidth combined with ultra-low power the BMA400 allows low-noise measurement of accelerations in three perpendicular axes. The BMA400 thus senses tilt, orientation, tab/double tab, and enables plug ’n’ play step counting with activity recognition especially suited for wearable devices, which need a long-lasting battery lifetime.

Thanks to the continuous measurement principle and always-defined bandwidth, the BMA400 is the ideal solution for smart home applications such as smart indoor climate systems and smart home security systems. In the latter, the BMA400 can distinguish between real alarm situations like broken glass and false signals coming from random vibrations. Thereby, the new acceleration sensor avoids false alarms.

Features

Parameter Technical data
Measurement range ±2 g, ±4 g, ±8 g, ±16 g
Digital resolution 12 bit
Output Data Rate (ODR) 12.5 Hz to 800 Hz
Low path filter bandwidth Selectable 0.48xODR or 0.24xODR
Current consumption (independent from ODR due to continuous measurement) Max. performance: 14.5 μA
Typical use case: 5.8 μA
Low power use case: 3.5μA
Noise density Max. performance: 180 μg/√Hz (Z: x 1.45)
Typical use case: 300 μg/√Hz (Z: x 1.45)
Low power: 415 μg/√Hz (Z: x 1.45)
Ultra low power / Auto-wake-up mode 800 nA @ 25 Hz ODR
Embedded features
  • Step counter (< 4 μA overall)
  • Activity recognition (walking, running, standing still)
  • Activity change
  • Orientation
  • Tab/Double tab (< 8 μA overall)
  • General interrupt 1 and 2 (programmable via thresholds, timer, logical AND/OR operations)
  • 1 kB FIFO
Offset ±80 mg
TCO ±1 mg/K
Interface SPI & I²C & 2 Interrupt pins
Supply voltage 1.71 V up to 3.6 V

Parts Required

 

Name Link
Arduino Uno UNO R3 CH340G/ATmega328P, compatible for Arduino UNO
BMA400 BMA400 Acceleration Sensor
Connecting wire Free shipping Dupont line 120pcs 20cm male to male + male to female and female to female jumper wire
sensor shield Expansion IO Board Sensor Shield

Schematic/Connection

 

arduino and BMA400

arduino and BMA400

 

Code Example

This uses the library from https://github.com/Seeed-Studio/Grove_3Axis_Digital_Accelerometer_BMA400

#include "BMA400.h"
float x = 0, y = 0, z = 0;
int16_t temp = 0;
void setup(void)
{
Wire.begin();
Serial.begin(115200);
while(!Serial);
Serial.println("BMA400 Raw Data");
while(1)
{
if(bma400.isConnection())
{
bma400.initialize();
Serial.println("BMA400 is connected");
break;
}
else Serial.println("BMA400 is not connected");
delay(2000);
}
}
void loop(void)
{
bma400.getAcceleration(&x, &y, &z);
temp = bma400.getTemperature();
Serial.print(x);
Serial.print(",");
Serial.print(y);
Serial.print(",");
Serial.print(z);
Serial.print(",");
Serial.print(temp);
Serial.println();
delay(500);
}

 

Output

Open the serial monitor and you should see something like this

BMA400 is connected
564.45,808.59,201.17,23
1029.30,-105.47,400.39,23
908.20,-189.45,359.38,23
902.34,-265.63,345.70,23

 

Links

Click to access BST-BMA400-DS000.pdf

https://github.com/BoschSensortec/BMA400-API

https://www.bosch-sensortec.com/bst/products/all_products/bma400_1

 

 

Share

You may also like

Leave a Comment

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More