CO2 and TVOC Measurement Monitor using Arduino and CCS811 Gas Sensor

Description:

In this project we will detect Carbon Dioxide (CO2) and Total volatile organic compounds(TVOC) in air using CCS811 Gas sensor. We will use Arduino UNO. You can use any other Arduino (Nano, etc…) too.  Output will be seen on 16×2 LCD Display.

Circuit Diagram:

CO2 and TVOC Measurement Monitor using Arduino and CCS811 Gas Sensor
Circuit Diagram: CO2 and TVOC Measurement Monitor using Arduino and CCS811 Gas Sensor

Components:

SR. NO.COMPONENTPINOUT DIAGRAMBUY
1Arduino UNO (Other Arduinos can be used too)Arduino UNO Pinout Diagram⇗
2CCS811 Gas Sensor
316×2 LCD Display
410K Potentiometer
Arduino UNO
Arduino UNO

Arduino UNO

The Arduino UNO is a popular microcontroller board based on the ATmega328P microcontroller. It has 14 digital input/output pins, 6 analog inputs, a 16 MHz quartz crystal, a USB connection, a power jack, an ICSP header, and a reset button. It is designed to be easy to use and provides a simple way to connect sensors and other devices to a computer or other microcontroller board.

In this project, the Arduino UNO is used as the main controller. It reads data from the CCS811 gas sensor and processes the information to measure the levels of CO2 and TVOC in the air. The Arduino UNO also controls the display of the measured data and can be programmed to send notifications or alerts when the levels of CO2 and TVOC exceed a certain threshold. The Arduino UNO acts as the brain of the device, controlling the flow of data between the sensor and the display, and providing a convenient platform for programming the behavior of the device.

CCS811 Air Quality and Gas Sensor
CCS811 Air Quality and Gas Sensor

CCS811 Air Quality and Gas Sensor

The CCS811 gas sensor is a highly accurate and miniature device that is designed to detect and measure levels of carbon dioxide (CO2) and total volatile organic compounds (TVOCs) in the air. It features a metal oxide semiconductor (MOX) sensor, which is sensitive to a wide range of gases and can detect levels as low as parts per billion (ppb). The CCS811 is also equipped with a microcontroller unit (MCU) that can process and transmit the gas data via an I2C interface.

In this project, the CCS811 gas sensor is used to detect and measure levels of CO2 and TVOCs in the air. The sensor is connected to the Arduino UNO microcontroller board, which reads the sensor data and uses it to control the operation of the monitor. The Arduino UNO can also be used to display the gas data on an LCD screen or send it to a computer or mobile device via serial communication. The CCS811 gas sensor, in combination with the Arduino UNO, allows for real-time monitoring of CO2 and TVOC levels, making it a useful tool for monitoring air quality in various settings such as homes, offices, and industrial environments.

Steps and Info:

1. Get correct components as given. You can buy online or offline. I buy electronics components mostly from Amazon.

2. Start connecting the components. If you are new to connecting components in an electronic circuit, then use a Breadboard or you can straight up make connections using Jumper wires but it will create problem when there will be two or more connections needed at one pin (for example two or more different sensors 5V connection to Arduino’s 5V pin). But before soldering components on a PCB or printing a PCB for your circuit, better try using breadboard so that any errors and mistakes can be observed on breadboard and not after soldering. Or do connections in your way.

3. Now after building the circuit, download the Arduino IDE from https://www.arduino.cc/ website.

4. If you are new to Arduino IDE software, then watch this video we made specially for beginners about Arduino IDE.

5. If you know Arduino IDE then straight up copy the code we given and paste it into the Arduino IDE sketch.

6. Connect the Arduino to your Computer/device. Select a proper port, proper Arduino type and whatever other settings are. Here it is Arduino UNO. (If you don’t know what this all is then watch our video: ).

7. Compile the code and Upload it.

8. If any error occurs then try to troubleshoot it by finding/copy-pasting it into our Solve Errors page https://electronicsprojects.in/solve-errors/, or you can straight up paste the error on Internet and you know the rest. Also check if there are no spelling/syntax errors in the code. Compile the code again once to check if errors are fixed. I have given proper connections and code but still nothing is perfect.

9. Once code compiles and uploads smoothly, you can start testing the working of your circuit/project.

10. Turn ON the circuit, check the 16×2 LCD Display and you will see the current amount of CO2 and TVOC in the atmosphere near the CCS811 Gas Sensor.

11. If it doesn’t work, then check connections and code. Also you can talk with me and the community through discord. All the links to social is given at the right side of this page.

Program Code:

/* https://www.electronicsprojects.in CO2 and TVOC Measurement Monitor using Arduino and CCS811 Gas Sensor */

#include <LiquidCrystal.h>
#include "Adafruit_CCS811.h"
LiquidCrystal lcd(7, 6, 5, 4, 3, 2); 
Adafruit_CCS811 ccs;
void setup() {
  lcd.begin(16, 2);  
  ccs.begin();
  while(!ccs.available());
  float temp = ccs.calculateTemperature();
  ccs.setTempOffset(temp - 25.0);
}
void loop() {
  if(ccs.available()){
    float temp = ccs.calculateTemperature();
    if(!ccs.readData()){
      int co2 = ccs.geteCO2();
      int tvoc = ccs.getTVOC();
      lcd.setCursor(0, 0);
      lcd.print(String ("CO2:")+ String (co2)+String(" PPM"));
      
      lcd.setCursor(0, 1);
      lcd.print(String ("TVOC:")+ String (tvoc)+String(" PPB "));
      lcd.print(String("T:"+String (int(temp)))+String("C"));
      delay(2000);
      lcd.clear();      
    }
    else{
      lcd.print("error");
      while(1);
    }
  }
}

Download:

Links:

More: