通过融入精确的振动控制,提升与设备和应用的交互,提供更具吸引力和沉浸式的体验。
A
A
硬件概览
它是如何工作的?
Vibro Motor 4 Click基于Vybronics的VG1040003D,是一款硬币大小的线性谐振式致动器,可在垂直于电机表面的Z平面上产生振动/触觉反馈。VG1040003D在产生2 GRMS的G力时典型地消耗145mA电流,非常适合需要清晰触觉反馈和低功耗的应用。对于触觉反馈应用,快速上升和下降时间对于实现最佳用户体验至关重要。这就是为什么G1040003D的上升时间(50%功率)为10ms,下降时间(10%功率)为50ms,使其成为触觉反馈应用的最佳选择之一。该Click board™由德州仪器提供的
灵活的Haptic/Vibra驱动器DRV2605驱动,旨在通过最大时钟频率为400kHz的标准I2C 2-Wire接口提供高度灵活的触觉控制。它具有一个启用功能,通过mikroBUS™插座上标记为EN的CS引脚进行路由,并配备一个包含超过100种授权效果的广泛集成库,消除了设计触觉波形的需求。它还包含智能环路架构,并提供自动超驱动和制动,创建了简化的输入波形范式、可靠的电机控制和一致的电机性能。DRV2605还可以在PWM模式下运行,并接受来自mikroBUS™插座上PWM引脚的PWM信号。在此模式下,
DRV2605设备持续驱动致动器,直到用户将DRV2605设置为待机模式或进入另一个接口模式为止。有关DRV2605操作模式的更多信息,请参阅附带的数据表。此Click board™可以通过VCC SEL跳线器选择3.3V或5V逻辑电压电平。这样,既可以使用3.3V又可以使用5V的MCU可以正确使用通信线路。此外,此Click board™配备了一个包含易于使用的函数和示例代码的库,可用作进一步开发的参考。
功能概述
开发板
Curiosity PIC32 MZ EF 开发板是一个完全集成的 32 位开发平台,特点是高性能的 PIC32MZ EF 系列(PIC32MZ2048EFM),该系列具有 2MB Flash、512KB RAM、集成的浮点单元(FPU)、加密加速器和出色的连接选项。它包括一个集成的程序员和调试器,无需额外硬件。用户可以通过 MIKROE
mikroBUS™ Click™ 适配器板扩展功能,通过 Microchip PHY 女儿板添加以太网连接功能,使用 Microchip 扩展板添加 WiFi 连接能力,并通过 Microchip 音频女儿板添加音频输入和输出功能。这些板完全集成到 PIC32 强大的软件框架 MPLAB Harmony 中,该框架提供了一个灵活且模块化的接口
来应用开发、一套丰富的互操作软件堆栈(TCP-IP、USB)和易于使用的功能。Curiosity PIC32 MZ EF 开发板提供了扩展能力,使其成为连接性、物联网和通用应用中快速原型设计的绝佳选择。
微控制器概述
MCU卡片 / MCU

建筑
PIC32
MCU 内存 (KB)
2048
硅供应商
Microchip
引脚数
100
RAM (字节)
524288
使用的MCU引脚
mikroBUS™映射器
“仔细看看!”
Click board™ 原理图

一步一步来
项目组装
实时跟踪您的结果
应用程序输出
1. 应用程序输出 - 在调试模式下,“应用程序输出”窗口支持实时数据监控,直接提供执行结果的可视化。请按照提供的教程正确配置环境,以确保数据正确显示。

2. UART 终端 - 使用UART Terminal通过USB to UART converter监视数据传输,实现Click board™与开发系统之间的直接通信。请根据项目需求配置波特率和其他串行设置,以确保正常运行。有关分步设置说明,请参考提供的教程。

3. Plot 输出 - Plot功能提供了一种强大的方式来可视化实时传感器数据,使趋势分析、调试和多个数据点的对比变得更加直观。要正确设置,请按照提供的教程,其中包含使用Plot功能显示Click board™读数的分步示例。在代码中使用Plot功能时,请使用以下函数:plot(insert_graph_name, variable_name);。这是一个通用格式,用户需要将“insert_graph_name”替换为实际图表名称,并将“variable_name”替换为要显示的参数。

软件支持
库描述
该库包含 Vibro Motor 4 Click 驱动程序的 API。
关键功能:
vibromotor4_set_mode
- Vibro Motor 4设置所需模式功能vibromotor4_set_duty_cycle
- Vibro Motor 4设置PWM占空比vibromotor4_pwm_start
- Vibro Motor 4启动PWM模块
开源
代码示例
完整的应用程序代码和一个现成的项目可以通过NECTO Studio包管理器直接安装到NECTO Studio。 应用程序代码也可以在MIKROE的GitHub账户中找到。
/*!
* @file main.c
* @brief VibroMotor4 Click example
*
* # Description
* This library contains API for Vibro Motor 4 Click driver.
* The library initializes and defines the I2C bus drivers
* to write and read data from registers and PWM module.
*
* The demo application is composed of two sections :
*
* ## Application Init
* The initialization of I2C and PWM module, log UART, and additional pins.
* After successful driver init, executes a default configuration
* and configures Vibro Motor 4 Click board™.
*
* ## Application Task
* This is an example that shows the use of a Vibro Motor 4 Click board™.
* Changing duty cycle results in different vibrations.
* Results are being sent to the Usart Terminal where you can track their changes.
*
* @author Nenad Filipovic
*
*/
#include "board.h"
#include "log.h"
#include "vibromotor4.h"
static vibromotor4_t vibromotor4;
static log_t logger;
void application_init ( void )
{
log_cfg_t log_cfg; /**< Logger config object. */
vibromotor4_cfg_t vibromotor4_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.
vibromotor4_cfg_setup( &vibromotor4_cfg );
VIBROMOTOR4_MAP_MIKROBUS( vibromotor4_cfg, MIKROBUS_1 );
err_t init_flag = vibromotor4_init( &vibromotor4, &vibromotor4_cfg );
if ( I2C_MASTER_ERROR == init_flag )
{
log_error( &logger, " Application Init Error. " );
log_info( &logger, " Please, run program again... " );
for ( ; ; );
}
vibromotor4_enable( &vibromotor4, VIBROMOTOR4_PROPERTY_ENABLE );
Delay_ms ( 100 );
vibromotor4_soft_rst( &vibromotor4 );
Delay_ms ( 100 );
vibromotor4_default_cfg ( &vibromotor4 );
Delay_ms ( 100 );
vibromotor4_set_duty_cycle( &vibromotor4, 0.0 );
Delay_ms ( 100 );
vibromotor4_pwm_start( &vibromotor4 );
Delay_ms ( 100 );
log_info( &logger, " Application Task " );
Delay_ms ( 100 );
}
void application_task ( void )
{
static int8_t duty_cnt = 0;
static int8_t duty_inc = 1;
float duty = duty_cnt / 10.0;
vibromotor4_set_duty_cycle ( &vibromotor4, duty );
log_printf( &logger, "> Duty: %d%%\r\n", ( uint16_t )( duty_cnt * 10 ) );
Delay_ms ( 1000 );
if ( 5 == duty_cnt ) {
duty_inc = -1;
} else if ( 0 == duty_cnt ) {
duty_inc = 1;
}
duty_cnt += duty_inc;
}
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
额外支持
资源
类别:触觉