初学者
10 分钟

使用MAX31865和PIC32MZ2048EFM100在温度测量中实现无与伦比的精度和可靠性

您超精确温度监测的合作伙伴!

RTD Click with Curiosity PIC32 MZ EF

已发布 6月 24, 2024

点击板

RTD Click

开发板

Curiosity PIC32 MZ EF

编译器

NECTO Studio

微控制器单元

PIC32MZ2048EFM100

温度控制的精通始于我们的RTD解决方案,精心制作用于PT100铂探头,为精度设定了新的基准。

A

A

硬件概览

它是如何工作的?

RTD Click基于Analog Devices的MAX31865,这是一款针对铂电阻温度探测器(RTD)进行优化的电阻到数字转换器。该点击板使用PT100型铂探头进行温度测量。板上有四个螺钉端子,因此可以使用不同类型的PT100探头设计。该点击板可以与2、3或4线PT100探头类

型一起使用。RTD探头通常用于测量−200°C到500°C范围内的温度,但确切的值取决于使用的具体探头。像15位ADC分辨率、输入端口过压保护(高达±45V)、故障检测、快速响应时间(21mS)和SPI接口等功能,使RTD Click成为在精确测量极高和极低温度时的理想选择。

此点击板只能使用3.3V逻辑电压级别操作。在使用具有不同逻辑电平的MCU之前,板必须执行适当的逻辑电压级别转换。此外,它配备了一个包含函数和示例代码的库,可用作进一步开发的参考。

RTD Click top side image
RTD Click bottom side image

功能概述

开发板

Curiosity PIC32 MZ EF 开发板是一个完全集成的 32 位开发平台,特点是高性能的 PIC32MZ EF 系列(PIC32MZ2048EFM),该系列具有 2MB Flash、512KB RAM、集成的浮点单元(FPU)、加密加速器和出色的连接选项。它包括一个集成的程序员和调试器,无需额外硬件。用户可以通过 MIKROE 

mikroBUS™ Click™ 适配器板扩展功能,通过 Microchip PHY 女儿板添加以太网连接功能,使用 Microchip 扩展板添加 WiFi 连接能力,并通过 Microchip 音频女儿板添加音频输入和输出功能。这些板完全集成到 PIC32 强大的软件框架 MPLAB Harmony 中,该框架提供了一个灵活且模块化的接口

来应用开发、一套丰富的互操作软件堆栈(TCP-IP、USB)和易于使用的功能。Curiosity PIC32 MZ EF 开发板提供了扩展能力,使其成为连接性、物联网和通用应用中快速原型设计的绝佳选择。

Curiosity PIC32MZ EF double side image

微控制器概述 

MCU卡片 / MCU

default

建筑

PIC32

MCU 内存 (KB)

2048

硅供应商

Microchip

引脚数

100

RAM (字节)

524288

你完善了我!

配件

PT100 3线温度探头是一种先进的RTD铂传感器,专为精确测量高达250°C的温度而设计。该探头与RTD Click板™完美兼容,利用RTD传感器 - 温度敏感电阻器,其电阻会随温度变化而改变。该探头的核心特点是精心制作的铂带,其在0°C时的电阻为100Ω,因此被称为PT100。主要特点包括高达250°C的温度范围,用于增强精度的3线配置,长度为1米(100厘米,3.37英寸),耐用的2B级构造以及0.5英寸的严格公差。无论是在工业还是科学领域,PT100 3线温度探头都能提供可靠且精确的温度读数,确保在各种应用中实现最佳性能。

RTD Click accessories image

使用的MCU引脚

mikroBUS™映射器

NC
NC
AN
NC
NC
RST
SPI Chip Select
RPD4
CS
SPI Slock
RPD1
SCK
SPI Data OUT
RPD14
MISO
SPI Data IN
RPD3
MOSI
Power Supply
3.3V
3.3V
Ground
GND
GND
NC
NC
PWM
Data-Ready
RF13
INT
NC
NC
TX
NC
NC
RX
NC
NC
SCL
NC
NC
SDA
NC
NC
5V
Ground
GND
GND
1

“仔细看看!”

Click board™ 原理图

RTD Click Schematic schematic

一步一步来

项目组装

Curiosity PIC32MZ EF front image hardware assembly

从选择您的开发板和Click板™开始。以Curiosity PIC32 MZ EF作为您的开发板开始。

Curiosity PIC32MZ EF front image hardware assembly
GNSS2 Click front image hardware assembly
Prog-cut hardware assembly
GNSS2 Click complete accessories setup image hardware assembly
Curiosity PIC32 MZ EF MB 1 Access - upright/background 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
Curiosity PIC32 MZ EF 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

实时跟踪您的结果

应用程序输出

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”替换为要显示的参数。

软件支持

库描述

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

关键函数:

  • rtd_read_register - 此函数从选择的寄存器中读取数据。

  • rtd_read_temperature - 此函数从温度寄存器中读取数据。

  • rtd_convert_temperature - 此函数将来自温度寄存器的数据转换。

开源

代码示例

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

/*!
 * \file 
 * \brief Rtd Click example
 * 
 * # Description
 * This app measures temperature and converts the data to celsius degrees.
 *
 * The demo application is composed of two sections :
 * 
 * ## Application Init 
 * Initializes RTD click driver, and sets the
 * proper configuration mode for three wire RTD.
 * 
 * ## Application Task  
 * Measures temperature, converts the data to celsius degrees,
 * and displays it on the USB UART.
 * 
 * \author MikroE Team
 *
 */
// ------------------------------------------------------------------- INCLUDES

#include "board.h"
#include "log.h"
#include "rtd.h"

// ------------------------------------------------------------------ VARIABLES

static rtd_t rtd;
static log_t logger;

// ------------------------------------------------------ APPLICATION FUNCTIONS

void application_init ( void )
{
    log_cfg_t log_cfg;
    rtd_cfg_t cfg;

    /** 
     * 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.
    rtd_cfg_setup( &cfg );
    RTD_MAP_MIKROBUS( cfg, MIKROBUS_1 );
    rtd_init( &rtd, &cfg );
    
    RTD_SET_DATA_SAMPLE_EDGE;

    rtd_write_register( &rtd, RTD_CONFIGURATION, 0xD0 );
    Delay_ms ( 100 );
    log_info( &logger, " Application Task " );
}

void application_task ( void )
{
    uint16_t read_value = 0;
    float converted_value = 0;

    read_value = rtd_read_temperature( &rtd );
    converted_value = rtd_convert_temperature( &rtd, read_value, RTD_REF_RESISTANCE_470 );

    log_printf( &logger, " Current temperature: %.2f \r\n", converted_value );

    Delay_ms ( 300 );
}

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 
 * \brief Rtd Click example
 * 
 * # Description
 * This app measures temperature and converts the data to celsius degrees.
 *
 * The demo application is composed of two sections :
 * 
 * ## Application Init 
 * Initializes RTD click driver, and sets the
 * proper configuration mode for three wire RTD.
 * 
 * ## Application Task  
 * Measures temperature, converts the data to celsius degrees,
 * and displays it on the USB UART.
 * 
 * \author MikroE Team
 *
 */
// ------------------------------------------------------------------- INCLUDES

#include "board.h"
#include "log.h"
#include "rtd.h"

// ------------------------------------------------------------------ VARIABLES

static rtd_t rtd;
static log_t logger;

// ------------------------------------------------------ APPLICATION FUNCTIONS

void application_init ( void )
{
    log_cfg_t log_cfg;
    rtd_cfg_t cfg;

    /** 
     * 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.
    rtd_cfg_setup( &cfg );
    RTD_MAP_MIKROBUS( cfg, MIKROBUS_1 );
    rtd_init( &rtd, &cfg );
    
    RTD_SET_DATA_SAMPLE_EDGE;

    rtd_write_register( &rtd, RTD_CONFIGURATION, 0xD0 );
    Delay_ms ( 100 );
    log_info( &logger, " Application Task " );
}

void application_task ( void )
{
    uint16_t read_value = 0;
    float converted_value = 0;

    read_value = rtd_read_temperature( &rtd );
    converted_value = rtd_convert_temperature( &rtd, read_value, RTD_REF_RESISTANCE_470 );

    log_printf( &logger, " Current temperature: %.2f \r\n", converted_value );

    Delay_ms ( 300 );
}

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

额外支持

资源

喜欢这个项目吗?

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