Ire 212 Lab5
Ire 212 Lab5
Ire 212 Lab5
LAB REPORT: 05
COURSE NO.-IRE 212
IoT Architecture and Technologies
04-11-2024
SUBMITTED TO:
Suman Saha
Assistant Professor
Department of IRE, SUBMITTED BY:
BDU
Koushik Biswas
ID: 2101029
Department of IRE,
BDU
Session: 2021-2022
Page: 01
LAB INTRODUCTION
OBJECTIVE:
The primary objective of this project is to develop a low-cost, reliable air quality
monitoring device using Arduino that can measure and display air quality
indicators, including gas concentration, temperature, and humidity levels. This
device aims to make air quality data accessible and understandable to the general
public.
Software Tool:
Arduino IDE
Hardware:
List of Programs:
Problem NO: 01
Theory:
The Air Quality Monitoring System (AQMS) is an Arduino-based project designed to
assess environmental air quality and display key information such as temperature,
humidity, and pollution levels. This system provides real-time monitoring of air
quality, which is crucial for raising public awareness about pollution levels and
helping people make informed health decisions. The project uses the Air Quality
Index (AQI), a standardized metric that simplifies understanding of air quality and
its potential health impacts.
To interface the Arduino Uno with the MQ135 gas sensor for the Air Quality
Monitoring System, follow these steps. The MQ135 sensor will allow the Arduino
to read and analyze the concentration of various gases in the air, which will be used
to assess the air quality.
Page: 03
Connection Diagram
Pin Connections:
1. Connect the VCC pin of the MQ135 to the 5V pin on the Arduino.
2. Connect the GND pin of the MQ135 to the GND pin on the Arduino.
3. Connect the AO pin of the MQ135 to the A0 analog input pin on the
Arduino.
Circuit Diagram
Page: 04
This experimental study's goal is to use the DHT22 sensor to measure and evaluate
the temperature and humidity in a given space. The purpose of the experiment is
to assess the DHT22 sensor's response time, accuracy, and dependability in
recording environmental conditions. This study also aims to show how DHT21
sensor data can be gathered, analyzed, and displayed for real-world uses like IoT
devices and climate control systems.
Humidity Sensing: The DHT22 uses a capacitive sensor element that detects
moisture by measuring changes in capacitance. This data is then converted to a
humidity percentage.
• Temperature Sensing: The DHT22 uses a thermistor to measure temperature. The
thermistor's resistance varies with temperature, which is converted into a
temperature reading.
Code in C++:
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <DHT.h>
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
#define OLED_RESET 4
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
#define sensor A0
#define DHT11PIN 2
#define DHTTYPE DHT11 // Specify the DHT sensor type
int gasLevel = 0;
String quality = "";
DHT dht(DHT11PIN, DHTTYPE); // Create an instance of DHT
void sendSensor() {
float h = dht.readHumidity();
float t = dht.readTemperature();
if (isnan(h) || isnan(t)) {
Serial.println("Failed to read from DHT sensor!");
return;
}
// Display on OLED
display.setTextColor(WHITE);
display.setTextSize(1);
display.setFont();
display.setCursor(0, 43);
display.println("Temp :");
display.setCursor(80, 43);
display.println(t);
display.setCursor(114, 43);
display.println("C");
display.setCursor(0, 56);
display.println("RH :");
display.setCursor(80, 56);
display.println(h);
display.setCursor(114, 56);
display.println("%");
Page: 07
void air_sensor() {
gasLevel = analogRead(sensor);
// Display on OLED
display.setTextColor(WHITE);
display.setTextSize(1);
display.setCursor(1, 5);
display.setFont();
display.println("Air Quality:");
display.setTextSize(1);
display.setCursor(5, 23);
display.println(gasLevel);
display.setCursor(20, 23);
display.println(quality);
void setup() {
Page: 08
Serial.begin(9600);
pinMode(sensor, INPUT);
dht.begin(); // Initialize the DHT sensor
if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3c)) {
Serial.println(F("SSD1306 allocation failed"));
}
display.clearDisplay();
display.setTextColor(WHITE);
display.setTextSize(2);
display.setCursor(50, 0);
display.println("Air");
display.setTextSize(1);
display.setCursor(23, 20);
display.println("Quality monitor");
display.display();
delay(1200);
display.clearDisplay();
display.setTextSize(1.5);
display.setCursor(20, 20);
display.println("BY Circuit");
display.setCursor(20, 40);
display.println("Digest");
display.display();
delay(1000);
display.clearDisplay();
}
void loop() {
display.clearDisplay();
air_sensor();
sendSensor();
display.display();
delay(2000);
}
Page: 09
Output:
Conclusion:
The Arduino-based Air Quality Monitoring System is a practical and effective
solution for monitoring environmental conditions in real-time. By providing
accessible and understandable air quality data, it enables users to respond to adverse
air quality conditions, contributing to public health and environmental awareness.