Arun IoT 5
Arun IoT 5
Experiment-5
Student Name: Arun UID: 22BET10320
Branch: IT Section/Group: 22BET_IOT_703-B
Semester: 5th Date of Performance: 11/09/2024
Subject Name: IOT LAB Subject Code: 22ITP-329
1. Aim: To Design a weather station by checking Air quality of an environment with the help
of IoT.
2. Objective: The objective of this experiment is to use the MQ-135 sensor to detect and
monitor the concentration of harmful gases in the air. By analyzing the sensor's analog
output, the experiment aims to assess air quality and identify potential contamination. This
helps in determining environmental safety and necessary precautions.
3. Input/Equipment Used: Arduino Uno R3, MQ 135 Air Quality Sensor Module, Jumper
Wire, Arduino IDE
4. Procedure:
• Connect MQ-135 VCC to Arduino 5V.
• Connect MQ-135 GND to Arduino GND.
• Connect MQ-135 AOUT to Arduino analog pin (e.g., A0).
• Connect MQ-135 DOUT to Arduino digital pin (optional, e.g., D2).
• Upload code to Arduino and monitor sensor data via Serial Monitor.
5. Connections:
• VCC to 5V: Connect the MQ-135 VCC pin to the Arduino 5V pin to power the sensor.
• GND to GND: Connect the MQ-135 GND pin to the Arduino GND pin for a common
ground.
• AO to A0: Connect the MQ-135 AO (Analog Output) pin to the Arduino analog pin A0
to read analog sensor values.
• DO to Pin 2: Connect the MQ-135 DO (Digital Output) pin to Arduino digital pin 2 to
use the digital output if needed.
• Common Ground: Ensure that both the MQ-135 sensor and Arduino share a common
ground connection.
• Follow the Diagram: Refer to the connection diagram for accurate wiring between the
MQ-135 module and Arduino.
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING
6. Code:
int sensorValue;
int digitalValue;
void setup()
{ Serial.begin(9600);
pinMode(13, OUTPUT);
pinMode(2, INPUT);
}void loop()
{ sensorValue = analogRead(0);
digitalValue = digitalRead(2);
if (sensorValue > 400)
{
digitalWrite(13, HIGH);
} else
{
digitalWrite(13, LOW);
} Serial.println(sensorValue, DEC);
Serial.println(digitalValue, DEC);
delay(5000); // wait 5000ms for next reading
}
7. Result
8. Conclusion: The MQ-135 air quality sensor is a versatile device used for detecting a
range of gases in the environment, including ammonia (NH3), nitrogen oxides (NOx),
alcohol, benzene, smoke, and carbon dioxide (CO2). The sensor provides an analog output
that corresponds to the concentration of these gases in the air. This output can be read by a
microcontroller, like an Arduino, to assess air quality. If the sensor readings stay within the
normal range, the air quality can be considered safe. However, if the readings rise
significantly, it suggests the presence of potentially harmful substances, and appropriate
actions should be taken to ensure safety. This makes the MQ-135 sensor a useful tool for
monitoring air quality in various settings.
9. Learning Outcomes:
• Connection and integration of the MQ-135 sensor with Arduino UNO.
• Evaluate the role of Air Quality monitoring in real-world scenarios.
• Understand how to interpret and analyze air quality data to assess environmental
conditions.