TOP Contributors

  1. MIKROE (2656 codes)
  2. Alcides Ramos (354 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (112 codes)
  5. Chisanga Mumba (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 (136888 times)
  2. FAT32 Library (70022 times)
  3. Network Ethernet Library (56002 times)
  4. USB Device Library (46308 times)
  5. Network WiFi Library (41934 times)
  6. FT800 Library (41209 times)
  7. GSM click (29017 times)
  8. PID Library (26432 times)
  9. mikroSDK (26399 times)
  10. microSD click (25386 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

CO 2 click

Rating:

0

Author: MIKROE

Last Updated: 2024-04-03

Package Version: 2.1.0.16

mikroSDK Library: 2.0.0.0

Category: Gas

Downloaded: 84 times

Not followed.

License: MIT license  

CO 2 click is a very accurate, carbon-monoxide-gas-sensor Click board™, equipped with the SPEC amperometric, 3SP CO 1000 gas sensor which electrochemically reacts with the carbon monoxide (CO).

No Abuse Reported

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

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

Do you want to report abuse regarding "CO 2 click".

  • mikroSDK Library 1.0.0.0
  • Comments (0)

mikroSDK Library Blog


CO 2 click

CO 2 click is a very accurate, carbon-monoxide-gas-sensor Click board™, equipped with the SPEC amperometric,3SP CO 1000 gas sensor which electrochemically reacts with the carbon monoxide (CO).

co2_click.png

click Product page


Click library

  • Author : MikroE Team
  • Date : Dec 2019.
  • 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 form compilers IDE(recommended way), or downloaded from our LibStock, or found on mikroE github account.

Library Description

This library contains API for CO2 Click driver.

Standard key functions :

  • Config Object Initialization function.

    void co2_cfg_setup ( co2_cfg_t *cfg );

  • Initialization function.

    CO2_RETVAL co2_init ( co2_t ctx, co2_cfg_t cfg );

Example key functions :

  • Function reads the converted data (CO) from the 12-bit AD converter.

    void co2_read_adc( co2_t ctx, uint16_t data_out );

  • Function puts the device to enabled or to disabled state.

    void co2_enable( co2_t *ctx, uint8_t state );

  • Function reads the CO converted data and calculates this value to the ppm.

    co2_get_co2_ppm( co2_t ctx, float co2_data );

Examples Description

This application enables usage of very accurate CO sensor.

The demo application is composed of two sections :

Application Init

Initializes I2C interface and performs the device configuration for properly working.


void application_init ( void )
{
    log_cfg_t log_cfg;
    co2_cfg_t cfg;
    uint8_t temp_w;

    /** 
     * 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( &cfg );
    CO2_MAP_MIKROBUS( cfg, MIKROBUS_1 );
    co2_init( &co2, &cfg );

    Delay_ms ( 500 );

    //co2_default_cfg( &co2 );

    temp_w = CO2_WRITE_MODE;
    co2_generic_write( &co2, CO2_LOCK_REG, &temp_w, 1 );
    temp_w = CO2_STANDBY_MODE;
    co2_generic_write( &co2, CO2_MODECN_REG, &temp_w, 1 );
    temp_w = CO2_3500_OHM_TIA_RES | CO2_100_OHM_LOAD_RES;
    co2_generic_write( &co2, CO2_TIACN_REG, &temp_w, 1 );
    temp_w = CO2_VREF_EXT | CO2_50_PERCENTS_INT_ZERO | CO2_BIAS_POL_NEGATIVE | CO2_0_PERCENTS_BIAS;
    co2_generic_write( &co2, CO2_REFCN_REG, &temp_w, 1 );

    log_printf( &logger, "CO 2 is initialized\r\n\r\n" );
    Delay_ms ( 1000 );
}

Application Task

Gets CO (Carbon Monoxide) data as ppm value every 300 miliseconds. Results will be logged on UART. The CO value range is from 0 to 1000 ppm.


void application_task ( void )
{
    float co2_value;

    co2_wait_i2c_ready( &co2 );
    co2_get_co2_ppm( &co2, &co2_value );

    log_printf( &logger, "CO : %.2f ppm\r\n", co2_value );
    Delay_ms ( 300 );
}

The full application code, and ready to use projects can be installed directly form compilers IDE(recommneded) or found on LibStock page or mikroE GitHub accaunt.

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. The terminal available in all Mikroelektronika compilers, or any other terminal application of your choice, can be used to read the message.


ALSO FROM THIS AUTHOR

Pressure 13 click

5

Pressure 13 Click is a compact add-on board that contains an integrated pressure sensor for manifold air pressure measurement applications. This board features the KP229E2701, a miniaturized analog manifold air pressure sensor based on a capacitive principle from Infineon.

[Learn More]

MCP16331 INV click

0

MCP16331 INV click works as a buck-boost voltage regulator, a switching regulator topology that combines principles of the buck conversion (step-down) and the boost conversion (step-up).

[Learn More]

Knob click

0

Knob G click features a combination of high-quality quadrature rotary encoder, and a LED ring composed of 24 individual green LEDs.

[Learn More]