初学者
10 分钟

使用ACS37002和STM32F031K6提供电流的准确洞察,以实现最佳性能

最精确的霍尔效应电流测量

Hall Current 16 Click with Nucleo 32 with STM32F031K6 MCU

已发布 10月 01, 2024

点击板

Hall Current 16 Click

开发板

Nucleo 32 with STM32F031K6 MCU

编译器

NECTO Studio

微控制器单元

STM32F031K6

自信迈入电流测量的未来。我们的霍尔效应解决方案不仅提供数据,还能精准理解交流/直流电流,确保您的系统以最高效率运行。

A

A

硬件概览

它是如何工作的?

Hall Current 16 Click 基于 Allegro Microsystems 的 ACS37002,这是一款400kHz高精度电流传感器。它是一款完全集成的霍尔效应电流传感器,出厂时已调整为在整个工作范围内提供高精度,无需用户编程。电流通过两个霍尔板差动感应,可以消除干扰的外部共模磁场。霍尔传感器与集成电流导体没有物理连接,因为 ACS37002 通过磁耦合由导体中的电流产生的磁场提供高隔离。电流传感器具有过电压检测、过电流故障、温度补偿等功能。ACS37002 额定能承受 3125VRMS 的介电电压。IP+ 和 IP- 端子

内部保险丝连接,允许通过负载连接器连接负载。根据两个 GAIN SEL 跳线的位置,增益可以设置为最高 66.7A 的 IP 默认情况下,两个跳线均设置为 0 位置,结果是 50A 双向增益。灵敏度可以根据选择的增益在 19.8 到 39.6mV/A 之间变化。Hall Current 16 Click 上的电流传感器将其输出与零电流电压参考一起发送到德州仪器的两通道 12 位 A/D 转换器 ADC122S101。该 ADC 在 500ksps 到 1Msps 的采样率范围内完全规范。它基于逐次逼近寄存器架构,带有内部跟踪保持电路。Hall Current 16 Click 使

用 ADC122S101 的标准 4 线 SPI 串行接口与主 MCU 通信。如果感测到的电流超过比较器阈值,过流故障 (OCF) 引脚将触发并显示有效低标志。阈值可以设置为满量程输出摆幅的百分比。您可以关闭过流故障功能。此 Click board™ 可以通过 PWR SEL 跳线选择 3.3V 或 5V 逻辑电压电平进行操作。这样,3.3V 和 5V 的 MCU 都可以正确使用通信线路。此外,此 Click board™ 配备了包含易于使用的函数和示例代码的库,可用于进一步开发。

Hall Current 16 Click hardware overview image
Hall Current 16 Click Current Warning image

功能概述

开发板

Nucleo 32开发板搭载STM32F031K6 MCU,提供了一种经济且灵活的平台,适用于使用32引脚封装的STM32微控制器进行实验。该开发板具有Arduino™ Nano连接性,便于通过专用扩展板进行功能扩展,并且支持mbed,使其能够无缝集成在线资源。板载集成

ST-LINK/V2-1调试器/编程器,支持通过USB重新枚举,提供三种接口:虚拟串口(Virtual Com port)、大容量存储和调试端口。该开发板的电源供应灵活,可通过USB VBUS或外部电源供电。此外,还配备了三个LED指示灯(LD1用于USB通信,LD2用于电源

指示,LD3为用户可控LED)和一个复位按钮。STM32 Nucleo-32开发板支持多种集成开发环境(IDEs),如IAR™、Keil®和基于GCC的IDE(如AC6 SW4STM32),使其成为开发人员的多功能工具。

Nucleo 32 with STM32F031K6 MCU double side image

微控制器概述 

MCU卡片 / MCU

default

建筑

ARM Cortex-M0

MCU 内存 (KB)

32

硅供应商

STMicroelectronics

引脚数

32

RAM (字节)

4096

你完善了我!

配件

Click Shield for Nucleo-32是扩展您的开发板功能的理想选择,专为STM32 Nucleo-32引脚布局设计。Click Shield for Nucleo-32提供了两个mikroBUS™插座,可以添加来自我们不断增长的Click板™系列中的任何功能。从传感器和WiFi收发器到电机控制和音频放大器,我们应有尽有。Click Shield for Nucleo-32与STM32 Nucleo-32开发板兼容,为用户提供了一种经济且灵活的方式,使用任何STM32微控制器快速创建原型,并尝试各种性能、功耗和功能的组合。STM32 Nucleo-32开发板无需任何独立的探针,因为它集成了ST-LINK/V2-1调试器/编程器,并随附STM32全面的软件HAL库和各种打包的软件示例。这个开发平台为用户提供了一种简便且通用的方式,将STM32 Nucleo-32兼容开发板与他们喜欢的Click板™结合,应用于即将开展的项目中。

Click Shield for Nucleo-32 accessories 1 image

使用的MCU引脚

mikroBUS™映射器

NC
NC
AN
NC
NC
RST
SPI Chip Select
PA4
CS
SPI Clock
PB3
SCK
SPI Data OUT
PB4
MISO
SPI Data IN
PB5
MOSI
Power Supply
3.3V
3.3V
Ground
GND
GND
NC
NC
PWM
Overcurrent Fault
PA12
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 16 Click Schematic schematic

一步一步来

项目组装

Click Shield for Nucleo-144 front image hardware assembly

从选择您的开发板和Click板™开始。以Nucleo 32 with STM32F031K6 MCU作为您的开发板开始。

Click Shield for Nucleo-144 front image hardware assembly
Nucleo 144 with STM32L4A6ZG MCU front image hardware assembly
Stepper 22 Click front image hardware assembly
Prog-cut hardware assembly
Stepper 22 Click complete accessories setup image hardware assembly
Board mapper by product8 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
STM32 M4 Clicker HA MCU/Select 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

软件支持

库描述

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

关键功能:

  • hallcurrent16_get_current - Hall Current 16 获取电流功能。

  • hallcurrent16_get_voltage - Hall Current 16 获取电压功能。

  • hallcurrent16_get_ovc_fault - Hall Current 16 获取过流故障功能。

开源

代码示例

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

/*!
 * @file main.c
 * @brief Hall Current 16 Click example
 *
 * # Description
 * This example demonstrates the use of Hall Current 16 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 app 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 "hallcurrent16.h"

static hallcurrent16_t hallcurrent16;
static log_t logger;

void application_init ( void )
{
    log_cfg_t log_cfg;  /**< Logger config object. */
    hallcurrent16_cfg_t hallcurrent16_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.
    hallcurrent16_cfg_setup( &hallcurrent16_cfg );
    HALLCURRENT16_MAP_MIKROBUS( hallcurrent16_cfg, MIKROBUS_1 );
    if ( SPI_MASTER_ERROR == hallcurrent16_init( &hallcurrent16, &hallcurrent16_cfg ) )
    {
        log_error( &logger, " Communication init." );
        for ( ; ; );
    }
    Delay_ms ( 100 );
    
    if ( HALLCURRENT16_ERROR == hallcurrent16_default_cfg ( &hallcurrent16 ) )
    {
        log_error( &logger, " Default configuration." );
        for ( ; ; );
    }    
    log_info( &logger, " Application Task " );
    log_printf( &logger, " -------------------- \r\n" );
    Delay_ms ( 100 );
}

void application_task ( void )
{
    static float current = 0.0;
    if ( HALLCURRENT16_OK == hallcurrent16_get_current( &hallcurrent16, &current ) )
    {
        log_printf( &logger, " Current : %.3f A \r\n", current );
    }
    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

额外支持

资源

喜欢这个项目吗?

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