Component guide · Advanced · 3 min read
Sensirion STC31 Thermal Conductivity CO2 Sensor

0 to 100% vol) and DFRobot Gravity STCC4
By Geekobot Learning Team · Updated 29 Oct 2026
On this page
The Sensirion STC31 measures CO2 by how well a gas mixture conducts heat. It covers 0 to 100 percent volume in nitrogen or air, which suits fermentation, incubators, food packaging and CO2 supply lines rather than room air. It needs temperature, humidity and pressure compensation for accuracy. The DFRobot Gravity STCC4 board uses Sensirion's newer thermal-conductivity CO2 sensor for indoor ranges.
Key specs at a glance
- Principle
- Thermal conductivity
- Range
- 0 to 25% or 0 to 100% vol (STC31 mode setting)
- Interface
- I2C, address 0x29 by default (STC31)
- Supply
- 2.7 to 5.5 V (STC31)
- Compensation
- Feed in RH, temperature and pressure
- Size
- Tiny DFN package
Models in this guide
These are alternatives. Pick the one that fits your project; you only need one.
What the Sensirion STC31 and STCC4 CO2 sensors is
The Sensirion STC31 and STCC4 are tiny thermal-conductivity CO2 sensors; the STC31 measures high CO2 concentrations in gas mixes, and the STCC4 is a low-cost indoor CO2 sensor.
Thermal conductivity sensing works best on two-gas mixtures (CO2 in nitrogen or CO2 in air). Other gases such as helium or hydrogen upset it.
Sensirion's STC3x Arduino library handles the measurement and compensation commands.
Sensirion STC31 and STCC4 CO2 sensors pinout
The pins on the Sensirion STC31 and STCC4 CO2 sensors and what each one does.
| Pin | Function |
|---|---|
| VDD, GND | Power |
| SDA, SCL | I2C |
| ADDR | Address select |
- VDD, GND
- Power
- SDA, SCL
- I2C
- ADDR
- Address select
Wiring the Sensirion STC31 and STCC4 CO2 sensors
Connect the Sensirion STC31 and STCC4 CO2 sensors like this.
| Sensirion STC31 and STCC4 CO2 sensors pin | Arduino Uno | ESP32 |
|---|---|---|
| VDD | 3.3 V | 3.3 V |
| GND | GND | GND |
| SDA | A4 (level shifted) | GPIO 21 |
| SCL | A5 (level shifted) | GPIO 22 |
- VDD
- Arduino Uno:
- 3.3 V
- ESP32:
- 3.3 V
- GND
- Arduino Uno:
- GND
- ESP32:
- GND
- SDA
- Arduino Uno:
- A4 (level shifted)
- ESP32:
- GPIO 21
- SCL
- Arduino Uno:
- A5 (level shifted)
- ESP32:
- GPIO 22
Example code
Check the library version for exact function names; send humidity and pressure for best accuracy.
#include <SensirionI2CStc3x.h>
SensirionI2CStc3x stc;
void setup() {
Serial.begin(115200);
Wire.begin();
stc.begin(Wire);
stc.setBinaryGas(0x0001); // CO2 in air, 0 to 100% vol
}
void loop() {
uint16_t gasTicks, tempTicks;
if (!stc.measureGasConcentration(gasTicks, tempTicks)) {
float co2 = 100.0 * ((float)gasTicks - 16384.0) / 32768.0;
Serial.print(co2, 2); Serial.println(" % vol CO2");
}
delay(1000);
}Setup and tuning
VDD (2.7 to 5.5 V on STC31), GND, SDA and SCL with pull-ups.
use the Sensirion STC3x or STCC4 Arduino library.
feed temperature, humidity and pressure for accurate results.
STC31 versions measure up to 25 % or 100 % CO2 in N2 or air.
keep the sensor in the gas stream but protected from condensation.
What you need
Shop this list6 of 6 found in our store · ₹12,291
Sensirion STC31-C-R3 CO2 Concentration Sensor 0-100% vol – I2C Output: the part this guide coversSensirion STC31-C-R3 CO2 Concentration Sensor 0-100% vol – I2C Output₹3,715
Sensirion STC31-R3 Gas Concentration Sensor 0-100% CO2, I2C Output: another version this guide coversSensirion STC31-R3 Gas Concentration Sensor 0-100% CO2, I2C Output₹6,129
DFRobot Gravity STCC4 True Carbon Dioxide Sensor (3-in-1 Air Quality Monitoring, 400-5000ppm) – Gravity I2C: another version this guide coversDFRobot Gravity STCC4 True Carbon Dioxide Sensor (3-in-1 Air Quality Monitoring, 400-5000ppm) – Gravity I2C₹1,899
ESP32-WROOM-32 38-pin development board: for Wi-Fi logging and dashboardsESP32-WROOM-32 38-Pin Development Board₹389
4-channel logic level converter (BSS138): to connect 5 V and 3.3 V signals safely4-Channel Logic Level Converter (BSS138)₹20
0.96 inch OLED display 128x64: to show readings without a computer0.96" OLED Display 128x64₹139Closest match, check the specs
Alternatives and when to choose them
- SCD4x: room air CO2.
- MH-Z14A and MH-Z16: NDIR up to 10% vol.
- CO2 NDIR sensors: overview.
Common mistakes to avoid
- Skipping compensation.
- Using STC31 for indoor ppm.
- Condensation on the sensor.
- Missing pull-ups.
Frequently asked questions
What is the STC31 used for?
Measuring high CO2 levels in gas mixtures, such as fermentation and breath analysis.
Can the STC31 measure room CO2?
It is better for high concentrations; use the STCC4 or SCD4x for rooms.
Why are readings off?
Temperature, humidity or pressure compensation has not been set.
Is it an NDIR sensor?
No. It measures CO2 by thermal conductivity, not infrared.
Which library should I use?
Use Sensirion's official STC3x or STCC4 Arduino library.
Parts for this guide
Keep learning
Sources
Written by the Geekobot team from manufacturer datasheets. Always check the datasheet for the exact part and variant you buy.
