TOP Contributors

  1. MIKROE (2650 codes)
  2. Alcides Ramos (350 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 (136552 times)
  2. FAT32 Library (69748 times)
  3. Network Ethernet Library (55849 times)
  4. USB Device Library (46189 times)
  5. Network WiFi Library (41811 times)
  6. FT800 Library (41003 times)
  7. GSM click (28930 times)
  8. PID Library (26386 times)
  9. mikroSDK (26291 times)
  10. microSD click (25303 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

Vibra Sense 2 click

Rating:

5

Author: MIKROE

Last Updated: 2020-11-23

Package Version: 1.0.0.0

mikroSDK Library: 1.0.0.0

Category: Motion

Downloaded: 1426 times

Not followed.

License: MIT license  

Vibra Sense 2 Click is a compact add-on board that contains a piezo sensor suitable for vibration measurements.

No Abuse Reported

Do you want to subscribe in order to receive notifications regarding "Vibra Sense 2 click" changes.

Do you want to unsubscribe in order to stop receiving notifications regarding "Vibra Sense 2 click" changes.

Do you want to report abuse regarding "Vibra Sense 2 click".

  • mikroSDK Library 2.0.0.0
  • Comments (0)
DOWNLOAD LINK RELATED COMPILER CONTAINS
mikroBasic PRO for ARM
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for AVR
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for dsPIC30/33 & PIC24
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for FT90x
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for PIC
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for PIC32
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for ARM
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for AVR
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for dsPIC30/33 & PIC24
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for FT90x
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for PIC
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for PIC32
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for ARM
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for AVR
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for dsPIC30/33 & PIC24
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for FT90x
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for PIC
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for PIC32
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc

mikroSDK Library Blog

Vibra Sense 2 click

Vibra Sense 2 click

Native view of the Vibra Sense 2 click board.

View full image
Vibra Sense 2 click

Vibra Sense 2 click

Front and back view of the Vibra Sense 2 click board.

View full image

Library Description

The library covers all the necessary functions that enables the usage of the Vibra Sense 2 Click board™. It offers reading from output register, calculations that result in relatively accurate measurement of output voltage and the vibration level of the piezo element.

Key functions:

  • uint16_t vibrasense2_read_data ( ); - Function is used to read raw data from MCP3221.
  • uint16_t vibrasense2_read_voltage ( uint16_t v_ref ); - Function is used to calculate piezo voltage in millivolts.
  • int8_t vibrasense2_vibration_level ( ); - Function is used to get vibration level.

Examples description

The application is composed of three sections :

  • System Initialization - Initializes I2C module ans LOG structure.
  • Application Initialization - Initalizes I2C driver and makes an initial log.
  • Application Task - Demonstrates use of Vibra Sense 2 Click board™ by checking vibration levels and displaying changes via USART terminal.
void application_task ( )
{
    new_val = vibrasense2_vibration_level( );
    if ( new_val != old_val )
    {
        switch ( new_val )
        {
            case VIBRASENSE2_VIBRA_LVL_0:
            {
                mikrobus_logWrite( "No Vibration", _LOG_LINE );
                break;
            }
            case VIBRASENSE2_VIBRA_LVL_1:
            {
                mikrobus_logWrite( "Marginal Vibration", _LOG_LINE );
                break;
            }
            case VIBRASENSE2_VIBRA_LVL_2:
            {
                mikrobus_logWrite( "Slight Vibration", _LOG_LINE );
                break;
            }
            case VIBRASENSE2_VIBRA_LVL_3:
            {
                mikrobus_logWrite( "Enhanced Vibration", _LOG_LINE );
                break;
            }
            case VIBRASENSE2_VIBRA_LVL_4:
            {
                mikrobus_logWrite( "Moderate Vibration", _LOG_LINE );
                break;
            }
            case VIBRASENSE2_VIBRA_LVL_5:
            {
                mikrobus_logWrite( "High Vibration", _LOG_LINE );
                break;
            }
            case VIBRASENSE2_VIBRA_LVL_6:
            {
                mikrobus_logWrite( "Severe Vibration", _LOG_LINE );
                break;
            }
            default:
            {
                mikrobus_logWrite( "Error occured!", _LOG_LINE );
            }
        }
        old_val = new_val;
    }
}

Other mikroE Libraries used in the example:

  • I2C
  • UART

Additional notes and informations

Depending on the development board you are using, you may need USB UART clickUSB 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

Air quality 5 click

10

Air quality 5 click is a triple MOS sensor on a single Click board, which can detect gas pollution for a number of different gases. The onboard sensor is specially designed to detect the pollution from automobile exhausts as well as the gas pollution from the industrial or agricultural industry.

[Learn More]

ISO 9141 click

5

ISO 9141 Click is a compact add-on board that contains a monolithic bus driver with ISO 9141 interface. This board features the L9637, a monolithic integrated circuit containing standard ISO 9141 compatible interface functions from ST Microelectronics.

[Learn More]

UART 1-Wire click

0

UART 1-Wire click is used to convert standard UART or RS232 signals into 1-Wire® signals. Apart from other features such as the slew rate control for larger 1-Wire® busses, selectable data rate, an accurate self-calibrating time base, ESD protection and more, the main feature of the UART 1-Wire® click, is that it manages all the sensitive signal timings involved in 1-Wire® communication, allowing rapid development of UART to 1-Wire® applications.

[Learn More]