airquality8 2.0.0.0
Main Page

Air Quality 8 click

‍Air quality 8 Click is a compact add-on board containing a best-in-class air-quality sensing solution. This board features the ZMOD4510, a fully calibrated digital sensor solution that detects air quality in various indoor and outdoor applications from Renesas. The ZMOD4510 comes with selective ozone measurement capabilities, offering visibility into the air quality in users' environments for a personalized experience. This Click boardâ„¢ is an I2C configurable and characterized by outstanding long-term stability and lifetime. Many additional features such as low power consumption, wide NO2 and O3 detection range, and high sensitivity make this Click boardâ„¢ an excellent choice for detecting unhealthy conditions in outdoor air, such as personal air-quality monitor, HVAC, and other various air quality-related applications.

click Product page


Click library

  • Author : Nenad Filipovic
  • Date : Sep 2021.
  • Type : I2C type

Software Support

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

Standard key functions :

Example key functions :

  • airquality8_calc_oaq Air Quality 8 calculates AQI function.
    float airquality8_calc_oaq ( float *rmox, uint8_t rcda_strategy, uint8_t gas_detection_strategy );
    float airquality8_calc_oaq(float *rmox, uint8_t rcda_strategy, uint8_t gas_detection_strategy)
    Air Quality 8 calculates AQI function.
  • airquality8_read_rmox Air Quality 8 calculate rmox resistance function.
    err_t airquality8_read_rmox ( airquality8_t *ctx, float *rmox, uint16_t mox_lr, uint16_t mox_er );
    err_t airquality8_read_rmox(airquality8_t *ctx, float *rmox, uint16_t mox_lr, uint16_t mox_er)
    Air Quality 8 calculate rmox resistance function.
  • airquality8_start_measurement Air Quality 8 start measurement function.
    err_t airquality8_start_measurement(airquality8_t *ctx)
    Air Quality 8 start measurement function.

Example Description

‍This library contains API for Air Quality 8 Click driver. The library initializes and defines the I2C bus drivers to write and read data from registers. The library also includes a function for configuring sensor and measurement, read and calculate mox resistance ( RMOX ) and air quality index ( AQI ), etc.

The demo application is composed of two sections :

Application Init

‍Initialization of I2C module and log UART, and additional pins. After the driver inits and executes a default configuration, the app read product ID and configuration parameters, initializes the sensor and measurement.

void application_init ( void )
{
log_cfg_t log_cfg;
airquality8_cfg_t airquality8_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
// Click initialization.
airquality8_cfg_setup( &airquality8_cfg );
AIRQUALITY8_MAP_MIKROBUS( airquality8_cfg, MIKROBUS_1 );
if ( I2C_MASTER_ERROR == airquality8_init( &airquality8, &airquality8_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
if ( AIRQUALITY8_ERROR == airquality8_default_cfg ( &airquality8 ) )
{
log_error( &logger, " Default configuration." );
for ( ; ; );
}
Delay_ms ( 100 );
static uint8_t cfg_data[ 6 ];
static uint8_t prod_data[ 5 ];
static uint16_t pid;
airquality8_get_sensor_info( &airquality8, &cfg_data[ 0 ], &prod_data[ 0 ], &pid );
if ( pid != AIRQUALITY8_PRODUCT_ID )
{
status_flag = AIRQUALITY8_ERROR_I2C;
display_error( );
for ( ; ; );
}
Delay_ms ( 100 );
log_printf( &logger, "---------------------------\r\n" );
log_printf( &logger, " Product ID : 0x%.2X \r\n", pid );
Delay_ms ( 100 );
airquality8_init_sensor( &airquality8, &mox_lr, &mox_er );
Delay_ms ( 10 );
Delay_ms ( 10 );
log_printf( &logger, "---------------------------\r\n" );
log_info( &logger, " Application Task " );
log_printf( &logger, "---------------------------\r\n" );
log_printf( &logger, " Air Quality Index\r\n" );
log_printf( &logger, "- - - - - - - - - - - - - -\r\n" );
Delay_ms ( 100 );
}
@ AIRQUALITY8_ERROR
Definition airquality8.h:195
@ AIRQUALITY8_ERROR_I2C
Definition airquality8.h:198
#define AIRQUALITY8_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition airquality8.h:143
#define AIRQUALITY8_PRODUCT_ID
Air Quality 8 product ID.
Definition airquality8.h:91
err_t airquality8_get_sensor_info(airquality8_t *ctx, uint8_t *cfg_data, uint8_t *prod_data, uint16_t *pid)
Air Quality 8 get sensor info function.
err_t airquality8_init_measurement(airquality8_t *ctx)
Air Quality 8 init measurement function.
err_t airquality8_init_sensor(airquality8_t *ctx, uint16_t *mox_lr, uint16_t *mox_er)
Air Quality 8 init sensor function.
void application_init(void)
Definition main.c:77

Application Task

‍This is an example that demonstrates the use of the Air Quality 8 Click boardâ„¢. In this example, the app performs the start of the measurement, reads an array of the 15 mox resistances measurements ( RMOX ), and calculates the air quality index ( AQI ), the app also, displays if an error occurs. Results are being sent to the Usart Terminal where you can track their changes.

void application_task ( void )
{
static uint8_t status_data;
static float rmox;
static float rmox_seq[ 15 ];
static float aqi;
status_flag = airquality8_start_measurement( &airquality8 );
airquality8_get_status( &airquality8, &status_data );
Delay_ms ( 10 );
{
airquality8_get_status( &airquality8, &status_data );
Delay_ms ( 10 );
}
for ( uint8_t n_cnt = 0; n_cnt < 15; n_cnt++ )
{
status_flag = airquality8_read_rmox( &airquality8, &rmox, mox_lr, mox_er );
rmox_seq[ n_cnt ] = rmox;
Delay_ms ( 100 );
if ( status_flag != AIRQUALITY8_OK )
{
display_error( );
}
}
log_printf( &logger, " \tAQI : %.3f \r\n", aqi );
log_printf( &logger, "---------------------------\r\n" );
Delay_ms ( 1000 );
}
@ AIRQUALITY8_OK
Definition airquality8.h:194
#define AIRQUALITY8_STATUS_LAST_SEQ_STEP_MASK
Definition airquality8.h:116
#define AIRQUALITY8_GAS_DETECTION_STRATEGY_AUTO
Air Quality 8 gas detection strategy setting.
Definition airquality8.h:97
#define AIRQUALITY8_RCDA_STRATEGY_ADJ
Definition airquality8.h:107
err_t airquality8_get_status(airquality8_t *ctx, uint8_t *status)
Air Quality 8 get status function.
void application_task(void)
Definition main.c:143

Additional Function

  • display_error This function displays error messages.
    static void display_error ( void );

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

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.