10 min

Stay on top of temperature fluctuations with BH1900NUX and PIC18F8520

The temperature solution you can trust

Thermo 13 Click with EasyPIC PRO v7

Published Nov 08, 2023

Click board™

Thermo 13 Click

Development board

EasyPIC PRO v7


NECTO Studio



Discover how our temperature measurement solution can help you address temperature challenges and enhance your competitive edge



Hardware Overview

How does it work?

Thermo 13 Click is based on the BH1900NUX, a high accuracy temperature sensor IC with the 2-Wire interface, from ROHM Semiconductor. The Click board™ itself has a reasonably small number of components because most of the measurement circuitry is already integrated on the BH1900NUX sensor. The I2C compatible serial interface lines, along with the INT pin, which also works in the open drain configuration, are pulled up by the onboard resistors. The 2-Wire lines are routed to the respective I2C lines of the mikroBUS™ (SCK and SDA), while the ALERT pin of the sensor IC is routed to the INT pin of the mikroBUS™. The sensor IC uses the I2C compatible communication interface. There are five registers, used to set the high and low temperature limits, temperature hysteresis for the interrupt events, configuration register used to store all the working parameters, read-only register which holds the sampled temperature data, and more. More information about all the registers can be found in the BH1900NUX datasheet. However, provided library contains functions that simplify the use of the Thermo 13 click. The included application example demonstrates their functionality and it can be used as a reference for custom design. An analog signal from the thermal sensor is sampled by the internal ADC converter. Thanks to high

resolution ADC, the step size can be as small as 0.0625°C. The INT pin is used to trigger an interrupt event on the host MCU. This pin has a programmable polarity: it can be set to be asserted either to a HIGH logic level or to a LOW logic level by setting POL bit in the configuration register. Since the Click board™ features a pull-up resistor, it is advised to set the polarity so that the asserted state drives the pin to a LOW logic level. A special mechanism is employed to reduce false ALERT triggering. This mechanism includes queueing of the cycles in which the temperature limit is exceeded The ALERT pin can be set to work in two different modes: Comparator mode and thermostat mode. When working in the Comparator mode, this pin will be triggered whenever a temperature limit is exceeded. The INT pin stays asserted until the temperature drops below the hysteresis level. Both values are set in the respective temperature registers (limit and hysteresis). This mode is useful for thermostat-like applications: it can be used to power down a system in case of overheating or turn off the cooling fan if the temperature is low enough. If set to work in the thermostat mode, the INT pin will stay asserted when the temperature exceeds the value in the high limit register. When the temperature drops below the hysteresis level, the INT pin will be cleared. This mode is

used to trigger an interrupt on the host MCU, which is supposed to read the sensor when the interrupt event is generated. The device can be set to work in several different power modes. It can be set to continuously sample the temperature measurements, it can be set to the shutdown mode. The shutdown mode consumes the least power, keeping all the internal sections but the communication section, unpowered. This allows for a lower power consumption. The design of the Click board™ itself is such that the thermal radiation from other components, which might affect the environmental temperature readings of the sensor, is reduced. The onboard SMD jumper labeled as VCC SEL allows voltage selection for interfacing with both 3.3V and 5V MCUs. Thermo 13 click supports I2C communication interface, allowing it to be used with a wide range of different MCUs. The slave I2C address can be configured by an SMD jumpers, labeled as A0, A1 and A2. They are used to set the last three bis of the I2C address. This Click Board™ is designed to be operated only with up to 3.3V logic levels. Proper conversion of logic voltage levels should be applied, before the Click board™ is used with MCUs operated at 5V.

Thermo 13 Click hardware overview image

Features overview

Development board

EasyPIC PRO v7 is the seventh generation of PIC development boards specially designed to develop embedded applications rapidly. It supports a wide range of 8-bit PIC microcontrollers from Microchip and a broad set of unique functions, such as a powerful onboard mikroProg programmer and In-Circuit debugger over USB-B. 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. With two different connectors for each port, EasyPIC PRO v7 allows you to connect accessory boards, sensors, and custom electronics more efficiently than ever. Each part of the EasyPIC PRO v7 development board contains

the components necessary for the most efficient operation of the same board. An integrated mikroProg, a fast USB 2.0 programmer with mikroICD hardware In-Circuit Debugger, offers many valuable programming/debugging options and seamless integration with the Mikroe software environment. Besides it also includes a clean and regulated power supply block for the development board. It can use a wide range of external power sources, including an external 12V power supply, 7-23V AC or 9-32V DC via DC connector/screw terminals, and a power source via the USB Type-B (USB-B) connector. Communication options such as USB-UART, RS-232, and Ethernet are also included, including the well-established

mikroBUS™ standard, two display options (graphical and character-based LCD), and a standard TQFP socket for the seventh-generation MCU cards. This socket covers a wide range of 8-bit PIC MCUs, from PIC18LF, PIC16LF, PIC16F, and PIC18F families. EasyPIC PRO v7 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.

EasyPIC PRO v7 horizontal image

Microcontroller Overview

MCU Card / MCU



7th Generation



MCU Memory (KB)


Silicon Vendor


Pin count


RAM (Bytes)


Used MCU Pins

mikroBUS™ mapper

Power Supply
I2C Clock
I2C Data

Take a closer look


Thermo 13 Click Schematic schematic

Step by step

Project assembly

EasyPIC PRO v7 front image hardware assembly

Start by selecting your development board and Click board™. Begin with the EasyPIC PRO v7 as your development board.

EasyPIC PRO v7 front image hardware assembly
Buck 22 Click front image hardware assembly
EasyPIC PRO v7 MCUcard with PIC18F8520 front image hardware assembly
EasyPIC PRO v7 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
EasyPIC PRO v7a MCU Selection Necto Step hardware assembly
EasyPIC PRO v7a Display Selection Necto Step 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 Thermo 13 Click driver.

Key functions:

  • thermo13_set_temp_limit - Set temperature limit register

  • thermo13_get_temp_limit - Get temperature register

  • thermo13_get_ambient_temperature_data - Ambient temperature data

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 Thermo13 Click example
 * # Description
 * The application measures temperature
 * The demo application is composed of two sections :
 * ## Application Init 
 * Initializes the driver init, configures the module and
 * reads the temperature Limit LOW/HIGH values that are set.
 * ## Application Task  
 * Reads ambient temperature data and this data logs to USBUART every 1500ms.
 * \author MikroE Team
// ------------------------------------------------------------------- INCLUDES

#include "board.h"
#include "log.h"
#include "thermo13.h"

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

static thermo13_t thermo13;
static log_t logger;

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

void application_init ( void )
    log_cfg_t log_cfg;
    thermo13_cfg_t cfg;
    float temp_limit_low;
    float temp_limit_high;

     * 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

    thermo13_cfg_setup( &cfg );
    thermo13_init( &thermo13, &cfg );

    // Configuration 
    thermo13_configuration( &thermo13, THERMO13_CFG_CONTINUOUS_MEASUREMENT |
                            THERMO13_CFG_FAULT_QUEUE_1 |
                            THERMO13_CFG_ALERT_ACTIVE_HIGH |
                            THERMO13_CFG_INTERRUPT_IS_ACTIVE |
                            THERMO13_CFG_WAIT_TIME_X16 );

    // Temperature Register
    log_printf( &logger, " --- Temperature register data --- \r\n \r\n" );

    temp_limit_low = thermo13_get_temp_limit ( &thermo13, THERMO13_REG_TEMPERATURE_LIMIT_LOW );
    log_printf( &logger, " --- Temp - Limit LOW : %.2f C \r\n ", temp_limit_low );

    temp_limit_high = thermo13_get_temp_limit ( &thermo13, THERMO13_REG_TEMPERATURE_LIMIT_HIGH );
    log_printf( &logger, " --- Temp - Limit HIGH :  %.2f C \r\n \r\n  ", temp_limit_high );
    log_printf( &logger, " --- Ambient temperature measurement --- \r\n " );


void application_task ( void )
    float temperature;

    temperature = thermo13_get_ambient_temperature_data ( &thermo13, THERMO13_TEMP_IN_CELSIUS );
    log_printf( &logger, "** temperature %.2f ** \r\n", temperature );
    log_printf( &logger, " ----------------------------\r\n" );
    Delay_ms ( 1500 );

void main ( void )
    application_init( );

    for ( ; ; )
        application_task( );

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

Additional Support