top of page

CO2 and TVOC sensor

We use the CCS811 sensor to detect CO2 and TVOC

IMG_8794.PNG

CO2 KEYESTUDIO mainly uses the CCS811B chip,  a miniature digital gas sensor that detects a wide range of volatile organic compounds (TVOCs), including equivalent levels of carbon dioxide (CO2) and metal oxide (MOX).

This is the code we used:

#include <CCS811.h>

 

void setup (void) {

  Serial.begin (9600);

  while (sensor.begin ()! = 0) {

   Serial.println ("tete does not work");

   delay (1000);

  }

  sensor.setMeasCycle (sensor.eCycle_250ms);

}

void loop () {

  delay (1000);

  if (sensor.checkDataReady () == true) {

   Serial.print ("CO2:");  

   Serial.println (sensor.getCO2PPM ());  

   Serial.print ("ppm, TVOC:");  

   Serial.print (sensor.getTVOCPPB ());  

   Serial.println ("ppb");

  }

 

  else {

   Serial.println ("Data is not ready!");

  }

 

  sensor.writeBaseLine (0x847B);

  delay (1000);

}

bottom of page