通过整合精确的移动和旋转检测,彻底改变您的解决方案。
A
A
硬件概览
它是如何工作的?
MPU 9DOF Click 基于 InvenSense 的 MPU-9250,这是一款 9 轴运动追踪设备,结合了三轴陀螺仪、加速度计、磁力计和一个数字运动处理器™(DMP)。MPU-9250 特点是三个 16 位 ADC 用于数字化各部分(陀螺仪、加速度计和磁力计)的输出,功耗低且性能高。为了精确跟踪快速和慢速运动,MPU-9250 具有用户可编程的全量程陀螺仪范围 ±250、±500、±1000 和 ±2000dps,加速度计范围 ±2g、±4g、±8g 和 ±16g,以及磁力计范围 ±4800μT。嵌入式 DMP 引擎支持先进的运动处理和
低功耗功能,如使用可编程中断的手势识别,以及计步器功能,允许宿主 MCU 在 DMP 维持步数的同时休眠。DMP 从加速度计、陀螺仪和磁力计获取数据并 处理数据,这些数据可以从 DMP 的寄存器读取,或者缓存在一个 512 字节的 FIFO 中。除了所有上述功能,DMP 还可以生成一个中断,路由到 mikroBUS™ 插座的 INT 引脚,该中断可以唤醒宿主 MCU 从挂起模式。MPU 9DOF Click 允许使用 I2C 和 SPI 接口,I2C 的最大频率为 400kHz,SPI 通信的最大频率为 1MHz。可以通过将标有 SPI I2C 的 SMD 跳线放置在
适当位置来进行选择。请注意,所有跳线的位置必须 在同一侧,否则 Click board™ 可能会无响应。当选择 I2C 接口时,MPU-9250 允许使用标记为 ADDR SEL 的 SMD 跳线选择其 I2C 从机地址的最低有效位(LSB)。此 Click board™ 只能在 3.3V 逻辑电压水平下操作。在使用具有不同逻辑电平的 MCU 之前,必须执行适当的逻辑电压水平转换。然而,这款 Click board™ 配备了一个包含功能和示例代码的库,可用作进一步开发的参考。
功能概述
开发板
Flip&Click PIC32MZ 是一款紧凑型开发板,设计为一套完整的解决方案,它将 Click 板™的灵活性带给您喜爱的微控制器,使其成为实现您想法的完美入门套件。它配备了一款板载 32 位 PIC32MZ 微控制器,Microchip 的 PIC32MZ2048EFH100,四个 mikroBUS™ 插槽用于 Click 板™连接,两个 USB 连接器,LED 指示灯,按钮,调试器/程序员连接器,以及两个与 Arduino-UNO 引脚兼容的头部。得益于创
新的制造技术,它允许您快速构建具有独特功能和特性的小工具。Flip&Click PIC32MZ 开发套件的每个部分都包含了使同一板块运行最高效的必要组件。此外,还可以选择 Flip&Click PIC32MZ 的编程方式,使用 chipKIT 引导程序(Arduino 风格的开发环境)或我们的 USB HID 引导程序,使用 mikroC、mikroBasic 和 mikroPascal for PIC32。该套件包括一个通过 USB 类型-C(USB-C)连接器的干净且调
节过的电源供应模块。所有 mikroBUS™ 本身支持的 通信方法都在这块板上,包括已经建立良好的 mikroBUS™ 插槽、用户可配置的按钮和 LED 指示灯。Flip&Click PIC32MZ 开发套件允许您在几分钟内创建新的应用程序。它由 Mikroe 软件工具原生支持,得益于大量不同的 Click 板™(超过一千块板),其数量每天都在增长,它涵盖了原型制作的许多方面。
微控制器概述
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”替换为要显示的参数。

软件支持
库描述
此库包含 MPU 9DOF Click 驱动程序的 API。
关键功能:
mpu9dof_read_accel
- 此功能读取加速度计的 X 轴、Y 轴和 Z 轴。mpu9dof_read_gyro
- 此功能读取陀螺仪的 X 轴、Y 轴和 Z 轴。mpu9dof_read_mag
- 此功能读取磁力计的 X 轴、Y 轴和 Z 轴。
开源
代码示例
完整的应用程序代码和一个现成的项目可以通过NECTO Studio包管理器直接安装到NECTO Studio。 应用程序代码也可以在MIKROE的GitHub账户中找到。
/*!
* \file
* \brief Mpu9Dof Click example
*
* # Description
* MPU 9DOF Click carries the world’s first 9-axis Motion Tracking device. It comprises two chips: one that contains
* a 3-axis accelerometer, a 3-axis gyroscope, and a DMP (digital motion processor);
* the other is a 3-axis digital compass.
*
* The demo application is composed of two sections :
*
* ## Application Init
* Initialization driver enable's - I2C, initialize MPU-9150 XL G & MPU-9150 MAG and start write log.
*
* ## Application Task
* This is a example which demonstrates the use of MPU 9DOF Click board.
* Measured accel, gyro and magnetometar coordinates values ( X, Y, Z )
* and temperature value in degrees celsius [ �C ] are being sent to the uart where you can track their changes.
* All data logs on usb uart for aproximetly every 1 sec.
*
* \author MikroE Team
*
*/
// ------------------------------------------------------------------- INCLUDES
#include "board.h"
#include "log.h"
#include "mpu9dof.h"
// ------------------------------------------------------------------ VARIABLES
static mpu9dof_t mpu9dof;
static log_t logger;
static int16_t accel_x;
static int16_t accel_y;
static int16_t accel_z;
static int16_t gyro_x;
static int16_t gyro_y;
static int16_t gyro_z;
static int16_t mag_x;
static int16_t mag_y;
static int16_t mag_z;
static float temperature;
// ------------------------------------------------------ APPLICATION FUNCTIONS
void application_init ( void )
{
log_cfg_t log_cfg;
mpu9dof_cfg_t cfg;
/**
* 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.
mpu9dof_cfg_setup( &cfg );
MPU9DOF_MAP_MIKROBUS( cfg, MIKROBUS_1 );
mpu9dof_init( &mpu9dof, &cfg );
Delay_10ms( );
mpu9dof_default_cfg ( &mpu9dof );
}
void application_task ( void )
{
mpu9dof_read_accel( &mpu9dof, &accel_x, &accel_y, &accel_z );
Delay_10ms( );
mpu9dof_read_gyro( &mpu9dof, &gyro_x, &gyro_y, &gyro_z );
Delay_10ms( );
temperature = mpu9dof_read_temperature( &mpu9dof );
Delay_10ms( );
mpu9dof_read_mag( &mpu9dof, &mag_x, &mag_y, &mag_z );
Delay_10ms( );
log_printf( &logger, " Accel X : %d | Gyro X : %d | Mag X : %d \r\n", accel_x, gyro_x, mag_x );
log_printf( &logger, " Accel Y : %d | Gyro Y : %d | Mag Y : %d \r\n", accel_y, gyro_y, mag_y );
log_printf( &logger, " Accel Z : %d | Gyro Z : %d | Mag Z : %d \r\n", accel_z, gyro_z, mag_z );
Delay_10ms( );
log_printf( &logger, "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\r\n" );
Delay_10ms( );
log_printf( &logger, "Temperature: %.2f C\r\n", temperature );
Delay_100ms( );
log_printf( &logger, "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\r\n" );
log_printf( &logger, "\r\n");
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