TOP Contributors

  1. MIKROE (2693 codes)
  2. Alcides Ramos (362 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (112 codes)
  5. Bugz Bensce (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 (137949 times)
  2. FAT32 Library (70758 times)
  3. Network Ethernet Library (56444 times)
  4. USB Device Library (46825 times)
  5. Network WiFi Library (42586 times)
  6. FT800 Library (41785 times)
  7. GSM click (29468 times)
  8. mikroSDK (27020 times)
  9. PID Library (26661 times)
  10. microSD click (25797 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

CO2 click

Rating:

0

Author: MIKROE

Last Updated: 2024-07-04

Package Version: 2.1.0.14

mikroSDK Library: 2.0.0.0

Category: Gas

Downloaded: 222 times

Not followed.

License: MIT license  

CO2 Click is a compact add-on board that contains Sensirion miniature CO2 sensor. This board features the STC31, a gas concentration sensor designed for high-volume applications. The STC31 utilizes a revolutionized thermal conductivity measurement principle, which results in superior repeatability and long-term stability. The outstanding performance of these sensors is based on Sensirion’s patented CMOSens® sensor technology, which combines the sensor element, signal processing, and digital calibration on a small CMOS chip. It features a digital I2C interface, which makes it easy to connect directly to MCU. This Click board™ represents an ideal choice for health, environmental, industrial, residential monitoring of high CO2 concentrations and applications where reliability is crucial.

No Abuse Reported

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

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

Do you want to report abuse regarding "CO2 click".

  • Information
  • Comments (0)

mikroSDK Library Blog


CO2 click

CO2 Click is a compact add-on board that contains Sensirion’s miniature CO2 sensor. This board features the STC31, a gas concentration sensor designed for high-volume applications. The STC31 utilizes a revolutionized thermal conductivity measurement principle, which results in superior repeatability and long-term stability. The outstanding performance of these sensors is based on Sensirion’s patented CMOSens® sensor technology, which combines the sensor element, signal processing, and digital calibration on a small CMOS chip. It features a digital I2C interface, which makes it easy to connect directly to MCU. This Click board™ represents an ideal choice for health, environmental, industrial, residential monitoring of high CO2 concentrations and applications where reliability is crucial.

CO2_click.png

click Product page


Click library

  • Author : Luka Filipovic
  • Date : Jun 2021.
  • Type : I2C type

Software Support

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

Standard key functions :

  • co2_cfg_setup Config Object Initialization function.

    void co2_cfg_setup ( co2_cfg_t *cfg );
  • co2_init Initialization function.

    err_t co2_init ( co2_t *ctx, co2_cfg_t *cfg );
  • co2_default_cfg Click Default Configuration function.

    err_t co2_default_cfg ( co2_t *ctx );

Example key functions :

  • co2_get_id Read device and serial ID's.

    err_t co2_get_id ( co2_t *ctx );
  • co2_set_reference Set device refrence values for gas calculation.

    err_t co2_set_reference ( co2_t *ctx, uint16_t humidity, uint16_t pressure );
  • co2_read_gas Read CO2 concentration and temperature value.

    err_t co2_read_gas ( co2_t *ctx, float *gas_concentration, float *temperature );

Example Description

This example showcases ability of Click board. It reads ID's configures device for operation work and reads CO2 gas concentration in air and temperature of IC every second.

The demo application is composed of two sections :

Application Init

Initialization of host communication modules (UART, I2C). Checks device and serial ID's from device. Then calls default configuration function that resets device, self tests it selft and configures for measuring CO2 concentration from air.


void application_init ( void ) 
{
    log_cfg_t log_cfg;  /**< Logger 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.
    co2_cfg_setup( &co2_cfg );
    CO2_MAP_MIKROBUS( co2_cfg, MIKROBUS_1 );
    err_t init_flag = co2_init( &co2, &co2_cfg );
    if ( init_flag == I2C_MASTER_ERROR ) 
    {
        log_error( &logger, " Application Init Error. " );
        log_info( &logger, " Please, run program again... " );

        for ( ; ; );
    }

    init_flag = co2_get_id( &co2 );

    if ( ( init_flag < 0 ) && ( co2.device_id != CO2_DEVICE_ID ) )
    {
        log_error( &logger, "ID" );
    }
    else
    {
        log_printf( &logger, " > Device ID: 0x%.8lX\r\n", co2.device_id );
        log_printf( &logger, " > Serial ID: 0x%.8lX%.8lX\r\n", co2.serial_id[ 0 ], co2.serial_id[ 1 ] );
    }

    init_flag = co2_default_cfg ( &co2 );

    if ( init_flag < 0 )
    {
        log_error( &logger, " Default configuration. " );
        log_info( &logger, " Please, run program again... " );

        for ( ; ; );
    }

    //Set reference values for device to calculate gas concentartion.
    if ( CO2_OK != co2_set_reference( &co2, CO2_AIR_HUMIDITY, CO2_AIR_PRESSURE ) )
    {
        log_error( &logger, " Reference values." );
    }

    Delay_ms ( 1000 );
    log_info( &logger, " Application Task " );
}

Application Task

Reads air CO2 gas concentration in precentage and IC's temperature in deg Celzius in span of 1 second and logs data to UART Terminal.


void application_task ( void )
{
    float gas_data = 0;
    float temp_data = 0;

    if ( CO2_OK == co2_read_gas( &co2, &gas_data, &temp_data ) )
    {
        log_printf( &logger, " > CO2[%%]: %.2f\r\n", gas_data );
        log_printf( &logger, " > Temperature[degC]: %.2f\r\n", temp_data );
        Delay_ms ( 1000 );
    }

    Delay_ms ( 1 );
}

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

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

Tamper 2 click

5

Tamper 2 click contains a levered D2HW-A221Dswitch by Omron, which outputs signal in both positions - pressed and released. The most common use of the Tamper 2 click is door opening or closing detection, detecting the end of travel of a linear actuator, a Morse code input device, etc.

[Learn More]

DC Motor 29 click

0

DC Motor 29 Click is a compact add-on board that contains a high-performance DC motor driver. This board features the DRV8245P, an automotive H-Bridge driver with integrated current sense and diagnostic from Texas Instruments. It can be configured as a single full-bridge driver or independent half-bridge driver. The driver offers excellent power handling and thermal capability due to a BiCMOS high power process technology mode, in which it is designed.

[Learn More]

UWB 3 click

0

UWB 3 Click is a compact add-on board that brings Ultra-Wideband communication to your application. This board features the DWM3001, a fully integrated UWB transceiver module from Qorvo. The module integrates the DW3110 IC, nRF52833 MCU, planar UWB antenna, accelerometer, power management, and crystal. It is a fully calibrated, tested, and validated design. This Click board™ makes the perfect solution for the development of precision real-time location systems (RTLS) using two-way ranging or TDoA schemes in various markets, location-aware wireless sensor networks (WSNs), and more.

[Learn More]