Beginner
10 min

Perfect your heat mapping endeavors with ADT7420 and STM32F415ZG

Surface thermometry made easy

Surface temp Click with UNI Clicker

Published Nov 08, 2023

Click board™

Surface temp Click

Dev Board

UNI Clicker

Compiler

NECTO Studio

MCU

STM32F415ZG

Our surface temperature measurement solution acts as your dedicated sleuth, uncovering temperature insights for effective control.

A

A

Hardware Overview

How does it work?

Surface temp Click is based on the ADT7420, an accurate 16-bit Digital I2C temperature sensor from Analog Devices. It has a 16-bit ADC to monitor and digitize the temperature to 0.0078°C resolution. The ADC resolution, by default, is set to 13 bits (0.0625°C) and is a user-programmable mode that can be changed through the serial interface. The ADT7420 is guaranteed to operate over supply voltages from 2.7 V to 5.5 V. Operating at 3.3 V. The average supply current is typically 210 μA. The ADT7420 has a shutdown mode that powers down the device and offers a shutdown current of typically 2.0 μA at 3.3 V. The ADT7420 is rated for operation over the −40°C to +150°C temperature range. The Surface temp Click board™ have a sensing pad, which is thermally connected to a ADT7420, for temperature sensing. The internal temperature sensor has high accuracy and linearity over the entire rated temperature

range without needing correction or calibration by the user. In normal mode (default power-up mode) the ADT7420 runs an automatic conversion sequence. During this automatic conversion sequence, a conversion typically takes 240 ms to complete and the ADT7420 is continuously converting. This means that as soon as one temperature conversion is completed, another temperature conversion begins. Each temperature conversion result is stored in the temperature value registers and is available through the I2C interface. In continuous conversion mode, the read operation provides the most recent converted result. Like most I2C-compatible devices, the ADT7420 has a 7-bit serial address. The address can be selected by JP2 and JP3 jumpers (details in ADT7420 datasheet). Pin A0 and Pin A1 are available for address selection, giving the ADT7420 four possible I2C addresses. The INT and CT

pins have two undertemperature/overtemperature modes: comparator mode and interrupt mode. The interrupt mode is the default power-up overtemperature mode. The CT pin is an open-drain output that becomes active when the temperature exceeds a programmable critical temperature limit. The INT pin is also an open-drain output that becomes active when the temperature exceeds a programmable limit. The INT pin and CT pin can operate in comparator and interrupt event modes. The voltage range which can be used to power up the Surface temp Click, allows it to work with controllers which have GPIO on both 3.3V and 5V. It can be selected by soldering a small SMD jumper, labeled as VCC SEL to the correct position. As well as PWR LED indicator for signaling that power is present on the system.

Surface temp Click hardware overview image

Features overview

Development board

UNI Clicker is a compact development board designed as a complete solution that brings the flexibility of add-on Click boards™ to your favorite microcontroller, making it a perfect starter kit for implementing your ideas. It supports a wide range of microcontrollers, such as different ARM, PIC32, dsPIC, PIC, and AVR from various vendors like Microchip, ST, NXP, and TI (regardless of their number of pins), four mikroBUS™ sockets for Click board™ connectivity, a USB connector, LED indicators, buttons, a debugger/programmer connector, and two 26-pin headers for interfacing with external electronics. Thanks to innovative manufacturing technology, it allows you to build

gadgets with unique functionalities and features quickly. Each part of the UNI Clicker development kit contains the components necessary for the most efficient operation of the same board. In addition to the possibility of choosing the UNI Clicker programming method, using a third-party programmer or CODEGRIP/mikroProg connected to onboard JTAG/SWD header, the UNI Clicker board also includes a clean and regulated power supply module for the development kit. It provides two ways of board-powering; through the USB Type-C (USB-C) connector, where onboard voltage regulators provide the appropriate voltage levels to each component on the board, or using a Li-Po/Li

Ion battery via an onboard battery connector. All communication methods that mikroBUS™ itself supports are on this board (plus USB HOST/DEVICE), including the well-established mikroBUS™ socket, a standardized socket for the MCU card (SiBRAIN standard), and several user-configurable buttons and LED indicators. UNI 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.

UNI clicker double image

Microcontroller Overview

MCU Card / MCU

default

Type

8th Generation

Architecture

ARM Cortex-M4

MCU Memory (KB)

1024

Silicon Vendor

STMicroelectronics

Pin count

144

RAM (Bytes)

196608

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
Critical Overtemperature Indicator
PD12
PWM
Over/Undertemperature Indicator
PD3
INT
NC
NC
TX
NC
NC
RX
I2C Clock
PB8
SCL
I2C Data
PB9
SDA
Power Supply
5V
5V
Ground
GND
GND
1

Take a closer look

Schematic

Surface temp Click Schematic schematic

Step by step

Project assembly

UNI Clicker front image hardware assembly

Start by selecting your development board and Click board™. Begin with the UNI Clicker as your development board.

UNI Clicker front image hardware assembly
Thermo 28 Click front image hardware assembly
SiBRAIN for STM32F745VG front image hardware assembly
Prog-cut hardware assembly
UNI Clicker MB 1 - upright/with-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
Necto image step 7 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 Surface temp Click driver.

Key functions:

  • surfacetemp_get_temperature - Getting temperature value

  • surfacetemp_set_hysteresis - Setting hysteresis value

  • surfacetemp_setup - Device initialization

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 SurfaceTemp Click example
 * 
 * # Description
 * This example demonstrates the use of Surface Temp Click.
 *
 * The demo application is composed of two sections :
 * 
 * ## Application Init 
 * Initalizes the driver and configures the click board.
 * 
 * ## Application Task  
 * Reads the temperature in Celsius and displays the value on the USB UART each second.
 * 
 * \author MikroE Team
 *
 */
// ------------------------------------------------------------------- INCLUDES

#include "board.h"
#include "log.h"
#include "surfacetemp.h"

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

static surfacetemp_t surfacetemp;
static log_t logger;

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

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

    uint8_t status;

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

    surfacetemp_cfg_setup( &cfg );
    SURFACETEMP_MAP_MIKROBUS( cfg, MIKROBUS_1 );
    surfacetemp_init( &surfacetemp, &cfg );

    status = surfacetemp_setup( &surfacetemp );

    surfacetemp_set_high_threshold( &surfacetemp, 40.00 );
    surfacetemp_set_low_threshold( &surfacetemp, 10.00 );
    surfacetemp_set_critical_threshold( &surfacetemp, 70.00 );
    surfacetemp_set_hysteresis( &surfacetemp, 0 );

    if ( status == 0 )
    {
        log_printf( &logger, "--- INIT DONE --- \r\n" );
    }
    else
    {
        log_printf( &logger, "--- INIT ERROR --- \r\n" );
        for( ; ; );
    }
    Delay_ms( 1000 );
}

void application_task ( void )
{
    float temperature;

    temperature = surfacetemp_get_temperature( &surfacetemp );
    log_printf( &logger, "> Temperature : %.2f \r\n", temperature );
    Delay_ms( 1000 );
}

void main ( void )
{
    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.