10 min

Maintain the perfect balance in temperature control with PTMP4718 and STM32L4A6RG

Your vigilant guardian against extremes

Temp Alarm Click with Fusion for ARM v8

Published Nov 15, 2023

Click board™

Temp Alarm Click

Development board

Fusion for ARM v8


NECTO Studio



With our temperature sensor, you can alarm the chill and sound the heat, ensuring that your space is always in the comfort zone. It's the perfect solution for reliable and precise temperature monitoring.



Hardware Overview

How does it work?

Temp Alert Click is based on the PTMP4718, a high-accuracy remote and local temperature sensor from Texas Instruments. It has 1°C accuracy for both the local and the remote channels. The resolution is better for the remote channel (0.125°C compared to the local 1°C). The sensor has a remote diode fault detection, low power consumption, programmable alert limits, and series resistance cancellation. Depending on the application, it can work in an interrupt or comparator mode. In both modes, the alert is asserted at the end of a conversion cycle if the measured temperature exceeds a High Alert Limit or goes below a Low Alert Limit defined in the limit thresholds. It can also work in a shutdown and a continuous conversion mode. The local temperature resolution is 8-bit in a -40 to 125°C

range. The remote temperature accuracy is 11-bit at -55 to 125°C and optimized for a diode-connected MMBT3904 transistor. Temp Alert Click is equipped with this NPN switching transistor from NXP Semiconductor that acts as a remote temperature sensor. There are DN and DP connectors as positive and negative connections for remote sensors. If you do not intend to use the remote temperature sensors at all, you should connect those DP and DN. In case of noise, you can add a 470pF capacitor between DP and DN pins. Temp Alert Click uses a standard 2-Wire U2C interface to communicate with the host MCU, supporting clock frequencies of up to 1MHz. The critical TCR pin will alert the critical temperature, with a threshold set by two 2K resistors to 77°C. According to a datasheet table, you can set this

value by replacing the resistors to up to 125°C. The critical temperature is considered when the temperature exceeds the high or low alert limits. The alert ALR pin is asserted when those temperatures reach the limits. The visual presentation of those two conditions is presented over the NC7WZ14, a Schmitt trigger from ON Semiconductor, which turns ON the T CRIT and ALERT red LEDs. This Click board™ can operate with either 3.3V or 5V logic voltage levels selected via the VCC SEL jumper. This way, both 3.3V and 5V capable MCUs can use the communication lines properly. Also, this Click board™ comes equipped with a library containing easy-to-use functions and an example code that can be used as a reference for further development.

Temp Alarm Click hardware overview 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

Temperature Output
Power Supply
Alert Interrupt
I2C Clock
I2C Data
Power Supply

Take a closer look


Temp Alarm 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 Temp Alarm Click driver.

Key functions:

  • tempalarm_write_reg - Temp Alarm register writing function.

  • tempalarm_read_remote_temperature - Temp Alarm remote sensor read temperature function.

  • tempalarm_set_alarm_high_limit - Temp Alarm remote sensor set limit high temperature function.

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 Temp Alarm Click example
 * # Description
 * This example demonstrates the use of Temp Alarm click board by reading and displaying
 * the temperature measurements and monitoring it.
 * The demo application is composed of two sections :
 * ## Application Init
 * Initializes the driver and sets the Local sensor critical temperature at 30 degC with hysteresis of 1 degC,
 * and Remote sensor alarm temperature at 30 degC.
 * ## Application Task
 * Reads the temperature measurement in degrees Celsius and displays the results on the USB UART
 * approximately once per second. Monitoring alarm and critical state.
 * @author Stefan Ilic

#include "board.h"
#include "log.h"
#include "tempalarm.h"

static tempalarm_t tempalarm;
static log_t logger;

void application_init ( void ) 
    log_cfg_t log_cfg;  /**< Logger config object. */
    tempalarm_cfg_t tempalarm_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.
    tempalarm_cfg_setup( &tempalarm_cfg );
    TEMPALARM_MAP_MIKROBUS( tempalarm_cfg, MIKROBUS_1 );
    if ( I2C_MASTER_ERROR == tempalarm_init( &tempalarm, &tempalarm_cfg ) ) 
        log_error( &logger, " Communication init." );
        for ( ; ; );
    if ( TEMPALARM_ERROR == tempalarm_default_cfg ( &tempalarm ) )
        log_error( &logger, " Default configuration." );
        for ( ; ; );
    log_info( &logger, " Application Task " );

void application_task ( void ) 
    uint8_t flag_data = 0; 
    int8_t local_temp = 0;
    float remote_temp = 0;
    tempalarm_get_alarms( &tempalarm, &flag_data );
        tempalarm_read_temperature( &tempalarm, &local_temp );
        tempalarm_read_remote_temp( &tempalarm, &remote_temp );
        log_printf( &logger, " Local temperature : %d degC \r\n" , ( int16_t ) local_temp );
        log_printf( &logger, " Remote temperature : %.3f degC \r\n" , remote_temp );
        log_printf( &logger, " -------------------------------- \r\n" );
    if ( TEMPALARM_PIN_STATE_LOW == tempalarm_get_alr_pin( &tempalarm ) )
        log_printf( &logger, " Alarm is on, remote temperature  \r\n" );
        log_printf( &logger, "      is higher then 30 degC      \r\n" );
        log_printf( &logger, " -------------------------------- \r\n" );
    if ( TEMPALARM_PIN_STATE_LOW == tempalarm_get_tcr_pin( &tempalarm ) )
        log_printf( &logger, " Alarm is on, local temperature  \r\n" );
        log_printf( &logger, "      is higher then 30 degC      \r\n" );
        log_printf( &logger, " -------------------------------- \r\n" );
    Delay_ms( 1000 );

void main ( void ) 
    application_init( );

    for ( ; ; ) 
        application_task( );

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

Additional Support