solderedelectronics/soldered-bma400-esp-idf-component

1.0.0

Latest
uploaded 10 hours ago
Soldered BMA400 accelerometer breakout component

Readme

# Soldered BMA400 Accelerometer Component

| ![Soldered BMA400 Accelerometer breakout](TODO_PRODUCT_IMAGE_URL) |
| :------------------------------------------------------------------------------------: |
|                      [Soldered BMA400 Accelerometer breakout](https://www.solde.red/333419)                      |

<!-- TODO: product not released yet (SKU 333419), swap the image URL above once the listing is live -->

ESP-IDF component for the Soldered BMA400 breakout board. The BMA400 is a Bosch ultra-low-power triaxial accelerometer, drawing as little as 14 µA in normal mode, with on-chip step counting, tap detection, orientation and activity-change recognition, and a FIFO buffer. The board connects over I2C and is part of the [Qwiic ecosystem](https://soldered.com/collections/qwiic-ecosystem), so no soldering is needed to hook it up.

### Installation

Add it to your project with the component manager:

```bash
idf.py add-dependency "solderedelectronics/soldered-bma400"
```

Or clone this repository into your project's `components/` folder.

### Usage

The I2C bus belongs to your application, not to the driver, so that other Qwiic devices can share it. Create the bus first, then hand it over:

```c
#include "driver/i2c_master.h"
#include "soldered_bma400.h"

i2c_master_bus_config_t bus_cfg = {
    .i2c_port = I2C_NUM_0,
    .sda_io_num = GPIO_NUM_21,
    .scl_io_num = GPIO_NUM_22,
    .clk_source = I2C_CLK_SRC_DEFAULT,
    .glitch_ignore_cnt = 7,
    .flags.enable_internal_pullup = true,
};
i2c_master_bus_handle_t bus;
ESP_ERROR_CHECK(i2c_new_master_bus(&bus_cfg, &bus));

bma400_t sensor;
ESP_ERROR_CHECK(soldered_bma400_init(&sensor, bus, BMA400_I2C_ADDRESS_SDO_LOW));

if (soldered_bma400_get_sensor_data(&sensor, false) == BMA400_OK) {
    printf("%.3f g, %.3f g, %.3f g\n", sensor.data.accel_x, sensor.data.accel_y, sensor.data.accel_z);
}
```

Use `BMA400_I2C_ADDRESS_SDO_HIGH` instead if the address jumper on the board is soldered. `soldered_bma400_init_with_config()` takes a different I2C clock.

Every call leaves the Bosch API result code in the handle, so `soldered_bma400_check_status()` and `soldered_bma400_status_string()` describe what went wrong after any of them.

### Examples

- **basic_readings** - reads X, Y, Z acceleration in a loop, the mode most applications want
- **motion_detection** - configures the generic interrupt feature and reacts to it on a GPIO interrupt pin
- **step_counter** - uses the built-in step counter and activity type detection (running/walking/still)

Build any of them with:

```bash
cd examples/basic_readings
idf.py set-target esp32
idf.py build flash monitor
```

### Repository Contents

- **/src** - source files (.c), with the unmodified Bosch BMA400 Sensor API in `src/bma400_api/`
- **/include** - header files (.h), with the Bosch API headers in `include/bma400_api/`
- **/examples** - examples for using the library
- **_other_** - idf_component.yml manifest file for ESP Component Registry

### Hardware design

You can find hardware design for this board in the Soldered BMA400 Accelerometer breakout hardware repository.

### Documentation

Access library documentation [here](https://docs.soldered.com/).

### About Soldered

<img src="https://raw.githubusercontent.com/SolderedElectronics/Soldered-Generic-Arduino-Library/dev/extras/Soldered-logo-color.png" alt="soldered-logo" width="500"/>

At Soldered, we design and manufacture a wide selection of electronic products to help you turn your ideas into acts and bring you one step closer to your final project. Our products are intented for makers and crafted in-house by our experienced team in Osijek, Croatia. We believe that sharing is a crucial element for improvement and innovation, and we work hard to stay connected with all our makers regardless of their skill or experience level. Therefore, all our products are open-source. Finally, we always have your back. If you face any problem concerning either your shopping experience or your electronics project, our team will help you deal with it, offering efficient customer service and cost-free technical support anytime. Some of those might be useful for you:

- [Web Store](https://www.soldered.com/shop)
- [Tutorials & Projects](https://soldered.com/learn)
- [Documentation](https://docs.soldered.com)

### Original source

This component is possible thanks to the original [BMA400 Sensor API](https://github.com/BoschSensortec/BMA400-Sensor-API) by Bosch Sensortec. Thank you, Bosch. The Bosch API is BSD-3-Clause licensed, its license is kept alongside the sources in `src/bma400_api/LICENSE`.

### Open-source license

Soldered invests vast amounts of time into hardware & software for these products, which are all open-source. Please support future development by buying one of our products.

Check license details in the LICENSE file. Long story short, use these open-source files for any purpose you want to, as long as you apply the same open-source licence to it and disclose the original source. No warranty - all designs in this repository are distributed in the hope that they will be useful, but without any warranty. They are provided "AS IS", therefore without warranty of any kind, either expressed or implied. The entire quality and performance of what you do with the contents of this repository are your responsibility. In no event, Soldered (TAVU) will be liable for your damages, losses, including any general, special, incidental or consequential damage arising out of the use or inability to use the contents of this repository.

## Have fun!

And thank you from your fellow makers at Soldered Electronics.

Links

Supports all targets

To add this component to your project, run:

idf.py add-dependency "solderedelectronics/soldered-bma400-esp-idf-component^1.0.0"

download archive

Stats

  • Archive size
    Archive size ~ 60.56 KB
  • Downloaded in total
    Downloaded in total 0 times
  • Downloaded this version
    This version: 0 times

Badge

solderedelectronics/soldered-bma400-esp-idf-component version: 1.0.0
|