Min menu

Pages

project 23 : Interfacing Gravity Infrared CO2 Sensor with Arduino to Measure Carbon Dioxide in PPM

 Interfacing Gravity Infrared CO2 Sensor with Arduino to Measure Carbon Dioxide in PPM 



The expanding grouping of carbon dioxide noticeable all around has become a difficult issue now. As indicated by the NOAA report, the ozone CO2 fixation has arrived at 0.0385 percent (385 ppm) and it is the most noteworthy sum in 2.1 million years. This implies that in 1,000,000 particles of air, there are 385 particles of carbon dioxide. This rising degree of CO2 has influenced the climate gravely and driven us to confront the circumstance like environmental change and a dangerous atmospheric devation. There are many air quality estimating gadgets introduced on streets to tell the CO2 level, yet we can likewise assemble a DIY CO2 estimating gadget and can introduce it in our general vicinity. 

In this instructional exercise, we are going to interface the Gravity Infrared CO2 Sensor with Arduino to quantify the CO2 fixation in PPM. Gravity Infrared CO2 Sensor is a high accuracy simple CO2 sensor. It quantifies the CO2 content in the scope of 0 to 5000 ppm. You can likewise check our past activities where we utilized the MQ135 Gas sensor, Sharp GP2Y1014AU0F Sensor, and Nova PM Sensor SDS011 to construct an air quality screen. 



Components Required 


  • Arduino Nano 
  • Gravity Infrared CO2 Sensor V1.1 
  • Jumper Wires
  • 0.96' SPI OLED Display Module 
  • Breadboard 


Infrared CO2 Sensor Pinout: 

As referenced before, the Infrared CO2 Sensor accompanies a 3-pin connector. The underneath figure and table shows the pin tasks for the Infrared CO2 Sensor:


Pin No.

Pin Name

Description

1SignalAnalog Output (0.4~2V)
2VCCVCC (4.5~5.5V)
3GNDGND
Circuit Diagram 

Circuit Diagram for interfacing Gravity Analog Infrared CO2 Sensor for Arduino is given beneath:




Testing the Interfacing of Gravity Infrared CO2 Sensor with Arduino 


When the equipment and code are prepared, the time has come to test the sensor. For that, associate the Arduino to the PC, select the Board and Port, and hit the transfer button. At that point open your chronic screen and sit tight for quite a while (preheat measure), at that point you'll see the last information.



Code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
int sensorIn = A4;
#include <SPI.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
// Declaration for SSD1306 display connected using software SPI (default case):
#define OLED_MOSI   9
#define OLED_CLK   10
#define OLED_DC    11
#define OLED_CS    12
#define OLED_RESET 13
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT,
  OLED_MOSI, OLED_CLK, OLED_DC, OLED_RESET, OLED_CS);
void setup(){
  Serial.begin(9600);
  // Set the default voltage of the reference voltage
  analogReference(DEFAULT);
  display.begin(SSD1306_SWITCHCAPVCC);
  display.clearDisplay();
  display.display();
}
void loop(){
  //Read voltage
  int sensorValue = analogRead(sensorIn);
  // The analog signal is converted to a voltage
  float voltage = sensorValue*(5000/1024.0);
  if(voltage == 0)
  {
    Serial.println("Fault");
  }
  else if(voltage < 400)
  {
    Serial.println("preheating");
  }
  else
  {
    int voltage_diference=voltage-400;
    float concentration=voltage_diference*50.0/16.0;
    // Print Voltage
    Serial.print("voltage: ");
    Serial.print(voltage);
    Serial.println("mv");
    //Print CO2 concentration
    Serial.print("CO2 Concentration: ");
    Serial.print(concentration);
    Serial.println("ppm");
    display.setTextSize(2);
    display.setTextColor(WHITE);
    display.setCursor(18,43);
    display.println("CO2");
    display.setCursor(63,43);
    display.println("(PPM)");
    display.setTextSize(2);
    display.setCursor(28,5);
    display.println(concentration);
    display.display();
    display.clearDisplay();
  }
  delay(2000);
}
reaction: