TOP Contributors

  1. MIKROE (2658 codes)
  2. Alcides Ramos (355 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (112 codes)
  5. Chisanga Mumba (90 codes)
  6. S P (73 codes)
  7. dany (71 codes)
  8. MikroBUS.NET Team (35 codes)
  9. NART SCHINACKOW (34 codes)
  10. Armstrong Subero (27 codes)

Most Downloaded

  1. Timer Calculator (136918 times)
  2. FAT32 Library (70042 times)
  3. Network Ethernet Library (56008 times)
  4. USB Device Library (46310 times)
  5. Network WiFi Library (41935 times)
  6. FT800 Library (41240 times)
  7. GSM click (29026 times)
  8. PID Library (26435 times)
  9. mikroSDK (26410 times)
  10. microSD click (25389 times)
Libstock prefers package manager

Package Manager

We strongly encourage users to use Package manager for sharing their code on Libstock website, because it boosts your efficiency and leaves the end user with no room for error. [more info]

< Back
mikroSDK Library

Thermo 18 click

Rating:

0

Author: MIKROE

Last Updated: 2024-04-03

Package Version: 2.1.0.10

mikroSDK Library: 2.0.0.0

Category: Temperature & humidity

Downloaded: 74 times

Not followed.

License: MIT license  

Thermo 18 Click is a compact add-on board that provides an accurate temperature measurement. This board features the WSEN-TIDS, a silicon-based, high-precision digital temperature sensor with embedded analog and digital signal processing unit from Würth Elektronik.

No Abuse Reported

Do you want to subscribe in order to receive notifications regarding "Thermo 18 click" changes.

Do you want to unsubscribe in order to stop receiving notifications regarding "Thermo 18 click" changes.

Do you want to report abuse regarding "Thermo 18 click".

  • Information
  • Comments (0)

mikroSDK Library Blog


Thermo 18 click

Thermo 18 Click is a compact add-on board that provides an accurate temperature measurement. This board features the WSEN-TIDS, a silicon-based, high-precision digital temperature sensor with embedded analog and digital signal processing unit from Würth Elektronik.

thermo_18_click.png

click Product page


Click library

  • Author : Luka FIlipovic
  • Date : Aug 2021.
  • Type : I2C type

Software Support

We provide a library for the Thermo18 Click as well as a demo application (example), developed using MikroElektronika compilers. The demo can run on all the main MikroElektronika development boards.

Package can be downloaded/installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on Mikroe github account.

Library Description

This library contains API for Thermo18 Click driver.

Standard key functions :

  • thermo18_cfg_setup Config Object Initialization function.

    void thermo18_cfg_setup ( thermo18_cfg_t *cfg );
  • thermo18_init Initialization function.

    err_t thermo18_init ( thermo18_t *ctx, thermo18_cfg_t *cfg );
  • thermo18_default_cfg Click Default Configuration function.

    err_t thermo18_default_cfg ( thermo18_t *ctx );

Example key functions :

  • thermo18_read_temperature Reads and calculates temperature value.

    err_t thermo18_read_temperature ( thermo18_t *ctx, float *temperature )
  • thermo18_set_temperature_threshold Sets temperature threshold.

    err_t thermo18_set_temperature_threshold ( thermo18_t *ctx, uint8_t threshold_reg, float threshold_limit );
  • thermo18_reset Resets device.

    err_t thermo18_reset ( thermo18_t *ctx );

Example Description

The example application showcases ability of device to read temperature and detect and assert interrupt on undertemperature or overtemperature thresholds.

The demo application is composed of two sections :

Application Init

Initialization of communication modules and interrupt pin. Reads device ID to check comunication. Then resets device, and sets undertemperature and overtemperature thresholds on 24 and 30 degrees Celsius. In the end enables OneShot temperature conversion.


void application_init ( void )
{
    log_cfg_t log_cfg;  /**< Logger config object. */
    thermo18_cfg_t thermo18_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.
    thermo18_cfg_setup( &thermo18_cfg );
    THERMO18_MAP_MIKROBUS( thermo18_cfg, MIKROBUS_1 );
    err_t init_flag = thermo18_init( &thermo18, &thermo18_cfg );
    if ( I2C_MASTER_ERROR == init_flag )
    {
        log_error( &logger, " Application Init Error. " );
        log_info( &logger, " Please, run program again... " );
        for ( ; ; );
    }

    uint8_t temp_data = 0;
    thermo18_generic_read( &thermo18, THERMO18_REG_DEVICE_ID, &temp_data );
    log_printf( &logger, " > ID: 0x%.2X\r\n", ( uint16_t )temp_data );

    if ( THERMO18_DEVICE_ID != temp_data )
    {
        log_error( &logger, " Device ID. " );
        log_info( &logger, " Please, run program again... " );
        for ( ; ; );
    }

    if ( thermo18_default_cfg ( &thermo18 ) )
    {
        log_error( &logger, " Default configuration. " );
        log_info( &logger, " Please, run program again... " );
        for ( ; ; );
    }

    Delay_ms ( 1000 );
    Delay_ms ( 1000 );
    //One shot reading
    thermo18_generic_write( &thermo18, THERMO18_REG_CTRL, THERMO18_CONTROL_ONESHOT_ENABLED );

    log_info( &logger, " Application Task " );
}

Application Task

Checks status to see if the temperature conversion is finished. When it's finished reads and logs calculated temperature data. Then checks if status is asserted for threshold detection, and logs if detected. In the end re-enables OneShot conversion.


void application_task ( void ) 
{
    uint8_t status;
    thermo18_generic_read( &thermo18, THERMO18_REG_STATUS, &status );
    //Check if data is ready
    if ( THERMO18_STATUS_DATA_READY == ( status & THERMO18_STATUS_DATA_BUSY ) )
    {
        //Temperature reading
        float temp = 0.0;
        thermo18_read_temperature( &thermo18, &temp );
        log_printf( &logger, " > Temperature[degC]: %.2f\r\n", temp );
        //Check threshold
        if ( 0 != status )
        {
            if ( THERMO18_STATUS_OVERTEMPERATURE == status )
            {
                log_info( &logger, " Overtemperature Threshold detected." );
            }
            else if ( THERMO18_STATUS_UNDERTEMPERATURE == status )
            {
                log_info( &logger, " Undertemperature Threshold detected." );
            }
        }
        //Re-Enable One shot reading
        thermo18_generic_write( &thermo18, THERMO18_REG_CTRL, THERMO18_CONTROL_ONESHOT_ENABLED );
    }

    Delay_ms ( 300 );
}

The full application code, and ready to use projects can be installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on Mikroe github account.

Other Mikroe Libraries used in the example:

  • MikroSDK.Board
  • MikroSDK.Log
  • Click.Thermo18

Additional notes and informations

Depending on the development board you are using, you may need USB UART click, USB UART 2 Click or RS232 Click to connect to your PC, for development systems with no UART to USB interface available on the board. UART terminal is available in all MikroElektronika compilers.


ALSO FROM THIS AUTHOR

AudioAmp 8 click

0

AudioAmp 8 Click is a compact add-on board that reproduces input audio signal at sound-producing output elements, with desired volume and power levels. This board features the MA12070, a super-efficient audio power amplifier from Infineon Technologies. This I2C configurable audio amplifier is based on proprietary multi-level switching technology, enabling low power loss during operation. It supports a supply voltage range from 4 to 26V, allowing it to be used in many applications. Besides, it is equipped with protection features, allowing a reliable operation.

[Learn More]

EEPROM 7 click

5

EEPROM 7 Click is a compact add-on board that contains the highest-density memory solution.

[Learn More]

3G-EA click

0

3G-EA click is a versatile cellular network communication solution, featuring the compact 3G UMTS/HSPA Quectel UG95 module. This module features a full set of options for the cellular networking and communication, such as the network indication, embedded TCP/UDP stack, HTTP/HTTPS stack, full GSM/GPRS/EDGE implementation, UMTS/HSDPA/HSUPA protocol implementation and more. 3G-EA click features data-rates of 7.2 Mb/s (downlink) and 5.76 Mb/s (uplink) in HSPA mode. Onboard 16bit audio CODEC IC adds high-quality voice communication capability.

[Learn More]