Beginner
10 min

Experience the future of temperature record-keeping with MAX6642 and PIC32MZ2048EFM100

We keep your temperature wisdom stored safely

Temp-Log 6 Click with Curiosity PIC32 MZ EF

Published Nov 08, 2023

Click board™

Temp-Log 6 Click

Dev Board

Curiosity PIC32 MZ EF

Compiler

NECTO Studio

MCU

PIC32MZ2048EFM100

Elevate your temperature monitoring game with our solution's advanced EEPROM memory, ensuring you have the data you need when you need it.

A

A

Hardware Overview

How does it work?

Temp-Log 6 Click is based on the MAX6642, a ±1°C, SMBus/I2C compatible local/remote temperature sensor with an overtemperature alarm, from Analog Devices. This sensor is capable of measuring its own die temperature, as well as a temperature of a remote PN junction, which can be either a PNP transistor on a substrate of some integrated component (typically CPU, FPGA, ASIC or GPU), but also a discrete diode-connected PNP transistor with its collector grounded. There are some specific requirements for a discrete component when using it as a remote temperature sensor: it has to be a small signal PNP transistor with its collector grounded along with its base, while the emitter is connected to the DXP input pin of the MAX6642. Datasheet of the MAX6642 also states some forward voltage ranges for the highest and the lowest expected temperatures, so the transistor should be selected according to these parameters. The discrete component can be connected to the screw terminal at the edge of the Click board™. The MAX6642 features a 10-bit ADC

which results in having the 0.25°C resolution. For the local temperature sensing, there are only 8 bits of data available, while the full 10-bit resolution is used for the remote sensing. The MAX6642 IC automatically sends biasing current through the PN junctions, while the IC samples the forward voltage for the given current and calculates the temperature. The ADC integrates the result over a period of 60ms, reducing the noise that way. Therefore, the temperature acquisition is not particularly fast. In return, the temperature measurement results are more accurate and reliable. The accuracy of the remote measurement depends on the ideality factor of the remote PN junction. The ideality factor is one of the listed specifications of devices equipped with such on-chip elements. The MAX6642 is designed for an ideality factor of 1.008, a typical value for the Intel Pentium III CPU. However, if using IC with a different ideality factor, a conversion formula needs to be applied. The conversion formula can be found within the MAX6642 datasheet. The MAX6642 IC also features the ALERT reporting

capability. If a programmed threshold is exceeded, the ALERT pin will be asserted to a LOW logic level. When the ALERT pin is asserted, it will remain latched until its STATUS register is read after the overtemperature condition no longer exists. Another way to clear the ALERT interrupt is to respond to the alert response address. This is a global I2C/SMBus protocol, where the host MCU broadcasts a Receive Byte transmission after the interrupt is received. One (or more) slave devices which generated this interrupt will respond, sending their I2C slave address, following the bus arbitration rules. This protocol is explained in more details within the MAX6642 datasheet. The ALERT pin is routed to the INT pin of the mikroBUS™ and it is pulled up by a resistor. Temp-Log 6 click uses an I2C interface to communicate with the host MCU. It is equipped with an SMD jumper labeled as VCC SEL. This jumper is used to select the power supply for the pull-up resistors on the I2C bus, allowing both 3.3V and 5V MCUs to be interfaced with this Click board™.

Temp-Log 6 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

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
Alert Interrupt
RF13
INT
NC
NC
TX
NC
NC
RX
I2C Clock
RPA14
SCL
I2C Data
RPA15
SDA
Power Supply
5V
5V
Ground
GND
GND
1

Take a closer look

Schematic

Temp-Log 6 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
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

Track your results in real time

Application Output via Debug Mode

1. Once the code example is loaded, pressing the "DEBUG" button initiates the build process, programs it on the created setup, and enters Debug mode.

2. After the programming is completed, a header with buttons for various actions within the IDE becomes visible. Clicking the green "PLAY" button starts reading the results achieved with the Click board™. The achieved results are displayed in the Application Output tab.

DEBUG_Application_Output

Software Support

Library Description

This library contains API for Temp-Log 6 Click driver.

Key functions:

  • templog6_write_byte - Writes one byte of data.

  • templog6_read_byte - Reads one byte of data.

  • templog6_get_interrupt - Gets the INT pin.

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 
 * \brief TempLog6 Click example
 * 
 * # Description
 * The example starts off with the initialization and configuration of the click and logger
 * modules, tests the communication channel and reads and displays local and remote temperature
 * values every second.
 *
 * The demo application is composed of two sections :
 * 
 * ## Application Init 
 * Initializes and configures the click and logger modules and tests the communication for errors.
 * 
 * ## Application Task  
 * Reads and displays local and remote temperature values every second.
 * 
 * \author MikroE Team
 *
 */
// ------------------------------------------------------------------- INCLUDES

#include "board.h"
#include "log.h"
#include "templog6.h"

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

static templog6_t templog6;
static log_t logger;

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

void application_init ( )
{
    log_cfg_t log_cfg;
    templog6_cfg_t cfg;

    uint8_t test;

    /** 
     * 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.

    templog6_cfg_setup( &cfg );
    TEMPLOG6_MAP_MIKROBUS( cfg, MIKROBUS_1 );
    templog6_init( &templog6, &cfg );
        
    // Test communication 

    test = templog6_read_byte( &templog6, TEMPLOG6_REG_MANUFACTURER_ID );

    if ( test == TEMPLOG6_MANUFACTURER_ID )
    {
        log_printf( &logger, "--- Comunication OK!!! ---\r\n" );
    }
    else
    {
        log_printf( &logger, "--- Comunication ERROR!!! ---\r\n" );
        for ( ; ; );
    }

    templog6_default_cfg( &templog6 );

    log_printf( &logger, "--- Start measurement ---\r\n" );
}

void application_task ( )
{
    float remote_temp;
    float local_temp;
    
    local_temp = templog6_read_byte( &templog6, TEMPLOG6_REG_LOCAL_TEMPERATURE );
    log_printf( &logger, "--- Local Temperature: %f C\r\n", local_temp );
    
    remote_temp = templog6_read_byte( &templog6, TEMPLOG6_REG_REMOTE_TEMPERATURE );
    log_printf( &logger, "--- Remote Temperature: %f C\r\n", remote_temp );
    
    log_printf( &logger, "-----------------------------\r\n" );
    Delay_ms( 1000 );
}

void main ( )
{
    application_init( );

    for ( ; ; )
    {
        application_task( );
    }
}

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

Additional Support

Resources

Love this project?

'Buy This Kit' button takes you directly to the shopping cart where you can easily add or remove products.