HVAC click
HVAC Click is a compact add-on board that contains Sensirion’s next-generation miniature CO2 sensor. This board features the SCD41, a carbon dioxide sensor build on the photoacoustic sensing principle, and Sensirion’s patented PASens® and CMOSens® technology to offer high accuracy at a minor form factor.
click Product page
Click library
- Author : Stefan Ilic
- Date : Oct 2021.
- Type : I2C type
Software Support
We provide a library for the Hvac 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 Hvac Click driver.
Standard key functions :
hvac_cfg_setup
Config Object Initialization function.
void hvac_cfg_setup(hvac_cfg_t *cfg)
HVAC configuration object setup function.
HVAC Click configuration object.
Definition hvac.h:225
hvac_init
Initialization function.
err_t hvac_init(hvac_t *ctx, hvac_cfg_t *cfg)
HVAC initialization function.
HVAC Click context object.
Definition hvac.h:210
Example key functions :
hvac_sps30_start_measurement
SPS30 start measurement command function.
void hvac_sps30_start_measurement(hvac_t *ctx)
SPS30 start measurement command function.
hvac_sps30_get_ready_flag
SPS30 get ready flag function.
uint8_t hvac_sps30_get_ready_flag(hvac_t *ctx)
SPS30 get ready flag function.
hvac_sps30_read_measured_data
SPS30 read measured data function.
void hvac_sps30_read_measured_data(hvac_t *ctx, mass_and_num_cnt_data_t *m_n_c_data)
SPS30 read measured data function.
HVAC Click mass and number of particles object.
Definition hvac.h:192
Example Description
This is an example that demonstrates the use of the HVAC Click board.
The demo application is composed of two sections :
Application Init
Initialization driver enables - I2C, SCD40: perform factory reset, serial number, features, product type platform type, product version and SPS30: perform start measurement mode, also write log.
{
log_cfg_t log_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
if ( I2C_MASTER_ERROR ==
hvac_init( &hvac, &hvac_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
log_info( &logger, " Application Task " );
Delay_ms ( 1000 );
log_printf( &logger, " Perform Factory Reset \r\n" );
log_printf( &logger, "--------------------------\r\n" );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
log_printf( &logger, " SCD40 - Serial Number : %.4d-%.4d-%.4d \r\n",
log_printf( &logger, "--------------------------\r\n" );
Delay_ms ( 100 );
log_printf( &logger, " SCD40 - Features \r\n" );
log_printf( &logger, " Product Version : %d.%d \r\n",
log_printf( &logger, "--------------------------\r\n" );
Delay_ms ( 100 );
Delay_ms ( 100 );
}
#define HVAC_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition hvac.h:155
#define HVAC_PERFORM_FACTORY_RESET
Definition hvac.h:98
void hvac_scd40_get_feature_set_version(hvac_t *ctx, feature_data_t *f_data)
SCD40 get feature set version function.
void hvac_scd40_get_serial_number(hvac_t *ctx, uint16_t *serial_number)
SCD40 get serial number function.
void hvac_scd40_send_cmd(hvac_t *ctx, uint16_t cmd)
SCD40 send command function.
void application_init(void)
Definition main.c:41
uint16_t ser_num[3]
Definition main.c:39
feature_data_t version_data
Definition main.c:37
uint8_t product_minor_version
Definition hvac.h:184
uint8_t product_major_version
Definition hvac.h:183
uint8_t product_type
Definition hvac.h:181
uint8_t platform_type
Definition hvac.h:182
Application Task
This is an example which demonstrates the use of HVAC Click board. HVAC Click board can be used to measure : Concentration of CO2 in air, Temperature ( degree Celsius ), Relative Humidity ( % ), Mass Concentration of PM1.0, PM2.5, PM4.0, PM10 and Number Concentration of PM0.5, PM1.0, PM2.5, PM4.0 and PM10. All data logs write on USB uart changes.
{
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 100 );
log_printf( &logger, "- - - - - - - - - - - - - \r\n" );
log_printf( &logger, " Mass Concentration : \r\n" );
Delay_ms ( 100 );
log_printf( &logger, "- - - - - - - \r\n" );
log_printf( &logger, " Number Concentration : \r\n" );
log_printf( &logger, "--------------------------\r\n" );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
}
#define HVAC_MEASURE_SINGLE_SHOT
Definition hvac.h:82
#define HVAC_SPS30_NEW_DATA_IS_READY
Definition hvac.h:128
void hvac_scd40_read_measurement(hvac_t *ctx, measuremen_data_t *m_data)
SCD40 read measurement function.
measuremen_data_t hvac_data
Definition main.c:36
void application_task(void)
Definition main.c:95
mass_and_num_cnt_data_t sps30_data
Definition main.c:38
float num_pm_10
Definition hvac.h:201
float num_pm_1_0
Definition hvac.h:198
float mass_pm_10
Definition hvac.h:196
float num_pm_4_0
Definition hvac.h:200
float mass_pm_4_0
Definition hvac.h:195
float mass_pm_2_5
Definition hvac.h:194
float num_pm_2_5
Definition hvac.h:199
float mass_pm_1_0
Definition hvac.h:193
float num_pm_0_5
Definition hvac.h:197
uint16_t co2_concent
Definition hvac.h:168
float r_humidity
Definition hvac.h:170
float temperature
Definition hvac.h:169
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.Hvac
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.