The haptic driver that brings your digital world to life with realistic touch feedback!
A
A
Hardware Overview
How does it work?
Haptic 3 Click is based on the DA7282, a haptic driver capable of driving both LRA and ERM actuators from Dialog Semiconductor. The power-optimized architecture and advanced closed-loop digital algorithms achieve a high-fidelity haptic drive. The DA7282 features frequency control within an onboard Waveform Memory and three distinct general-purpose inputs for triggering up to six specific sequences, which helps with emulating button pressing in many applications. The device controls drive levels based on the sequence selected by the I2C interface across the load and senses the movement of the actuator. The driven waveform is generated by a current-regulated loop using a high-frequency PWM modulation. The differential output drive features a switching regulator architecture with an H-bridge differential drive across the load at 187.5kHz. The DA7282 can also perform close-loop actuator monitoring while driving to enable calibration-free playback, frequency tracking
(LRA only), Active Acceleration, Rapid Stop, and actuator diagnostics. Resonant frequency tracking can be enabled while driving an LRA to track the mechanical resonance of the actuator through closed-loop control or can be disabled to operate DA7282 in open-loop wideband frequency operation while driving LRAs with a broader bandwidth frequency response. Also, Active Acceleration and Rapid Stop features enable automated driving of both ERM and LRA loads (when frequency tracking is enabled), which reduces the time to reach the target acceleration level and the time for the actuator to come to a complete stop. Although it can use both mikroBUS™ power rails for regular power supply, its digital part requires a voltage level of 1.8V to work correctly. Therefore, a small regulating LDO, the BH18PB1WHFV, provides a 1.8V out of 5V and 3.3V mikroBUS™ power rails alongside Enable feature through the EN pin of the mikroBUS™ socket, offering a switch operation to turn ON/OFF
power delivery to the connected load. Haptic 3 Click communicates with MCU using the standard I2C 2-Wire interface with a maximum clock frequency of 400kHz. Since the sensor for communication requires a logic level of 1.8V, this Click board™ also features the PCA9306 voltage-level translator. The I2C interface bus lines are routed to the voltage-level translators allowing this Click board™ to work with both 3.3V and 5V MCUs properly. Also, it uses an interrupt pin, routed to the IRQ pin of the mikroBUS™ socket, when a different fault condition occurs to alert the MCU. This Click board™ can operate with either 3.3V or 5V logic voltage levels selected via the VCC SEL jumper. This way, both 3.3V and 5V capable MCUs can use the communication lines properly. However, the Click board™ comes equipped with a library containing easy-to-use functions and an example code that can be used, as a reference, for further development.
Features overview
Development board
EasyPIC v8 is a development board specially designed for the needs of rapid development of embedded applications. It supports many high pin count 8-bit PIC microcontrollers from Microchip, regardless of their number of pins, and a broad set of unique functions, such as the first-ever embedded debugger/programmer. The development board is well organized and designed so that the end-user has all the necessary elements, such as switches, buttons, indicators, connectors, and others, in one place. Thanks to innovative manufacturing technology, EasyPIC v8 provides a fluid and immersive working experience, allowing access anywhere and under any
circumstances at any time. Each part of the EasyPIC v8 development board contains the components necessary for the most efficient operation of the same board. In addition to the advanced integrated CODEGRIP programmer/debugger module, which offers many valuable programming/debugging options and seamless integration with the Mikroe software environment, the board also includes a clean and regulated power supply module for the development board. It can use a wide range of external power sources, including a battery, an external 12V power supply, and a power source via the USB Type-C (USB-C) connector.
Communication options such as USB-UART, USB DEVICE, and CAN are also included, including the well-established mikroBUS™ standard, two display options (graphical and character-based LCD), and several different DIP sockets. These sockets cover a wide range of 8-bit PIC MCUs, from the smallest PIC MCU devices with only eight up to forty pins. EasyPIC v8 is an integral part of the Mikroe ecosystem for rapid development. Natively supported by Mikroe software tools, it covers many aspects of prototyping and development thanks to a considerable number of different Click boards™ (over a thousand boards), the number of which is growing every day.
Microcontroller Overview
MCU Card / MCU
Architecture
PIC
MCU Memory (KB)
96
Silicon Vendor
Microchip
Pin count
40
RAM (Bytes)
3328
You complete me!
Accessories
Vibration ERM Motor 9K RPM 3V (VC1026B002F - old MPN C1026B002F) represents a compact-size Eccentric Rotating Mass (ERM) motor designed by Vybronics. This type of motor contains a small eccentric weight on its rotor, so while rotating, it also produces a vibration effect often used for haptic feedback on many small handheld devices. Due to its circular shape with a diameter of 10mm, the VC1026B002F is often referred to as a coin motor. The main characteristics of this vibration motor are its supply voltage, in this case, 3VDC, maximum rated current of 85mA, and the rated speed of 9000RPM, which produces the highest G force/vibration energy of 0.80GRMS. It can also be used with self-adhesive tape to mount it on your PCB or the inner wall of your product's housing.
Used MCU Pins
mikroBUS™ mapper
Take a closer look
Schematic
Step by step
Project assembly
Track your results in real time
Application Output via UART Mode
1. Once the code example is loaded, pressing the "FLASH" button initiates the build process, and programs it on the created setup.
2. After the programming is completed, click on the Tools icon in the upper-right panel, and select the UART Terminal.
3. After opening the UART Terminal tab, first check the baud rate setting in the Options menu (default is 115200). If this parameter is correct, activate the terminal by clicking the "CONNECT" button.
4. Now terminal status changes from Disconnected to Connected in green, and the data is displayed in the Received data field.
Software Support
Library Description
This library contains API for Haptic 3 Click driver.
Key functions:
haptic3_set_vibration_level
This function sets the motor vibration level.haptic3_get_vibration_level
This function reads the motor vibration level.haptic3_write_register
This function writes desired data to the selected register by using I2C serial interface.
Open Source
Code example
This example can be found in NECTO Studio. Feel free to download the code, or you can copy the code below.
/*!
* @file main.c
* @brief HAPTIC3 Click example
*
* # Description
* This example demonstrates the use of HAPTIC 3 click board by controlling
* the attached motor vibration level.
*
* The demo application is composed of two sections :
*
* ## Application Init
* Initializes the driver and performs the click default configuration.
*
* ## Application Task
* Changes the motor vibration level every 2 seconds from MAX to MIN,
* and displays the currently set level on the USB UART.
*
* @author Stefan Filipovic
*
*/
#include "board.h"
#include "log.h"
#include "haptic3.h"
static haptic3_t haptic3;
static log_t logger;
void application_init ( void )
{
log_cfg_t log_cfg; /**< Logger config object. */
haptic3_cfg_t haptic3_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.
haptic3_cfg_setup( &haptic3_cfg );
HAPTIC3_MAP_MIKROBUS( haptic3_cfg, MIKROBUS_1 );
if ( I2C_MASTER_ERROR == haptic3_init( &haptic3, &haptic3_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
if ( HAPTIC3_ERROR == haptic3_default_cfg ( &haptic3 ) )
{
log_error( &logger, " Default configuration." );
for ( ; ; );
}
log_info( &logger, " Application Task " );
}
void application_task ( void )
{
float vibration_level;
if ( HAPTIC3_OK == haptic3_set_vibration_level ( &haptic3, HAPTIC3_VIBRATION_LEVEL_MAX ) )
{
if ( HAPTIC3_OK == haptic3_get_vibration_level ( &haptic3, &vibration_level ) )
{
log_printf( &logger, " Vibration level: %.3f \r\n\n", vibration_level );
}
}
Delay_ms ( 1000 );
Delay_ms ( 1000 );
if ( HAPTIC3_OK == haptic3_set_vibration_level ( &haptic3, HAPTIC3_VIBRATION_LEVEL_MIN ) )
{
if ( HAPTIC3_OK == haptic3_get_vibration_level ( &haptic3, &vibration_level ) )
{
log_printf( &logger, " Vibration level: %.3f \r\n\n", vibration_level );
}
}
Delay_ms ( 1000 );
Delay_ms ( 1000 );
}
int main ( void )
{
/* Do not remove this line or clock might not be set correctly. */
#ifdef PREINIT_SUPPORTED
preinit();
#endif
application_init( );
for ( ; ; )
{
application_task( );
}
return 0;
}
// ------------------------------------------------------------------------ END