About CCS811 - CO2 and tVoC sensor
CCS811 manufactured by AMS it's an digital CO2 and tVoC air quality sensor. Main measurement characteristics:
- equivalent carbon dioxide range is 400ppm up to 29206ppm
- equivalent Total Volatile Organic Compounds output range is from 0ppb up to 32768ppb.
- internal compensation algorithm using external ambient temperature and humidity data source
- temperature range for operation -40C to +80C
More info on: CCS811 datasheet
In June 2019 we've released 6 new environmental and air quality sensors, including CCS811 I2C sensor breakout and HDC2010+CCS811 I2C combo sensors breakout, all being part of the s-Sense I2C sensor breakout family.
s-Sense CCS811 sensor breakout by itbrainpower.net


PN: SS-CCS811#I2C SKU: ITBP-6004 CCS811 I2C sensor breakout info
s-Sense HDC2010+CCS811 sensor breakout by itbrainpower.net


PN: SS-HDC2010+CCS811#I2C SKU: ITBP-6006 HDC2010+CCS811 I2C combo sensor breakout info
Next, let's kickstart with CCS811 sensor I2C breakout - around 10-15 minutes. Same hardware and software approach may be used for CCS811 + HDC2010 bundle sensors I2C breakout.
Arduino CCS811 sensor hardware integration (basic wiring)
First, identify if your Arduino it's 5V or 3.3V compliant!
The CCS811 I2C sensor breakout it's shipped in default auto 3-5V compliant configuration. In a nut shell, wire as bellow:
CCS811 breakout | Arduino 5V [Eg.: UNO] | Arduino 3.3V [Eg.: Zero] |
---|---|---|
Vin PAD | 5V | 3.3V |
Vdd PAD (3V3) | do not connect | do not connect |
SDA PAD | SDA | SDA |
SCL PAD | SCL | SCL |
GND PAD | GND | GND |
PAD 6 [on PCB bottom]** | D5 / GND | D5 / GND |
** PAD 6 - CCS811 WAKE signal [placed on PCB bottom side]
- when connected directly to GND, the CCS811 will avoid enter into SLEEP mode [sensor it's always ACTIVE].
- when connected to D5, the MCU host sowtware must be able to control SLEEP/ACTIVE mode switching [see software bellow].
HINT, for some ARDUINO boards:
* SDA (Serial Data) --> A4 on Uno/Pro-Mini, 20 on Mega2560/Due, 2 Leonardo/Pro-Micro
* SCK (Serial Clock) --> A5 on Uno/Pro-Mini, 21 on Mega2560/Due, 3 Leonardo/Pro-Micro
Bellow, sensor wiring examples, left to right, with Arduino UNO and xyz-mIoT shield [AT SAMD21G, 3.3V compliant, with or without modems]:

![CCS811 sensor breakout xyz-mIoT [Arduino zero like] shield wiring :: CLICK TO SEE FULL SIZE CCS811 sensor breakout xyz-mIoT [Arduino zero like] shield wiring](/images/CCS811_Arduino_wiring_xyz-mIoT.jpg)
Arduino CCS811 sensor software
a. download CCS811 Arduino library from: here.
b. unzip the library and install in Arduino libraries folder. Restart Arduino.
c. Make a folder named "ssense_CCS811_example".
Copy the code bellow, paste it one new file and save the file as "ssense_CCS811_example.ino" in the folder created in previously or, you may
download it from here (right click & save as): CCS811 - read sensor data Arduino code
1 | /* s-Sense CCS811 I2C sensor breakout example - v1.0/20190524. |
2 | * |
3 | * Compatible with: |
4 | * s-Sense CCS811 I2C sensor breakout [PN: SS-CCS811#I2C, SKU: ITBP-6004], info https://itbrainpower.net/sensors/CCS811-CO2-TVOC-I2C-sensor-breakout |
5 | * s-Sense CCS811 + HDC2010 I2C sensor breakout [PN: SS-HDC2010+CCS811#I2C, SKU: ITBP-6006], info https://itbrainpower.net/sensors/CCS811-HDC2010-CO2-TVOC-TEMPERATURE-HUMIDITY-I2C-sensor-breakout |
6 | * |
7 | * Reading CO2 and tVOC values example (pulling at 2sec) - based on test software (Beerware license) written by Nathan Seidle from SparkFun Electronics. |
8 | * Thank you Nathan! Great job! |
9 | * |
10 | * We've ported Nathan's functions into a class, add some variables, functions and fuctionalities. |
11 | * |
12 | * |
13 | * Mandatory wiring: |
14 | * Common for 3.3V and 5V Arduino boards: |
15 | * sensor I2C SDA <------> Arduino I2C SDA |
16 | * sensor I2C SCL <------> Arduino I2C SCL |
17 | * sensor GND <------> Arduino GND |
18 | * sensor PAD6 <------> Arduino D5 or Arduino GND [connecting to GND the CCS811 sensor will be always ON] |
19 | * For Arduino 3.3V compatible: |
20 | * sensor Vin <------> Arduino 3.3V |
21 | * For Arduino 5V compatible: |
22 | * sensor Vin <------> Arduino 5V |
23 | * |
24 | * Leave other sensor PADS not connected. |
25 | * |
26 | * SPECIAL note for some ARDUINO boards: |
27 | * SDA (Serial Data) -> A4 on Uno/Pro-Mini, 20 on Mega2560/Due, 2 Leonardo/Pro-Micro |
28 | * SCK (Serial Clock) -> A5 on Uno/Pro-Mini, 21 on Mega2560/Due, 3 Leonardo/Pro-Micro |
29 | * |
30 | * WIRING WARNING: wrong wiring may damage your Arduino board MCU or your sensor! Double check what you've done. |
31 | * |
32 | * New CCS811 sensors requires at 48-burn in. Once burned in a sensor requires 20 minutes of run in before readings are considered good. |
33 | * READ CCS811 documentation! https://itbrainpower.net/downloadables/CCS811_DS000459_5-00.pdf |
34 | * |
35 | * You are legaly entitled to use this SOFTWARE ONLY IN CONJUNCTION WITH s-Sense CCS811 I2C sensors DEVICES USAGE. Modifications, derivates and redistribution |
36 | * of this software must include unmodified this COPYRIGHT NOTICE. You can redistribute this SOFTWARE and/or modify it under the terms |
37 | * of this COPYRIGHT NOTICE. Any other usage may be permited only after written notice of Dragos Iosub / R&D Software Solutions srl. |
38 | * |
39 | * This SOFTWARE is distributed is provide "AS IS" in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
40 | * or FITNESS FOR A PARTICULAR PURPOSE. |
41 | * |
42 | * Dragos Iosub, Bucharest 2019. |
43 | * https://itbrainpower.net |
44 | */ |
45 | |
46 | #define SERIAL_SPEED 19200 |
47 | |
48 | #include <sSense-CCS811.h> |
49 | |
50 | CCS811 ssenseCCS811; |
51 | |
52 | |
53 | void setup() |
54 | { |
55 | DebugPort.begin(SERIAL_SPEED); |
56 | delay(5000); |
57 | DebugPort.println("s-Sense CCS811 I2C sensor."); |
58 | if(!ssenseCCS811.begin(uint8_t(I2C_CCS811_ADDRESS), uint8_t(CCS811_WAKE_PIN), driveMode_1sec)) |
59 | DebugPort.println("Initialization failed."); |
60 | } |
61 | |
62 | void loop() |
63 | { |
64 | ssenseCCS811.setEnvironmentalData((float)(21.102), (float)(57.73)); // replace with temperature and humidity values from HDC2010 sensor |
65 | /*if (ssenseCCS811.dataAvailable()){ |
66 | { |
67 | ssenseCCS811.readAlgorithmResults(); //Calling this function updates the global tVOC and CO2 variables |
68 | |
69 | .....DebugPort.print("CO2["); |
70 | DebugPort.print(ssenseCCS811.getCO2()); |
71 | DebugPort.print("] tVOC["); |
72 | DebugPort.print(ssenseCCS811.gettVOC()); |
73 | DebugPort.print("] millis["); |
74 | DebugPort.print(millis()); |
75 | DebugPort.print("]"); |
76 | DebugPort.println(); |
77 | } |
78 | */ |
79 | if (ssenseCCS811.checkDataAndUpdate()) |
80 | { |
81 | DebugPort.print("CO2["); |
82 | DebugPort.print(ssenseCCS811.getCO2()); |
83 | DebugPort.print("] tVOC["); |
84 | DebugPort.print(ssenseCCS811.gettVOC()); |
85 | DebugPort.print("] millis["); |
86 | DebugPort.print(millis()); |
87 | DebugPort.print("]"); |
88 | DebugPort.println(); |
89 | } |
90 | else if (ssenseCCS811.checkForError()) |
91 | { |
92 | ssenseCCS811.printError(); |
93 | } |
94 | |
95 | delay(2000); |
96 | } |
97 |
c'. The very same code it's available in Arduino "File-> Examples", under "ssense-CCS811" library.
d. Compile and upload the code to your Arduino shield. The sensor data may be seen on Arduino Serial Monitor (set to 19200bps).
Advanced CCS811 Arduino feature [read CO2 and tVoC compensated data - using external temperature and humidity data source]
CCS811 have some interesting features (read datasheet) - one of them being the temperature drift compensation.
In a nut shell, the CCS811 firmware use external temperature and humidity as data source for reading compensation algorithm.
In order to implement this feature, just use in line 59 data supplied by external THS sensor [I suppose you may like to have our CCS811+HDC2010 combo sensor].
TUTORIAL PROVIDED WITHOUT ANY WARRANTY!!! USE IT AT YOUR OWN RISK!!!!