Beginner
10 min

Achieve precision in monitoring CO2 levels using PASCO2V01BUMA1 and TM4C129ENCPDT

Ensure the air you breathe is always fresh and healthy

CO2 3 Click with Fusion for ARM v8

Published Nov 09, 2023

Click board™

CO2 3 Click

Development board

Fusion for ARM v8

Compiler

NECTO Studio

MCU

TM4C129ENCPDT

Stay ahead in safeguarding health and well-being by measuring CO2 levels using our state-of-the-art solution.

A

A

Hardware Overview

How does it work?

CO2 3 Click is based on the XENSIV™ PASCO2V01BUMA1, the smallest CO2 sensor module from Infineon Technologies that uses photoacoustic spectroscopy technology to measure indoor air quality. The module consists of a gas measuring cell with an infrared (IR) emitter, a high-SNR microphone as the acoustic detector, and an XMC™ microcontroller for data processing, delivering exceptional accuracy, boasting a rate of ±30ppm ±3% of reading. Its diffuser port allows for efficient gas exchange while maintaining dust protection, and its acoustic isolation ensures highly accurate CO2 sensing information. Because of its superior features, this board makes an excellent choice for building automation, smart home appliances, and air quality monitoring, including air purifiers, thermostats, and HVAC systems. Its precise measurements can help optimize indoor air quality, improving human health, productivity, and comfort. As mentioned, the PASCO2V01BUMA1 overcomes the size, performance, and assembly challenges of existing CO2 sensor solutions by using photoacoustic spectroscopy (PAS). It uses pulses of light from an infrared source that pass through an optical filter explicitly tuned to the CO2 absorption wavelength. The CO2 molecules inside the measurement chamber absorb the filtered light, causing the molecules to shake and generate a pressure wave with each pulse, known as the photoacoustic effect. The sound is then detected by an acoustic detector optimized for low-frequency operation,

and the microcontroller converts the output into a CO2 concentration reading. This results in a highly accurate and reliable measurement of CO2 levels in real-time. All significant components of the XENSIV™ PASCO2V01BUMA1 CO2 module are developed in-house according to Infineon's high-quality standards, ensuring the highest quality and performance. The dedicated MCU runs advanced compensation algorithms to deliver direct and reliable ppm readouts of actual CO2 levels. The available configuration options, such as ABOC, pressure compensation, signal alarm, sample rate, and early measurement notification, make this board one of the most versatile plug-and-play CO2 solutions on the market. This Click board™ comes with a configurable host interface that allows communication with MCU using the selected interface. The PASCO2V01BUMA1 can communicate with MCU using the UART interface with commonly used UART RX and TX pins as its default communication protocol operating at 115200bps to transmit and exchange data with the host MCU or using the optional I2C interface. The I2C interface is compatible with the Fast-Mode, allowing a maximum frequency of 400kHz. Selection is made by positioning SMD jumpers marked COMM SEL to the appropriate position. All jumpers must be on the same side, or the Click board™ may become unresponsive. As a third option for communication with the MCU, users have a PWM interface controlled via the PWS pin of the mikroBUS™ socket. The PWS pin is first

asserted after the Power-On boot sequence (not after soft reset), and the level of the pin is checked. If a low level is detected, an internal interrupt routine configures the device into Continuous mode and starts a measurement sequence. At the end of each measurement sequence, the level of this pin is polled. If it is high, the device is configured back to Idle mode. The PWO pin, routed to the AN pin of the mikroBUS™ socket by default, offers the possibility to read out the CO2 concentration by delivering a PWM signal whose timing information contains the CO2 concentration value. At the end of each measurement sequence, the device updates the PWM timing with the measured CO2 concentration. This board also possesses an additional interrupt alert signal, routed on the INT pin of the mikroBUS™ socket, to provide a notification of CO2 measurements that violate programmed thresholds. This Click board™ can only be operated with a 3.3V logic voltage level. Since the sensor module for proper operation requires a voltage level of 12V, this Click board™ also features the TLV61046A, a voltage boost converter to generate a stable 12V supply. The board must perform appropriate logic voltage level conversion before using MCUs with different logic levels. However, the Click board™ comes equipped with a library containing functions and an example code that can be used as a reference for further development.

CO2 3 Click hardware overview image

Features overview

Development board

Fusion for ARM v8 is a development board specially designed for the needs of rapid development of embedded applications. It supports a wide range of microcontrollers, such as different ARM® Cortex®-M based MCUs regardless of their number of pins, and a broad set of unique functions, such as the first-ever embedded debugger/programmer over WiFi. The development board is well organized and designed so that the end-user has all the necessary elements, such as switches, buttons, indicators, connectors, and others, in one place. Thanks to innovative manufacturing technology, Fusion for ARM v8 provides a fluid and immersive working experience, allowing access anywhere and under any

circumstances at any time. Each part of the Fusion for ARM v8 development board contains the components necessary for the most efficient operation of the same board. An advanced integrated CODEGRIP programmer/debugger module offers many valuable programming/debugging options, including support for JTAG, SWD, and SWO Trace (Single Wire Output)), and seamless integration with the Mikroe software environment. Besides, it also includes a clean and regulated power supply module for the development board. It can use a wide range of external power sources, including a battery, an external 12V power supply, and a power source via the USB Type-C (USB-C) connector.

Communication options such as USB-UART, USB HOST/DEVICE, CAN (on the MCU card, if supported), and Ethernet is also included. In addition, it also has the well-established mikroBUS™ standard, a standardized socket for the MCU card (SiBRAIN standard), and two display options for the TFT board line of products and character-based LCD. Fusion for ARM v8 is an integral part of the Mikroe ecosystem for rapid development. Natively supported by Mikroe software tools, it covers many aspects of prototyping and development thanks to a considerable number of different Click boards™ (over a thousand boards), the number of which is growing every day.

Fusion for ARM v8 horizontal image

Microcontroller Overview

MCU Card / MCU

default

Type

8th Generation

Architecture

ARM Cortex-M4

MCU Memory (KB)

1024

Silicon Vendor

Texas Instruments

Pin count

128

RAM (Bytes)

262144

Used MCU Pins

mikroBUS™ mapper

PWM CO2 Concentration
PD0
AN
NC
NC
RST
NC
NC
CS
NC
NC
SCK
NC
NC
MISO
NC
NC
MOSI
Power Supply
3.3V
3.3V
Ground
GND
GND
PWM Interface Control
PL4
PWM
Interrupt
PQ4
INT
UART TX
PK1
TX
UART RX
PK0
RX
I2C Clock
PD2
SCL
I2C Data
PD3
SDA
Power Supply
5V
5V
Ground
GND
GND
1

Take a closer look

Schematic

CO2 3 Click Schematic schematic

Step by step

Project assembly

Fusion for PIC v8 front image hardware assembly

Start by selecting your development board and Click board™. Begin with the Fusion for ARM v8 as your development board.

Fusion for PIC v8 front image hardware assembly
Buck 22 Click front image hardware assembly
SiBRAIN for PIC32MZ1024EFK144 front image hardware assembly
v8 SiBRAIN MB 1 - upright/background hardware assembly
Necto image step 2 hardware assembly
Necto image step 3 hardware assembly
Necto image step 4 hardware assembly
NECTO Compiler Selection Step Image hardware assembly
NECTO Output Selection Step Image hardware assembly
Necto image step 6 hardware assembly
Necto image step 7 hardware assembly
Necto image step 8 hardware assembly
Necto image step 9 hardware assembly
Necto image step 10 hardware assembly
Necto PreFlash Image hardware assembly

Track your results in real time

Application Output

After pressing the "FLASH" button on the left-side panel, it is necessary to open the UART terminal to display the achieved results. By clicking on the Tools icon in the right-hand panel, multiple different functions are displayed, among which is the UART Terminal. Click on the offered "UART Terminal" icon.

UART Application Output Step 1

Once the UART terminal is opened, the window takes on a new form. At the top of the tab are two buttons, one for adjusting the parameters of the UART terminal and the other for connecting the UART terminal. The tab's lower part is reserved for displaying the achieved results. Before connecting, the terminal has a Disconnected status, indicating that the terminal is not yet active. Before connecting, it is necessary to check the set parameters of the UART terminal. Click on the "OPTIONS" button.

UART Application Output Step 2

In the newly opened UART Terminal Options field, we check if the terminal settings are correct, such as the set port and the Baud rate of UART communication. If the data is not displayed properly, it is possible that the Baud rate value is not set correctly and needs to be adjusted to 115200. If all the parameters are set correctly, click on "CONFIGURE".

UART Application Output Step 3

The next step is to click on the "CONNECT" button, after which the terminal status changes from Disconnected to Connected in green, and the data is displayed in the Received data field.

UART Application Output Step 4

Software Support

Library Description

This library contains API for CO2 3 Click driver.

Key functions:

  • co23_get_co2_ppm - CO2 3 get CO2 concentration function.

  • co23_set_meas_cfg - CO2 3 set measurement configuration function.

  • co23_set_pressure_ref - CO2 3 set reference pressure function.

Open Source

Code example

This example can be found in NECTO Studio. Feel free to download the code, or you can copy the code below.

/*!
 * @file main.c
 * @brief CO2 3 Click example
 *
 * # Description
 * This library contains API for CO2 3 Click driver.
 * This driver provides the functions for sensor configuration 
 * and reading the CO2 gas concentration in the air.
 *
 * The demo application is composed of two sections :
 *
 * ## Application Init
 * The initialization of I2C or UART module, log UART, and additional pins.
 * After the driver init, the app executes a default configuration.
 *
 * ## Application Task
 * This example demonstrates the use of the CO2 3 Click board™.
 * The device starts a single measurement sequence,
 * measures and display air CO2 gas concentration (ppm).
 * Results are being sent to the UART Terminal, where you can track their changes.
 *
 * @author Nenad Filipovic
 *
 */

#include "board.h"
#include "log.h"
#include "co23.h"

static co23_t co23;
static log_t logger;

void application_init ( void ) 
{
    log_cfg_t log_cfg;    /**< Logger config object. */
    co23_cfg_t co23_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.
    co23_cfg_setup( &co23_cfg );
    CO23_MAP_MIKROBUS( co23_cfg, MIKROBUS_1 );
    if ( I2C_MASTER_ERROR == co23_init( &co23, &co23_cfg ) ) 
    {
        log_error( &logger, " Communication init." );
        for ( ; ; );
    }
    Delay_ms( 100 );
    
    if ( CO23_ERROR == co23_default_cfg ( &co23 ) )
    {
        log_error( &logger, " Default configuration." );
        for ( ; ; );
    }
    Delay_ms( 100 );
    
    log_info( &logger, " Application Task " );
    log_printf( &logger, "-----------------------\r\n" );
    Delay_ms( 100 );
}

void application_task ( void ) 
{     
    co23_meas_cfg_t meas_cfg;
    meas_cfg.op_mode = CO23_OP_MODE_SINGLE;
    co23_set_meas_cfg( &co23, meas_cfg );
    Delay_ms( 1000 );
    
    uint16_t co2_ppm = 0;
    co23_get_co2_ppm( &co23, &co2_ppm );
    log_printf( &logger, " CO2: %d ppm\r\n", co2_ppm );
    log_printf( &logger, "-----------------------\r\n" );
    Delay_ms( 100 );
}

void main ( void ) 
{
    application_init( );

    for ( ; ; ) 
    {
        application_task( );
    }
}

// ------------------------------------------------------------------------ END

Additional Support

Resources