TOP Contributors

  1. MIKROE (2779 codes)
  2. Alcides Ramos (376 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (118 codes)
  5. Bugz Bensce (97 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 (139563 times)
  2. FAT32 Library (72041 times)
  3. Network Ethernet Library (57254 times)
  4. USB Device Library (47615 times)
  5. Network WiFi Library (43219 times)
  6. FT800 Library (42559 times)
  7. GSM click (29930 times)
  8. mikroSDK (28292 times)
  9. PID Library (26930 times)
  10. microSD click (26309 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: 1881 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

UVC Light click

5

UVC Light Click is Click board with ultraviolet LEDs with 275nm wavelength. UVC radiation refers to wavelengths shorter than 280 nm. Because of the spectral sensitivity of DNA, only the UVC region demonstrates significant germicidal properties.

[Learn More]

GPS click - L10 - Examples

0

Simple example which demonstrates usage of the GPS Click board with QUECTEL GPS module.
It displays a map of the world on the TFT and shows the location of the GPS module on it.
Also it displays current coordinates of GPS receiver.

[Learn More]

Reed click

1

REED click is a simple board that carries a standard reed switch — a simple hermetically sealed switch that can be activated with a magnet or electromagnetic coil. A single pin (CS) connected to the MCU is outputting a 1 or 0 depending on the whether the switch is close or open. REED click is designed to use either a 3.3V or a 5V power supply.

[Learn More]