IOT – based weather reporting system
IOT – based weather reporting system
Project Team:
Project Supervisor:
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.
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
Chapter 4:........................................................................................................... 31
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
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.
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.
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.
1.4. Objectives
This project aims to satisfy the following objectives:
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.
❖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.
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:
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.
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.
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 .
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.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.
figure 4:Relay
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:
Operating 5V 5V 3.3V
Voltage
I/O SPI I2C UART SPI DSI UART UART, GPIO
Connectivity GPIO SDIOCSI GPIO
Image
21
Difference between DHT11 VS DHT22:
Image
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].
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.
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.
23
Block diagram:
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
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
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.
26
relay connect to TEC1-12706:
27
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.
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.
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
32
deployments use the same components as XAMPP, it makes transitioning from
a local test server to a live server possible[1].
1. Login page: You must enter the correct username and password in order
to go to the main 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
34
4. Users page: Users are inserted, deleted, or modified where they are
entered (name ,identification ,status, update ,delete/restore).
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.
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.
36
4.5Hardware Implementation
This section will provide some information about the hardware
implementations of project.
37
Figure 26:hardware test
38
Figure 28:final result
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.
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)
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)
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.
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
}
46
Figure 34:test code
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.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
49