Beginner
10 min

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

We keep your temperature wisdom stored safely

Temp-Log 6 Click with PIC32MZ clicker

Published Nov 08, 2023

Click board™

Temp-Log 6 Click

Dev. board

PIC32MZ clicker

Compiler

NECTO Studio

MCU

PIC32MZ1024EFH064

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

PIC32MZ Clicker is a compact starter development board that brings the flexibility of add-on Click boards™ to your favorite microcontroller, making it a perfect starter kit for implementing your ideas. It comes with an onboard 32-bit PIC32MZ microcontroller with FPU from Microchip, a USB connector, LED indicators, buttons, a mikroProg connector, and a header for interfacing with external electronics. Thanks to its compact design with clear and easy-recognizable silkscreen markings, it provides a fluid and immersive working experience, allowing access anywhere and under

any circumstances. Each part of the PIC32MZ Clicker development kit contains the components necessary for the most efficient operation of the same board. In addition to the possibility of choosing the PIC32MZ Clicker programming method, using USB HID mikroBootloader, or through an external mikroProg connector for PIC, dsPIC, or PIC32 programmer, the Clicker board also includes a clean and regulated power supply module for the development kit. The USB Micro-B connection can provide up to 500mA of current, which is more than enough to operate all onboard

and additional modules. All communication methods that mikroBUS™ itself supports are on this board, including the well-established mikroBUS™ socket, reset button, and several buttons and LED indicators. PIC32MZ Clicker is an integral part of the Mikroe ecosystem, allowing you to create a new application in minutes. Natively supported by Mikroe software tools, it covers many aspects of prototyping thanks to a considerable number of different Click boards™ (over a thousand boards), the number of which is growing every day.

PIC32MZ clicker double side image

Microcontroller Overview

MCU Card / MCU

default

Architecture

PIC32

MCU Memory (KB)

1024

Silicon Vendor

Microchip

Pin count

64

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
RB5
INT
NC
NC
TX
NC
NC
RX
I2C Clock
RD10
SCL
I2C Data
RD9
SDA
Power Supply
5V
5V
Ground
GND
GND
1

Take a closer look

Click board™ Schematic

Temp-Log 6 Click Schematic schematic

Step by step

Project assembly

PIC32MZ clicker front image hardware assembly

Start by selecting your development board and Click board™. Begin with the PIC32MZ clicker as your development board.

PIC32MZ clicker front image hardware assembly
GNSS2 Click front image hardware assembly
Prog-cut hardware assembly
GNSS2 Click complete accessories setup image hardware assembly
Micro B Connector Clicker 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
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

Track your results in real time

Application Output

1. Application Output - In Debug mode, the 'Application Output' window enables real-time data monitoring, offering direct insight into execution results. Ensure proper data display by configuring the environment correctly using the provided tutorial.

2. UART Terminal - Use the UART Terminal to monitor data transmission via a USB to UART converter, allowing direct communication between the Click board™ and your development system. Configure the baud rate and other serial settings according to your project's requirements to ensure proper functionality. For step-by-step setup instructions, refer to the provided tutorial.

3. Plot Output - The Plot feature offers a powerful way to visualize real-time sensor data, enabling trend analysis, debugging, and comparison of multiple data points. To set it up correctly, follow the provided tutorial, which includes a step-by-step example of using the Plot feature to display Click board™ readings. To use the Plot feature in your code, use the function: plot(*insert_graph_name*, variable_name);. This is a general format, and it is up to the user to replace 'insert_graph_name' with the actual graph name and 'variable_name' with the parameter to be displayed.

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

The complete application code and a ready-to-use project are available through the NECTO Studio Package Manager for direct installation in the NECTO Studio. The application code can also be found on the MIKROE GitHub account.

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