TOP Contributors

  1. MIKROE (2656 codes)
  2. Alcides Ramos (353 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 (136804 times)
  2. FAT32 Library (69983 times)
  3. Network Ethernet Library (55951 times)
  4. USB Device Library (46274 times)
  5. Network WiFi Library (41892 times)
  6. FT800 Library (41188 times)
  7. GSM click (28990 times)
  8. PID Library (26420 times)
  9. mikroSDK (26375 times)
  10. microSD click (25382 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: 1455 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

Thermo 19 click

0

Thermo 19 Click is a compact add-on board that provides an accurate temperature measurement. This board features the MAX31825, a temperature sensor that provides 8-bit to 12-bit Celsius temperature measurements with better than ±1.75°C from -45°C to +145°C from Analog Devices. It has a unique 64-bit serial code stored in an on-chip ROM, an alarm output for detection of temperature faults, temperature resolution selection from 8 to 12 bits, and it allows temperature conversion to 10-bit digital word in a period of 80ms (max).

[Learn More]

CAN FD 7 click

0

CAN FD 7 Click is a compact add-on board that contains a CAN transceiver that supports both CAN and CAN FD protocols. This board features the TCAN1462, an automotive fault-protected CAN FD transceiver from Texas Instruments. It is a high-speed Controller Area Network (CAN) transceiver that meets the ISO 11898-2:2016 high-speed CAN specification and the CiA 601-4 signal improvement capability (SIC) specification.

[Learn More]

BarGraph 3 click

6

BarGraph 3 click is equipped with a five-segment LED bar graph display, notable for its strong and reliable illumination of the segments.

[Learn More]