humidity  2.0.0.0
Main Page

Humidity click

Humidity Click is a compact add-on board used to sense the amount of water vapor in the air. This board features the HIH-5030, an analog output relative humidity sensor from Honeywell Sensing and Productivity Solutions. The HIH-5031 is a covered, condensation-resistant, integrated circuit humidity sensor that is factory-fitted with a hydrophobic filter allowing usage in many condensing environments.

click Product page


Click library

  • Author : Stefan Filipovic
  • Date : Oct 2021.
  • Type : I2C type

Software Support

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

Standard key functions :

Example key functions :

Example Description

This example demonstrates the use of Humidity click board.

The demo application is composed of two sections :

Application Init

Initializes the driver and logger. The I2C communication interface is selected by default.

void application_init ( void )
{
log_cfg_t log_cfg;
humidity_cfg_t humidity_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
// Click initialization.
humidity_cfg_setup( &humidity_cfg );
HUMIDITY_MAP_MIKROBUS( humidity_cfg, MIKROBUS_1 );
if ( HUMIDITY_OK != humidity_init( &humidity, &humidity_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
log_info( &logger, " Application Task " );
}

Application Task

Reads the ADC voltage and then calculates the relative humidity from it. The calculated value of relative humidity in percents is being displayed on the USB UART approximately once per second.

void application_task ( void )
{
float voltage = 0;
if ( HUMIDITY_OK == humidity_read_voltage ( &humidity, &voltage ) )
{
log_printf( &logger, " Relative Humidity [%%RH]: %.2f\r\n\n", humidity_voltage_to_rh( &humidity, voltage ) );
}
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.Humidity

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.


humidity_t
Humidity Click context object.
Definition: humidity.h:128
humidity_voltage_to_rh
float humidity_voltage_to_rh(humidity_t *ctx, float voltage)
Humidity voltage to relative humidity function.
humidity_init
err_t humidity_init(humidity_t *ctx, humidity_cfg_t *cfg)
Humidity initialization function.
application_task
void application_task(void)
Definition: main.c:59
HUMIDITY_OK
@ HUMIDITY_OK
Definition: humidity.h:163
HUMIDITY_MAP_MIKROBUS
#define HUMIDITY_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition: humidity.h:104
humidity_drv_t
humidity_drv_t
Humidity Click driver selector.
Definition: humidity.h:117
application_init
void application_init(void)
Definition: main.c:30
humidity_read_voltage
err_t humidity_read_voltage(humidity_t *ctx, float *voltage)
Humidity read voltage level function.
humidity_cfg_t
Humidity Click configuration object.
Definition: humidity.h:143
humidity_drv_interface_selection
void humidity_drv_interface_selection(humidity_cfg_t *cfg, humidity_drv_t drv_sel)
Humidity driver interface setup function.
humidity_cfg_setup
void humidity_cfg_setup(humidity_cfg_t *cfg)
Humidity configuration object setup function.