Easily measure acceleration forces and enable the monitoring of motion and changes in velocity
A
A
Hardware Overview
How does it work?
Accel 5 Click is based on the BMA400, an ultra-low power triaxial accelerometer sensor, from Bosch Sensortec. This sensor has many features perfectly suited for IoT applications and wearables, offering a good balance between the performance and the power consumption. One of its key features is its ultra-low power consumption, allowing it to be used in various always-on low power applications. To improve the battery life even more, this sensor also features a Sleep mode when the sensor current consumption is in magnitude of few hundred nanoamperes. This sensor can measure the acceleration in ranges of ±2 g, ±4 g, ±8, and ±16 g. It also offers lowpass filtering of the output data, in the range from 0.48 x ODR (Output Data Refresh rate), up to maximal ODR frequency of 800Hz. An internal 12bit A/D converter ensures reliable and low noise operation, so that the data coming from the internal MEMS remains clean and accurate. Three power modes allow customized balance between the power consumption and performance. An extensive integrated interrupt engine offers many distinctive functionalities, such as the automatic enter/exit Low Power mode, advanced actions detection such as the running, walking, several other features such as the step counting, and more. After the POR (Power ON Reset) event, the device stays in the Sleep mode. In Sleep mode, the sensor practically does not consume any power (about 300nA), but the sensor functionality is completely suspended. To use the sensor, it has to be either in Low Power mode, where it uses a fixed Output Data Refresh (ODR) of 25Hz, or in the Normal mode. Some options are exclusive only to Normal mode, such as the step counting detection,
output filtering and so on. Normal mode still uses power conservative, allowing the device to be used in the Always-ON low power applications. While operating in Normal mode, two filters are available for the data filtering. The filters can be applied either to the output registers, the FIFO engine, or can be used to process the interrupt data. The first filter can be used to obtain data rates from 12.5Hz up to 800Hz, which is defined by the filter registers, while the second filter offers fixed frequency of 100Hz, superimposed by a frequency of 1Hz. The output noise is affected by the ODR frequency. Acceleration data is available in 12-bit format from both the data registers and the internal FIFO buffer of 1kb. The FIFO buffer can be used for more complex calculations or timed readings. Writing to FIFO buffer is only allowed in the Normal mode, while it can be read in the Low power mode, too. The interrupt engine facilitates the complete FIFO buffer, triggering an interrupt for several FIFO events: overflow event, watermark event, almost full event, and so on. The BMA400 sensor contains an integrated timer, which can be used along with the interrupts to be used for the auto Wakeup or auto Power down functions. The automatic functions are a part of the sensor power management. The automatic mode changes can be set either to an acceleration interrupt after a specified threshold is reached, or it can be set to a timer interrupt: when the timer expires, the interrupt is generated, and the power mode is switched. An extensive interrupt engine offers two layers of interrupts. It offers basic interrupts, including some basic functions, such as the Data Ready interrupt, FIFO buffer related interrupts and the Wakeup event interrupt. Basic interrupts also
report Interrupt overrun event, where too many interrupts are competing, so that the sensor is not able to process them all. Besides the basic interrupts, the interrupt engine offers some more sophisticated, advanced interrupts, that include detection all of the activities: tap/double tap, step counting, activity changed, orientation changed, and two generic interrupts. The advanced interrupts require a certain ODR rate and can be used in the Normal mode exclusively, while basic interrupts offer more rudimental control over events. The advanced interrupt engine can use two programmable interrupt pins. Both of these pins can be assigned with any interrupt source and can be either LOW or HIGH on interrupt, depending on settings in appropriate registers. These two pins are routed to INT and PWM pins of the mikroBUS™, and are labeled as IT1 and IT2, respectively. Besides the acceleration MEMS and complementary analog front-end circuitry, the BMA400 sensor also has an integrated temperature sensor. It is updated every 160ms and sampled with the 8-bit resolution. Thermal data is always available, except when the device is in the Sleep mode. Accel 5 click offers two communication interfaces. It can be used with either I2C or SPI. The onboard SMD jumpers labeled as SEL COM allow switching between the two interfaces. Note that all the jumpers have to be positioned either to I2C or to SPI position. When I2C interface is selected, an additional SMD jumper labeled as the I2C ADD becomes available, determining the least significant bit of the BMA400 I2C address. The Click board™ should be interfaced only with MCUs that operate on 3.3V.
Features overview
Development board
Fusion for ARM v8 is a development board specially designed for the needs of rapid development of embedded applications. It supports a wide range of microcontrollers, such as different ARM® Cortex®-M based MCUs regardless of their number of pins, and a broad set of unique functions, such as the first-ever embedded debugger/programmer over WiFi. The development board is well organized and designed so that the end-user has all the necessary elements, such as switches, buttons, indicators, connectors, and others, in one place. Thanks to innovative manufacturing technology, Fusion for ARM v8 provides a fluid and immersive working experience, allowing access anywhere and under any
circumstances at any time. Each part of the Fusion for ARM v8 development board contains the components necessary for the most efficient operation of the same board. An advanced integrated CODEGRIP programmer/debugger module offers many valuable programming/debugging options, including support for JTAG, SWD, and SWO Trace (Single Wire Output)), and seamless integration with the Mikroe software environment. Besides, it also includes a clean and regulated power supply module for the development board. It can use a wide range of external power sources, including a battery, an external 12V power supply, and a power source via the USB Type-C (USB-C) connector.
Communication options such as USB-UART, USB HOST/DEVICE, CAN (on the MCU card, if supported), and Ethernet is also included. In addition, it also has the well-established mikroBUS™ standard, a standardized socket for the MCU card (SiBRAIN standard), and two display options for the TFT board line of products and character-based LCD. Fusion for ARM v8 is an integral part of the Mikroe ecosystem for rapid development. Natively supported by Mikroe software tools, it covers many aspects of prototyping and development thanks to a considerable number of different Click boards™ (over a thousand boards), the number of which is growing every day.
Microcontroller Overview
MCU Card / MCU
![default](https://cdn.mikroe.com/rent-a-product/request-setup/mcu-cards/mcu-card-for-stm32-stm32f405zg.png)
Type
8th Generation
Architecture
ARM Cortex-M4
MCU Memory (KB)
1024
Silicon Vendor
STMicroelectronics
Pin count
144
RAM (Bytes)
196608
Used MCU Pins
mikroBUS™ mapper
Take a closer look
Click board™ Schematic
![Accel 5 Click Schematic schematic](https://dbp-cdn.mikroe.com/catalog/click-boards/resources/1ee790c3-f143-6d0e-8d56-0242ac120009/schematic.webp)
Step by step
Project assembly
Track your results in real time
Application Output via UART Mode
1. Once the code example is loaded, pressing the "FLASH" button initiates the build process, and programs it on the created setup.
2. After the programming is completed, click on the Tools icon in the upper-right panel, and select the UART Terminal.
3. After opening the UART Terminal tab, first check the baud rate setting in the Options menu (default is 115200). If this parameter is correct, activate the terminal by clicking the "CONNECT" button.
4. Now terminal status changes from Disconnected to Connected in green, and the data is displayed in the Received data field.
![UART_Application_Output](https://dbp-cdn.mikroe.com/cms/shared-resources/1ef8714c-f1d3-6e0c-bc9f-02420a000253/UART-OUTPUT.png)
Software Support
Library Description
This library contains API for Accel 5 Click driver.
Key functions:
accel5_write_byte
- Functions for write one byte in registeraccel5_read_byte
- Functions for read byte from registeraccel5_read_data
- Functions for read data from register
Open Source
Code example
The complete application code and a ready-to-use project are available through the NECTO Studio Package Manager for direct installation in the NECTO Studio. The application code can also be found on the MIKROE GitHub account.
/*!
* \file
* \brief Accel5 Click example
*
* # Description
* This application allows linear motion and gravitational force measurements.
*
* The demo application is composed of two sections :
*
* ## Application Init
* Initializes Driver init and settings accelerometer data range and mode.
*
* ## Application Task
* Reads the accel X / Y / Z axis data, every 500 ms.
*
* \author MikroE Team
*
*/
// ------------------------------------------------------------------- INCLUDES
#include "board.h"
#include "log.h"
#include "accel5.h"
// ------------------------------------------------------------------ VARIABLES
static accel5_t accel5;
static log_t logger;
// ------------------------------------------------------ APPLICATION FUNCTIONS
void application_init ( void )
{
log_cfg_t log_cfg;
accel5_cfg_t cfg;
/**
* Logger initialization.
* Default baud rate: 115200
* Default log level: LOG_LEVEL_DEBUG
* @note If USB_UART_RX and USB_UART_TX
* are defined as HAL_PIN_NC, you will
* need to define them manually for log to work.
* See @b LOG_MAP_USB_UART macro definition for detailed explanation.
*/
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, "---- Application Init ----" );
// Click initialization.
accel5_cfg_setup( &cfg );
ACCEL5_MAP_MIKROBUS( cfg, MIKROBUS_1 );
if ( accel5_init( &accel5, &cfg ) == ACCEL5_INIT_ERROR )
{
log_info( &logger, "---- Application Error ----" );
for ( ; ; );
}
log_info( &logger, "---- Application Init Done ----\n" );
accel5_soft_reset( &accel5 );
Delay_ms( 500 );
accel5_default_cfg( &accel5, ACCEL5_CFG_0_NORMAL_MODE, ACCEL5_CFG_1_ACC_RANGE_4g );
Delay_ms( 500 );
}
void application_task ( void )
{
int16_t x_axis_data;
int16_t y_axis_data;
int16_t z_axis_data;
// Task implementation.
x_axis_data = accel5_get_axis( &accel5, ACCEL5_X_AXIS );
log_printf ( &logger, " X axis : %d\r\n", x_axis_data );
y_axis_data = accel5_get_axis( &accel5, ACCEL5_Y_AXIS );
log_printf ( &logger, " Y axis : %d\r\n", y_axis_data );
z_axis_data = accel5_get_axis( &accel5, ACCEL5_Z_AXIS );
log_printf ( &logger, " Z axis : %d\r\n\n", z_axis_data );
Delay_ms( 500 );
}
void main ( void )
{
application_init( );
for ( ; ; )
{
application_task( );
}
}
// ------------------------------------------------------------------------ END