STM32 Nucleo and BMA400 acceleration sensor example using the Arduino IDE

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

This is the connections I used

Nucleo Sensor
3v3 3v3
Gnd Gnd
I2C_SCL1 SCL
I2C_SDA1 SDA

 

Code Example

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

[codesyntax lang=”cpp”]

#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);
}

[/codesyntax]

 

Output

Open the serial monitor and you should see something like this. move the sensor around through its various axis

BMA400 is connected
248.05,1064.45,226.56,25
7.81,1064.45,226.56,25
177.73,800.78,-150.39,24
5.86,800.78,-150.39,24
234.37,751.95,-54.69,83
37.11,941.41,-44.92,25
7.81,941.41,-44.92,25
-542.97,960.94,44.92,25
-992.19,960.94,44.92,25

 

Links

https://ae-bst.resource.bosch.com/media/_tech/media/datasheets/BST-BMA400-DS000.pdf

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

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

Share
This div height required for enabling the sticky sidebar
Ad Clicks : Ad Views : Ad Clicks : Ad Views :