ESP8266 (NodeMCU) + CSS811 | CJMCU-811


VCC – 3V3


WAK (wakeup) – GND

SCL – D1

SDA – D2


#include <Arduino.h>

Read basic CO2 and TVOCs on alternate Wire ports

Marshall Taylor @ SparkFun Electronics
Nathan Seidle @ SparkFun Electronics

April 4, 2017

Read the TVOC and CO2 values from the SparkFun CSS811 breakout board

This shows how to begin communication with the sensor on a different Wire port.
Helpful if you have platform that is a slave to a larger system and need
a dedicated Wire port or if you need to talk to many sensors at the same time.

A new sensor requires at 48-burn in. Once burned in a sensor requires
20 minutes of run in before readings are considered good.

Hardware Connections (Breakoutboard to Arduino):
3.3V to 3.3V pin
GND to GND pin
SDA to A4
SCL to A5

Uses Wire.h for i2c operation

Development environment specifics:
Arduino IDE 1.8.1

This code is released under the [MIT License](

Please review the file included with this example. If you have any questions
or concerns with licensing, please contact

Distributed as-is; no warranty is given.
#include <Wire.h>

#include “SparkFunCCS811.h”

//#define CCS811_ADDR 0x5B //Default I2C Address
#define CCS811_ADDR 0x5A //Alternate I2C Address

CCS811 mySensor(CCS811_ADDR);

void setup()
Serial.println(“CCS811 Basic Example”);

Wire.begin(); //Compilation will fail here if your hardware doesn’t support additional Wire ports

//This begins the CCS811 sensor and prints error status of .beginWithStatus()
CCS811Core::CCS811_Status_e returnCode = mySensor.beginWithStatus(Wire); //Pass Wire1 into the library
Serial.print(“CCS811 begin exited with: “);

void loop()
//Check to see if data is ready with .dataAvailable()
if (mySensor.dataAvailable())
//If so, have the sensor read and calculate the results.
//Get them later

//Returns calculated CO2 reading
Serial.print(“] tVOC[“);
//Returns calculated TVOC reading
Serial.print(“] millis[“);
//Simply the time since program start

delay(10); //Don’t spam the I2C bus