初学者
10 分钟

使用INA700A和PIC32MZ2048EFM100提供关于功耗和能量使用的详细信息

基于EZShunt™技术的高性能功率监控器

VCP Monitor 5 Click with Curiosity PIC32 MZ EF

已发布 11月 18, 2024

点击板

VCP Monitor 5 Click

开发板

Curiosity PIC32 MZ EF

编译器

NECTO Studio

微控制器单元

PIC32MZ2048EFM100

监控电流、电压和温度,具有高精度,以实现精确的能量管理

A

A

硬件概览

它是如何工作的?

VCP Monitor 5 Click 基于 Texas Instruments 的 INA700A,这是一款采用先进的 EZShunt™ 技术的 16 位数字功率监测器。INA700A 集成了精密分流电阻和高分辨率的 ΔΣ ADC,专为精确电流检测应用设计。此 IC 可处理高达 ±15.728A 的满量程电流测量,工作在 -0.3V 到 +40V 的宽泛共模电压范围内,适用于多种功率监测需求。它非常适合高精度功率监控应用,包括工业电池组、智能网络接口卡 (NIC) 和硬件加速卡等高性能系统,这些系统需要精确的电流和能量监测。此功率监测器能够精确测量和报告电流、总

线电压、内部温度、功率、能量和电荷积累。凭借内置的 ±0.5% 振荡器,它可以在后台无缝执行实时计算。集成的温度传感器在结温范围内的精度为 ±3°C,确保在各种操作条件下实现可靠的热监测。设备支持从 50µs 到 4.12ms 的可选 ADC 转换时间,并提供 1x 到 1024x 的采样平均选项,大幅降低测量噪声并提高过流事件检测窗口的精确度。VCP Monitor 5 Click 使用标准的 2 线 I2C 通信协议,使主 MCU 可以控制 INA700A。I2C 接口支持高达 400kHz 的时钟频率,可通过 ADDR SEL 跳线选择 I2C 地址。警报

中断 ALR 引脚可用于在监测输出值超出范围阈值时报告多个诊断,或在 ADC 转换完成时提供指示。检测到的异常情况(如电流欠/超限、总线电压欠/超限或功率超限)除了通过 ALR 引脚,还可以通过红色 ALERT LED 进行可视化显示。此 Click 板™ 可以使用 3.3V 或 5V 的逻辑电压水平,通过 VCC SEL 跳线选择,从而使 3.3V 和 5V 的 MCU 都能正确使用通信线路。此外,此 Click 板™ 附带易于使用的函数库和示例代码,可用作进一步开发的参考。

VCP Monitor 5 Click hardware overview image

功能概述

开发板

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 开发板提供了扩展能力,使其成为连接性、物联网和通用应用中快速原型设计的绝佳选择。

Curiosity PIC32MZ EF double side image

微控制器概述 

MCU卡片 / MCU

default

建筑

PIC32

MCU 内存 (KB)

2048

硅供应商

Microchip

引脚数

100

RAM (字节)

524288

使用的MCU引脚

mikroBUS™映射器

NC
NC
AN
NC
NC
RST
ID COMM
RPD4
CS
NC
NC
SCK
NC
NC
MISO
NC
NC
MOSI
Power Supply
3.3V
3.3V
Ground
GND
GND
NC
NC
PWM
Alarm Interrupt
RF13
INT
NC
NC
TX
NC
NC
RX
I2C Clock
RPA14
SCL
I2C Data
RPA15
SDA
Power Supply
5V
5V
Ground
GND
GND
1

“仔细看看!”

Click board™ 原理图

VCP Monitor 5 Click Schematic schematic

一步一步来

项目组装

Curiosity PIC32MZ EF front image hardware assembly

从选择您的开发板和Click板™开始。以Curiosity PIC32 MZ EF作为您的开发板开始。

Curiosity PIC32MZ EF front image hardware assembly
GNSS2 Click front image hardware assembly
Prog-cut hardware assembly
GNSS2 Click complete accessories setup image hardware assembly
Board mapper by product7 hardware assembly
Necto image step 2 hardware assembly
Necto image step 3 hardware assembly
Necto image step 4 hardware assembly
Necto image step 5 hardware assembly
Necto image step 6 hardware assembly
Curiosity PIC32 MZ EF MCU Step hardware assembly
Necto No Display image step 8 hardware assembly
Necto image step 9 hardware assembly
Necto image step 10 hardware assembly
Debug Image Necto Step hardware assembly

实时跟踪您的结果

应用程序输出

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”替换为要显示的参数。

软件支持

库描述

该库包含 VCP Monitor 5 Click 驱动程序的 API。

关键功能:

  • vcpmonitor5_get_bus_voltage - 此函数通过 I2C 串行接口读取总线电压输出测量值,单位为伏特 [V]。

  • vcpmonitor5_get_current - 此函数通过 I2C 串行接口读取电流测量结果,单位为毫安 [mA]。

  • vcpmonitor5_get_power - 此函数通过 I2C 串行接口读取功率测量结果,单位为瓦特 [W]

开源

代码示例

完整的应用程序代码和一个现成的项目可以通过NECTO Studio包管理器直接安装到NECTO Studio 应用程序代码也可以在MIKROE的GitHub账户中找到。

/*!
 * @file main.c
 * @brief VCP Monitor 5 Click example
 *
 * # Description
 * This library contains API for the VCP Monitor 5 Click driver 
 * for measurements of the voltage, current, power, energy, charge, and die temperature.
 *
 * The demo application is composed of two sections :
 *
 * ## Application Init
 * The initialization of the I2C module and log UART.
 * After driver initialization, the app sets the default configuration.
 *
 * ## Application Task
 * The demo application reads and displays the results of the input bus voltage, 
 * current, power, energy, charge accumulation measurements, and die temperature.
 * Results are being sent to the UART Terminal, where you can track their changes.
 *
 * @author Nenad Filipovic
 *
 */

#include "board.h"
#include "log.h"
#include "vcpmonitor5.h"

static vcpmonitor5_t vcpmonitor5;
static log_t logger;

void application_init ( void ) 
{
    log_cfg_t log_cfg;  /**< Logger config object. */
    vcpmonitor5_cfg_t vcpmonitor5_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.
    vcpmonitor5_cfg_setup( &vcpmonitor5_cfg );
    VCPMONITOR5_MAP_MIKROBUS( vcpmonitor5_cfg, MIKROBUS_1 );
    if ( I2C_MASTER_ERROR == vcpmonitor5_init( &vcpmonitor5, &vcpmonitor5_cfg ) ) 
    {
        log_error( &logger, " Communication init." );
        for ( ; ; );
    }
    
    if ( VCPMONITOR5_ERROR == vcpmonitor5_default_cfg ( &vcpmonitor5 ) )
    {
        log_error( &logger, " Default configuration." );
        for ( ; ; );
    }
    
    log_info( &logger, " Application Task " );
}

void application_task ( void ) 
{
    float app_buf = 0;
    if ( VCPMONITOR5_OK == vcpmonitor5_get_bus_voltage( &vcpmonitor5, &app_buf ) )
    {
        log_printf( &logger, " Voltage: %.2f [V]\r\n", app_buf );
        Delay_ms( 50 );
    }

    if ( VCPMONITOR5_OK == vcpmonitor5_get_current( &vcpmonitor5, &app_buf ) )
    {
        log_printf( &logger, " Current: %.2f [mA]\r\n", app_buf );
        Delay_ms( 50 );
    }

    if ( VCPMONITOR5_OK == vcpmonitor5_get_power( &vcpmonitor5, &app_buf ) )
    {
        log_printf( &logger, " Power: %.2f [W]\r\n", app_buf );
        Delay_ms( 50 );
    }

    if ( VCPMONITOR5_OK == vcpmonitor5_get_energy( &vcpmonitor5, &app_buf ) )
    {
        log_printf( &logger, " Energy: %.2f [kJ]\r\n", app_buf );
        Delay_ms( 50 );
    }

    if ( VCPMONITOR5_OK == vcpmonitor5_get_charge( &vcpmonitor5, &app_buf ) )
    {
        log_printf( &logger, " Charge: %.2f [C]\r\n", app_buf );
        Delay_ms( 50 );
    }

    if ( VCPMONITOR5_OK == vcpmonitor5_get_temperature( &vcpmonitor5, &app_buf ) )
    {
        log_printf( &logger, " Temperature: %.2f [degC]\r\n", app_buf );
        Delay_ms( 50 );
    }
    log_printf( &logger, " ----------------------------\r\n" );
    Delay_ms( 2000 );
}

int main ( void ) 
{
    application_init( );
    
    for ( ; ; ) 
    {
        application_task( );
    }

    return 0;
}

// ------------------------------------------------------------------------ END

额外支持

资源

喜欢这个项目吗?

'购买此套件' 按钮会直接带您进入购物车,您可以在购物车中轻松添加或移除产品。