With CO2 Module you can easily measure the concentration of carbon dioxide. It is low power device which can be used with battery power. Remember that the device can require calibration and to get best results it has to be in active state for few days.

How It Works

Technically it uses infrared light for measurements. More information on Wikipedia

And how it works within the SDK? As any other BigClown module. There are init, periodical + manual measurements and calibration functions available in the SDK

Recognizable CO2 Module Events

For now there are just two events - error and update.



You can measure the CO2 level manually or periodically. Every measure can trigger function within event handler.

To set periodic measurements, just use this function in your application_init: bc_module_co2_set_update_interval (bc_tick_t interval). interval is time between measurements, in milliseconds.

To make a manual measurement, just use bc_module_co2_measure(void).

To get CO2 concentration from last measurement you have to use this function: bc_module_co2_get_concentration_ppm (float *ppm).




In this example, CO2 levels will be measured and sent to computer every time button is pressed.

#include "bcl.h"
#include "bc_usb_cdc.h"

bc_button_t button;

void button_event_handler(bc_button_t *self, bc_button_event_t event, void *event_param)
    (void) self;
    (void) event_param;

    float ppm = 0.0;

    if (event == BC_BUTTON_EVENT_PRESS)

        char buffer[50];
        sprintf(buffer, "CO2 level: %.4fppm\r\n", ppm);
        bc_usb_cdc_write(buffer, strlen(buffer));

void application_init(void)

    bc_button_init(&button, BC_GPIO_BUTTON, BC_GPIO_PULL_DOWN, false);
    bc_button_set_event_handler(&button, button_event_handler, NULL);
Chapters in this document:
Edit this page

We will inspire you!

You will get regularly our Clownsletter with real projects from other Makers. Do not miss it!

By sign up you will know how even you can inspire others and get €100 discount coupon!