初学者
10 分钟

使用TSYS03和STM32F031K6体验温度监测的革命

ThermoSense:智能。简单。精确。

Thermo 20 Click with Nucleo 32 with STM32F031K6 MCU

已发布 10月 01, 2024

点击板

Thermo 20 Click

开发板

Nucleo 32 with STM32F031K6 MCU

编译器

NECTO Studio

微控制器单元

STM32F031K6

由于我们的创新温度监控解决方案,测量热量从未如此简单。

A

A

硬件概览

它是如何工作的?

Thermo 20 Click 基于 TE Connectivity 的 TSYS03,这是一款超紧凑的数字温度传感器,具有精确的数字输出和低功耗。TSYS03 经过工厂校准,通过几个 I2C 可配置地址提供准确的温度测量。Thermo 20 Click 板™ 的供电电压范围为 2.4V 到 5.5V,电流消耗仅为 5µA,非常适合电池供电和汽车应用。TSYS03 的工作温度范围从 -40°C 到 +125°C,在 0°C 至 60°C 的环境温度下,温度测量精度为 ±0.5°C。TSYS03 包含一个半导体二极管作为测量元件,

该二极管集成在一个 ASIC 中。温度是通过二极管的电压降和具有 16 位分辨率的 A/D 转换器获得的。输出通过可配置的 I2C 接口以数字值形式获得。TSYS03 以其高精度、低于 5 µA 的电流消耗和最大 0.1 °C 的低自热特性而著称。Thermo 20 Click 使用标准 I2C 双线接口与 MCU 通信,最大时钟频率为 1MHz。标准 I2C 地址为 0x40,但传感器还可以响应第二个替代 I2C 地址。可以一次性后续写入替代静态 I2C 地址,这会导致错误的存储器 CRC,但传感器仍

然可以正常工作。在操作过程中还可以将替代 I2C 地址写入传感器。该地址是临时的,在软件复位或硬件重启功能期间会被覆盖。该 Click 板™ 可在 3.3V 或 5V 逻辑电压水平下工作,可通过 VCC SEL 跳线选择。这样,3.3V 和 5V 兼容的 MCU 都能正确使用通信线路。此外,该 Click 板™ 配备了包含易于使用的函数库和示例代码的库,可作为进一步开发的参考。

Thermo 20 Click hardware overview 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
NC
NC
CS
NC
NC
SCK
NC
NC
MISO
NC
NC
MOSI
Power Supply
3.3V
3.3V
Ground
GND
GND
NC
NC
PWM
NC
NC
INT
NC
NC
TX
NC
NC
RX
I2C Clock
PB6
SCL
I2C Data
PB7
SDA
Power Supply
5V
5V
Ground
GND
GND
1

“仔细看看!”

Click board™ 原理图

Thermo 20 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
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

软件支持

库描述

该库包含 Thermo 20 Click 驱动程序的 API。

关键功能:

  • thermo20_set_cmd - 发送命令功能

  • thermo20_start_conversion - 开始转换功能

  • thermo20_get_temperature - 获取温度数据功能

开源

代码示例

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

/*!
 * @file main.c
 * @brief Thermo20 Click example
 *
 * # Description
 * This example showcases the ability of Thermo 20 Click board to
 * read it's serial number. It can read themperature and measure from -40degC to
 * 120degC.
 *
 * The demo application is composed of two sections :
 *
 * ## Application Init
 * Initialization communication modules(I2C, UART). Resets device and read Serial Number.
 *
 * ## Application Task
 * In span of ~ 1000ms it sends command for adc conversion of temperature, reads ADC value,
 * and calculates temperature in degrees C.
 * 
 * @note For this driver to work on 18bit PIC MCU-s you need to additionally pull up communication lines.
 *
 * @author Mikroe Team
 *
 */

#include "board.h"
#include "log.h"
#include "thermo20.h"

static thermo20_t thermo20;
static log_t logger;

void application_init ( void ) 
{
    log_cfg_t log_cfg;  /**< Logger config object. */
    thermo20_cfg_t thermo20_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.
    thermo20_cfg_setup( &thermo20_cfg );
    THERMO20_MAP_MIKROBUS( thermo20_cfg, MIKROBUS_1 );
    err_t init_flag = thermo20_init( &thermo20, &thermo20_cfg );
    if ( I2C_MASTER_ERROR == init_flag ) 
    {
        log_error( &logger, " Application Init Error. " );
        log_info( &logger, " Please, run program again... " );

        for ( ; ; );
    }

    thermo20_default_cfg ( &thermo20 );
    
    uint32_t ser_numb = thermo20_get_serial_number( &thermo20 );
    log_printf( &logger, " > Serial Number: %lu\r\n", ser_numb );
    
    log_info( &logger, " Application Task " );
}

void application_task ( void ) 
{
    thermo20_start_conversion( &thermo20 );
    
    float temperature = thermo20_get_temperature( &thermo20 );
    
    log_printf( &logger, " > Temperature[deg C]: %.2f\r\n", temperature );
    
    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

额外支持

资源

喜欢这个项目吗?

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