TOP Contributors

  1. MIKROE (2653 codes)
  2. Alcides Ramos (352 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 (136734 times)
  2. FAT32 Library (69950 times)
  3. Network Ethernet Library (55941 times)
  4. USB Device Library (46266 times)
  5. Network WiFi Library (41886 times)
  6. FT800 Library (41170 times)
  7. GSM click (28983 times)
  8. PID Library (26413 times)
  9. mikroSDK (26360 times)
  10. microSD click (25376 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

HAPTIC 2 click

Rating:

0

Author: MIKROE

Last Updated: 2024-04-03

Package Version: 2.1.0.13

mikroSDK Library: 2.0.0.0

Category: Haptic

Downloaded: 71 times

Not followed.

License: MIT license  

HAPTIC 2 Click is a compact add-on board that contains a linear vibration driver. This board features the LC898302AXA, a motor driver dedicated to LRA and ERM applications from ON Semiconductor. Controlled by only one pin, it allows crisp vibration thanks to automatic braking and over-driving feature and ignores the deviation of resonance frequency thanks to auto-tuning function. The original driving waveform will enable you to reduce power consumption, and it is helpful to maintain battery lifetime. This Click board™ is suitable for numerous everyday applications such as indicator systems, game consoles, training equipment/simulators with haptics function, robotics and mechatronics, and many more.

No Abuse Reported

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

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

Do you want to report abuse regarding "HAPTIC 2 click".

  • Information
  • Comments (0)

mikroSDK Library Blog


HAPTIC 2 click

HAPTIC 2 Click is a compact add-on board that contains a linear vibration driver. This board features the LC898302AXA, a motor driver dedicated to LRA and ERM applications from ON Semiconductor. Controlled by only one pin, it allows crisp vibration thanks to automatic braking and over-driving feature and ignores the deviation of resonance frequency thanks to auto-tuning function. The original driving waveform will enable you to reduce power consumption, and it is helpful to maintain battery lifetime.

haptic2_click.png

click Product page


Click library

  • Author : Nikola Peric
  • Date : Feb 2022.
  • Type : PWM type

Software Support

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

Standard key functions :

  • haptic2_cfg_setup Config Object Initialization function.

    void haptic2_cfg_setup ( haptic2_cfg_t *cfg );
  • haptic2_init Initialization function.

    HAPTIC2_RETVAL haptic2_init ( haptic2_t *ctx, haptic2_cfg_t *cfg );
  • haptic2_default_cfg Click Default Configuration function.

    void haptic2_default_cfg ( haptic2_t *ctx );

Example key functions :

  • haptic2_set_duty_cycle Sets PWM duty cycle.

    err_t haptic2_set_duty_cycle ( haptic2_t *ctx, float duty_cycle );
  • haptic2_pwm_stop Stop PWM module.

    err_t haptic2_pwm_stop ( haptic2_t *ctx );
  • haptic2_pwm_start Start PWM module.

    err_t haptic2_pwm_start ( haptic2_t *ctx );

Examples Description

This app shows some of the functions that Haptic 2 click has.

The demo application is composed of two sections :

Application Init

Initialization driver enables - PWM, PWM signal is set to 8000 HZ and to give a 0% duty cycle and start PWM module.

void application_init ( void ) 
{
    log_cfg_t log_cfg;          /**< Logger config object. */
    haptic2_cfg_t haptic2_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_printf( &logger, "\r\n" );
    log_info( &logger, " Application Init " );

    // Click initialization.

    haptic2_cfg_setup( &haptic2_cfg );
    HAPTIC2_MAP_MIKROBUS( haptic2_cfg, MIKROBUS_1 );
    err_t init_flag  = haptic2_init( &haptic2, &haptic2_cfg );
    if ( init_flag == PWM_ERROR ) 
    {
        log_error( &logger, " Application Init Error. " );
        log_info( &logger, " Please, run program again... " );

        for ( ; ; );
    }

    haptic2_default_cfg ( &haptic2 );

    haptic2_set_duty_cycle ( &haptic2, 0.0 );
    haptic2_pwm_start( &haptic2 );

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

Application Task

This is an example that demonstrates the use of the Haptic 2 Click board. In this example, we switched PWM signal back and forth from 10% duty cycle to 90% duty cycle every 500 milliseconds. Results are being sent to the Usart Terminal where you can track their changes.

void application_task ( void ) 
{
    static int8_t duty_cnt = 1;
    static int8_t duty_inc = 1;
    float duty = duty_cnt / 10.0;

    haptic2_set_duty_cycle ( &haptic2, duty );
    log_printf( &logger, "Duty: %d%%\r\n", ( uint16_t )( duty_cnt * 10 ) );
    Delay_ms ( 500 );

    if ( 10 == duty_cnt ) 
    {
        duty_inc = -1;
    }
    else if ( 0 == duty_cnt ) 
    {
        duty_inc = 1;
    }
    duty_cnt += duty_inc;
}

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

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

9DOF click

7

9DOF click carries ST’s LSM9DS1 inertial measurement module that combines a 3D accelerometer, a 3D gyroscope and a 3D magnetometer into a single device outputting so called nine degrees of freedom data (3-axis acceleration, angular velocity and heading), in 16-bit resolution.

[Learn More]

XBEE click

0

XBee Click is a compact add-on board providing wireless connectivity to end-point devices in ZigBee mesh networks. This board features the XB24CZ7PIS-004, a low-power Digi XBee® RF module delivering superior performance and interference immunity from Digi International. With its ultra-sensitive receiver, the XB24CZ7PIS-004 operates in the 2.4GHz ISM band (indoor/urban range of 60m and outdoor of 1200m), allowing the formation of robust mesh network optimized for use in the US, Canada, Europe, Australia, and Japan (worldwide acceptance). Alongside firmware updates, it supports commissioning and LED behaviors to aid device deployment and commissioning.

[Learn More]

V to Hz click

0

V to HZ click is a device that converts an analog voltage input signal into a pulse wave signal of a certain frequency. It has a linear response, so applying a voltage in a range of 0 to 5V on its input, will result in generating the pulse train with frequency linearly proportional to the input voltage.

[Learn More]