Beginner
10 min

Achieve accurate and reliable temperature measurements in any setting with MAX31825 and PIC32MZ2048EFM100

Turning up the heat on temperature monitoring

Thermo 19 Click with Curiosity PIC32 MZ EF

Published Nov 11, 2023

Click board™

Thermo 19 Click

Dev Board

Curiosity PIC32 MZ EF

Compiler

NECTO Studio

MCU

PIC32MZ2048EFM100

Our temperature measurement solution ensures precision in every degree to help you maintain the ideal conditions for your needs.

A

A

Hardware Overview

How does it work?

Thermo 19 Click is based on the MAX31825, a digital thermometer that provides 12-bit temperature measurements and communicates over a 1-wire interface from Analog Devices. The sensor provides 8-bit to 12-bit temperature measurements from -45°C to +145°C with better than ±1.75°C accuracy and better than ±1°C accuracy from 0°C to +70°C. Temperature measurements are sent to the MCU using the 1-Wire interface that requires only one data line that can also be used to power the sensor parasitically. Besides, it includes two input pins that allow one of 64 different addresses to be selected to identify the sensor's physical location and an interrupt representing an alarm output for detecting temperature measurement faults. The Thermo

19 Click communicates with MCU using the 1-Wire interface that, by definition, requires only one data line (and ground) for communication with MCU. The 1-Wire communication line is routed to the SMD jumper labeled as GP SEL, which allows routing of the 1-Wire communication either to the PWM pin or to the AN pin of the mikroBUS™ socket. These pins are labeled GP0 and GP1, respectively, the same as the SMD jumper positions, making the selection of the desired pin simple and straightforward. The MAX31825 possesses an interrupt output that represents alarm output with user-definable settings for temperature fault detection routed to the INT pin on the mikroBUS™ socket, labeled as ALT. It also includes two address pins (ADD0 and ADD1).

ADD0 is connected to an external resistor whose value is measured by the MAX31825 in response to the Convert Location command, resulting in five location address bits (A4:A0) stored in the Status register. In addition to ADD0, the ADD1 input can be connected to GND or VDD, labeled as 0 and 1, which can be performed by using the SMD jumper labeled as ADDR SEL. This Click board™ can be operated only with a 3.3V logic voltage level. The board must perform appropriate logic voltage level conversion before using MCUs with different logic levels. Also, it comes equipped with a library containing functions and an example code that can be used as a reference for further development.

Thermo 19 Click hardware overview image

Features overview

Development board

Curiosity PIC32 MZ EF development board is a fully integrated 32-bit development platform featuring the high-performance PIC32MZ EF Series (PIC32MZ2048EFM) that has a 2MB Flash, 512KB RAM, integrated FPU, Crypto accelerator, and excellent connectivity options. It includes an integrated programmer and debugger, requiring no additional hardware. Users can expand

functionality through MIKROE mikroBUS™ Click™ adapter boards, add Ethernet connectivity with the Microchip PHY daughter board, add WiFi connectivity capability using the Microchip expansions boards, and add audio input and output capability with Microchip audio daughter boards. These boards are fully integrated into PIC32’s powerful software framework, MPLAB Harmony,

which provides a flexible and modular interface to application development a rich set of inter-operable software stacks (TCP-IP, USB), and easy-to-use features. The Curiosity PIC32 MZ EF development board offers expansion capabilities making it an excellent choice for a rapid prototyping board in Connectivity, IOT, and general-purpose applications.

Curiosity PIC32MZ EF double side image

Microcontroller Overview

MCU Card / MCU

default

Architecture

PIC32

MCU Memory (KB)

2048

Silicon Vendor

Microchip

Pin count

100

RAM (Bytes)

524288

Used MCU Pins

mikroBUS™ mapper

1-Wire Data IN/OUT
RPB4
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
1-Wire Data IN/OUT
RPE8
PWM
Alarm Interrupt
RF13
INT
NC
NC
TX
NC
NC
RX
NC
NC
SCL
NC
NC
SDA
NC
NC
5V
Ground
GND
GND
1

Take a closer look

Schematic

Thermo 19 Click Schematic schematic

Step by step

Project assembly

Curiosity PIC32MZ EF front image hardware assembly

Start by selecting your development board and Click board™. Begin with the Curiosity PIC32 MZ EF as your development board.

Curiosity PIC32MZ EF front image hardware assembly
Thermo 28 Click front image hardware assembly
Prog-cut hardware assembly
Curiosity PIC32 MZ EF MB 1 - 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

Track your results in real time

Application Output

After loading the code example, pressing the "DEBUG" button builds and programs it on the selected setup.

Application Output Step 1

After programming is completed, a header with buttons for various actions available in the IDE appears. By clicking the green "PLAY "button, we start reading the results achieved with Click board™.

Application Output Step 3

Upon completion of programming, the Application Output tab is automatically opened, where the achieved result can be read. In case of an inability to perform the Debug function, check if a proper connection between the MCU used by the setup and the CODEGRIP programmer has been established. A detailed explanation of the CODEGRIP-board connection can be found in the CODEGRIP User Manual. Please find it in the RESOURCES section.

Application Output Step 4

Software Support

Library Description

This library contains API for Thermo 19 Click driver.

Key functions:

  • thermo19_write_scratchpad - This function writes the temperature thresholds and configuration byte to the scratchpad.

  • thermo19_read_scratchpad - This function reads the scratchpad bytes.

  • thermo19_read_temperature - This function reads the temperature value in Celsius.

Open Source

Code example

This example can be found in NECTO Studio. Feel free to download the code, or you can copy the code below.

/*!
 * @file main.c
 * @brief Thermo19 Click example
 *
 * # Description
 * This example demonstrates the use of Thermo 19 click board by reading
 * and displaying the temperature in Celsius.
 *
 * The demo application is composed of two sections :
 *
 * ## Application Init
 * Initializes the driver and performs the click default configuration.
 *
 * ## Application Task
 * Reads and displays the temperature measured by the click board on the USB UART
 * approximately every 400ms as this matches the required conversion time for 12-bit 
 * temperature resolution.
 *
 * @author Nikola Citakovic
 *
 */

#include "board.h"
#include "log.h"
#include "thermo19.h"

static thermo19_t thermo19;
static log_t logger;

void application_init ( void ) 
{
    log_cfg_t log_cfg;  /**< Logger config object. */
    thermo19_cfg_t thermo19_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.
    thermo19_cfg_setup( &thermo19_cfg );
    THERMO19_MAP_MIKROBUS( thermo19_cfg, MIKROBUS_1 );
    if ( ONE_WIRE_ERROR == thermo19_init( &thermo19, &thermo19_cfg ) )
    {
        log_error( &logger, " Communication init." );
        for ( ; ; );
    }
    
    if ( THERMO19_ERROR == thermo19_default_cfg ( &thermo19 ) )
    {
        log_error( &logger, " Default configuration." );
        for ( ; ; );
    }
    
    log_info( &logger, " Application Task " );
}

void application_task ( void ) 
{
    float temperature;
    if ( THERMO19_OK == thermo19_read_temperature ( &thermo19, &temperature ) )
    {
        log_printf( &logger, " Temperature: %.2f C\r\n\n", temperature );
    }
}

void main ( void )  
{
    application_init( );    
    
    for ( ; ; ) 
    {
        application_task( );
    }
}

// ------------------------------------------------------------------------ END

Additional Support

Resources