30 min

Experience a new era of motion sensing with 820M1-0025 and PIC18F26K22

Revolutionize predictive maintenance by leveraging piezoelectric principles

Piezo Accel Click with Curiosity HPC

Published Jan 23, 2024

Click board™

Piezo Accel Click

Development board

Curiosity HPC


NECTO Studio



Our cutting-edge piezoelectric accelerometer harnesses advanced technology to provide unparalleled vibration monitoring for early fault detection and proactive maintenance



Hardware Overview

How does it work?

Piezo Accel Click is based on the 820M1-0025, a piezoelectric accelerometer designed for embedded condition monitoring and preventive maintenance applications from TE Connectivity. The 820M1-0025 accelerometer is available in the range of ±25g and features a flat frequency response up to >15kHz. Featuring stable piezoceramic crystals in shear mode sealed in a fully hermetic LCC package, the accelerometer incorporates an amplified ±1.25V output with optimum measurement resolution. This Click board™ is suitable for machine health monitoring and has superior resolution, dynamic range, and bandwidth to MEMS devices. The piezoelectric technology incorporated in the 820M1-0025 accelerometer has a proven track record for offering the reliable and long-term stable output

required for condition monitoring applications. This output signal can be processed in two ways: as an analog value or converted to a digital one using the LTC1864, a successive approximation A/D converter with a 16-bit resolution from Analog Devices. This ADC includes a sample-and-hold feature and has a differential analog input with an adjustable reference pin used as the reference input, resulting in accuracy and stability of the 4.096V reference voltage level provided by the MCP1541 from Microchip. Piezo Accel Click communicates with MCU using the 3-Wire SPI serial interface through an earlier-mentioned AD converter, the LTC1864. The 5V logic level provides a needed reference voltage for one side of the TXB0106, a 6-bit bidirectional level shifting, and a voltage translator with automatic direction

sensing from Texas Instruments. On the other side of the level shifter, the reference voltage is taken from the 3.3V pin from the mikroBUS™. In addition to the AD converter, the output of the 820M1-0025 can also be sent directly to an analog pin of the mikroBUS ™ socket labeled as AN. Output signal processing can be performed by placing an onboard SMD jumper labeled as AN SEL in an appropriate position marked as AN and ADC. This Click board™ can operate with either 3.3V or 5V logic voltage levels selected via the VCC SEL jumper. This way, both 3.3V and 5V capable MCUs can use the communication lines properly. Also, this Click board™ comes equipped with a library containing easy-to-use functions and an example code that can be used as a reference for further development.

Piezo Accel Click top side image
Piezo Accel Click bottom side image

Features overview

Development board

Curiosity HPC, standing for Curiosity High Pin Count (HPC) development board, supports 28- and 40-pin 8-bit PIC MCUs specially designed by Microchip for the needs of rapid development of embedded applications. This board has two unique PDIP sockets, surrounded by dual-row expansion headers, allowing connectivity to all pins on the populated PIC MCUs. It also contains a powerful onboard PICkit™ (PKOB), eliminating the need for an external programming/debugging tool, two mikroBUS™ sockets for Click board™ connectivity, a USB connector, a set of indicator LEDs, push button switches and a variable potentiometer. All

these features allow you to combine the strength of Microchip and Mikroe and create custom electronic solutions more efficiently than ever. Each part of the Curiosity HPC development board contains the components necessary for the most efficient operation of the same board. An integrated onboard PICkit™ (PKOB) allows low-voltage programming and in-circuit debugging for all supported devices. When used with the MPLAB® X Integrated Development Environment (IDE, version 3.0 or higher) or MPLAB® Xpress IDE, in-circuit debugging allows users to run, modify, and troubleshoot their custom software and hardware

quickly without the need for additional debugging tools. Besides, it includes a clean and regulated power supply block for the development board via the USB Micro-B connector, alongside all communication methods that mikroBUS™ itself supports. Curiosity HPC development board allows you to create a new application in just a few steps. Natively supported by Microchip software tools, it covers many aspects of prototyping thanks to many number of different Click boards™ (over a thousand boards), the number of which is growing daily.

Curiosity HPC double image

Microcontroller Overview

MCU Card / MCU




MCU Memory (KB)


Silicon Vendor


Pin count


RAM (Bytes)


Used MCU Pins

mikroBUS™ mapper

Analog Output
SPI Chip Select
SPI Clock
Power Supply
Power Supply

Take a closer look


Piezo Accel Click Schematic schematic

Step by step

Project assembly

Curiosity HPC front no-mcu image hardware assembly

Start by selecting your development board and Click board™. Begin with the Curiosity HPC as your development board.

Curiosity HPC front no-mcu image hardware assembly
IR Sense 4 Click front image hardware assembly
MCU DIP 28 hardware assembly
Prog-cut hardware assembly
Curiosity HPC 28pin-DIP - upright/background hardware assembly
Necto image step 2 hardware assembly
Necto image step 3 hardware assembly
Necto image step 4 hardware assembly
Necto image step 5 hardware assembly
Necto image step 6 hardware assembly
Necto DIP image step 7 hardware assembly
Necto No Display image step 8 hardware assembly
Necto image step 9 hardware assembly
Necto image step 10 hardware assembly
Debug Image Necto Step hardware assembly

Track your results in real time

Application Output

After loading the code example, pressing the "DEBUG" button builds and programs it on the selected setup.

Application Output Step 1

After programming is completed, a header with buttons for various actions available in the IDE appears. By clicking the green "PLAY "button, we start reading the results achieved with Click board™.

Application Output Step 3

Upon completion of programming, the Application Output tab is automatically opened, where the achieved result can be read. In case of an inability to perform the Debug function, check if a proper connection between the MCU used by the setup and the CODEGRIP programmer has been established. A detailed explanation of the CODEGRIP-board connection can be found in the CODEGRIP User Manual. Please find it in the RESOURCES section.

Application Output Step 4

Software Support

Library Description

This library contains API for Piezo Accel Click driver.

Key functions:

  • piezoaccel_adc_raw_read - Piezo Accel read raw adc function

  • piezoaccel_adc_voltage_read - Piezo Accel read adc converted to voltage function

  • piezoaccel_g_unit_read - Piezo Accel read force of acceleration function

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 main.c
 * @brief PiezoAccel Click 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.
 * ## 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.
 * *note:*
 * This demo app is intended to be used with MikroPlot data
 * visualization tool for clear understanding of the results.
 * @author Stefan Nikolic

#include "board.h"
#include "log.h"
#include "piezoaccel.h"

static piezoaccel_t piezoaccel;
static log_t logger;

static piezoaccel_setup_t setup_cfg_data;
static double time_var = 0;
static const int time_incr = 20;

void application_init ( void ) {
    log_cfg_t log_cfg;                  /**< Logger config object. */
    piezoaccel_cfg_t piezoaccel_cfg;    /**< Click config object. */

     * 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.

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

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 main ( void ) {
    application_init( );

    for ( ; ; ) {
        application_task( );

// ------------------------------------------------------------------------ END

Additional Support