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]
Rating:
Author: MIKROE
Last Updated: 2024-12-31
Package Version: 2.1.0.1
mikroSDK Library: 2.0.0.0
Category: Gas
Downloaded: 9 times
Not followed.
License: MIT license
Air Quality 12 Click is a compact add-on board for monitoring indoor air quality. This board features the RRH46410, a digital gas sensor module from Renesas, which integrates advanced sensing technology for precise detection of total volatile organic compounds (TVOC), indoor air quality (IAQ), and estimated carbon dioxide levels (eCO2). This module features a MEMS gas sensing element with a metal oxide (MOx) chemiresistor, a CMOS signal conditioning IC, and an onboard MCU, offering a complete, self-contained solution with low power consumption and support for both UART and I2C communication.
Do you want to subscribe in order to receive notifications regarding "Air Quality 12 Click" changes.
Do you want to unsubscribe in order to stop receiving notifications regarding "Air Quality 12 Click" changes.
Do you want to report abuse regarding "Air Quality 12 Click".
DOWNLOAD LINK | RELATED COMPILER | CONTAINS |
---|---|---|
5790_air_quality_12_c.zip [464.80KB] | mikroC AI for ARM GCC for ARM Clang for ARM mikroC AI for PIC mikroC AI for PIC32 XC32 GCC for RISC-V Clang for RISC-V mikroC AI for AVR mikroC AI for dsPIC XC16 |
|
Air Quality 12 Click is a compact add-on board for monitoring indoor air quality. This board features the RRH46410, a digital gas sensor module from Renesas, which integrates advanced sensing technology for precise detection of total volatile organic compounds (TVOC), indoor air quality (IAQ), and estimated carbon dioxide levels (eCO2). This module features a MEMS gas sensing element with a metal oxide (MOx) chemiresistor, a CMOS signal conditioning IC, and an onboard MCU, offering a complete, self-contained solution with low power consumption and support for both UART and I2C communication.
We provide a library for the Air Quality 12 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.
This library contains API for Air Quality 12 Click driver.
airquality12_cfg_setup
Config Object Initialization function.
void airquality12_cfg_setup ( airquality12_cfg_t *cfg );
airquality12_init
Initialization function.
err_t airquality12_init ( airquality12_t *ctx, airquality12_cfg_t *cfg );
airquality12_default_cfg
Click Default Configuration function.
err_t airquality12_default_cfg ( airquality12_t *ctx );
airquality12_get_sensor_info
This function reads the device product ID, firmware version, and tracking number.
err_t airquality12_get_sensor_info ( airquality12_t *ctx, airquality12_info_t *info );
airquality12_get_int_pin
This function returns the INT pin logic state.
uint8_t airquality12_get_int_pin ( airquality12_t *ctx );
airquality12_get_measurement
This function reads the sensor measurement results.
err_t airquality12_get_measurement ( airquality12_t *ctx, airquality12_results_t *results );
This example demonstrates the use of Air Quality 12 Click board by reading the IAQ 2nd Gen measurements and displays the results on the USB UART.
The demo application is composed of two sections :
Initializes the driver and configures the Click board to the default configuration. Then it reads the sensor product ID, firmware version, and the 48-bit tracking number.
void application_init ( void )
{
log_cfg_t log_cfg; /**< Logger config object. */
airquality12_cfg_t airquality12_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.
airquality12_cfg_setup( &airquality12_cfg );
AIRQUALITY12_MAP_MIKROBUS( airquality12_cfg, MIKROBUS_1 );
if ( AIRQUALITY12_OK != airquality12_init( &airquality12, &airquality12_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
if ( AIRQUALITY12_ERROR == airquality12_default_cfg ( &airquality12 ) )
{
log_error( &logger, " Default configuration." );
for ( ; ; );
}
airquality12_info_t info;
if ( AIRQUALITY12_OK == airquality12_get_sensor_info ( &airquality12, &info ) )
{
log_printf( &logger, " ---- Sensor info ----\r\n" );
log_printf( &logger, " Product ID: 0x%.4X\r\n", info.product_id );
log_printf( &logger, " FW version: %u.%u.%u\r\n", ( uint16_t ) info.fw_ver_major,
( uint16_t ) info.fw_ver_minor,
( uint16_t ) info.fw_ver_patch );
log_printf( &logger, " Tracking number: 0x%.2X%.2X%.2X%.2X%.2X%.2X\r\n",
( uint16_t ) info.tracking_num[ 5 ], ( uint16_t ) info.tracking_num[ 4 ],
( uint16_t ) info.tracking_num[ 3 ], ( uint16_t ) info.tracking_num[ 2 ],
( uint16_t ) info.tracking_num[ 1 ], ( uint16_t ) info.tracking_num[ 0 ] );
log_printf( &logger, " ---------------------\r\n" );
}
log_info( &logger, " Application Task " );
}
Checks the data ready interrupt pin and then reads the IAQ 2nd Gen measurements and displays the results on the USB UART. The GP1 LED turns ON during the data reading. The data sample rate is set to 3 seconds for the IAQ 2nd Gen operating mode, and the first 100 samples upon startup should be ignored since the sensor is in the warm-up phase.
void application_task ( void )
{
airquality12_results_t results = { 0 };
if ( airquality12_get_int_pin ( &airquality12 ) )
{
airquality12_set_gp1_pin ( &airquality12, 1 );
if ( AIRQUALITY12_OK == airquality12_get_measurement ( &airquality12, &results ) )
{
log_printf ( &logger, " Sample number: %u\r\n", ( uint16_t ) results.sample_num );
log_printf ( &logger, " IAQ: %.1f\r\n", results.iaq );
log_printf ( &logger, " TVOC: %.2f mg/m^3\r\n", results.tvoc );
log_printf ( &logger, " ETOH: %.2f ppm\r\n", results.etoh );
log_printf ( &logger, " ECO2: %u ppm\r\n", results.eco2 );
log_printf ( &logger, " rel_IAQ: %u\r\n\n", results.rel_iaq );
}
airquality12_set_gp1_pin ( &airquality12, 0 );
}
}
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:
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.