TOP Contributors

  1. MIKROE (2752 codes)
  2. Alcides Ramos (372 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (118 codes)
  5. Bugz Bensce (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 (139064 times)
  2. FAT32 Library (71594 times)
  3. Network Ethernet Library (56989 times)
  4. USB Device Library (47330 times)
  5. Network WiFi Library (43006 times)
  6. FT800 Library (42297 times)
  7. GSM click (29777 times)
  8. mikroSDK (27874 times)
  9. PID Library (26858 times)
  10. microSD click (26129 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: 1795 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

CAN SPI 3.3V click

0

This is code that shows simple connection of two CAN SPI modules with SN65HVD230.<br/> Messages are sent by pressing PortB buttons and received message can be seen on PortD LEDs.<br/>

[Learn More]

Brushless 13 Click

0

Brushless 13 Click is a compact add-on board that controls brushless DC motors with any MCU. This board features the STSPIN830, a compact and versatile three-phase and three-sense motor driver from STMicroelectronics. The driver integrates both the control logic and a fully protected low RDson triple half-bridge power stage.

[Learn More]

eINK 1.54 inch display

0

eINK click is an adapter Click boardâ„¢, used to interface a compatible eINK display with the host MCU.

[Learn More]