Enhance the accuracy of your navigation systems and robotics projects by integrating our three-axis accelerometer, offering real-time motion data for improved control
A
A
Hardware Overview
How does it work?
Accel 13 Click is based on the IIS2DLPC, a high-performance ultra-low-power 3-axis accelerometer for industrial applications, from STMicroelectronics. This sensor has many features perfectly suited for wearables, handheld, and IoT applications, offering a good balance between the performance and the power consumption. One of its key features is its extremely low power consumption, which makes it perfectly suited for such applications. There are several power modes which the IIS2DLPC device can use. While in Low Power mode, the device consumes the least power, but the access to some features is restricted. More information can be found within the IIS2DLPC datasheet. The IIS2DLPC sensor can measure acceleration within ranges of ±2 g, ±4 g, ±8, and ±16 g. It can output the measurement data using the Output Data Rate (ODR) from 1.6Hz (Low Power mode), up to 1600Hz (Performance mode). A high-precision analog front end facilitates highly sensitive MEMS, featuring a 14-bit A/D Converter. It allows very high accuracy of the output, even during very low amplitude changes. This makes the sensor particularly sensitive and accurate
with movements that generate relatively low acceleration signals. However, using a highly sensitive MEMS makes the IIS2DLPC prone to damage caused by extremely high g-forces (10,000 g for less than 200 µs). Acceleration data is available in 14-bit format from both the data registers and the internal FIFO buffe, which can can memorize 32 slots of X, Y and Z data. The FIFO buffer can be used for more complex calculations or timed readings, reducing the traffic on the communication interface. The interrupt engine facilitates the FIFO buffer, triggering an interrupt for two FIFO events: watermark event, and FIFO buffer full event. FIFO buffer allows optimization within the firmware that runs on the host MCU. Besides the acceleration MEMS and complementary analog front-end circuit, the IIS2DLPC sensor also has an integrated temperature sensor. It is updated up to 25 times per second, and sampled to an 12-bit value (complement of 2’s format). Interrupts can be triggered for many different events. Some basic events include the data-ready interrupt event and aforementioned FIFO events, while so-called
feature engines can trigger an interrupt for any of the detected motion/movement events, including step detection/counter, activity recognition, tilt on wrist, tap/double tap, any/no motion, and error event interrupt. The extensive 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 PWM and INT pin of the mikroBUS™, and are labeled as IT1 and IT2, respectively. Accel 13 click offers two communication interfaces. It can be used with either I2C or SPI. The onboard SMD jumpers labeled as COMM SEL allow switching between the two interfaces. Note that all the jumpers have to be positioned either I2C or to SPI position. When I2C interface is selected, an additional SMD jumper labeled as ADDR SEL becomes available, determining the least significant bit of the IIS2DLPC I2C address. The Click board™ should be interfaced only with MCUs that use logic levels of 3.3V.
Features overview
Development board
Fusion for STM32 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 32-bit ARM® Cortex®-M based MCUs from STMicroelectronics, 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 STM32 v8 provides a fluid and immersive working experience, allowing
access anywhere and under any circumstances at any time. Each part of the Fusion for STM32 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 STM32 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
Type
8th Generation
Architecture
ARM Cortex-M4
MCU Memory (KB)
256
Silicon Vendor
STMicroelectronics
Pin count
32
RAM (Bytes)
65536
Used MCU Pins
mikroBUS™ mapper
Take a closer look
Schematic
Step by step
Project assembly
Track your results in real time
Application Output
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.
Software Support
Library Description
This library contains API for Accel 13 Click driver.
Key functions:
accel13_get_status
- This function reads the status data and stores it in the status objectaccel13_get_tap_status
- This function reads the tap status data and stores it in the tap_status objectaccel13_get_6d_status
- This function reads the 6D status data and stores it in the sixd_status object
Open Source
Code example
This example can be found in NECTO Studio. Feel free to download the code, or you can copy the code below.
/*!
* \file
* \brief Accel13 Click example
*
* # Description
* This application enables reading acceleration and tapping data on all 3 axes,
* using I2C or SPI communication.
*
* The demo application is composed of two sections :
*
* ## Application Init
* Initializes driver init, Test communication,
* starts chip configuration for measurement and Temperature reads.
*
* ## Application Task
* Reads Accelerometer data and detects tap on the axis
*
* *note:*
* The example is the basic functionality of the IIS2DLPC sensor,
* it is possible to read the acceleration data and detect Tap on all 3 axes.
* For other settings and improvements in reading accuracy,
* you need to further set up the registers and set the sensor to your conditions.
*
* \author MikroE Team
*
*/
// ------------------------------------------------------------------- INCLUDES
#include "board.h"
#include "log.h"
#include "accel13.h"
// ------------------------------------------------------------------ VARIABLES
static accel13_t accel13;
static log_t logger;
static accel13_axis_t axis;
static accel13_tap_t tap;
// ------------------------------------------------------ APPLICATION FUNCTIONS
void application_init ( void )
{
log_cfg_t log_cfg;
accel13_cfg_t cfg;
uint8_t device_id;
float temperature;
/**
* 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.
accel13_cfg_setup( &cfg );
ACCEL13_MAP_MIKROBUS( cfg, MIKROBUS_1 );
accel13_init( &accel13, &cfg );
accel13_generic_read_bytes( &accel13, ACCEL13_REG_WHO_AM_I, &device_id, 1 );
if ( device_id != ACCEL13_DEF_WHO_AM_I )
{
log_printf( &logger, "*\\*/*\\*/ Communication ERROR !!! \\*/*\\*/*" );
for ( ; ; );
}
log_printf( &logger, "---- Communication OK!!! ----\r\n" );
Delay_100ms( );
// Configuration
accel13_default_cfg ( &accel13 );
accel13_generic_write_single_byte( &accel13, ACCEL13_REG_CTRL_6, ACCEL13_CTRL6_BW_FILT_ODR_2 |
ACCEL13_CTRL6_FULL_SCALE_2g |
ACCEL13_CTRL6_FDS_LOW_PASS |
ACCEL13_CTRL6_LOW_NOISE_ENABLE );
// Temperature
temperature = accel13_get_temperature( &accel13 );
log_printf( &logger, " Temperature : %f.2 \r\n", temperature);
}
void application_task ( void )
{
// Reads Accel data
accel13_get_axis_data( &accel13, &axis );
log_printf( &logger, "---- Accel axis data ----\r\n\n" );
log_printf( &logger, "* X : %d \r\n", axis.x );
log_printf( &logger, "* Y : %d \r\n", axis.y);
log_printf( &logger, "* Z : %d \r\n", axis.z);
log_printf( &logger, "-------------------------\r\n" );
Delay_ms( 300 );
// Detections Tap on the axis
accel13_get_tap_status( &accel13, &tap );
if ( tap.tap_x == 0x01 )
{
log_printf( &logger, "---- Tap on the X axis ----\r\n" );
}
if ( tap.tap_y == 0x01 )
{
log_printf( &logger, "---- Tap on the Y axis ----\r\n" );
}
if ( tap.tap_z == 0x01 )
{
log_printf( &logger, "---- Tap on the Z axis ----\r\n" );
}
}
void main ( void )
{
application_init( );
for ( ; ; )
{
application_task( );
}
}
// ------------------------------------------------------------------------ END