Skip to content


In this article, we are going to look at a peculiar sensor called the Air Quality Sensor aka Air pollution sensor CCS811. We will touch through the introduction on air quality sensors and related topics such as what are the pollutants and how it is measured etc. and then we will move to the product intro and execution.

All the modules that you require to implement this project are available on our website. Visit Probots.

What is an Air Quality Sensor??

Air pollution sensors are devices that monitor the presence of air pollution in the surrounding area. They can be used in both indoor and outdoor environments.

What kinds of pollutants are measured by Air quality sensors??

Regardless of whether you are measuring inside or outside, there are two major categories of pollution that consumer sensors can monitor:

  • Particulate matter 
  • gases.
This is a Portable Air Quality Monitor Pollution Meter PM 2.5 Detector.

While there are a much wider range and components of airborne pollutants (mold, bacteria, and more), each with different health implications, these are the two categories that most consumer sensors currently can monitor.

Particulate matter (PM)

Particulate matter is a mixture of solid particles and liquid droplets. Some you can see with the naked eye (e.g., visible dust) while others are so small you would need a microscope to see them. Two primary PM size fractions of concern are PM10 (PM with a size up to 10 micrometers) and PM2.5 (size up to 2.5 micrometers).


Many gaseous pollutants can be found both outside and inside. When fuel is burned, whether in the town factory, in your gas stove or furnace, or in your car, gases like carbon monoxide (CO) and nitrogen dioxide (NO2) will form. You may run into these types of gases in your home, too.

How does the Air Quality Sensor work ??

Low-cost sensors use a variety of methods to measure air quality, including lasers to estimate the number and size of particles passing through a chamber and meters to estimate the amount of a gas passing through the sensor.

The sensors generally use algorithms to convert raw data into useful measurements The algorithms may also adjust for temperature, humidity, and other conditions that affect sensor measurements. Higher-quality devices can have other features that improve results, such as controlling the temperature of the air in the sensors to ensure measurements are consistent over time.

Sensors can measure different aspects of air quality depending on how they are deployed. For example, stationary sensors measure pollution in one location, while mobile sensors, such as wearable sensors carried by an individual, reflect exposure at multiple locations.

The Carbon Dioxide Sensors are infrared detection sensors that operate by transmitting an infrared beam through the sample, which absorbs the energy of the beam depending on the concentration of carbon dioxide present, and detecting how much of the infrared beam’s energy is left after passing through the sample and converting that to reading in the concentration of carbon dioxide.

Where are these Air Quality Sensors used??

The obvious applications for this design are used in home appliances and industrial-related applications such as air purifiers. Because developing countries have a significant level of industrialization, measuring air quality reliably and cost-effectively is paramount. 

When the air quality index exceeds a certain threshold, many organizations such as the air quality index of China (AQICN) encourage mask usage to prevent hazardous inhalation of polluted air.

A home consumer solution that accurately measures and reports air quality factors provides significant convenience for residents of developing countries.

Image Source: foobot

Consumer air purifiers can also benefit from incorporating air quality sensors into their designs. Instead of an unintelligent and rudimentary air purification algorithm, enhancements can be added to purify air only if the AQI crosses a preset or programmable threshold. This level of intelligence would reduce the overall power consumption of the design by minimizing the duty cycle of the purification mechanism.

CCS811 Air Quality Sensor

The CCS811 is a low power digital gas sensor solution that integrates a metal oxide (MOX) gas sensor to detect a wide range of Volatile Organic Compounds (VOCs) for indoor air quality monitoring with a microcontroller unit (MCU), which includes an Analog-to-Digital converter (ADC), and an I²C interface.

The integrated MCU manages the sensor drive modes and raw sensor data measured while detecting VOCs. TVOC: Total volatile organic compounds (TVOC) is a group of VOCs used to represent the entire pool of pollutants. Much like particulate matter, the term “VOC” doesn’t refer to a specific substance; instead, it refers to a group of substances that exhibit similar chemical properties. There are thousands of these substances, with some examples including:

  • Benzene
  • Formaldehyde
  • Ethylene glycol
  • Methylene chloride
  • Tetrachloroethylene
  • Toluene

With an I²C digital interface, it simplifies the hardware and software design, enabling faster time to market.

Next we will see the wiring diagram and then move to the Coding section

Wiring Diagram:

Pin Connections Details:


The main intention of the code is to analyze the amount of TVOC and CO2 levels present in the room or any area. 
To see the working of this Air Quality Sensor, we will be using a library from Adafruit. You can just download this library “ADAFRUIT CCS811 LIBRARY” from the manage libraries section in the Arduino IDE


#include "Adafruit_CCS811.h"
Adafruit_CCS811 ccs;
void setup() 
  Serial.println("CCS811 test");
      Serial.println("Failed to start sensor! Please check your wiring.");
    //calibrate temperature sensor
    float temp = ccs.calculateTemperature();
    ccs.setTempOffset(temp - 25.0);
void loop() 
     float temp = ccs.calculateTemperature();
      Serial.print("CO2: ");
      Serial.print("ppm, TVOC: ");
      Serial.print(" ppb, Temp:");


To view the result you can open the serial monitor of the Arduino IDE

All the components used in this article are readily available on our website. Please visit: PROBOTS to buy any components you need to kickstart your project.

Leave a Reply

Your email address will not be published. Required fields are marked *