vibromotor  2.0.0.0
Main Page

VIBRO MOTOR click

Vibro Motor click features a compact size Eccentric Rotating Mass (ERM) motor, labeled as C1026B002F. This type of motor is often used for haptic feedback on many small handheld devices, such as the cellphones, pagers, RFID scanners and similar devices.

click Product page - Vibro Motor

click Product page - Vibro Motor 2


Click library

  • Author : MikroE Team
  • Date : Jan 2020.
  • Type : PWM type

Software Support

We provide a library for the VibroMotor 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 form compilers IDE(recommended way), or downloaded from our LibStock, or found on mikroE github account.

Library Description

This library contains API for VibroMotor Click driver.

Standard key functions :

Example key functions :

Examples Description

This application contorl the speed of vibro motor.

The demo application is composed of two sections :

Application Init

Initializes GPIO driver and PWM. Configures PWM to 20kHz frequency, calculates maximum duty ratio and starts PWM with duty ratio value 0.

void application_init ( void )
{
log_cfg_t log_cfg;
// Logger initialization.
log_cfg.level = LOG_LEVEL_DEBUG;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, "---- Application Init ----" );
// Click initialization.
VIBROMOTOR_MAP_MIKROBUS( cfg, MIKROBUS_1 );
vibromotor_init( &vibromotor, &cfg );
vibromotor_pwm_start( &vibromotor );
}

Application Task

Allows user to enter desired command to control Vibro Motor Click board.

void application_task ( void )
{
if ( duty_cycle > vibromotor.pwm_period )
{
duty_cycle = 100;
}
vibromotor_set_duty_cycle ( &vibromotor, duty_cycle );
duty_cycle += 50;
Delay_100ms();
}

The full application code, and ready to use projects can be installed directly form compilers IDE(recommneded) or found on LibStock page or mikroE GitHub accaunt.

Other mikroE Libraries used in the example:

  • MikroSDK.Board
  • MikroSDK.Log
  • Click.VibroMotor

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. The terminal available in all Mikroelektronika compilers, or any other terminal application of your choice, can be used to read the message.


vibromotor_cfg_setup
void vibromotor_cfg_setup(vibromotor_cfg_t *cfg)
Config Object Initialization function.
VIBROMOTOR_MAP_MIKROBUS
#define VIBROMOTOR_MAP_MIKROBUS(cfg, mikrobus)
Definition: vibromotor.h:52
vibromotor_pwm_start
void vibromotor_pwm_start(vibromotor_t *ctx)
Start PWM module.
application_task
void application_task(void)
Definition: main.c:58
vibromotor_set_duty_cycle
void vibromotor_set_duty_cycle(vibromotor_t *ctx, float duty_cycle)
Generic sets PWM duty cycle.
vibromotor_cfg_t
Click configuration structure definition.
Definition: vibromotor.h:100
application_init
void application_init(void)
Definition: main.c:36
vibromotor_init
VIBROMOTOR_RETVAL vibromotor_init(vibromotor_t *ctx, vibromotor_cfg_t *cfg)
Initialization function.