TOP Contributors

  1. MIKROE (2659 codes)
  2. Alcides Ramos (356 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 (136940 times)
  2. FAT32 Library (70063 times)
  3. Network Ethernet Library (56015 times)
  4. USB Device Library (46330 times)
  5. Network WiFi Library (41943 times)
  6. FT800 Library (41264 times)
  7. GSM click (29050 times)
  8. mikroSDK (26465 times)
  9. PID Library (26441 times)
  10. microSD click (25401 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

TempHum 24 click

Rating:

0

Author: MIKROE

Last Updated: 2024-04-03

Package Version: 2.1.0.6

mikroSDK Library: 2.0.0.0

Category: Temperature & humidity

Downloaded: 58 times

Not followed.

License: MIT license  

Temp&Hum 24 Click is a compact add-on board that measures the surrounding environment's humidity and temperature. This board features the HDC3021, an integrated capacitive-based relative humidity and temperature sensor with a removable tape cover from Texas Instruments. The HDC3021 is characterized by its high accuracy (±0.5%RH and ±0.1°C over a wide operating temperature range) and high resolution, providing 16-bit data to the host controller with a configurable I2C interface. Offset Error Correction reduces RH sensor offset due to aging, exposure to extreme operating conditions, and contaminants to return the device to within accuracy specifications.

No Abuse Reported

Do you want to subscribe in order to receive notifications regarding "TempHum 24 click" changes.

Do you want to unsubscribe in order to stop receiving notifications regarding "TempHum 24 click" changes.

Do you want to report abuse regarding "TempHum 24 click".

  • Information
  • Comments (0)

mikroSDK Library Blog


TempHum 24 click

Temp&Hum 24 Click is a compact add-on board that measures the surrounding environment's humidity and temperature. This board features the HDC3021, an integrated capacitive-based relative humidity and temperature sensor with a removable tape cover from Texas Instruments. The HDC3021 is characterized by its high accuracy (±0.5%RH and ±0.1°C over a wide operating temperature range) and high resolution, providing 16-bit data to the host controller with a configurable I2C interface. Offset Error Correction reduces RH sensor offset due to aging, exposure to extreme operating conditions, and contaminants to return the device to within accuracy specifications.

temphum24_click.png

click Product page


Click library

  • Author : Stefan Filipovic
  • Date : Mar 2023.
  • Type : I2C type

Software Support

We provide a library for the TempHum 24 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 TempHum 24 Click driver.

Standard key functions :

  • temphum24_cfg_setup Config Object Initialization function.

    void temphum24_cfg_setup ( temphum24_cfg_t *cfg );
  • temphum24_init Initialization function.

    err_t temphum24_init ( temphum24_t *ctx, temphum24_cfg_t *cfg );
  • temphum24_default_cfg Click Default Configuration function.

    err_t temphum24_default_cfg ( temphum24_t *ctx );

Example key functions :

  • temphum24_read_temp_and_rh This function reads the temperature in celsius and the relative humidity level in percents.

    err_t temphum24_read_temp_and_rh ( temphum24_t *ctx, float *temp, float *hum );
  • temphum24_read_temp_history This function reads the temperature minimum and maximum values since the beginning of the measurements.

    err_t temphum24_read_temp_history ( temphum24_t *ctx, float *temp_min, float *temp_max );
  • temphum24_read_rh_history This function reads the relative humidity minimum and maximum values since the beginning of measurements.

    err_t temphum24_read_rh_history ( temphum24_t *ctx, float *hum_min, float *hum_max );

Example Description

This example demonstrates the use of Temp & Hum 24 click board by reading the temperature and humidity data.

The demo application is composed of two sections :

Application Init

Initializes the driver and performs the click default configuration which resets the device and starts the auto measurement mode with data rate of 1 Hz.


void application_init ( void )
{
    log_cfg_t log_cfg;  /**< Logger config object. */
    temphum24_cfg_t temphum24_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.
    temphum24_cfg_setup( &temphum24_cfg );
    TEMPHUM24_MAP_MIKROBUS( temphum24_cfg, MIKROBUS_1 );
    if ( I2C_MASTER_ERROR == temphum24_init( &temphum24, &temphum24_cfg ) ) 
    {
        log_error( &logger, " Communication init." );
        for ( ; ; );
    }

    if ( TEMPHUM24_ERROR == temphum24_default_cfg ( &temphum24 ) )
    {
        log_error( &logger, " Default configuration." );
        for ( ; ; );
    }

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

Application Task

Reads the temperature (degrees C) and the relative humidity (%RH) data and displays the results on the USB UART approximately once per second. It also reads and displays the minimum and maximum values measured since the beginning of measurements.

void application_task ( void )
{
    float temp = 0, hum = 0;
    if ( TEMPHUM24_OK == temphum24_read_temp_and_rh ( &temphum24, &temp, &hum ) )
    {
        float min_temp = 0, max_temp = 0;
        float min_rh = 0, max_rh = 0;
        log_printf ( &logger, " Temperature: %.2f C\r\n", temp );
        if ( TEMPHUM24_OK == temphum24_read_temp_history ( &temphum24, &min_temp, &max_temp ) )
        {
            log_printf ( &logger, " MIN: %.2f C\r\n MAX: %.2f C\r\n", min_temp, max_temp );
        }
        log_printf ( &logger, "\r\n Humidity: %.1f %%RH\r\n", hum );
        if ( TEMPHUM24_OK == temphum24_read_rh_history ( &temphum24, &min_rh, &max_rh ) )
        {
            log_printf ( &logger, " MIN: %.1f %%RH\r\n MAX: %.1f %%RH\r\n", min_rh, max_rh );
        }
        log_printf ( &logger, "----------------------\r\n" );
        Delay_ms ( 1000 );
    }
}

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.TempHum24

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

3D Hall 11 click

0

3D Hall 11 Click is a compact add-on board used to detect the strength of a magnetic field in all three dimensions. This board features the TMAG5273, a low-power linear 3D Hall-effect sensor from Texas Instruments. A precision analog signal chain alongside an integrated 12-bit ADC digitizes the measured analog magnetic field values and passes them via the I2C interface to the microcontroller for further processing. It can achieve ultra-high precision at speeds up to 20kSPS for faster and more accurate real-time control and has an integrated temperature sensor available for multiple system functions.

[Learn More]

TempHum 9 click

0

Temp-Hum 9 click is a smart temperature and humidity sensing click board™, packed with features that allow simple integration into any design.

[Learn More]

Air Flow click

0

Air Flow Click is a compact add-on board that contains a flow-based 2-in-1 differential pressure sensor. This board features the LHDULTRAM012UB3, LHD ULTRA series micro-flow differential pressure sensor from TE Connectivity Measurement Specialties.

[Learn More]