通过利用我们的电流测量解决方案来实现运营卓越,以跟踪电流变化,使您能够基于数据做出决策,从而提高效率并减少停机时间。
A
A
硬件概览
它是如何工作的?
Current 4 Click基于德州仪器的INA250,这是一款带有高精度、低漂移电阻的电流传感放大器,可在很宽的温度范围内提供高精度的测量。INA250在电流通过时测量内部电流感测电阻上产生的电压。集成的2mΩ电流分流电阻具有0.1%的容差和15ppm/°C的低漂移,使最终设备性能更高。该放大器允许在共模电压下进行高精度电流测量,并在很宽的温度范围内提供最大0.84%的误差。Current 4 Click只使用一个引脚与MCU通信,该引脚路由到mikroBUS™插座的AN引脚上。来自
INA250的输出模拟信号被转发到运算放大器的输入,该运算放大器是德州仪器的LMV321低压轨对轨OpAmp,是需要低电压操作的应用中最经济的解决方案。LMV321 OpAmp的输出具有稳定的单位增益,充当缓冲器,以便主机MCU可以通过mikroBUS™插座的AN引脚对INA250的输出电压进行采样。INA250可以配置为通过参考电压级别测量单向和双向电流。对于单向操作,参考引脚应与地连接。当电流增加时,输出信号从此参考电压(或在这种情况下地)向上增加。对于双向电流,
可以使用外部电压源作为参考电压;在这种情况下,Diodes Incorporated的低压降线性稳压器AP7331为INA250提供2.5V的参考供电电压。通过将标记为VREF SEL的SMD跳线器定位到适当的位置,可以选择参考电压级别,选择由AP7331提供的2.5V或GND之间。此Click板可以通过VCC SEL跳线选择3.3V或5V逻辑电压级别运行。这样,既支持3.3V又支持5V的MCU可以正确使用通信线路。此外,此Click板配备了一个包含易于使用的函数和示例代码的库,可用作进一步开发的参考。

功能概述
开发板
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),使其成为开发人员的多功能工具。

微控制器概述
MCU卡片 / MCU

建筑
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板™结合,应用于即将开展的项目中。
使用的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”替换为要显示的参数。

软件支持
库描述
该库包含 Current 4 Click 驱动程序的 API。
关键功能:
current4_read_load_current
- 读取负载电流current4_read_an_pin_voltage
- 读取AN引脚电压水平功能current4_read_an_pin_value
- 读取AN引脚数值功能
开源
代码示例
完整的应用程序代码和一个现成的项目可以通过NECTO Studio包管理器直接安装到NECTO Studio。 应用程序代码也可以在MIKROE的GitHub账户中找到。
/*!
* @file main.c
* @brief Current 4 Click Example.
*
* # Description
* This example showcases the ability of the Current 4 Click board.
* It configures Host MCU for communication and reads the voltage
* of AN pin and calculates current on load output.
*
* The demo application is composed of two sections :
*
* ## Application Init
* Initialization of the communication modules(ADC and UART).
*
* ## Application Task
* In span on 500ms reads voltage and calculates the current on load.
*
* @author Luka Filipovic
*
*/
#include "board.h"
#include "log.h"
#include "current4.h"
static current4_t current4; /**< Current 4 Click driver object. */
static log_t logger; /**< Logger object. */
void application_init ( void )
{
log_cfg_t log_cfg; /**< Logger config object. */
current4_cfg_t current4_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.
current4_cfg_setup( ¤t4_cfg );
CURRENT4_MAP_MIKROBUS( current4_cfg, MIKROBUS_1 );
if ( ADC_ERROR == current4_init( ¤t4, ¤t4_cfg ) )
{
log_error( &logger, " Application Init Error. " );
log_info( &logger, " Please, run program again... " );
for ( ; ; );
}
log_info( &logger, " Application Task " );
}
void application_task ( void )
{
float current4_load_current = 0;
if ( ADC_ERROR != current4_read_load_current ( ¤t4, ¤t4_load_current ) )
{
log_printf( &logger, " > Load current : %.2f[A]\r\n", current4_load_current );
log_printf( &logger, "**********************\r\n" );
}
Delay_ms ( 500 );
}
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
/*!
* @file main.c
* @brief Current 4 Click Example.
*
* # Description
* This example showcases the ability of the Current 4 Click board.
* It configures Host MCU for communication and reads the voltage
* of AN pin and calculates current on load output.
*
* The demo application is composed of two sections :
*
* ## Application Init
* Initialization of the communication modules(ADC and UART).
*
* ## Application Task
* In span on 500ms reads voltage and calculates the current on load.
*
* @author Luka Filipovic
*
*/
#include "board.h"
#include "log.h"
#include "current4.h"
static current4_t current4; /**< Current 4 Click driver object. */
static log_t logger; /**< Logger object. */
void application_init ( void )
{
log_cfg_t log_cfg; /**< Logger config object. */
current4_cfg_t current4_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.
current4_cfg_setup( ¤t4_cfg );
CURRENT4_MAP_MIKROBUS( current4_cfg, MIKROBUS_1 );
if ( ADC_ERROR == current4_init( ¤t4, ¤t4_cfg ) )
{
log_error( &logger, " Application Init Error. " );
log_info( &logger, " Please, run program again... " );
for ( ; ; );
}
log_info( &logger, " Application Task " );
}
void application_task ( void )
{
float current4_load_current = 0;
if ( ADC_ERROR != current4_read_load_current ( ¤t4, ¤t4_load_current ) )
{
log_printf( &logger, " > Load current : %.2f[A]\r\n", current4_load_current );
log_printf( &logger, "**********************\r\n" );
}
Delay_ms ( 500 );
}
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