Comparison · Intermediate · 3 min read
CO2 Sensors
MH-Z19, SCD40/41, SCD30 and S8 for Indoor Air Quality
By Geekobot Learning Team · Updated 29 Oct 2026
On this page
CO2 sensors tell you when a room needs fresh air: outdoors is about 420 ppm, under 1000 ppm indoors is good and above 1500 ppm calls for ventilation. NDIR sensors such as the MH-Z19 and SCD30 measure CO2 directly; the Sensirion SCD40 and SCD41 use a compact photoacoustic method. Avoid VOC sensors that only estimate eCO2.
Key specs at a glance
- MH-Z19B / C
- NDIR, UART and PWM, 4.5 to 5.5 V, about 400 to 5000 ppm, 3 min warm-up
- SCD40
- I2C 0x62, 400 to 2000 ppm, small, 2.4 to 5.5 V, also temperature and humidity
- SCD41
- Same as SCD40 with a range up to 5000 ppm and single-shot mode
- SCD30
- NDIR, I2C or UART, 400 to 10000 ppm
- Calibration
- Automatic baseline correction or manual calibration in fresh air
- Response
- 30 seconds to a few minutes
What the numbers mean
CO2 itself is harmless at these levels, but it is a good indicator of how much exhaled air is in a room.
| Level (ppm) | Meaning |
|---|---|
| 400 to 450 | Fresh outdoor air |
| 450 to 1000 | Typical well-ventilated room |
| 1000 to 1500 | Getting stuffy; open a window soon |
| 1500 to 2500 | Poor ventilation; drowsiness and poor focus reported |
| Above 2500 | Ventilate immediately |
- 400 to 450
- Fresh outdoor air
- 450 to 1000
- Typical well-ventilated room
- 1000 to 1500
- Getting stuffy; open a window soon
- 1500 to 2500
- Poor ventilation; drowsiness and poor focus reported
- Above 2500
- Ventilate immediately
Which sensor type
inexpensive, UART and PWM output, needs 5 V and a warm-up. Good for ESP32 and Arduino projects.
tiny, I2C, also reports temperature and humidity, easy to place in a case. Excellent for wall displays.
larger, a wider range and also temperature and humidity.
infrared modules with UART and Modbus for industrial use.
Do not use the eCO2 of a VOC sensor as a CO2 measurement. See the VOC sensors guide.
Reading an MH-Z19 over UART
Send the 9-byte read command and decode the reply. The sketch is for an ESP32 on Serial2 at 9600 baud.
// Sensor TX -> GPIO16, sensor RX -> GPIO17, Vin 5 V, GND
const uint8_t CMD[9] = {0xFF, 0x01, 0x86, 0, 0, 0, 0, 0, 0x79};
void setup() {
Serial.begin(115200);
Serial2.begin(9600, SERIAL_8N1, 16, 17);
}
void loop() {
Serial2.write(CMD, 9);
delay(100);
uint8_t r[9];
if (Serial2.readBytes(r, 9) == 9 && r[0] == 0xFF && r[1] == 0x86) {
int ppm = r[2] * 256 + r[3];
Serial.print("CO2 ppm: "); Serial.println(ppm);
}
delay(5000);
}Warm-up and calibration
Let the sensor warm up for at least the time in the data sheet. Many modules have automatic baseline correction (ABC), which resets the lowest reading of the day to about 420 ppm. This works well in rooms that are aired every day but drifts if the room is always occupied. In that case turn ABC off and do a manual calibration outdoors, or use the sensor's forced recalibration at a known level.
Try it: Adc resolution calculator
Change the values and the diagram and results update as you type.
Common mistakes to avoid
- Reading values straight after power-on.
- Placing the sensor next to your face or a window vent.
- Leaving ABC on in a room that never reaches fresh air.
- Using a VOC sensor's eCO2 instead of a real CO2 reading.
- Powering a 5 V module from 3.3 V.
Frequently asked questions
What CO2 level is bad?
Above 1000 ppm indoors suggests poor ventilation, and above 1500 ppm you should open a window.
MH-Z19 or SCD40?
SCD40 is smaller and gives temperature and humidity too. MH-Z19 is a low-cost UART option.
How often should I calibrate?
With ABC on, it calibrates itself weekly. Without it, check against outdoor air every few months.
Can I use it for safety?
No. These sensors indicate ventilation, not toxic gas levels. Use certified detectors for CO or gas leaks.
Why do my readings jump?
Breath or ventilation changes. Average over a few minutes and place the sensor in free air.
Parts for this guide
Calculators
Terms in this guide
Projects that use it
Put this into practice: 1 step-by-step build in our project library uses parts from this guide.
Keep learning
Sources
- Winsen MH-Z19 data sheet
- Sensirion SCD4x and SCD30 data sheets
- ASHRAE guidance on indoor CO2 as a ventilation indicator
Written by the Geekobot team from manufacturer datasheets. Always check the datasheet for the exact part and variant you buy.




