30 min

Enhance your thermal awareness with advanced thermal imaging solution based on the MLX90640-BAA and STM32F469II

Count on clarity: The thermal imaging solution you need!

IR Grid 3 click with Fusion for ARM v8

Published Sep 22, 2023

Click board™

IR Grid 3 click

Development board

Fusion for ARM v8


NECTO Studio



Elevate your thermal perception with our advanced thermal imaging solution, designed to enhance your ability to monitor, analyze, and optimize temperature-related aspects in your projects and processes



Hardware Overview

How does it work?

IR Grid 3 Click is based on the MLX90640ESF-BAA, a 32x24 IR array sensor, from Melexis. This sensor contains 8 Kbit EEPROM, used to store all the compensation and calibration parameters, along with some editable user parameters, such as the config registers, I2C address and similar. These sensors can measure temperature relative to the cold junction temperature, and for this reason, the MLX90640ESF-BAA IR sensor incorporates a PTAT (Proportional to Absolute Temperature) compensation sensor. The device also contains the power supply voltage measurement unit, allow power supply monitoring. It is recommended that the supply voltage stay as accurate as possible, which is taken care of if used with the MikroElektronika development systems. The IR sensor array, as well as the PTAT sensor readings, are sampled by fast internal ADC and stored on the RAM, which can be accessed via the I2C. The resolution of the ADC can be programmed between 16bit and 19bit. The MLX90640ESF-BAA IR sensor used on this Click board™ has a Field of View (FOV) of 110°x75°, with the IR sensing elements arranged in a 32x28 grid. Each sensor measures the temperature in its individual FOV, allowing the host MCU to build a thermal image or calculate the temperature at each spot of the viewed scene. The measurement results are stored in the onboard RAM. The entire RAM area is divided into two pages, with access patterns controlled by the configuration registers (chess

pattern, or interleaved pattern). The configuration parameters are factory calibrated for chess pattern access, yielding the most accurate results when using this mode. The chess pattern mode is selected by default. Two modes of operation are available: the device can continuously sample data from the IR elements, with the programmed refresh rate (up to 64 frames per second), or it can take one frame, by sampling the selected page. The status byte contains flags that indicate that the reading of a specific page is done. The configuration and control registers allow configuring of the working parameters. These registers contain bits that control the behavior of the sensor IC: the refresh rate, ADC resolution, measurement mode (continuous or step mode), sleep mode, I2C mode (FM or FM+), etc. The data from the EEPROM registers is copied after the POR cycle to the working RAM registers, preparing the device to be instantly operated. Besides the default working parameters, the EEPROM IC contains all the compensating parameters, necessary for completing the accurate thermal computations. A certain workflow has to be followed when operating this sensor. The workflow includes calculation of the compensation parameters that are stored in the EEPROM for each element. Those calculations include ambient temperature calculation, pixel offset calculation, pixel to pixel sensitivity difference compensation, object emissivity compensation, and object

temperature calculation. The datasheet of the MLX90640ESF-BAA IR sensor contains these equations, which use the parameters stored in EEPROM. However, this Click board™ is supported by the library, which contains functions that simplify working with this sensor. It should be noted that the sensor measures the IR emissivity of an object, so it is to expect that some materials cannot be accurately measured by this sensor due to their low emissivity, such as the aluminum. To better understand the emissivity property of the materials, a person wearing clothes, can be taken as an example: the measured temperature will reflect the clothes temperature, rather than the body temperature itself, which is known to be about 37 ˚C Care should be taken not to expose the Click board™ to a cold or hot air flow, as it will cause false readings of the real temperature. This sensor requires the temperature across the sensor package to be constant. The MLX90640ESF-BAA IR sensor uses 3.3V for optimal results. While the power for the IR sensor itself is taken from the 3.3V mikroBUS™ rail, in order to support MCUs which use 5V compatible logic levels, the Click board™ comes equipped with PCA9306, a bi-directional I2C level translator IC, produced by Texas Instruments. This allows the logic voltage level to be selected by the SMD jumper labeled as VCC SEL. Besides I2C bus lines, no additional lines of the mikroBUS™ are used. I2C bus lines are routed to the respective pins of the mikroBUS™.

IR Grid 3 Click top side image
IR Grid 3 Click bottom side image

Features overview

Development board

Fusion for ARM v8 is a development board specially designed for the needs of rapid development of embedded applications. It supports a wide range of microcontrollers, such as different ARM® Cortex®-M based MCUs regardless of their number of pins, and a broad set of unique functions, such as the first-ever embedded debugger/programmer over WiFi. The development board is well organized and designed so that the end-user has all the necessary elements, such as switches, buttons, indicators, connectors, and others, in one place. Thanks to innovative manufacturing technology, Fusion for ARM v8 provides a fluid and immersive working experience, allowing access anywhere and under any

circumstances at any time. Each part of the Fusion for ARM v8 development board contains the components necessary for the most efficient operation of the same board. An advanced integrated CODEGRIP programmer/debugger module offers many valuable programming/debugging options, including support for JTAG, SWD, and SWO Trace (Single Wire Output)), and seamless integration with the Mikroe software environment. Besides, it also includes a clean and regulated power supply module for the development board. It can use a wide range of external power sources, including a battery, an external 12V power supply, and a power source via the USB Type-C (USB-C) connector.

Communication options such as USB-UART, USB HOST/DEVICE, CAN (on the MCU card, if supported), and Ethernet is also included. In addition, it also has the well-established mikroBUS™ standard, a standardized socket for the MCU card (SiBRAIN standard), and two display options for the TFT board line of products and character-based LCD. Fusion for ARM v8 is an integral part of the Mikroe ecosystem for rapid development. Natively supported by Mikroe software tools, it covers many aspects of prototyping and development thanks to a considerable number of different Click boards™ (over a thousand boards), the number of which is growing every day.

Fusion for ARM v8 horizontal image

Microcontroller Overview

MCU Card / MCU



8th Generation


ARM Cortex-M4

MCU Memory (KB)


Silicon Vendor


Pin count


RAM (Bytes)


Used MCU Pins

mikroBUS™ mapper

Power Supply
I2C Clock
I2C Data
Power Supply

Take a closer look


IR Grid 3 click Schematic schematic

Step by step

Project assembly

Fusion for PIC v8 front image hardware assembly

Start by selecting your development board and Click board™. Begin with the Fusion for ARM v8 as your development board.

Fusion for PIC v8 front image hardware assembly
Buck 22 Click front image hardware assembly
SiBRAIN for PIC32MZ1024EFK144 front image hardware assembly
v8 SiBRAIN 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 Compiler Selection Step Image hardware assembly
NECTO Output Selection Step Image hardware assembly
Necto image step 6 hardware assembly
Necto image step 7 hardware assembly
Necto image step 8 hardware assembly
Necto image step 9 hardware assembly
Necto image step 10 hardware assembly
Necto PreFlash Image hardware assembly

Track your results in real time

Application Output

After pressing the "FLASH" button on the left-side panel, it is necessary to open the UART terminal to display the achieved results. By clicking on the Tools icon in the right-hand panel, multiple different functions are displayed, among which is the UART Terminal. Click on the offered "UART Terminal" icon.

UART Application Output Step 1

Once the UART terminal is opened, the window takes on a new form. At the top of the tab are two buttons, one for adjusting the parameters of the UART terminal and the other for connecting the UART terminal. The tab's lower part is reserved for displaying the achieved results. Before connecting, the terminal has a Disconnected status, indicating that the terminal is not yet active. Before connecting, it is necessary to check the set parameters of the UART terminal. Click on the "OPTIONS" button.

UART Application Output Step 2

In the newly opened UART Terminal Options field, we check if the terminal settings are correct, such as the set port and the Baud rate of UART communication. If the data is not displayed properly, it is possible that the Baud rate value is not set correctly and needs to be adjusted to 115200. If all the parameters are set correctly, click on "CONFIGURE".

UART Application Output Step 3

The next step is to click on the "CONNECT" button, after which the terminal status changes from Disconnected to Connected in green, and the data is displayed in the Received data field.

UART Application Output Step 4

Software Support

Library Description

This library contains API for IR Grid 3 Click driver.

Key functions:

  • irgrid3_generic_write - This function reads a desired number of data bytes starting from the selected register by using I2C serial interface

  • irgrid3_get_frame_data - This function is used for getting frame data

  • irgrid3_get_pixel_temperature - This function is used for getting pixels temperature.

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 IRGrid3 Click example
 * # Description
 * The demo application displays a reading of ambient temperature and 
 * a 32x24 pixel object temperature matrix.
 * The demo application is composed of two sections :
 * ## Application Init 
 * Configures the click and log objects and sets the click default configuration.
 * ## Application Task  
 * Reads the temperature of all pixels every 500ms 
 * and displays it on USB UART in a form of a 32x24 matrix.
 * @author Stefan Ilic

#include "board.h"
#include "log.h"
#include "irgrid3.h"

static irgrid3_t irgrid3;
static log_t logger;

void application_init ( void ) {
    log_cfg_t log_cfg;  /**< Logger config object. */
    irgrid3_cfg_t irgrid3_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.
    irgrid3_cfg_setup( &irgrid3_cfg );
    IRGRID3_MAP_MIKROBUS( irgrid3_cfg, MIKROBUS_1 );
    err_t init_flag = irgrid3_init( &irgrid3, &irgrid3_cfg );
    if ( I2C_MASTER_ERROR == init_flag ) {
        log_error( &logger, " Application Init Error. " );
        log_info( &logger, " Please, run program again... " );

        for ( ; ; );

    irgrid3_default_cfg ( &irgrid3 );
    Delay_ms( 1000 );
    log_info( &logger, "---- Start measurement ----" );

void application_task ( void ) {
    float px_matrix[ 768 ];
    float temp_ambient;

    irgrid3_get_pixel_temperature( &irgrid3, &temp_ambient, px_matrix );

    log_printf( &logger, "\r\n>> Pixel temperature matrix 32x24 <<\r\n" );
    for ( uint16_t cnt = 1 ; cnt < 769 ; cnt++) {
        log_printf( &logger, "%.2f", px_matrix[ cnt - 1 ] );
        if ( ( ( cnt % 32 ) == 0 ) ) {
            log_printf( &logger, "\r\n" );
        } else {
            log_printf( &logger, " | " );
    log_printf( &logger, "\r\n** Ambient (sensor) temperature is %.2f Celsius\r\n", temp_ambient );
    Delay_ms( 500 );

void main ( void ) {
    application_init( );

    for ( ; ; ) {
        application_task( );

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

Additional Support