Code Monkey home page Code Monkey logo

measuring-concentration-of-co2-in-air-using-arduino-nano-and-mq-135-sensor's Introduction


Interfacing MQ135 Gas Sensor with Arduino

Description

This project demonstrates how to interface the MQ135 Gas Sensor with Arduino to measure CO2 levels in parts per million (ppm). When the CO2 level exceeds a threshold (650 ppm), the display will flash a warning message prompting the user to open a window for ventilation.

Components Used

  • Arduino Nano
  • MQ135 Gas Sensor
  • 128x64 OLED Display (SSD1306)
  • Jumper Wires

Pinout

  • OLED Display:

    • VCC to 5V
    • GND to GND
    • SDA to A4 (SDA on Arduino Nano)
    • SCL to A5 (SCL on Arduino Nano)
  • MQ-135 Sensor:

    • VCC to 5V
    • GND to GND
    • A0 to A0 on Arduino Nano

Pinout If you are wondering why the pinouts are different in the photo its because the photo uses diffent display, i have used 4 pin oled display and have given the pinouts accordingly, refer those.

Calculating the Ro Value of MQ135 Sensor

To calculate the Ro values in clean air, follow these steps:

  1. Download the MQ-135 Library and preheat the sensor for 24 hours before reading the Ro values.
  2. Use the following code to read the Ro values:
#include "MQ135.h"
void setup (){
Serial.begin (9600);
}
void loop() {
MQ135 gasSensor = MQ135(A0); // Attach sensor to pin A0
float rzero = gasSensor.getRZero();
Serial.println (rzero);
delay(1000);
}
  1. Once you have obtained the Ro values, navigate to Documents > Arduino > libraries > MQ135-master folder and open the MQ135.h file.
  2. Change the RLOAD and RZERO values in the file:
/// The load resistance on the board
#define RLOAD 22.0
/// Calibration resistance at atmospheric CO2 level
#define RZERO 5804.99
  1. Scroll down and replace the ATMOCO2 value with the current Atmospheric CO2 level (e.g., 411.29):
/// Atmospheric CO2 level for calibration purposes
#define ATMOCO2 397.13

Installation

  1. Connect the components according to the pinout provided.
  2. Install the required libraries:
  3. Upload the provided Arduino code to your Arduino Nano board.
  4. Open the serial monitor or connect display to view the CO2 readings and warnings when CO2 levels are high.

OLED Display MQ135 Sensor

Future Scope

Integrate the system with home automation platforms like Home Assistant to monitor CO2 levels in closed rooms. Automatically trigger actions such as opening windows or activating ventilation systems when CO2 levels exceed a predefined threshold. (Will probably use an ESP32)

License

This project is licensed under the MIT License - see the LICENSE file for details.


measuring-concentration-of-co2-in-air-using-arduino-nano-and-mq-135-sensor's People

Contributors

bassslapper3390 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.