初学者
10 分钟

使用ACS37010和PIC32MZ2048EFM100提供可靠且精确的交流和直流电流读数

电流监测的未来

Hall Current 17 Click with Curiosity PIC32 MZ EF

已发布 6月 27, 2024

点击板

Hall Current 17 Click

开发板

Curiosity PIC32 MZ EF

编译器

NECTO Studio

微控制器单元

PIC32MZ2048EFM100

探索电流感应技术的未来,我们的先进霍尔效应传感器为您的系统提供无与伦比的精确度和响应速度,实时监测交流和直流电流。

A

A

硬件概览

它是如何工作的?

Hall Current 17 Click 基于 Allegro MicroSystems 的 ACS37010,这是一款高精度电流传感器。它是一款完全集成的霍尔效应电流传感器,经过工厂调校,可在整个工作范围内提供高精度,无需用户编程。其内部结构提供了高隔离和由导体中流动的电流产生的磁场与完全单片霍尔传感器 IC 之间的良好磁耦合。两个霍尔板差分感应电流,消除了干扰的共模磁场。霍尔传感器与集成的电流导体没有物理连接,因为 ACS37002 通过磁耦合导体中电流产生的磁场在初级和次级信号引线之间提供高隔离。电流传感器

具有过压检测、欠压检测、温度补偿等功能。ACS37010 额定能够承受 3500VRMS 的介电电压。IP+ 和 IP- 端子允许通过负载连接器连接负载。ACS37010 的电流感应范围为 ±50A,固定灵敏度为 40mV/A。它使用差分感应,对外部磁场具有很强的抗干扰能力。Hall Current 17 Click 使用 ACS37010 的非比率操作,带有 VREF 输出,以提高噪声环境中的精度。霍尔板的信号通过集成的前后放大器,然后传递到 VOUT 缓冲器,输出连同零电流电压参考一起发送到德州仪器的两通道 12 位 A/D 转换器 

ADC122S101。该 ADC 在 500ksps 至 1Msps 的采样率范围内完全规格化。它基于逐次逼近寄存器架构,具有内部跟踪保持电路。Hall Current 17 Click 使用 ADC122S101 的标准 4 线 SPI 串行接口与主 MCU 通信。该 Click board™ 可以通过 VCC SEL 跳线选择使用 3.3V 或 5V 逻辑电压水平。这样,3.3V 和 5V 的 MCU 都可以正确使用通信线路。此外,这款 Click board™ 配备了包含易于使用的功能和示例代码的库,可用于进一步开发。

Hall Current 17 Click hardware overview image
Hall Current 17 Click Current Warning 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
SPI Chip Select
RPD4
CS
SPI Clock
RPD1
SCK
SPI Data OUT
RPD14
MISO
SPI Data IN
RPD3
MOSI
Power Supply
3.3V
3.3V
Ground
GND
GND
NC
NC
PWM
NC
NC
INT
NC
NC
TX
NC
NC
RX
NC
NC
SCL
NC
NC
SDA
Power Supply
5V
5V
Ground
GND
GND
1

“仔细看看!”

Click board™ 原理图

Hall Current 17 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
Curiosity PIC32 MZ EF MB 1 Access - upright/background 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”替换为要显示的参数。

软件支持

库描述

该库包含 Hall Current 17 Click 驱动程序的 API。

关键功能:

  • hallcurrent17_get_current - Hall Current 17 获取电流功能。

  • hallcurrent17_get_vout - Hall Current 17 获取输出电压功能。

  • hallcurrent17_get_vref - Hall Current 17 获取参考电压功能。

开源

代码示例

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

/*!
 * @file main.c
 * @brief Hall Current 17 Click example
 *
 * # Description
 * This example demonstrates the use of Hall Current 17 Click board™ 
 * by reading and displaying the current measurements.
 *
 * The demo application is composed of two sections :
 *
 * ## Application Init
 * The initialization of SPI module and log UART.
 * After driver initialization, the app sets the default configuration.
 *
 * ## Application Task
 * The demo application reads the current measurements [A] and displays the results.
 * Results are being sent to the UART Terminal, where you can track their changes.
 *
 * @author Nenad Filipovic
 *
 */

#include "board.h"
#include "log.h"
#include "hallcurrent17.h"

static hallcurrent17_t hallcurrent17;
static log_t logger;

void application_init ( void )
{
    log_cfg_t log_cfg;  /**< Logger config object. */
    hallcurrent17_cfg_t hallcurrent17_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.
    hallcurrent17_cfg_setup( &hallcurrent17_cfg );
    HALLCURRENT17_MAP_MIKROBUS( hallcurrent17_cfg, MIKROBUS_1 );
    if ( SPI_MASTER_ERROR == hallcurrent17_init( &hallcurrent17, &hallcurrent17_cfg ) )
    {
        log_error( &logger, " Communication init." );
        for ( ; ; );
    }
    
    if ( HALLCURRENT17_ERROR == hallcurrent17_default_cfg ( &hallcurrent17 ) )
    {
        log_error( &logger, " Default configuration." );
        for ( ; ; );
    }
    
    log_info( &logger, " Application Task " );
}

void application_task ( void )
{
    static float current = 0.0;
    if ( HALLCURRENT17_OK == hallcurrent17_get_current( &hallcurrent17, &current ) )
    {
        log_printf( &logger, " Current: %.3f [A]\r\n", current );
    }
    log_printf( &logger, " --------------------\r\n" );
    Delay_ms( 1000 );
}

void main ( void )
{
    application_init( );

    for ( ; ; )
    {
        application_task( );
    }
}

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

额外支持

资源

喜欢这个项目吗?

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