初学者
10 分钟

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

ThermoSense:智能。简单。精确。

Thermo 20 Click with PIC32MZ clicker

已发布 6月 25, 2024

点击板

Thermo 20 Click

开发板

PIC32MZ clicker

编译器

NECTO Studio

微控制器单元

PIC32MZ1024EFH064

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

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

功能概述

开发板

PIC32MZ Clicker 是一款紧凑型入门开发板,它将 Click 板™的灵活性带给您喜爱的微控制器,使其成为实现您想法的完美入门套件。它配备了一款板载 32 位带有浮点单元的 Microchip PIC32MZ 微控制器,一个 USB 连接器,LED 指示灯,按钮,一个 mikroProg 连接器,以及一个用于与外部电子设备接口的头部。得益于其紧凑的设计和清晰易识别的丝网标记,它提供了流畅且沉浸式的工作体验,允许在任

何情况下、任何地方都能访问。PIC32MZ Clicker 开 发套件的每个部分都包含了使同一板块运行最高效的必要组件。除了可以选择 PIC32MZ Clicker 的编程方式,使用 USB HID mikroBootloader 或通过外部 mikroProg 连接器为 PIC,dsPIC 或 PIC32 编程外,Clicker 板还包括一个干净且调节过的开发套件电源供应模块。USB Micro-B 连接可以提供多达 500mA 的电流,这足以操作所有板载和附加模块。所有 

mikroBUS™ 本身支持的通信方法都在这块板上,包 括已经建立良好的 mikroBUS™ 插槽、重置按钮以及若干按钮和 LED 指示灯。PIC32MZ Clicker 是 Mikroe 生态系统的一个组成部分,允许您在几分钟内创建新的应用程序。它由 Mikroe 软件工具原生支持,得益于大量不同的 Click 板™(超过一千块板),其数量每天都在增长,它涵盖了原型制作的许多方面。

PIC32MZ clicker double side image

微控制器概述 

MCU卡片 / MCU

default

建筑

PIC32

MCU 内存 (KB)

1024

硅供应商

Microchip

引脚数

64

RAM (字节)

524288

使用的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
RD10
SCL
I2C Data
RD9
SDA
Power Supply
5V
5V
Ground
GND
GND
1

“仔细看看!”

Click board™ 原理图

Thermo 20 Click Schematic schematic

一步一步来

项目组装

PIC32MZ clicker front image hardware assembly

从选择您的开发板和Click板™开始。以PIC32MZ clicker作为您的开发板开始。

PIC32MZ clicker front image hardware assembly
GNSS2 Click front image hardware assembly
Prog-cut hardware assembly
Board mapper by product7 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
Flip&Click PIC32MZ 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

软件支持

库描述

该库包含 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

额外支持

资源

喜欢这个项目吗?

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