

The CCS811 (Keyestudio Part ID: KS0457) is a digital gas sensor designed to measure indoor air quality. It detects levels of carbon dioxide (CO2) and total volatile organic compounds (TVOCs) in the environment. The sensor integrates a metal oxide (MOX) gas sensor and a microcontroller with an analog-to-digital converter (ADC) to provide accurate and reliable air quality data. Communication with the CCS811 is achieved via the I2C interface, making it easy to integrate into various microcontroller-based systems.








The following table outlines the key technical details of the CCS811 sensor:
| Parameter | Value |
|---|---|
| Operating Voltage | 3.3V to 5V |
| Interface | I2C |
| CO2 Measurement Range | 400 ppm to 8192 ppm |
| TVOC Measurement Range | 0 ppb to 1187 ppb |
| Power Consumption | 1.2 mW (typical) |
| Operating Temperature Range | -40°C to 85°C |
| Humidity Range | 10% to 95% RH (non-condensing) |
| Dimensions | 20mm x 20mm x 3.2mm |
The CCS811 module has the following pinout:
| Pin | Name | Description |
|---|---|---|
| 1 | VIN | Power supply input (3.3V to 5V). |
| 2 | GND | Ground connection. |
| 3 | SDA | I2C data line. Used for communication with the microcontroller. |
| 4 | SCL | I2C clock line. Used for communication with the microcontroller. |
| 5 | INT | Interrupt pin. Can be used to signal when new data is available (optional). |
| 6 | RST | Reset pin. Pull low to reset the sensor (optional, typically not required). |
0x5A. Ensure no other devices on the I2C bus share this address.Below is an example code snippet to read CO2 and TVOC values from the CCS811 using the Adafruit CCS811 library:
#include <Wire.h>
#include "Adafruit_CCS811.h"
// Create an instance of the CCS811 sensor
Adafruit_CCS811 ccs;
void setup() {
Serial.begin(9600); // Initialize serial communication
Serial.println("CCS811 Air Quality Sensor Test");
if (!ccs.begin()) {
Serial.println("Failed to start CCS811 sensor! Check connections.");
while (1);
}
// Wait for the sensor to be ready
while (!ccs.available());
}
void loop() {
if (ccs.available()) {
if (!ccs.readData()) {
// Read CO2 and TVOC values
Serial.print("CO2: ");
Serial.print(ccs.geteCO2());
Serial.print(" ppm, TVOC: ");
Serial.print(ccs.getTVOC());
Serial.println(" ppb");
} else {
Serial.println("Error reading data from CCS811 sensor.");
}
}
delay(1000); // Wait 1 second before the next reading
}
Sensor Not Detected on I2C Bus:
0x5A) matches the address used in your code.Incorrect or Unstable Readings:
Error Reading Data:
Q: Can the CCS811 measure outdoor air quality?
A: The CCS811 is optimized for indoor air quality monitoring. It may not provide accurate readings in outdoor environments due to varying conditions.
Q: How often should I calibrate the sensor?
A: The CCS811 is factory-calibrated and does not require user calibration. However, ensure proper burn-in and warm-up periods for accurate results.
Q: Can I use the CCS811 with a 3.3V microcontroller?
A: Yes, the CCS811 is compatible with both 3.3V and 5V systems. Ensure the VIN pin is supplied with the appropriate voltage.
Q: What is the lifespan of the CCS811 sensor?
A: The sensor has a typical lifespan of 5 years under normal operating conditions.