0% found this document useful (0 votes)
34 views9 pages

Environmental Monitoring System - 20241223 - 134722 - 0000

The document outlines the development of an IoT-based Environmental Monitoring System designed to measure air quality, temperature, and pressure using specific sensors. It includes details on the system's components, software, execution flow, and GUI code, emphasizing real-time data acquisition for improved environmental awareness. The project aims to provide a cost-effective solution for monitoring environmental parameters, beneficial for both residential and industrial applications.

Uploaded by

beme2345114
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views9 pages

Environmental Monitoring System - 20241223 - 134722 - 0000

The document outlines the development of an IoT-based Environmental Monitoring System designed to measure air quality, temperature, and pressure using specific sensors. It includes details on the system's components, software, execution flow, and GUI code, emphasizing real-time data acquisition for improved environmental awareness. The project aims to provide a cost-effective solution for monitoring environmental parameters, beneficial for both residential and industrial applications.

Uploaded by

beme2345114
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

ENVIRONMENTAL MONITORING SYSTEM

ME2405-L
THERMODYNAMICS

GUI BASE
ENVIRONMENTAL MONITORING SYSTEM

COURSE INSTRUCTOR:
MUHAMMAD ADEEL

GROUP MEMBERS:
MIRZA SAMEER 2345114
SYED MINHAAL 2345125
RAJ ARYAN 2346124
M SHAYAAN KHAN 2345121
TABLE OF
CONTENTS

01 04
Problem Statement GUI Code

01 05
Objective GUI Display

02 06
Component Calculation Formula's

02 06
Software Circuit Diagram

03 07
Execution Flow Conclusion

07
Reference

Department Of Mechatronics, Szabist University


PROBLEM
STATEMENT
Air quality, temperature, and pressure are crucial environmental factors that directly
impact human health and daily activities. With increasing urbanization and
industrial activities, air pollution is rising, leading to severe health risks like
respiratory diseases. There is a need for a cost-effective, real-time monitoring
system that provides actionable insights into these parameters to help mitigate
adverse effects.

OBJECTIVE
The objective of this project is to design and implement an IoT-based monitoring
system capable of measuring:

Air quality (using the MQ135 sensor),


Temperature (using the BMP280 sensor),
Pressure (using the BMP280 sensor).

This system will provide real-time data to


enable users to make informed decisions to
improve environmental and health conditions.

Department Of Mechatronics, Szabist University


COMPONENTS
01 — BME 280 Sensor
Measures temperature and atmospheric pressure.

02 — MQ-135 Sensor
Measures air quality in parts per million (PPM).

03 — Arduino UNO
Microcontroller used to process sensor data.

04 — Jumper Wires
Connect components on the breadboard and Arduino.

05 — Breadboard
Used to connect components for prototyping.

SOFTWARE
06 — Spyder(tkinter,pyserial)
Used to make GUI that display the sensor value in running time.

Department Of Mechatronics, Szabist University


EXECUTION FLOW
INITIALIZATION:
The Arduino initializes the serial communication
and checks the connectivity of the BMP280
sensor.

The BMP280 sensor is configured to normal


mode with appropriate sampling and filtering
settings.

DATA ACQUISITION:
The MQ135 sensor reads the analog values and calculates
the air quality in PPM.

The BMP280 sensor collects temperature and pressure


data.

DATA PROCESSING
The collected data is processed using the respective
sensor libraries.

The data is displayed on the serial monitor in real time.

OUTPUT
Air Quality, Temperature,and pressure
readings are updated every 2 seconds.

Department Of Mechatronics, Szabist University


GUI CODE (TKINTER, PYSERIAL)
# GUI setup
import tkinter as tk
root = tk.Tk()
from tkinter import ttk
root.title("ENVIRONMENT MONITORING SYSTEM")
from tkinter import messagebox
root.geometry("400x300")
import serial
root.resizable(False,False)
import threading
# Gradient background
gradient_canvas = tk.Canvas(root, width=400, height=300,
# Serial port configuration
highlightthickness=0)
SERIAL_PORT = 'COM8' # Replace with your port
gradient_canvas.pack(fill="both", expand=True)
BAUD_RATE = 9600
create_gradient(gradient_canvas, (255, 204, 204), (204, 229,
255)) # Light pink to light blue
# Initialize serial connection
try:
# Labels and Variables
ser = serial.Serial(SERIAL_PORT, BAUD_RATE, timeout=1)
air_quality_label_var = tk.StringVar(value="N/A")
except serial.SerialException as e:
temp_label_var = tk.StringVar(value="N/A")
ser = None
pressure_label_var = tk.StringVar(value="N/A")
print(f"Error opening serial port: {e}")

# Title
# Function to read serial data
title_label = ttk.Label(root, text="ENVIRONMENT", font=
def read_serial_data():
("Arial", 20, "bold"), background="#ffcccc")
while True:
title_label.place(x=50,y=10)
if ser and ser.is_open:
line = ser.readline().decode('utf-8').strip()
# Air Quality Section
if line:
ttk.Label(root, text="Air Quality (PPM):", font=("Arial", 14,
process_serial_data(line)
"bold"), background="#ffcccc").place(x=20, y=60)
ttk.Label(root, textvariable=air_quality_label_var, font=
# Function to process serial data and update the GUI
("Arial", 14), foreground="#0066cc",
def process_serial_data(data):
background="#ffcccc").place(x=200, y=60)
if "Air Quality" in data:
air_quality_label_var.set(data.split(":")[1].strip())
# Temperature Section
elif "you Temperature" in data:
ttk.Label(root, text="Temperature (°C):", font=("Arial", 14,
temp_label_var.set(data.split("=")[1].strip())
"bold"), background="#cce6ff").place(x=20, y=110)
elif "Pressure" in data:
ttk.Label(root, textvariable=temp_label_var, font=("Arial", 14),
pressure_label_var.set(data.split("=")[1].strip())
foreground="#cc3300", background="#cce6ff").place(x=200,
y=110)
# Function to manually refresh data
def refresh_data():
# Pressure Section
if ser and ser.is_open:
ttk.Label(root, text="Pressure (hPa):", font=("Arial", 14, "bold"),
ser.write(b"REFRESH\n") # Assuming the Arduino
background="#ffcccc").place(x=20, y=160)
accepts this command
ttk.Label(root, textvariable=pressure_label_var, font=("Arial",
else:
14), foreground="#009933",
messagebox.showerror("Connection Error", "Serial
background="#ffcccc").place(x=200, y=160)
connection not available.")

# Refresh Button
# Function to safely close the serial port
refresh_button = ttk.Button(root, text="Refresh Data",
def close_serial():
command=refresh_data)
if ser and ser.is_open:
refresh_button.place(x=150, y=220)
ser.close()

# Start the serial reading in a separate thread


# Function to create a gradient background
thread = threading.Thread(target=read_serial_data,
def create_gradient(canvas, color1, color2):
daemon=True)
for i in range(300): # Height of the canvas
thread.start()
r = int(color1[0] + (color2[0] - color1[0]) * (i / 300))
g = int(color1[1] + (color2[1] - color1[1]) * (i / 300))
# Close serial port on exit
b = int(color1[2] + (color2[2] - color1[2]) * (i / 300))
root.protocol("WM_DELETE_WINDOW", lambda:
color = f"#{r:02x}{g:02x}{b:02x}"
(close_serial(), root.destroy()))
canvas.create_line(0, i, 400, i, fill=color)
root.mainloop()

Department Of Mechatronics, Szabist University


GUI Display

Monitor real-time environmental parameters


for better awareness and decision-making.

Department Of Mechatronics, Szabist University


CALCULATION
FORMULAS
Air Quality :
The MQ135 sensor provides an analog signal proportional to the concentration of
gases in the air. The formula used for calculating the PPM value:

PPM= AnalogReading\times\tezt{scalingFactor}
Temperature :
The BMP280 sensor outputs temperature in Celsius directly:

T = Temp_{event.temperature}

Pressure :
The BMP280 sensor outputs pressure in hectopascals (hPa):

P = Pressure_{event.pressure}
KEY INDICATOR ACTIVITY / PROJECT DATA / OUTCOME
These formulas are handled by the Adafruit BMP280 library.

CIRCUIT
Your Key Performance
Indicator goes here

Department Of Mechatronics, Szabist University


CONCLUSION
The IoT-GUI Based Environment Monitoring System successfully
demonstrates real-time monitoring of environmental parameters. This
system can be expanded by integrating wireless communication modules
such as Wi-Fi or Bluetooth for remote monitoring. The project addresses
the need for affordable environmental monitoring solutions, making it
highly beneficial for both residential and industrial applications.

REFERENCE
1-MQ135 Datasheet: Detailed information about the MQ135 sensor's
working principles.

2. Adafruit BMP280 Library Documentation: Guidelines for interfacing


the BMP280 sensor.

3. Arduino Documentation: Resources for programming the Arduino


UNO.

4. Adafruit BMP280 Product Page

Department Of Mechatronics, Szabist University

You might also like