0% found this document useful (0 votes)
4 views

IOT – based weather reporting system

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)
4 views

IOT – based weather reporting system

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/ 50

Palestine Polytechnic University

College of IT and Computer Engineering

Computer System Engineering Department

Graduation Project Name

IOT – based weather reporting system

Project Team:

Nour shaheen Karina manasra

Project Supervisor:

ENG. Elayan Abu Gharbyeh

May 2022
Acknowledgement
Thank God, as he should, for the majesty of his face and the greatness of
his sultan, he is the patron of our grace, for those who have guided paradise, to
the source of inexhaustible tenderness, to the candle that has caught and melted
to enlighten us our way, to the most precious of our mothers. To the good heart
and symbol of giving and love to our fathers, to all those who supported us,
encouraged us and strengthened us with the fruit of this humble achievement.
We thank our supervisor, Eng :Elayan Abu Gharbyeh, who has provided us
with support and advice, and we thank all the teachers of our college and our
dear university and all those who helped us, and thank God the Lord of the
Worlds.

1
Abstract
The proposed system is a progressive solution for weather monitoring at
a particular place and make the data available over the internet. The system
makes use of the cutting-edge technology Internet of Things (IOT) where is
described as connecting everyday objects like smart phones, internet
televisions, sensors and actuators to the internet where the devices are
intelligently linked together to enable new forms of communication amongst
people and themselves.

The designed system measures atmospheric pressure, temperature and


humidity, and the system is linked to a web page and a database and
communicates with the API site to fetch the wind speed from the site of this
data and send it through the MQTT, and the system takes advantage of sensors
such as (DHT11 and BOSCH BMP180,relay,thermoelectric cooler TEC1-
12706–40X40MM) and other electronic components to build the system.

2
Abbreviations
DHT11 Temperature-Humidity Sensor
TEC1-12706 Thermoelectric cooler
IoT Internet of Things
GPIO General Purpose Input/output
VCC Voltage, Common Collector
GND Ground
PC Personal Computer
USB Universal Serial Bus
BMP180 barometric pressure
IDE integrated development
environment
MOSI Master out slave in
MISO Master in slave out
RST Reset
esp8266 Espressif modules
XAMPP cross-platform, Apache, MySQL,
,PHP and Perl
TX Transmit
RX Receive
PHP Hypertext Preprocessor
Table 1:Abbreviations

3
Table of Contents:

Acknowledgement ............................................................................................... 1

Abstract ................................................................................................................ 2

Abbreviations ....................................................................................................... 3

Chapter1: Introduction ..................................................................................... …8


1.1. Overview of The Project................................................................................ 8
1.2. Motivation ..................................................................................................... 8
1.3. Importance of the project .............................................................................. 8
1.4. Objectives...................................................................................................... 9
1.5. Problem Statement ........................................................................................ 9
1.5.1 Definition .................................................................................................... 9
1.5.2 Problem Analysis ...................................................................................... 10
1.5.3 List of Requirements ................................................................................. 10
❖Functional requirements ................................................................................. 10
❖non-functional requirements .......................................................................... 10
1.5.4 Expected Results ....................................................................................... 10
1.6. Description of The System ........................................................................... 11
1.7. Overview of The Rest of Report................................................................... 12

Chapter 2: Background ...................................................................................... 13


2.1. Overview: .................................................................................................... 13
2.2. Theoretical background: ............................................................................. 13
2.3 Literature review: ........................................................................................ 14
2.4. System design Components: ........................................................................ 15
2.4.1.Hardware components ............................................................................... 15
Difference between Raspberry Pi VS Arduino VS NodeMCU: ...................... 20
2.4.2:System Software Component: ................................................................... 21
2.5. Design constraints: ..................................................................................... 22

CHAPTER 3: System Design ............................................................................ 23


3.1 Introduction ................................................................................................. 23
3.2 Detailed system description ......................................................................... 23
3.3Hardware system design ............................................................................... 25
............................................................................ 28
4
3.4 :Flow chart .................................................................................................. 29

Chapter 4:........................................................................................................... 31

Software & Hardware Implementation .............................................................. 31


4.1 Overview ...................................................................................................... 31
4.2 Weather API: ............................................................................................... 31
4.3 MQTT: The Standard for IoT Messaging ..................................................... 32
4.4 Software Implementation tools ..................................................................... 32
4.4.1 XAMMP(web page) .................................................................................. 32
4.5Hardware Implementation ............................................................................ 37
4.6 Implementation Results ................................................................................ 38
4.7 Implementation Issues .................................................................................. 40

Chapter 5 ............................................................................................................ 41
5.1 Overview ...................................................................................................... 41
5.2 Software Testing........................................................................................... 41
5.2.1 Testing web page ...................................................................................... 41
5.2.2 Testing web page (temperature sensor) ..................................................... 42
5.2.3 Testing web page (humidity sensor) ......................................................... 43
5.2.3 Testing web page ( barometric sensor) ...................................................... 44
5.3 Weather api testing(code) ............................................................................ 45
5.4 Hardware Testing ........................................................................................ 46
5.5 System Test ................................................................................................... 47

Chapter 6 ............................................................................................................ 48

Conclusion & Future work ................................................................................. 48


6.1 Overview ...................................................................................................... 48
6.2 Final Result .................................................................................................. 48
6.3Futures Works ............................................................................................... 48
6.4 Conclusion ................................................................................................... 48

References:......................................................................................................... 49

5
List of Figures:
figure 1:esp8266............................................................................................... 16
figure 2:DHT11 ................................................................................................ 17
figure 3:BMP180 ............................................................................................. 17
figure 4:Relay .................................................................................................. 18
Figure 5:TEC1-12706 ...................................................................................... 19
figure 6:block digram ....................................................................................... 24
figure 7:Esp8266 connect to DHT11 ............................................................... 25
figure 8:Esp8266 connect to BMP180 ............................................................. 26
figure 9:Esp8266 connect to relay .................................................................... 26
Figure 10:relay connect to TEC1-12706 .......................................................... 27
figure 11:Wiring Diagrams of weather ............................................................ 27
figure 12: System Schematic diagram .............................................................. 28
Figure 13:flow chart(web page) ....................................................................... 29
Figure 14:flow chart(hardware) ....................................................................... 30
Figure 15:sign api ............................................................................................ 31
Figure 16:fetch data ......................................................................................... 32
Figure 17:Login page ....................................................................................... 33
Figure 18:home page........................................................................................ 34
Figure91 :MQTT page ..................................................................................... 34
Figure 20:Users page ....................................................................................... 35
Figure 21:Barometric sensor page.................................................................... 35
Figure 22:Temperature sensor page ................................................................. 36
Figure 23:Humidity sensor page ...................................................................... 36
Figure 24:hardware test .................................................................................... 37
Figure 25: hardware test ................................................................................... 37
Figure 26:hardware test .................................................................................... 38
Figure 27:final result ........................................................................................ 38
Figure 28:final result ........................................................................................ 39
Figure 29:Implementation Results ................................................................... 39
Figure 30:Testing web page (temperature sensor) ........................................... 42
Figure 31:Testing web page (humidity sensor) ................................................ 43
Figure 32:Testing web page ( barometric sensor) ............................................ 44
Figure 33:code of api ....................................................................................... 45
Figure 34:test code ........................................................................................... 47
Figure 35:system test ....................................................................................... 47

6
List of Tables:
Table 1:Abbreviations........................................................................................................ 3
Table 2PI VS Arduino VS nodmcu................................................................................... 20
Table 3:DHT11 VS DHT22 ............................................................................................. 21

7
Chapter1: Introduction
1.1. Overview of The Project
The term weather refers to the state of the atmosphere in an area as a
result of fluctuations that occur in the atmosphere at a particular moment and
on a daily or weekly basis. The weather may change within minutes or days.
These fluctuations include wind, atmospheric pressure, temperature, humidity
changes, and other changes.

Weather affects a person's life and activities in many ways. Sudden


weather changes can be a nuisance to many people. So a person needs to know
the weather changes continuously, and know how to deal with some tasks
inside the house when the weather changes while outside the house.

1.2. Motivation
Knowing the fluctuations of the weather is one of the important things in
our lives. There are many motives that encouraged us to do this project:

The main motive for building this system is to know weather fluctuations
and sudden changes in wind speed, temperature and other factors related to
weather changes, also one of the motives that led to the design of the system is
the many people’s annoyance about not expecting the many fluctuations of the
weather and prompting them to change their daily plans frequently, or their lack
of knowledge of opening or closing windows when leaving the house or turn on
the heating or fan ,so this system was designed to solve all the problems and
complications that it suffers from people.

1.3. Importance of the project


The importance of the project What makes our project important to the
individual and society is:

8
1. Our system provides automatic and continuous weather monitoring. It
monitors the reading of the following weather elements, which are
temperature, wind speed, humidity and atmospheric pressure.

2. The website shows reports of both (temperature, humidity, barometric


sensor).
3. The system enables us to do some tasks inside the house during the
fluctuations of the weather, such as closing the window or opening
the window even if we are not inside the house.
4. The system also allows the operation of both the heating or the fan
according to changes in the weather.

1.4. Objectives
This project aims to satisfy the following objectives:

1. measure the most important weather elements such as temperature,


humidity, precipitation, atmospheric pressure and wind speed On the roof
of a particular building.
2. Based on the resulting readings in the first point , the necessary actions
should be taken ,such us, closing or opening the building windows or turn
on both the heating and the fan according to changes in the weather.

1.5. Problem Statement

1.5.1 Definition
Many people face unexpected changes in the weather so that the weather
can suddenly get worse or better, so it will be difficult to know what the
readings of weather elements such as temperature, wind speed, precipitation,
humidity and atmospheric pressure are in each period, and it will be difficult for
them to take preventive measures at home If they are out of the house.

9
1.5.2 Problem Analysis
Weather reports and home protection from weather fluctuations are
important in anyone's life. Many people face unexpected changes in the
weather, such as heavy rain, increased humidity in the air, or an increase in
wind speed. Most of the time, the windows of the house are not closed, so rain
or dust and moisture will enter the house, Therefore, we are working to reduce
these problems that many individuals suffer from, which affect their daily lives
and lead to a change in their daily program.

1.5.3 List of Requirements


In this section, we will talk about functional and nonfunctional
requirements:

❖Functional requirements
1. The website shows reports of both (temperature, humidity, barometric
sensor).
2. We need a Database in our project to require data processing, analytics,
and storage.
3. web page should meet the following needs:
 Show the user a list of the weather elements.
 Control buttons for opening and closing windows and air
conditioning.
 Monitor system status and data transferred in both directions.

❖non-functional requirements
 Working on a security system.
 The web page be easy to use and suitable for users.

1.5.4 Expected Results


After development of the system, the following results are expected to be
achieved:
11
1. Through the system, you will know the readings of the weather elements,
which are temperature, wind speed, atmospheric pressure, humidity and
automatically and continuously.
2. This system shows reports on (temperature, humidity, barometric
sensor).
3. The system has buttons, to open or close the window.
4. The system has buttons, to turn on both the heating and the fan
according to changes in the weather.

1.6. Description of The System


In this project the system is weather monitoring at a particular place and
make the data available over the internet. The system makes use of the cutting-
edge technology Internet of Things (IoT) where is described as connecting
everyday objects like smart phones, internet televisions, sensors and actuators
to the internet where the devices are intelligently linked together to enable new
forms of communication amongst people and themselves.

The designed system measures atmospheric pressure, temperature and


humidity. The system is linked to an Android application and a database and
communicates with the API site to fetch the wind speed from the site of this
data and send it through the MQTT, and the system takes advantage of sensors
such as DHT11 and BOSCH BMP180 and relay to open or close window and
another relay connect thermoelectric cooler TEC1-12706–40X40MM to turn on
the heating or fan .

11
1.7. Overview of The Rest of Report
The outline of the report consists of six chapters; the following is a brief
description of the topics that are covered in each other next chapters:

Chapter 2: “Background”, contains the theoretical background and Literature


review, options (design options for hardware components and design options
for software components) and design constraints.

Chapter 3: “Design”, includes a detailed conceptual description of the system


(HW and SW), detailed design, schematic diagrams, block diagrams, structural
diagrams, and any necessary information about the design.

Chapter4:“Software”, This chapter describes the implementations of the


software that are used in this project, application and web page.

Chapter 5: “Validation and Discussion”, This chapter describes the


implementation, implementation issues, and implementation challenges. Also
include description of the method used to validate the system, validation
results, analysis and discussion about the results, and recommendations.

Chapter 6: “Conclusion”, In this chapter gives information about conclusion


and provides for more features that can be done in the future.

12
Chapter 2: Background
2.1. Overview:
This chapter introduces a theoretical background of the project, short
description of design options that will be used in the system, discussion of the
specification and design constraints and some additional information about the
system.

2.2. Theoretical background:


INTERNET OF THINGS

The internet has changed all human lives in the past decade. The internet
of things, or "IOT" for short, is the extension of Internet connectivity beyond
computers and smartphones to a whole range of other things, processes and
environments such as physical devices and everyday objects.

Embedded with electronics, Internet connectivity and other forms of


hardware such as sensors, these devices can communicate and interact with
others over the Internet, and can be remotely monitored and controlled [2].

IOT has its applications in a large number of areas such as consumer


applications like smart homes, wearable technology and connected vehicles,
commercial applications like medical and healthcare and industrial applications
like manufacturing, agriculture, energy management and environmental
monitoring.

In our project, making weather reports using the Internet of things is a


process that includes all the activities and procedures required in measuring the
elements of the atmosphere, from the beginning until it is published. This
includes monitoring the weather and taking some precautions at home if
necessary.

13
Our project focuses on improving the process of collecting weather
information using special sensors, which is DH11 and Electro Peak BOSH
BMP180 ,to publish it automatically using the Internet of things in reports that
are renewed and published also automatically in web page . Which will enable
you, in cases of bad weather such as heavy rain or an increase in wind speed, to
close or open the window and turn on the heating or fan .

2.3 Literature review:


The first literature review
A scientific paper published in July 2021 entitled weather forecasting
study in internet of things technology. In this scientific paper, weather
forecasting is mainly used provides weather and climate information that
changes "How does the climate change over time?" Weather forecasting is the
use of science and technology to forecast the weather in a particular area.
To predict the weather, environmental sensors are used for measurements
and are reported in real time on the cloud. The elements that are measured in
this paper are temperature, forecast, humidity and wind , In the field of weather
forecasting, these measurements are sent to a web server via the internet via a
Wi-Fi connection, weather parameters are uploaded to the cloud and then live
reports of weather information are provided.[3]

The second literature review


A scientific paper published on June 9, 2020 entitled IoT-based advanced
weather monitoring system this paper finds a solution for weather monitoring at
a particular place , and makes the data available over the internet.
The system uses environmental sensors to monitor environmental
parameters such as wind speed, temperature and humidity, and then the data is

14
generated in real time and stored in the cloud. In this paper, applications that
take this data are used to take some necessary action[4]
The advantages of our project over previous solutions :
1. What distinguishes our project from the solution presented by the first
scientific paper is that we measure atmospheric pressure and
temperature, humidity and fetch the wind speed and that based on these
measurements, certain measures are taken.
2. Our project is very similar to the second scientific paper but besides
temperature, humidity and atmospheric pressure sensors we will be
using wind speed readings as well, these readings are recorded in a server
that is not in a cloud and in our project we use a web page to take these
readings from the server and apply the appropriate procedure.

2.4. System design Components:


This section describes all of the hardware used in our project, it presents
a figure for each one with a short description of its work principle and why it is
used in the system.

2.4.1.Hardware components

2.4.1.1:Microcontroller:
During our search, we`ve encountered microcontroller alternatives
options.
 NodeMCU (esp8266):
NodeMCU is an open-source firmware and development kit that helps
you to prototype or build IoT products. It includes firmware that runs on the
ESP8266 Wi-Fi SoC from Espressif Systems, and hardware which is based on
the ESP-12 module. The firmware uses the Lua scripting language. It is based
on the eLua project and built on the Espressif Non-OS SDK for ESP8266[5].

15
figure 1:esp8266

2.4.1.2: DHT11:
The DHT11 is a basic, ultra low-cost digital temperature and humidity
sensor. It uses a capacitive humidity sensor and a thermistor to measure the
surrounding air and spits out a digital signal on the data pin (no analog input
pins needed). It's fairly simple to use but requires careful timing to grab data.
The only real downside of this sensor is you can only get new data from it once
every 2 seconds, so when using our library, sensor readings can be up to 2
seconds old[7].

Technical Details:

a) Low cost
b) 3 to 5V power and I/O
c) 2.5mA max current use during conversion (while requesting data)
d) Good for 20-80% humidity readings with 5% accuracy
e) Good for 0-50°C temperature readings ±2°C accuracy
f) No more than 1 Hz sampling rate (once every second)
g) Body size 15.5mm x 12mm x 5.5mm
h) 4 pins with 0.1" spacing.

16
figure 2:DHT11

2.4.1.3: BMP180:
This precision sensor from Bosch is the best low-cost sensing solution
for measuring barometric pressure and temperature. Because pressure changes
with altitude you can also use it as an altimeter! The sensor is soldered onto a
PCB with a 3.3V regulator, I2C level shifter and pull-up resistors on the I2C
pins .The BMP180 is the next-generation of sensors from Bosch, and replaces
the BMP085. This board is 5V compliant - a 3.3V regulator and a i2c level
shifter circuit is included so you can use this sensor safely with 5V logic and
power[6].

figure 3:BMP180

17
2.4.1.4: Relay:
A relay is an electrically operated switch. It consists of a set of input
terminals for a single or multiple control signals, and a set of operating contact
terminals. The switch may have any number of contacts in multiple contact
forms, such as make contacts, break contacts, or combinations thereof.

Relays are used where it is necessary to control a circuit by an


independent low-power signal, or where several circuits must be controlled by
one signal. Relays were first used in long-distance telegraph circuits as signal
repeaters: they refresh the signal coming in from one circuit by transmitting it
on another circuit. Relays were used extensively in telephone exchanges and
early computers to perform logical operations[8].

figure 4:Relay

2.4.1.5: Thermoelectric cooler TEC1-12706–40X40MM:


This is TEC1-12706 40x40mm thermoelectric cooler Peltier plate module 12V
60W Get ice cold in minutes or heat to boiling by simply reversing the polarity,
used for numerous applications from CPU coolers to alternate power sources,
or even for your own custom car drink warmer/cooler. Since they consist
primarily of semiconductor material sandwiched between ceramic plates and
have no moving parts[9].

Feature: Its work is characterized by side refrigeration and side fever. Hot and
cold on both sides of the temperature difference of 68 degrees Connected to the
12-volt power supply cooling piece on both sides there will be difference in
18
temperature, side cold side of the heat, do not long power cooler radiator,
otherwise it will cause cooler internal overheating and burning.

Specification:

1. Model: TEC1-12706
2. Size: 40mm x 40mm
3. Operates from 0~15.2V and 0~6A
4. Operates Temperature: -30C to 70C
5. Max power consumption: 60W
6. These devices must be used in conjunction with a heat sink to avoid
burned
7. Each device is full inspected and tested
8. Fitted with 6-inch insulated leads

Figure 5:TEC1-12706

19
Difference between Raspberry Pi VS Arduino VS NodeMCU:

Component Arduino Raspberry Pi Node MCU


Best choose   
Developer Arduino Raspberry Pi open source
Foundation community

Type Single board Mini computer Single board


microcontroller microcontroller

Operating None Linux XTOS


System
CPU Atmel, ARM, Intel ARM Cortex LXT106
Clock Speed 16 MHz 1.2GHz 26 MHz – 52 MHz
Memory 32KB 1-4GB Upto 128MB
Storage 1KB MicroSDHC 4MB
Slot
Power USB, Battery, USB, Power USB
Power Supply
Supply

Operating 5V 5V 3.3V
Voltage
I/O SPI I2C UART SPI DSI UART UART, GPIO
Connectivity GPIO SDIOCSI GPIO

Image

Table 2PI VS Arduino VS nodmcu

21
Difference between DHT11 VS DHT22:

Component DHT11 DHT22


Best choose  
Temperature Range -20 to 60℃ -40 to 80℃
Temperature ±2% ±0.5%
Accuracy
 Humidity Range 5 to 95% RH 0 to 100%RH

 Humidity Accuracy ±5% ±2%

 Cost $5.90 $9.90

 Image

Table 3:DHT11 VS DHT22

2.4.2:System Software Component:


This section will provide some information about the main programs and
software technologies used in our project.

Software used for hardware and sensors:

2.4.2.1: Arduino IDE:


Arduino code is written in C+ with an addition of special methods and
functions. C++ is a human-readable programming language. The Arduino
Integrated Development Environment (IDE) is the main text editing program
used for Arduino programming. It is where you'll be typing up your code before

21
uploading it to the board you want to program. Arduino code is referred to as
sketches, It is processed and compiled to machine language, and arduino sketch
code is used to program wemos microcontrollers[10].

Software used for Web page:

2.4.2.2: XAMMP:
XAMPP is a free and open-source cross-platform web server solution
stack package developed by Apache Friends, consisting mainly of the Apache
HTTP Server, Maria DB database, and interpreters for scripts written in the
PHP and Perl programming languages. Since most actual web server
deployments use the same components as XAMPP, it makes transitioning from
a local test server to a live server possible.

2.5.2.3: Notepad++:
Notepad++ is a text and source code editor for use with Microsoft
Windows. It supports tabbed editing, which allows working with multiple open
files in a single window. The product's name comes from the C increment
operator.

Based on the powerful editing component Scintilla, Notepad++ is written


in C++ and uses pure Win32 API and STL which ensures a higher execution
speed and smaller program size. By optimizing as many routines as possible
without losing user friendliness.

2.5. Design constraints:


1. The system can’t send data or notifications without Wi-Fi connection so
all devices must be constantly connected to Wi-Fi.
2. The web page will not run without the Internet.
3. The system must work in an ideal environment because any external
influences other than weather factors will negatively affect our smart
project.
22
CHAPTER 3: System Design

3.1 Introduction
This chapter discusses the conceptual design of the system, it shows the
system requirement analysis, a block diagram of the system, schematic diagrams
and hardware system design.

3.2 Detailed system description


The proposed system monitoring the weather status according the
pressure, temperature, humidity and wind, by these information it will to be easy
for the user to take a decision about what have to do like open the window or run
the condition.
The system uses DHL11 sensor to track the temperature and humidity and
BOSCH BMP180 sensor to track the pressure, these sensors will be connected
will NodeMCU microcontroller to read the values and handle it to send these
value to the server throw the api to be sorted in the DB and the user reach it
throw the web page . The web page displays the reading of the temperature,
humidity and pressure (which sended from the sensors) from the server and DB,
also gets wind form external weather APIs to display for the user on the mobile.
The web page allows you to take actions and display the temperature,
humidity and pressure readings, the user can open or close the window and
on/off the air condition. The server take this action and store it to send it for the
NodeMCU for reflect these changes on reality. You can show the functional
block diagram in figure 5.

23
Block diagram:

figure 6:block digram

24
3.3 Hardware system design
 Esp8266 connect to DHT11:
In case are using the DHT11 Sensor, then connect a 4.7 KΩ
Resistor between Data Pin and VIN (or 3.3V) of ESP8266.
1. VCC: Power Supply (3V to 5.5V)
2. DATA: D4
3. NC: Not Connected
4. GND: Ground

figure 7:Esp8266 connect to DHT11

 Esp8266 connect to BMP180:

Start by connecting the VIN pin to the 3.3V output on the NodeMCU and
connect GND to ground. Now we are remaining with the pins that are used for
I2C communication. Note that each Arduino Board has different I2C pins
which should be connected accordingly. On the used Arduino b, the SDA (data
line) and SCL (clock line) are on the pin headers close to the AREF pin. They
are also known as D1 (SCL) and D2 (SDA). The figure 3.3 shows how to wire
BOSCH BMP180 to NodeMCU.

25
figure 8:Esp8266 connect to BMP180

 Esp8266 connect to relay :

Some ESP8266 pins output a 3.3V signal when the ESP8266 boots. This
may be problematic if you have relays or other peripherals connected to those
GPIOs. Additionally, some pins must be pulled HIGH or LOW in order to boot
the ESP8266.Taking this into account, the safest ESP8266 pins to use with
relays are: GPIO 5, GPIO 4, GPIO 14, GPIO 12 and GPIO 13.

figure 9:Esp8266 connect to relay

26
 relay connect to TEC1-12706:

Figure 10:relay connect to TEC1-12706

 Wiring Diagrams of weather

figure 11:Wiring Diagrams of weather

27
 System Schematic diagram:

figure 12: System Schematic diagram

28
3.4 :Flow chart
In this figure 13, it shows how the web page that was designed works, as
it includes:

1. The login page through which the user name and password are
entered.
2. Verify the entries thereafter and give a warning message if the
entries are wrong.
3. Enter the main page to view the live value of sensors .
4. click to choose (Humidity sensor report , user setting , MQTT
setting ,Barometric sensor report ,Temperature sensor report) .
5. Exit the site.

Figure 13:flow chart(web page)


29
In this figure 14, it shows how the hardware that was designed works, as it
includes:

1. Make sure the system is power on .


2. Control (fan ,heater, window)
3. Fetch (wind speed)from API
4. Identify sensors .
5. Read sensors value.
6. publish by mqtt .
7. Make sure the system is power off.
8. Exist site .

Figure 14:flow chart(hardware)

31
Chapter 4:
Software & Hardware Implementation
4.1 Overview
This chapter describes the implementation of the software and the
hardware of this project, including the circuit connection, and programming of
the microcontrollers.

4.2 Weather API:


sign up to use our fast and easy-to-work weather APIs for free. In case your
requirements go beyond our freemium account conditions, you may check the
entire list of our subscription plans. You can read the How to Start guide and
enjoy using our powerful weather APIs right now.

The site of weather api (https://openweathermap.org/api )[11].

This figure15: show how to sign api site :

Figure 15:sign api

31
The figure16: shows how to bring the KEY and enter the city number according
to its existing number in order to bring the required data

Figure 16:fetch data

4.3 MQTT: The Standard for IoT Messaging


MQTT (originally an initialism of MQ Telemetry Transport) is a
lightweight, publish-subscribe network protocol that transports messages
between devices. The protocol usually runs over TCP/IP, however, any network
protocol that provides ordered, lossless, bi-directional connections can support
MQTT .It is designed for connections with remote locations where resource
constraints exist or the network bandwidth is limited. The protocol is an open
OASIS standard and an ISO recommendation (ISO/IEC 20922)[12].

4.4 Software Implementation tools


This section will provide some information about the main programs and
software Technologies used in our project.

4.4.1 XAMMP(web page)


XAMPP is a free and open-source cross-platform web server solution
stack package developed by Apache Friends, consisting mainly of the Apache
HTTP Server, Maria DB database, and interpreters for scripts written in the
PHP and Perl programming languages. Since most actual web server

32
deployments use the same components as XAMPP, it makes transitioning from
a local test server to a live server possible[1].

The web page consists of 7 user interfaces, which are:

1. Login page: You must enter the correct username and password in order
to go to the main page.

Figure 17:Login page

2. Home page: Home page: contains a set of icons, when you click on
them, they will be transferred to other pages for example (home ,users
,MQTT setting ,logout……) , It also contains a group of images when
you click on it, either converting to pages or giving results on the same
home page.

33
Figure 18:home page

3. MQTT setting page : MQTT settings are set by entering each of


the(broker ,port ,client id ,username ,password) and save this data.

Figure91 :MQTT page

34
4. Users page: Users are inserted, deleted, or modified where they are
entered (name ,identification ,status, update ,delete/restore).

Figure 20:Users page

5. Barometric sensor page: When you click on the image of the


barometric sensor on the main page, you will be transferred to the report
page for this sensor, as shown in the figure 19.

Figure 21:Barometric sensor page

35
6. Temperature sensor page: When you click on the image of the
Temperature sensor on the main page, you will be transferred to the
report page for this sensor, as shown in the figure20.

Figure 22:Temperature sensor page

7. Humidity sensor page: When you click on the image of the Humidity
sensor on the main page, you will be transferred to the report page for
this sensor, as shown in the figure21.

Figure 23:Humidity sensor page

36
4.5Hardware Implementation
This section will provide some information about the hardware
implementations of project.

Figure 24:hardware test

Figure 25: hardware test

37
Figure 26:hardware test

4.6 Implementation Results


By the end of the implementation process ,the designed system measures
atmospheric pressure, temperature and humidity. The system is linked to an
web page and a database and communicates with the API site to fetch the wind
speed from the site of this data and send it through the MQTT, and the system
takes advantage of sensors such as DHT11 and BOSCH BMP180,relay
,thermoelectric cooler TEC1-12706–40X40MM and controlling the opening
and closing of the window and controlling heating or the fan .

Figure 27:final result

38
Figure 28:final result

Figure 29:Implementation Results


39
4.7 Implementation Issues
During the implementation of the project, we faced many obstacles and
we had to take Several issues to achieve the most appropriate design for the
system and access to the best features Related to the objectives of the project.

These issues and results are summarized as follows:

1. Libraries associated with some sensors, where we encountered


problems in finding the appropriate libraries for sensors in order to
run the code on them.
2. MQTT: We do not have enough information and experience about
the mqtt, so we have worked on research and continuous study in
order to understand the mqtt and work to apply it in our project
correctly.
3. We encountered a problem in the process of connecting both
hardware and software.
4. Finding the best sites that give correct and accurate values of wind
speed in any area.

41
Chapter 5
Validation & Testing
5.1 Overview
In this chapter we will discuss the testing of all component of the system
and the results obtained. We test all the parts to ensure that all of the functions
work perfectly and without errors.

5.2 Software Testing


5.2.1 Testing web page
We used HTML , JavaScript and php to design a web page to receive
data. we designed the web page interfaces (many Button to move the
interfaces, log in & MQTT setting & users.......) to check and test the
functionality of the project :

1. Received data.
2. determine temperature .
3. determine humidity.
4. Determine atmospheric pressure .
5. control of the window.
6. adjust MQTT settings.
7. Fetch wind speed.
8. control of the fan and heating .

41
5.2.2 Testing web page (temperature sensor)

Figure 30:Testing web page (temperature sensor)

42
5.2.3 Testing web page (humidity sensor)

Figure 31:Testing web page (humidity sensor)

43
5.2.3 Testing web page ( barometric sensor)

Figure 32:Testing web page ( barometric sensor)

44
5.3 Weather api testing(code)
In the figure31, the API code shows the weather site:

We are in JavaScript code work to analyze the JSON and convert it to the
interface or GUI interface.

Figure 33:code of api

The shape of the data that the API website is back in the form of JSON:
{
"coord":{
"lon":-79.42,
"lat":43.7
},
"weather":[
{
"id":804,
"main":"Clouds",
"description":"overcast clouds",
"icon":"04n"
}
],
"base":"stations",
"main":{
"temp":292.15,
"pressure":1023,
"humidity":72,
45
"temp_min":291.15,
"temp_max":293.15
},
"visibility":14484,
"wind":{
"speed":5.7,
"deg":130
},
"clouds":{
"all":90
},
"dt":1537837200,
"sys":{
"type":1,
"id":3721,
"message":0.0039,
"country":"CA",
"sunrise":1537873704,
"sunset":1537916966
},
"id":6167865,
"name":"Toronto",
"cod":200
}

5.4 Hardware Testing


In this section we will discuss the testing of components.

46
Figure 34:test code

5.5 System Test


After ensuring that all the parts are working properly, we started
assembling and integrating the parts with each other to make the system ready
to operate.

Figure 35:system test

47
Chapter 6
Conclusion & Future work

6.1 Overview
In this chapter, we will conclude the challenges, final result and future
work of our project.

6.2 Final Result


1. An integrated system was made between hardware and software.
2. The system works to measure the humidity,
3. The system works to measure atmospheric pressure.
4. The system works to measuring the temperature .
5. The system fetch the wind speed .
6. The system works to open and close window .
7. The system works to turn on fan and heater .

6.3Futures Works
The system can be developed in the future by adding new sensors such as
providing electric power in case of heavy rain or strong winds to avoid power
outages and other electronic parts.

6.4 Conclusion
At the end of the project we were able to measure the temperature,
humidity, and atmospheric pressure and fetch the values of wind speed from a
weather website through a specific api and we were also able to control the
windows, fan and heating and display all these results on the website we
worked on.

48
References:
1) PHP and Mysql learn, 18/3/2022:
https://www.w3schools.com/php/
2) Internet of Things, or IoT accessed 1/11/2021
https://www.iotforall.com/what-is-internet-of-things
3) A Study of Weather Forecasting in IOT Technology - World accessed
1/11/2021
https://www.wjrr.org/download_data/WJRR1301004.pdf

4) IoT based- Advanced Weather Monitoring System - EasyChair,


1/11/2021
file:///C:/Users/%D9%86%D9%88%D8%B1/Downloads/EasyChair-
Preprint-3582.pdf
5) NodeMCU(esp8266), 20/10/2021
https://create.arduino.cc/projecthub/electropeak/getting-started-
w-nodemcu-esp8266-on-arduino-ide-28184f
6) BMP180 , 5/10/2021
file:///C:/Users/%D9%86%D9%88%D8%B1/Downloads/BST-BMP180-
FL000.pdf
7) DHT11, 15/11/2021
https://learn.adafruit.com/dht
8) Relay, 23/11/2021
https://electronicsarea.com/relay/
9) TEC1-12706–40X40MM ,17/12/2021
https://usa.banggood.com/5Pcs-TEC1-12706-40x40mm-
Thermoelectric-Cooler-Peltier-Plate-12V-60W-p-952047.html
10) Arduino IDE, 23/3/2022
https://www.arduino.cc/en/software
11) weather api,19/4/2022
https://openweathermap.org/api
12) MQTT, 16/4/2022
https://mqtt.org/

49

You might also like