piezoaccel 2.0.0.0
Main Page

Piezo Accel click

Piezo Accel Click is a compact add-on board containing an acceleration sensor based on PE technology. This board features the 820M1-0025, a piezoelectric accelerometer designed for embedded monitoring and preventive maintenance applications from TE Connectivity.

click Product page


Click library

  • Author : Stefan Nikolic
  • Date : jan 2021.
  • Type : SPI type

Software Support

We provide a library for the PiezoAccel Click as well as a demo application (example), developed using MikroElektronika compilers. The demo can run on all the main MikroElektronika development boards.

Package can be downloaded/installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on mikroE github account.

Library Description

‍This library contains API for PiezoAccel Click driver.

Standard key functions :

Example key functions :

Example Description

‍This application demonstrates the performance of Piezo Accel click board.

The demo application is composed of two sections :

Application Init

‍ The initialization of UART LOG and SPI click drivers.

Additionally, a default config is performed for "out of the box" Piezo Accel click settings. Calibration is optional and is used to correct the power supply offset of the sensor.

void application_init ( void ) {
log_cfg_t log_cfg;
piezoaccel_cfg_t piezoaccel_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
// Click initialization.
piezoaccel_cfg_setup( &piezoaccel_cfg );
PIEZOACCEL_MAP_MIKROBUS( piezoaccel_cfg, MIKROBUS_1 );
err_t init_flag = piezoaccel_init( &piezoaccel, &piezoaccel_cfg );
if ( init_flag == SPI_MASTER_ERROR ) {
log_error( &logger, " Application Init Error. " );
log_info( &logger, " Please, run program again... " );
for ( ; ; );
}
piezoaccel_default_cfg( &piezoaccel, &setup_cfg_data );
log_info( &logger, " Application Task " );
Delay_ms ( 200 );
}
#define PIEZOACCEL_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition piezoaccel.h:104
void application_init(void)
Definition main.c:45

Application Task

‍ The ADC is constantly read and converted to a

g-force acceleration unit. Data is sent via LOG every 20 ms and works on MikroPlot for graphical representation of the sensor results.

void application_task ( void ) {
float read_val;
read_val = piezoaccel_g_unit_read( &piezoaccel, &setup_cfg_data );
log_printf( &logger, "%.2f,%.2f\r\n", read_val, time_var );
time_var += time_incr;
Delay_ms ( time_incr );
}
void application_task(void)
Definition main.c:79

Note

‍ This demo app is intended to be used with MikroPlot data

visualization tool for clear understanding of the results. https://www.mikroe.com/mikroplot-data-visualization-tool

The full application code, and ready to use projects can be installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on mikroE github account.

Other mikroE Libraries used in the example:

  • MikroSDK.Board
  • MikroSDK.Log
  • Click.PiezoAccel

Additional notes and informations

Depending on the development board you are using, you may need USB UART click, USB UART 2 Click or RS232 Click to connect to your PC, for development systems with no UART to USB interface available on the board. The terminal available in all Mikroelektronika compilers, or any other terminal application of your choice, can be used to read the message.