有了我们的温度传感器,您可以在寒冷时报警,在炎热时发出警报,确保您的空间始终处于舒适区。这是可靠且精确的温度监测的完美解决方案。
A
A
硬件概览
它是如何工作的?
Temp Alert Click 基于德州仪器的 PTMP4718,这是一款高精度的远程和本地温度传感器。它在本地和远程通道上都具有 1°C 的精度。远程通道的分辨率更高(0.125°C,而本地为 1°C)。该传感器具有远程二极管故障检测、低功耗、可编程警报限值和串联电阻消除功能。根据应用的不同,它可以在中断模式或比较器模式下工作。在这两种模式下,如果测量温度超过高警报限值或低于限值阈值中定义的低警报限值,则在转换周期结束时会发出警报。它还可以在关机模式和连续转换模式下工作。本地温度分辨率为 8 位,范围为 -40 到 125°C。远程温度精度为 11 位,
范围为 -55 到 125°C,并针对二极管连接的 MMBT3904 晶体管进行了优化。Temp Alert Click 配备了这款来自 NXP Semiconductor 的 NPN 开关晶体管,作为远程温度传感器。DN 和 DP 连接器分别为远程传感器的正负连接。如果您不打算使用远程温度传感器,应将 DP 和 DN 连接起来。在有噪声的情况下,您可以在 DP 和 DN 引脚之间添加一个 470pF 电容。Temp Alert Click 使用标准的 2 线 I2C 接口与主 MCU 通信,支持高达 1MHz 的时钟频率。关键的 TCR 引脚将在温度超过高或低警报限值时发出警报,该阈值由两个 2K 电阻设置为 77°C。
根据数据表中的表格,通过更换电阻可以将该值设置为最高 125°C。关键温度被认为是当温度超过高或低警报限值时。警报 ALR 引脚在这些温度达到限值时发出警报。这两种情况的视觉呈现通过 ON Semiconductor 的施密特触发器 NC7WZ14 实现,后者会点亮 T CRIT 和 ALERT 红色 LED。此 Click board™ 可以通过 VCC SEL 跳线选择使用 3.3V 或 5V 逻辑电压水平。这样,3.3V 和 5V 的 MCU 都可以正确使用通信线路。此外,这款 Click board™ 配备了包含易于使用的功能和示例代码的库,可用于进一步开发。
功能概述
开发板
Clicker 4 for STM32F3 是一款紧凑型开发板,作为完整的解决方案而设计,可帮助用户快速构建具备独特功能的定制设备。该板搭载 STMicroelectronics 的 STM32F302VCT6 微控制器,配备四个 mikroBUS™ 插槽用于连接 Click boards™、完善的电源管理功能以及其他实用资源,是快速开发各类应用的理想平台。其核心 MCU STM32F302VCT6 基于高性能
Arm® Cortex®-M4 32 位处理器,运行频率高达 168MHz,处理能力强大,能够满足各种高复杂度任务的需求,使 Clicker 4 能灵活适应多种应用场景。除了两个 1x20 引脚排针外,板载最显著的连接特性是四个增强型 mikroBUS™ 插槽,支持接入数量庞大的 Click boards™ 生态系统,该生态每日持续扩展。Clicker 4 各功能区域标识清晰,界面直观简洁,极大
提升使用便捷性和开发效率。Clicker 4 的价值不仅在于加速原型开发与应用构建阶段,更在于其作为独立完整方案可直接集成至实际项目中,无需额外硬件修改。四角各设有直径 4.2mm(0.165")的安装孔,便于通过螺丝轻松固定。对于多数应用,只需配套一个外壳,即可将 Clicker 4 开发板转化为完整、实用且外观精美的定制系统。
微控制器概述
MCU卡片 / MCU

建筑
ARM Cortex-M4
MCU 内存 (KB)
256
硅供应商
STMicroelectronics
引脚数
100
RAM (字节)
40960
使用的MCU引脚
mikroBUS™映射器
“仔细看看!”
Click board™ 原理图

一步一步来
项目组装
软件支持
库描述
该库包含 Temp Alert Click 驱动程序的 API。
关键功能:
tempalarm_write_reg- Temp Alarm 寄存器写入功能。tempalarm_read_remote_temperature- Temp Alarm 读取远程传感器温度功能。tempalarm_set_alarm_high_limit- Temp Alarm 设置远程传感器高温限值功能。
开源
代码示例
完整的应用程序代码和一个现成的项目可以通过NECTO Studio包管理器直接安装到NECTO Studio。 应用程序代码也可以在MIKROE的GitHub账户中找到。
/*!
* @file main.c
* @brief Temp Alarm Click example
*
* # Description
* This example demonstrates the use of Temp Alarm Click board by reading and displaying
* the temperature measurements and monitoring it.
*
* The demo application is composed of two sections :
*
* ## Application Init
* Initializes the driver and sets the Local sensor critical temperature at 30 degC with hysteresis of 1 degC,
* and Remote sensor alarm temperature at 30 degC.
*
* ## Application Task
* Reads the temperature measurement in degrees Celsius and displays the results on the USB UART
* approximately once per second. Monitoring alarm and critical state.
*
* @author Stefan Ilic
*
*/
#include "board.h"
#include "log.h"
#include "tempalarm.h"
static tempalarm_t tempalarm;
static log_t logger;
void application_init ( void )
{
log_cfg_t log_cfg; /**< Logger config object. */
tempalarm_cfg_t tempalarm_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.
tempalarm_cfg_setup( &tempalarm_cfg );
TEMPALARM_MAP_MIKROBUS( tempalarm_cfg, MIKROBUS_1 );
if ( I2C_MASTER_ERROR == tempalarm_init( &tempalarm, &tempalarm_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
if ( TEMPALARM_ERROR == tempalarm_default_cfg ( &tempalarm ) )
{
log_error( &logger, " Default configuration." );
for ( ; ; );
}
log_info( &logger, " Application Task " );
}
void application_task ( void )
{
uint8_t flag_data = 0;
int8_t local_temp = 0;
float remote_temp = 0;
tempalarm_get_alarms( &tempalarm, &flag_data );
if ( TEMPALARM_ADC_BUSY_MASK != ( TEMPALARM_ADC_BUSY_MASK & flag_data ) )
{
tempalarm_read_temperature( &tempalarm, &local_temp );
tempalarm_read_remote_temp( &tempalarm, &remote_temp );
log_printf( &logger, " Local temperature : %d degC \r\n" , ( int16_t ) local_temp );
log_printf( &logger, " Remote temperature : %.3f degC \r\n" , remote_temp );
log_printf( &logger, " -------------------------------- \r\n" );
}
if ( TEMPALARM_PIN_STATE_LOW == tempalarm_get_alr_pin( &tempalarm ) )
{
log_printf( &logger, " Alarm is on, remote temperature \r\n" );
log_printf( &logger, " is higher then 30 degC \r\n" );
log_printf( &logger, " -------------------------------- \r\n" );
}
if ( TEMPALARM_PIN_STATE_LOW == tempalarm_get_tcr_pin( &tempalarm ) )
{
log_printf( &logger, " Alarm is on, local temperature \r\n" );
log_printf( &logger, " is higher then 30 degC \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
额外支持
资源
类别:温度与湿度































