20. CO2 sensor¶

20.1. Introduction¶
CCS811 measures indoor eCO2 and TVOC density. eCO2 stands for equivalent CO2. It indicates the concentration of CO2 that will cause the same level of radiative forcing as the measured ambient air does. TVOC stands for total volatile organic compounds. It is a measurement of the gasses emitted from toxins and chemicals.
20.2. The principle¶
CCS811 is a Metal Oxide Sensor. It measures the resistance of a sensitive layer which is exposed to air. The sensitive layer is heated up.

When it is in clean air, the sensitive layer absorbs oxygen in air. Oxygen attracts free electrons. As a result, there is less flow of electrons in the sensitive layer and the resistance will be high.
When it is in polluted air, oxygen is reduced by the pollutants. Electrons are released and there is more flow of electrons in the sensitive layer. The oxidation will lower the resistance.
The lower resistance is, the higher the reading would be.
20.3. Specification¶
Supply Voltage: 1.8 ~ 3.6V
Supply Current: 30mA
Power Consumption: 60mW
Operating Temperature Range: -5 ~ 50℃
Operating Humidity Range: 10 ~ 95%
eCO2 output range: 400 ~ 8192ppm
TVOC output range: 0 ~ 1187ppb
20.4. Pinout Diagram¶
| Pin | Function |
|---|---|
| G | Ground |
| V | Voltage Supply |
| SDA | Data |
| SDL | Clock |
20.6. Quick to Start/Sample¶
Connect the CO2 sensor to development board (using wire)
Open Makecode, using the https://github.com/SMARTHON/pxt-advancedSensor PXT
Show the CO2 and TVOC on the OLED
20.8. FAQ¶
Q: Why it is not recommended to be used in outdoor environment?
A: Under outdoor environment, traffic and high levels of sun radiation produces ozone. It increases the sensor’s resistance so the sensor will have incorrect reading. Additionally, temperature and relative humidity will affect the sensor resistance. When temperature and relative humidity changes abruptly, baseline resistance is no longer applicable so the sensor will have incorrect reading.
Q: Why the CO2 reading start at 400ppm?
A: 400ppm is the current background CO2 of fresh air.

