0% found this document useful (0 votes)
130 views4 pages

Weather Forecasting Using Machine Learning Algorithm: Nitin Singh Saurabh Chaturvedi Shamim Akhter

The document describes a weather forecasting system that uses machine learning algorithms and sensors on a Raspberry Pi to predict rain. Real-time temperature, humidity, and pressure data is collected from sensors connected to the Raspberry Pi. A random forest classification model is trained on historic weather data and used to predict rain based on current sensor readings. A GUI allows users to get predictions from the 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)
130 views4 pages

Weather Forecasting Using Machine Learning Algorithm: Nitin Singh Saurabh Chaturvedi Shamim Akhter

The document describes a weather forecasting system that uses machine learning algorithms and sensors on a Raspberry Pi to predict rain. Real-time temperature, humidity, and pressure data is collected from sensors connected to the Raspberry Pi. A random forest classification model is trained on historic weather data and used to predict rain based on current sensor readings. A GUI allows users to get predictions from the 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/ 4

Weather Forecasting Using Machine Learning

Algorithm
Nitin Singh Saurabh Chaturvedi Shamim Akhter
Department of Electronics and Department of Electronics and Department of Electronics and
Communication Engineering Communication Engineering Communication Engineering
Jaypee Institute of Information Jaypee Institute of Information Jaypee Institute of Information
Technology, NOIDA, India Technology, NOIDA, India Technology, NOIDA, India
singhnitin0523@gmail.com saurabh.chaturvedi@jiit.ac.in shamim.akhter@jiit.ac.in

Abstract - The activities of many primary sectors depend results are presented in Section V, and the paper is
on the weather for production, e.g. farming. The climate is concluded in Section VI.
changing at a drastic rate nowadays, which makes the old
weather prediction methods less effective and more hectic. II. OVERVIEW OF IMPLEMENTED SYSTEM
To overcome these difficulties, the improved and reliable
weather prediction methods are required. These
In the proposed system, an application has been
predictions affect a nation’s economy and the lives of developed on Raspberry Pi 3 B. This application gets
people. To develop a weather forecasting system that can the real-time data from humidity-temperature and
be used in remote areas is the main motivation of this pressure sensors to predict the possibility of rain on the
work. The data analytics and machine learning present day. Fig. 1 demonstrates the block-level
algorithms, such as random forest classification, are used diagram of the system. The GPIO pins of Raspberry Pi
to predict weather conditions. In this paper, a low-cost and communicate between the hardware (sensors) and
portable solution for weather prediction is devised. software (application).
The application is made from three different modules:
Keywords - Weather forecast, machine learning,
Raspberry Pi, Python, confusion matrix, sensor.
sense.py, backend.py, and frontend.py. The sense.py
module gets the sensor value when prompted by a user.
It uses Adafruit_DHT and Adafruit_BMP
I. INTRODUCTION libraries to collect the data through GPIO pins. The
The process of predicting weather conditions for future backend.py module includes the machine learning
is called weather forecasting. This paper presents the model which is trained according to the random forest
rain prediction with the use of real-time data of classification. It collects the data from sense.py as a
temperature, humidity, and pressure using various NumPy array of size three. The data include
sensors. Machine learning provides a capability to the temperature, humidity, and pressure. The system
systems to learn and improve from experience without produces the result in the form of 0 or 1, where 1 points
being programmed by a user [1], [2]. With the out that rain will happen and 0 points out that there will
introduction of machine learning concept, there is a be no rain. The frontend.py module provides a graphical
great ease for data analysis and prediction. Machine user interface (GUI) to the application. This part of
learning does not require to understand the physical application interacts with the user. It is connected to the
processes that control the atmosphere but uses the past sense.py and backend.py modules.
data to predict future data. Therefore, this process may
be used as a weather forecasting method [3].
The random forest classification, a machine learning
algorithm, uses an ensemble learning method in which
two or more machine learning models are combined to
form a single machine learning model. It operates by
making multiple decision trees while training the
dataset and outputs the mode of classification of the
different trees.
The rest of the paper is organized as follows: Section II
discusses the overview of the implemented system.
Section III presents the description of the machine
learning approach. Section IV explains the details of the
hardware and software involved in this work. The

978-1-5386-9436-7/19/$31.00 ©2019 IEEE

171
Fig. 1. Block diagram of the system. The random forest classification model is trained with
75% of the derived data set and 25% is used as the test
The snap shot of the developed GUI is shown in Fig. 2. set for the model.
The raw data set had the details of temperature,
humidity, pressure, and rain for each hour of a day. As
shown in Table I, the new data set is derived by
averaging the values.
TABLE I. Derived data set from raw data by averaging

Fig. 2. GUI of the developed application.

III. MACHINE LEARNING APPROACH


The block diagram for the machine learning-based
prediction system is depicted in Fig. 3.

IV. HARDWARE AND SOFTWARE USED


This section deals with the details of the hardware and
Fig. 3. Machine learning-based prediction system. software used in the work.
A. Details of Used Hardware
Several steps are followed for implementing the In this work, the Raspberry Pi 3 B board, DHT11
machine learning approach in this work. The steps are
humidity and temperature sensor, and BMP180 pressure
as follows:
sensor are used.
A. Data Collection
Raspberry Pi Board: Raspberry Pi is a computer on a
The data set used for this work is available at [4]. It is single board. It has advanced in many aspects, including
Delhi’s weather data for the past 20 years.
memory and connectivity of different peripherals. The
B. Data Pre-processing and Feature Extraction Raspberry Pi 3 B is one of the latest versions of
Raspberry Pi which includes inbuilt features like
All attributes of the data set are processed once, and the
wireless LAN and Bluetooth [5]. The block diagram for
most prominent features of the data set are extracted to
be used further. Raspberry Pi is displayed in Fig. 4.

C. Deriving Another Data set


From the primary data set, another data set was derived
in this work by averaging the temperature, humidity,
pressure, and rain for a given date.
D. Training and Testing the Machine Learning
Model

172
Fig. 6. DHT11 humidity and temperature sensor [8].

BMP180 Barometric Pressure Sensor: This high-


precision sensor measures the barometric pressure or
Fig. 4. Block diagram for Raspberry Pi [5]. atmospheric pressure [9]. The sensor gives a digital
The Raspberry Pi 3 B consists of 1.2 GHz Broadcom output. It works on inter-integrated circuit protocol. The
BCM2837 system on chip and 1 GB RAM. It has BMP180 sensor is illustrated in Fig. 7.
40-pin extended GPIO for connecting sensors and other
devices. There are 4 USB ports, an HDMI port, a CSI
camera port for connecting a Pi camera, a DSI display
port for connecting a Raspberry Pi touchscreen display,
and a micro SD slot for loading the operating system
and storing data. The Raspberry Pi 3 B board used is
shown in Fig. 5.

Fig. 7. BMP180 barometric pressure sensor [10].

B. Details of Used Software


The Raspbian operating system (OS), Spyder 3, and
Python 3 are used in the system.

Raspbian OS: Raspbian is a computer OS for Raspberry


Fig. 5. Raspberry Pi 3 B model [6].
Pi which is Debian based [11]. There are several
For using Raspberry Pi board, the following versions of Raspbian, including Raspbian Stretch and
components are required: Raspbian Jessie. It uses the Pi improved X-window
environment, lightweight (PIXEL) as its main desktop
 Prepared operating system SD card environment.
 USB keyboard Spyder 3: Spyder is an open source integrated
 Display (with HDMI, DVI, or composite
development environment for Python, which is
input)
significantly used for machine learning [12]. Spyder
 Power supply
integrates with many key packages in the Python stack,
such as NumPy, SciPy, Matplotlib, Pandas, IPython,
Many programming languages can be used in Raspberry SymPy, and Cython.
Pi board, such as Python, C, C++, and Java. Python is
widely used in Raspberry Pi. Python 3: Python is a high-level programming
language. The automatic memory management and
DHT11 Humidity and Temperature Sensor: The DHT11 dynamic type system are its salient features. The object-
sensor has the temperature and humidity sensing oriented, functional, imperative, and procedural
capabilities. It provides a digital signal output. The programming attributes are supported by Python [13]. It
sensor is integrated with an 8-bit microcontroller. This has a significant number of libraries for different
high-performance sensor comprises a resistive element purposes. Python can be easily integrated with many
and a sensing element for negative temperature different languages, such as SQL, MATLAB, C, and
coefficient measuring devices [7]. The DHT11 sensor is Java.
shown in Fig. 6.
V. RESULTS

173
The random forest classification provides deep insights VI. CONCLUSION
into the data dependencies. The main result expected in The prime objective of this work is to develop a low-
this work is about whether rain will happen or not on a cost, reliable, and efficient weather forecasting
particular day according to the sensor data. In Fig. 8, the application using the machine learning concept in
graph shows the dependency of rain on temperature, Python on Raspberry Pi board.
humidity, and pressure. In this graph, 0, 1, and 2
indicate temperature, humidity, and pressure,
respectively. It can be inferred from the graph that
humidity is the most important factor while predicting
rain followed by temperature and pressure.
REFERENCES
[1] N. Hasan, M. T. Uddin, and N. K. Chowdhury,
“Automated weather event analysis with machine
learning,” in Proc. IEEE 2016 International Conference
on Innovations in Science, Engineering and Technology
(ICISET), 2016, pp. 1-5.
[2] L. L. Lai, H. Braun, Q. P. Zhang, Q. Wu, Y. N. Ma, W. C.
Sun, and L. Yang, “Intelligent weather forecast,” in Proc.
IEEE 2004 International Conference on Machine Learning
and Cybernetics, 2004, pp. 4216-4221.
[3] A. G. Salman, B. Kanigoro, and Y. Heryadi, “Weather
forecasting using deep learning techniques,” in Proc. IEEE
2015 International Conference on Advanced Computer
Fig. 8. Features of importance of the developed model. Science and Information Systems (ICACSIS), 2015,
pp. 281-285.
In this work, out of total 7339 data sets, the data sets are [4] Delhi Weather Data. [Online]. Available:
https://www.kaggle.com/mahirkukreja/delhi-weather-
divided into 75% as the training set and 25% as the test data/home
set, i.e. 5504 data for training and 1835 for testing. The [5] Raspberry Pi. [Online]. Available:
splitting between the training set and test set is random. https://en.wikipedia.org/wiki/Raspberry_Pi
[6] Raspberry Pi 3 Model B. [Online]. Available:
From sklearn.metrics, an inbuilt function, https://images-na.ssl-images-amazon.com/images/
[7] DHT11 Temperature and Humidity Sensor. [Online].
accuracy_score(), is used to check the accuracy Available: https://www.robot-r-us.com/vmchk/sensor-
of this model. An accuracy of 87.90% could be temp/humid/dht11-temperature-and-humidity-sensor.html
achieved in this machine learning model. [8] DHT11 Temperature and Humidity Module. [Online].
Available: https://www.makerfabs.com/DHT11-
The resultant confusion matrix of the test set is shown Temperature-and-Humidity-Module.html
in Table II. The size of the test set is 1835, out of which [9] Sensors - Pressure, Temperature and Altitude with the
BMP180. [Online]. Available:
the number 1491 represents the count of correct
https://thepihut.com/blogs/raspberry-pi-
predictions that rain will not happen and 122 is the tutorials/18025084-sensors-pressure-temperature-and-
number of correct predictions that rain will happen. altitude-with-the-bmp180
Therefore, total 1613 correct predictions are made out [10] BMP180 Barometric Pressure Sensor Module. [Online].
of 1835 test data. Available:
https://ae01.alicdn.com/kf/HTB108MyX2JNTKJjSspoq6A
TABLE II. Confusion matrix of test data set 6mpXai/BMP180-GY-68-GY68-3-3V-5V-BMP-180-
Temperature-Pressure-Sensor-Module-Barometric-IIC-
I2C.jpg
[11] Raspbian. [Online]. Available:
Confusion matrix Predicted: No Predicted: Yes
https://en.wikipedia.org/wiki/Raspbian
[12] Spyder (software). [Online]. Available:
https://en.wikipedia.org/wiki/Spyder_(software)
Actual: No 1491 56
[13] Python (programming language). [Online]. Available:
https://en.wikipedia.org/wiki/Python_(programming_langu
age)
Actual: Yes 166 122

174

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy