Close
0%
0%

Measure CO2 Concentration in Air with MQ-135

In the above project, we are going to utilize an MQ-135 sensor with Arduino to estimate CO2 concentration.

Similar projects worth following
1.5k views
0 followers
In this project, we have described how we can use the MQ-135 Sensor with Arduino to measure CO2 concentration.

About Project

0.96’ OLED Display Module

OLED is basically a self light-emitting technology, designed by putting a series of organic thin films between two conductors. When an electric current is applied to these films, a bright light is generated.

OLED Specifications:

  • Driver IC: SSD1306
  • Resolution: 128 x 64
  • Input Voltage: 3.3V ~ 6V
  • Operating temperature: -30°C ~ 70°C

Preparing the MQ-135 Sensor

MQ-135 Gas Sensor is a sensor for recognizing a broad range of gases, involving NH3, benzene, smoke and CO2. It can be bought as a module or just as a sensor alone.

  • 1 × Arduino Nano 33 IoT
  • 1 × MQ-135 Sensor
  • 1 × 0.96’ SPI OLED Display Module
  • 1 × Resistor 22.1k ohm

  • 1
    Run a Program
    // The load resistance on the board #define RLOAD 22.0 #include "MQ135.h" #include #include #include
    #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);
    MQ135 gasSensor = MQ135(A0);
    int val;
    int sensorPin = A0;
    int sensorValue = 0;
    void setup() {
    Serial.begin(9600);
    pinMode(sensorPin, INPUT);
    display.begin(SSD1306_SWITCHCAPVCC);
    display.clearDisplay();
    display.display();
    }
    void loop() {
    val = analogRead(A0);
    Serial.print ("raw = ");
    Serial.println (val);
    // float zero = gasSensor.getRZero();
    // Serial.print ("rzero: ");
    //Serial.println (zero);
    float ppm = gasSensor.getPPM();
    Serial.print ("ppm: ");
    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(ppm);
    display.display();
    display.clearDisplay();
    delay(2000);
    }

View all instructions

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates