Beginner
10 min

Achieve reliable thermo data storage with SE97B and PIC18F24K50

Temperature records, your way

Temp-Log 4 Click with EasyPIC v8

Published Nov 01, 2023

Click board™

Temp-Log 4 Click

Dev. board

EasyPIC v8

Compiler

NECTO Studio

MCU

PIC18F24K50

Customize and access your temperature records effortlessly with our solution's built-in EEPROM memory, designed to meet your unique requirements.

A

A

Hardware Overview

How does it work?

Temp-Log 4 Click is based on the SE97B, a temperature sensor with integrated EEPROM from NXP. This IC is used to convert the temperature measurement into digital information. Besides the thermal sensor, this IC also features 256 bytes of EEPROM on the same die. It is compliant with the JEDEC specification JC42.4-TSE2002B1 since it is designed specifically for DRAM DIMMs (Dual In-line Memory Modules), allowing the Serial Presence Detect (SPD) feature. However, it is not limited to this role only: it can be used as a very accurate general-purpose thermometer with the added benefit of integrated EEPROM, reducing the number of physical ICs required to design a temperature logging application. Temp-Log 4 click utilizes the I2C serial interface (SMBus compatible), which allows it to be used in a wide range of applications. The temperature sensor section includes all the features typically found on such ICs. The band gap thermal sensor is sampled by a 11-bit delta-sigma A/D converter. It is sampled about 10 times per second, and the thermal value is placed on the double-buffered output register. This prevents data corruption if access to the output registry is attempted during the conversion

process. The specified accuracy of the temperature sensor is typically ±2 °C in the range from -40 °C to +125 °C, further improving near the operating temperature of DIMM, within the range between +40 °C to +125 °C. The SE97B IC features the CAPABILITY register. This register is a read-only register and it provides some general information, such as the factory-specified accuracy in the upper-temperature range (+75°C to +95°C and +40°C to +125°C), measurement range, resolution, and other parameters of the sensor. Its description, along with the description of other registers, can be found in the SE97B IC datasheet. The SE97B IC is fully configurable. It contains a set of registers for configuring the thermal sensor, the upper and the lower thermal limit, as well as the critical temperature. This IC features a very usable interrupt engine, designed mainly to support SPD functionality, but it can be utilized for much wider range of applications. The #EVENT pin is an open-drain, active-LOW pin used to alert the host microcontroller (MCU) or some other circuit, whether the programmed thresholds have been exceeded, or a critical temperature level has been reached. The SE97B

allows two EVENT modes: the interrupt mode, and the comparator mode. The interrupt mode can be used in the embedded applications controlled by a MCU, while the comparator mode is used to directly control a circuit, since unlike the interrupt mode, it does not require the software to clear both the temperature and the EEPROM section have their own I2C address. The I2C address is determined by four fixed bit values, while the last three bits (LSBs) are determined by the logic states applied to A2, A1, and A0. While A0 and A1 address are hard-wired to a LOW logic level on this Click board™, the value of the A2 address bit can be changed by switching the SMD jumper labeled as ADDR SEL to either 0 (tied to GND) or 1 (tied to VCC). The datasheet of the SE97B offers a table with the content of these four bits for each section of the IC. Temp-Log 4 click uses the I2C communication interface. It has pull-up resistors connected to the mikroBUS™ 3.3V rail. A proper conversion of logic voltage levels should be applied before the Click board™ is used with MCUs operated with 5V.

Temp-Log 4 Click hardware overview image

Features overview

Development board

EasyPIC v8 is a development board specially designed for the needs of rapid development of embedded applications. It supports many high pin count 8-bit PIC microcontrollers from Microchip, regardless of their number of pins, and a broad set of unique functions, such as the first-ever embedded debugger/programmer. 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, EasyPIC v8 provides a fluid and immersive working experience, allowing access anywhere and under any

circumstances at any time. Each part of the EasyPIC v8 development board contains the components necessary for the most efficient operation of the same board. In addition to the advanced integrated CODEGRIP programmer/debugger module, which offers many valuable programming/debugging options and seamless integration with the Mikroe software environment, the board 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 DEVICE, and CAN are also included, including the well-established mikroBUS™ standard, two display options (graphical and character-based LCD), and several different DIP sockets. These sockets cover a wide range of 8-bit PIC MCUs, from the smallest PIC MCU devices with only eight up to forty pins. EasyPIC 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.

EasyPIC v8 horizontal image

Microcontroller Overview

MCU Card / MCU

default

Architecture

PIC

MCU Memory (KB)

16

Silicon Vendor

Microchip

Pin count

28

RAM (Bytes)

2048

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
RB1
INT
NC
NC
TX
NC
NC
RX
I2C Clock
RC3
SCL
I2C Data
RC4
SDA
NC
NC
5V
Ground
GND
GND
2

Take a closer look

Click board™ Schematic

Temp-Log 4 Click Schematic schematic

Step by step

Project assembly

EasyPIC v8 front image hardware assembly

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

EasyPIC v8 front image hardware assembly
Rotary B 2 Click front image hardware assembly
MCU DIP 28 hardware assembly
EasyPIC v8 28pin-DIP - 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 DIP 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

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 4 Click driver.

Key functions:

  • templog4_write_reg - Generic Write function.

  • templog4_read_reg - Generic Read function.

  • templog4_set_addr_ptr - Set Address Pointer function.

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 TempLog4 Click example
 * 
 * # Description
 * This application measures the temperature
 *
 * The demo application is composed of two sections :
 * 
 * ## Application Init 
 * Initializes I2C interface and performs a device configuration for properly working.
   Also sets the temperature limit to the desired values.
 * 
 * ## Application Task  
 * First ensures that the minimum conversion time is met, and then reads the
   ambient temperature calculated to the Celsius degrees.
   Also checks the limit status and shows a message when some limit condition is met.
 * 
 * \author MikroE Team
 *
 */
// ------------------------------------------------------------------- INCLUDES

#include "board.h"
#include "log.h"
#include "templog4.h"

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

static templog4_t templog4;
static log_t logger;

static uint8_t ret_status;

// ------------------------------------------------------- ADDITIONAL FUNCTIONS

void static check_limit_status ( )
{
    if ( ( ret_status & 0x80 ) != 0x00 )
    {
        log_printf( &logger, "** Critical temperature detection! **\r\n" );
    }
    if ( ( ret_status & 0x40) != 0x00 )
    {
        log_printf( &logger, "** Ambient temperature is higher than upper limit temperature! **\r\n" );
    }
    else if ( ( ret_status & 0x20) != 0x00 )
    {
        log_printf( &logger, "** Ambient temperature is lower than lower limit temperature! **\r\n" );
    }
}

void static wait_conversion_done ( )
{
    uint8_t time_cnt;

    for ( time_cnt = 0; time_cnt < 13; time_cnt++ )
    {
        Delay_10ms( );
    }
}

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

void application_init ( )
{
    log_cfg_t log_cfg;
    templog4_cfg_t cfg;

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

    templog4_cfg_setup( &cfg );
    TEMPLOG4_MAP_MIKROBUS( cfg, MIKROBUS_1 );
    templog4_init( &templog4, &cfg );
    templog4_default_cfg ( &templog4 );
}

void application_task ( )
{
    float temperature;

    wait_conversion_done( );

    ret_status = templog4_get_temp( &templog4, TEMPLOG4_TEMP_AMBIENT_REG, &temperature );

    log_printf( &logger, "** Ambient temperature: %f C **\r\n", temperature );

    check_limit_status( );

    log_printf( &logger, "\r\n", temperature );

    Delay_ms( 300 );
}

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.