TOP Contributors

  1. MIKROE (2784 codes)
  2. Alcides Ramos (405 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (133 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 (141243 times)
  2. FAT32 Library (74082 times)
  3. Network Ethernet Library (58702 times)
  4. USB Device Library (48802 times)
  5. Network WiFi Library (44506 times)
  6. FT800 Library (44054 times)
  7. GSM click (30802 times)
  8. mikroSDK (29646 times)
  9. PID Library (27352 times)
  10. microSD click (27250 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

ML Vibro Sens Click

Rating:

0

Author: MIKROE

Last Updated: 2024-12-02

Package Version: 2.1.0.1

mikroSDK Library: 2.0.0.0

Category: Motion

Downloaded: 43 times

Not followed.

License: MIT license  

ML Vibro Sens Click is a compact add-on board for motion sensing and vibration analysis. This board features the FXLS8974CF, a 3-axis low-g 12-bit digital accelerometer from NXP designed for precise motion detection and data collection. This Click boardā„¢ represents a machine learning training tool that communicates with the host MCU over an I2C interface, with selectable addresses and dual operating modes for interrupt signaling or motion detection. It features two DC motors - a balanced motor for generating steady baseline vibrations and an unbalanced motor for customizable vibration patterns controlled via PWM or PDM signals.

No Abuse Reported

Do you want to subscribe in order to receive notifications regarding "ML Vibro Sens Click" changes.

Do you want to unsubscribe in order to stop receiving notifications regarding "ML Vibro Sens Click" changes.

Do you want to report abuse regarding "ML Vibro Sens Click".

  • Information
  • Comments (0)

mikroSDK Library Blog


ML Vibro Sens Click

ML Vibro Sens Click is a compact add-on board for motion sensing and vibration analysis. This board features the FXLS8974CF, a 3-axis low-g 12-bit digital accelerometer from NXP designed for precise motion detection and data collection. This Click boardā„¢ represents a machine learning training tool that communicates with the host MCU over an I2C interface, with selectable addresses and dual operating modes for interrupt signaling or motion detection. It features two DC motors - a balanced motor for generating steady baseline vibrations and an unbalanced motor for customizable vibration patterns controlled via PWM or PDM signals.

mlvibrosens_click.png

Click Product page


Click library

  • Author : Stefan Filipovic
  • Date : Nov 2024.
  • Type : I2C type

Software Support

We provide a library for the ML Vibro Sens 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 ML Vibro Sens Click driver.

Standard key functions :

  • mlvibrosens_cfg_setup Config Object Initialization function.

    void mlvibrosens_cfg_setup ( mlvibrosens_cfg_t *cfg );
  • mlvibrosens_init Initialization function.

    err_t mlvibrosens_init ( mlvibrosens_t *ctx, mlvibrosens_cfg_t *cfg );
  • mlvibrosens_default_cfg Click Default Configuration function.

    err_t mlvibrosens_default_cfg ( mlvibrosens_t *ctx );

Example key functions :

  • mlvibrosens_get_int_pin This function returns the interrupt pin logic state.

    uint8_t mlvibrosens_get_int_pin ( mlvibrosens_t *ctx );
  • mlvibrosens_get_data This function reads accel X, Y, and Z axis data in g and temperature in degrees Celsius.

    err_t mlvibrosens_get_data ( mlvibrosens_t *ctx, mlvibrosens_data_t *data_out );
  • mlvibrosens_set_vibro_state This function sets the vibro motors state.

    void mlvibrosens_set_vibro_state ( mlvibrosens_t *ctx, uint8_t state );

Example Description

This example demonstrates the use of the ML Vibro Sens Click board by capturing and logging acceleration data on the X, Y, and Z axes, along with temperature readings. The data is output over USB UART and can be visualized in real-time using tools like SerialPlot. Additionally, the vibro motor state changes periodically, cycling through different vibration states for added feedback.

The demo application is composed of two sections :

Application Init

Initializes the communication interface and configures the ML Vibro Sens Click board with default settings. This setup enables an interrupt on the INT pin when data is ready, sets the acceleration sensitivity to a +/-4G range, and sets the output data rate to 100 Hz.


void application_init ( void )
{
    log_cfg_t log_cfg;  /**< Logger config object. */
    mlvibrosens_cfg_t mlvibrosens_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.
    mlvibrosens_cfg_setup( &mlvibrosens_cfg );
    MLVIBROSENS_MAP_MIKROBUS( mlvibrosens_cfg, MIKROBUS_1 );
    if ( I2C_MASTER_ERROR == mlvibrosens_init( &mlvibrosens, &mlvibrosens_cfg ) )
    {
        log_error( &logger, " Communication init." );
        for ( ; ; );
    }

    if ( MLVIBROSENS_ERROR == mlvibrosens_default_cfg ( &mlvibrosens ) )
    {
        log_error( &logger, " Default configuration." );
        for ( ; ; );
    }

    log_info( &logger, " Application Task " );
}

Application Task

Monitors the data-ready interrupt, retrieves acceleration and temperature data when available, and logs it over USB UART in the format X;Y;Z;TEMP. After every 1000 data readings, the vibro motor state cycles through predefined states to demonstrate the motor's functionality.

void application_task ( void )
{
    static uint8_t vibro_state = MLVIBROSENS_VIBRO_STATE_IDLE;
    static uint16_t result_num = 0;
    static mlvibrosens_data_t accel_data;

    // Wait for a data ready interrupt
    while ( mlvibrosens_get_int_pin ( &mlvibrosens ) );

    if ( MLVIBROSENS_OK == mlvibrosens_get_data ( &mlvibrosens, &accel_data ) )
    {
        log_printf ( &logger, "%f;%f;%f;%d;\r\n", accel_data.x, accel_data.y, 
                                                  accel_data.z, accel_data.temperature ); 
    }
    if ( ++result_num > 1000 )
    {
        result_num = 0;
        if ( ++vibro_state > MLVIBROSENS_VIBRO_STATE_BOTH )
        {
            vibro_state = MLVIBROSENS_VIBRO_STATE_IDLE;
        }
        mlvibrosens_set_vibro_state ( &mlvibrosens, vibro_state );
    }
}

Note

We recommend using the SerialPlot tool for data visualization. The temperature measurements should be visualized independently. The data format for plotter is as follows: X;Y;Z;TEMP;

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.MLVibroSens

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. UART terminal is available in all MikroElektronika compilers.


ALSO FROM THIS AUTHOR

RMS to DC 2 Click

0

RMS to DC 2 Click is a compact add-on board that converts the RMS of the input signal into a DC voltage. This board features the AD8436, a low-cost, low-power, true RMS-to-DC converter from Analog Devices. The AD8436 is a translinear precision, low-power, true RMS-to-DC converter that delivers true RMS or average rectified value of AC waveform. It features high accuracy, a wide dynamic input range (100μV rms to 3V rms), a wide bandwidth of up to 1MHz, and more. This Click boardā„¢ makes the perfect solution for the development of various true RMS digital multimeter applications, panel meters and gauges, AC + DC measurement applications, a true RMS measurement of an audio signal, and other similar applications that require accurate RMS value readings.

[Learn More]

Current 9 Click

0

Current 9 Click is a compact add-on board providing a precise and accurate current sensing solution. This board features the CT415-HSN830DR, high-bandwidth and ultra-low-noise XtremeSense® TMR current sensor designed for the current range up to 30A from Crocus Technology. This sensor also features an integrated current-carrying conductor which handles rated current and generates a current measurement as a linear analog output voltage, accomplishing a total output error of about ±1% full-scale. After that, the user is allowed to process the output voltage in analog or digital form.

[Learn More]

3D Hall 9 Click

0

3D Hall 9 Click is a compact add-on board used to detect the strength of a magnetic field in all three dimensions. This board features the ALS31300, a 3D linear Hall-effect sensor with digital output and advanced low power management from Allegro Microsystems. The ALS31300 features an I2C interface, enabling it to be easily configured by MCU with the measurement data provided in digital format of 12-bits corresponding to the magnetic field measured in each X, Y, and Z axes.

[Learn More]