TOP Contributors

  1. MIKROE (2660 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 (137013 times)
  2. FAT32 Library (70139 times)
  3. Network Ethernet Library (56028 times)
  4. USB Device Library (46353 times)
  5. Network WiFi Library (41968 times)
  6. FT800 Library (41295 times)
  7. GSM click (29058 times)
  8. mikroSDK (26495 times)
  9. PID Library (26452 times)
  10. microSD click (25415 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 14 click

Rating:

0

Author: MIKROE

Last Updated: 2024-04-03

Package Version: 2.1.0.11

mikroSDK Library: 2.0.0.0

Category: Temperature & humidity

Downloaded: 58 times

Not followed.

License: MIT license  

Temp & Hum 14 Click is a compact add-on board that contains one of the smallest and most accurate humidity and temperature sensors on the market. This board features the HTU31D, a highly accurate digital relative humidity sensor with temperature output from TE Connectivity. With power consumption down to 3.78μW and accuracy of ±2%RH and ±0.2°C, this Click board™ provides fast response time, precision measurement, low hysteresis, and sustained performance even when exposed to extreme temperature up to 125°C and humidity environments.

No Abuse Reported

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

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

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

  • mikroSDK Library 1.0.0.0
  • Comments (0)

mikroSDK Library Blog


TempHum 14 click

Temp & Hum 14 Click is a compact add-on board that contains one of the smallest and most accurate humidity and temperature sensors on the market. This board features the HTU31D, a highly accurate digital relative humidity sensor with temperature output from TE Connectivity. With power consumption down to 3.78μW and accuracy of ±2%RH and ±0.2°C, this Click board™ provides fast response time, precision measurement, low hysteresis, and sustained performance even when exposed to extreme temperature up to 125°C and humidity environments.

temphum14_click.png

click Product page


Click library

  • Author : Stefan Ilic
  • Date : Jul 2021.
  • Type : I2C type

Software Support

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

Standard key functions :

  • temphum14_cfg_setup Config Object Initialization function.

    void temphum14_cfg_setup ( temphum14_cfg_t *cfg );
  • temphum14_init Initialization function.

    err_t temphum14_init ( temphum14_t *ctx, temphum14_cfg_t *cfg );

Example key functions :

  • temphum14_set_conversion The function set conversion a single temperature and humidity conversion and select data resolution to the HTU31D RH/T SENSOR IC Digital Relative Humidity sensor with Temperature output on the Temp-Hum 14 click board.

    void temphum14_set_conversion ( temphum14_t *ctx, uint8_t hum_osr, uint8_t temp_osr );
  • temphum14_read_t_and_rh The function read temperature and humidity data of the HTU31D RH/T SENSOR IC Digital Relative Humidity sensor with Temperature output on the Temp-Hum 14 click board.

    void temphum14_read_t_and_rh ( temphum14_t *ctx, uint8_t *p_rx_data );
  • temphum14_get_temp_and_hum The function get temperature and humidity value of the HTU31D RH/T SENSOR IC Digital Relative Humidity sensor with Temperature output on the Temp-Hum 14 click board.

    void temphum14_get_temp_and_hum ( temphum14_t *ctx, float *temp, float *hum );

Example Description

This is an example that demonstrates the use of the Temp-Hum 14 Click board. Temp-Hum 14 Click board can be used to measure temperature and relative humidity. All data logs write on USB uart changes every 3 sec.

The demo application is composed of two sections :

Application Init

Initialization driver enables I2C, and hardware reset the device and read the serial number.


void application_init ( void ) {
    log_cfg_t log_cfg;  /**< Logger config object. */
    temphum14_cfg_t temphum14_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_printf( &logger, "-----------------------------\r\n" );
    log_info( &logger, " Application Init " );
    log_printf( &logger, "-----------------------------\r\n" );

    // Click initialization.
    temphum14_cfg_setup( &temphum14_cfg );
    TEMPHUM14_MAP_MIKROBUS( temphum14_cfg, MIKROBUS_1 );
    err_t init_flag = temphum14_init( &temphum14, &temphum14_cfg );
    if ( I2C_MASTER_ERROR == init_flag ) {
        log_error( &logger, " Application Init Error. " );
        log_info( &logger, " Please, run program again... " );

        for ( ; ; );
    }
    Delay_ms ( 100 );
    log_printf( &logger, "-----------------------------\r\n" );
    log_printf( &logger, " Hardware Reset \r\n" );
    temphum14_hw_reset( &temphum14 );
    Delay_ms ( 100 );

    ser_numb = temphum14_get_serial_number( &temphum14 );
    log_printf( &logger, "-----------------------------\r\n" );
    log_printf( &logger, " Serial Number : %lu \r\n", ser_numb );
    log_printf( &logger, "-----------------------------\r\n" );
    log_printf( &logger, " Software Reset \r\n" );
    temphum14_soft_reset( &temphum14 );
    Delay_ms ( 100 );

    temphum14_get_diagnostic( &temphum14, &status_data );
    Delay_ms ( 10 );

    display_diagnostic( );
    Delay_ms ( 100 );

    log_info( &logger, " Application Task " );
    log_printf( &logger, "-----------------------------\r\n" );
}

Application Task

Reading temperature and humidity, and loging it on the USB uart.


void application_task ( void ) {
    temphum14_set_conversion( &temphum14, TEMPHUM14_CONVERSION_HUM_OSR_0_020, TEMPHUM14_CONVERSION_TEMP_0_040 );
    Delay_ms ( 10 );

    temphum14_get_temp_and_hum( &temphum14, &temperature, &humidity );
    Delay_ms ( 10 );

    log_printf( &logger, "  Temperature : %.2f C \r\n", temperature );
    log_printf( &logger, "  Humidity    : %.2f %% \r\n", humidity );
    log_printf( &logger, "-----------------------------\r\n" );
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );
    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.TempHum14

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

Rotary W 2 click

0

Rotary W 2 Click is a compact add-on board that allows you to add a precision input knob to your design. This board features the TLC5925, a low-power 16-channel constant-current LED sink driver from Texas Instruments that, combined with a high-quality rotary encoder from ALPS, the EC12D1564402, allows you to add a precision input knob to your design. It also features an LED ring composed of 16 individual white LEDs that can be used to represent the encoder position more visually.

[Learn More]

CC3100 click

1

CC3100 click is mikroBUS add-on board which caries TI's CC3100MOD WiFi module. Click board uses SPI or UART bus for communication with host MCU.

[Learn More]

MIC24045 click

6

MIC24045 click carries MIC24045 I2C-programmable, high-efficiency, wide input range, 5A synchronous step-down regulator from Microchip. The click is designed to run on either 3.3V or 5V power supply. It communicates with the target microcontroller over I2C interface.

[Learn More]