TOP Contributors

  1. MIKROE (2653 codes)
  2. Alcides Ramos (351 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (112 codes)
  5. Chisanga Mumba (90 codes)
  6. S P (73 codes)
  7. dany (71 codes)
  8. MikroBUS.NET Team (35 codes)
  9. NART SCHINACKOW (34 codes)
  10. Armstrong Subero (27 codes)

Most Downloaded

  1. Timer Calculator (136694 times)
  2. FAT32 Library (69915 times)
  3. Network Ethernet Library (55929 times)
  4. USB Device Library (46254 times)
  5. Network WiFi Library (41882 times)
  6. FT800 Library (41138 times)
  7. GSM click (28974 times)
  8. PID Library (26407 times)
  9. mikroSDK (26350 times)
  10. microSD click (25351 times)
Libstock prefers package manager

Package Manager

We strongly encourage users to use Package manager for sharing their code on Libstock website, because it boosts your efficiency and leaves the end user with no room for error. [more info]

< Back
mikroSDK Library

Piezo Accel click

Rating:

0

Author: MIKROE

Last Updated: 2024-04-03

Package Version: 2.1.0.14

mikroSDK Library: 2.0.0.0

Category: Motion

Downloaded: 79 times

Not followed.

License: MIT license  

Piezo Accel Click is a compact add-on board containing an acceleration sensor based on PE technology.

No Abuse Reported

Do you want to subscribe in order to receive notifications regarding "Piezo Accel click" changes.

Do you want to unsubscribe in order to stop receiving notifications regarding "Piezo Accel click" changes.

Do you want to report abuse regarding "Piezo Accel click".

  • Information
  • Comments (0)

mikroSDK Library Blog


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.

piezo_accel_click.png

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 :

  • piezoaccel_cfg_setup Config Object Initialization function.

    void piezoaccel_cfg_setup ( piezoaccel_cfg_t *cfg );
  • piezoaccel_init Initialization function.

    PIEZOACCEL_RETVAL piezoaccel_init ( piezoaccel_t *ctx, piezoaccel_cfg_t *cfg );
  • piezoaccel_default_cfg Click Default Configuration function.

    void piezoaccel_default_cfg ( piezoaccel_t *ctx );

Example key functions :

  • piezoaccel_adc_raw_read Piezo Accel read raw adc function.

    uint16_t piezoaccel_adc_raw_read ( piezoaccel_t *ctx );
  • piezoaccel_adc_voltage_read Piezo Accel read adc converted to voltage function.

    float piezoaccel_adc_voltage_read ( piezoaccel_t *ctx );
  • piezoaccel_g_unit_read Piezo Accel read force of acceleration function.

    float piezoaccel_g_unit_read ( piezoaccel_t *ctx, piezoaccel_setup_t *cfg_data );

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;                  /**< 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 );
}

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

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.


ALSO FROM THIS AUTHOR

ROTARY Y click

0

Rotary click carries a 15-pulse incremental rotary encoder with detents, surrounded by a ring of 16 yellow LEDs. It’s a perfect solution for adding a precision input knob to your design. The encoder outputs A and B signals (out of phase to each other); the knob also acts as a push-button which sends an interrupt to the target board MCU. The LED ring is controlled through SPI lines (CS, SCK, MISO, MOSI). Rotary click can be used with either a 3.3V or 5V power supply.

[Learn More]

Accel 20 click

0

Accel 20 Click is a compact add-on board that contains an acceleration sensor. This board features the KX134-1211, a digital output 3-axis accelerometer optimized for machine condition monitoring from Rohm Semiconductor. It allows selectable full-scale acceleration measurements in ranges of ±8g, ±16g, ±32g, or ±64g in three axes with a configurable host interface that supports both SPI and I2C serial communication. It also features an Advanced Data Path (ADP) technology which allows noise filtering and sensor signal processing, usually carried out by the MCU, to be performed by the accelerometer. They contribute to reducing MCU load and power consumption together with improved application performance.

[Learn More]

Angle 9 click

0

Angle 9 Click is a compact add-on board that detects the absolute position of a permanent magnet. This board features the AAS33001, a precision angle sensor with incremental and motor commutation outputs and on-chip linearization from Allegro Microsystems. It is a contactless angle sensor for 0° to 360° angular position, rotation speed, and directional measurement. Support for incremental output interface (ABI) and motor commutation (UVW) is also available. The same goes for the on-chip EEPROM for storing factory and customer calibration parameters.

[Learn More]