Air Quality Sensor CCS811 Arduino Hookup

Last Updated on March 16, 2024

Air Quality Sensing and Monitoring becomes Vital task now a days because of the pollution. To design a Air quality sensing system we need robust and reliable air quality sensor. The Air Quality sensor CCS811 from ams has good features to measure the air quality parameters.




The air quality sensor CCS811 Senses a wide range of total volatile organic compounds (TVOCs), that includes equivalent carbon dioxide (eCO2) and metal oxide (mox) levels. This sensor breakout board can be easily interfaced with Arduino and other microcontrollers having I2C communications.

Arduino Hookup

Sensor CCS811

The Air Quality sensor CCS811 has integrated MCU and provides on board processing and comes with LGA package (tiny!) 2.7 x 4.0 mm, it requires minimum external components. This sensor is intended for indoor air quality sensing and it can be utilized in wearable electronic devices, smart phones, and home automation & security devices.

Arduino – CCS811 breakout board

The CCS811 Air quality breakout from sparkfun provides better possibilities to interface with micro controllers and Arduino development boards and it has optional NTC thermistor pin. To interface this breakout with Arduino we need only four wires and we can get basic readings from sensor.

Connect breakout board’s 3.3V to Arduino 3.3V pin and Gnd to Gnd pin of Arduino board, then connect SDA to A4 and SCL to A5 pin of Arduino board. Utilize the Sparkfunccs811 arduino library for better output response.

After uploading the code use serial monitor of Arduino IDE to get readings and  A new sensor requires at 48-burn in. Once burned in a sensor requires 20 minutes of run in before readings are considered good.

Arduino Code

 

/******************************************************************************  
https://github.com/sparkfun/CCS811_Air_Quality_Breakout  
https://github.com/sparkfun/SparkFun_CCS811_Arduino_Library  
******************************************************************************/
#include "SparkFunCCS811.h"

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

CCS811 mySensor(CCS811_ADDR);

void setup()
{
  Serial.begin(9600);
  Serial.println("CCS811 Basic Example");

  //It is recommended to check return status on .begin(), but it is not
  //required.
  CCS811Core::status returnCode = mySensor.begin();
  if (returnCode != CCS811Core::SENSOR_SUCCESS)
  {
    Serial.println(".begin() returned with an error.");
    while (1); //Hang if there was a problem.
  }
}

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
    mySensor.readAlgorithmResults();

    Serial.print("CO2[");
    //Returns calculated CO2 reading
    Serial.print(mySensor.getCO2());
    Serial.print("] tVOC[");
    //Returns calculated TVOC reading
    Serial.print(mySensor.getTVOC());
    Serial.print("] millis[");
    //Simply the time since program start
    Serial.print(millis());
    Serial.print("]");
    Serial.println();
  }

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

Going further

1.Sparkfun Air quality sensor CCS811 Breakout board

2.http://ams.com/eng/Products/Environmental-Sensors/Air-Quality-Sensors/CCS811

3.https://github.com/sparkfun/SparkFun_CCS811_Arduino_Library




Leave a Reply

Your email address will not be published. Required fields are marked *