Вы находитесь на странице: 1из 39

Project report submitted in partial fulfillment for

the Degree of B. Tech in Applied Electronics &


Instrumentation Engineering under Maulana Abul
Kalam Azad University of Technology

IOT Based Weather Station using Raspberry Pi

By
Rajarshi Roy (Roll No :11705516031 )
Manojeet Chowdhury (Roll No :11705516039 )
Md Rehan (Roll No :11705516038 )
Vivek kr. Gupta (Roll No :11705516002)
Guddu Kumar Patwa (Roll No :11705516046)

Under Supervision of
Ms. Naiwrita Dey

DEPARTMENT OF APPLIED ELECTRONICS &


INSTRUMENTATION ENGINEERING,
RCC INSTITUTE OF INFORMATION TECHNOLOGY,
CANAL SOUTH ROAD, BELIAGHATA, KOLKATA – 700015,
November, 2019

1
Contents

Acknowledgement I
Certificate of Approval II
Recommendation III
Abstract IV
List of Tables V
List of Figures VI

Chapter No Chapter Name Page No


Chapter 1 Introduction 9-15
Chapter 2 Methodology 16-17

Chapter 3 Regression and Prediction 18-22

Chapter 4 Modelling and Prototyping 23-27

Chapter 5 Data Visualization and 28-35


Results
Chapter 6 Conclusion 36

Chapter 7 Reference 37-39

2
ACKNOWLEDGEMENT

It is a great privilege for us to express our profound gratitude to our respected teacher Mr.
Guide Name, Applied Electronics &Instrumentation Engineering, RCC Institute of
Information Technology, for his constant guidance, valuable suggestions, supervision and
inspiration throughout the course work without which it would have been difficult to complete
the work within scheduled time.
We would like to express our gratitude towards Other Faculty Name for his kind co-
operation and encouragement which helped us in completion of this project.
We are also indebted to the Head of the Department, Applied Electronics & Instrumentation
Engineering, RCC Institute of Information Technology for permitting us to pursue the project.
We would like to take this opportunity to thank all the respected teachers of this department
for being a perennial source of inspiration and showing the right path at the time of necessity.

Rajarshi Roy
----------------------------------
Student Name
(University Roll
No:11705516031)

Manojeet Chowdhury
----------------------------------
Student Name
(University Roll
No:11705516039)

Md Rehan
----------------------------------
Student Name
(University Roll No:11705516038)

Vivek Kumar Gupta


----------------------------------
Student Name
(University Roll No:11705516002)

Guddu Kumar Patwa


----------------------------------
Student Name
(University Roll No:11705516046)

3
RCC INSTITUTE OF INFORMATION TECHNOLOGY
CANAL SOUTH ROAD, BELIAGHATA, KOLKATA – 700 015
PHONE : 2323 2463 FAX : (033)2323 4668
E-mail : campus@rcciit.in Website : www.rcciit.org

CERTIFICATE OF APPROVAL

The project report titled “IOT Based Weather Station using Raspberry Pi.” prepared by
Rajarshi Roy Roll No:11705516031, Manojeet Chowdhury, Roll No:11705516039, Md
Rehan, Roll No:11705516038, Vivek Kr Gupta, Roll No:11705516002; and Guddu Kumar
Patwa, Roll No:11705516046; is hereby approved and certified as a creditable study in
technological subjects performed in a way sufficient for its acceptance for partial fulfilment of
the degree for which it is submitted.

It is to be understood that by this approval, the undersigned do not, necessarily endorse or


approve any statement made, opinion expressed or conclusion drawn therein, but approve the
project only for the purpose for which it is submitted.

----------------------------------- ------------------------------------
[Supervisor] [Head of the Department]
Department Applied Electronics & Instrumentation
Engineering

--------------------------------------
Examiner

4
RCC INSTITUTE OF INFORMATION TECHNOLOGY
CANAL SOUTH ROAD, BELIAGHATA, KOLKATA – 700 015
PHONE: 2323 2463 FAX : (033)2323 4668
E-mail : campus@rcciit.in Website : www.rcciit.org

RECOMMENDATION

I hereby recommend that the project report titled “Thesis title : IOT Based Weather Station
” prepared by Rajarshi Roy, Roll No:11705516031, Manojeet Chowdhury, Roll
No:11705516039, Md Rehan, Roll No:11705516038, Vivek kr Gupta, Roll
No:11705516002; and Guddu Kumar Patwa, Roll No:11705516046 be accepted in partial
fulfillment of the requirement for the Degree of Bachelor of Technology in Applied Electronics
& Instrumentation Engineering, RCC Institute of Information Technology.

-------------------------------------
[Supervisor]

--------------------------------------

[Head of the Department]


Applied Electronics & Instrumentation Engineering

5
Abstract
A weather station can be described as an instrument or device, which provides us with the
information of the weather in our neighbouring environment. For example it can provide us
with details about the surrounding temperature, barometric pressure, humidity, etc. Hence, this
device basically senses the temperature, pressure, humidity, light intensity, rain value. There
are various types of sensors present in the prototype, using which all the aforementioned
parameters can be measured. It can be used to monitor the temperature or humidity of a
particular room/place. With the help of temperature and humidity we can calculate other data
parameters, such as the dew point. In addition to the above mentioned functionalities, we can
monitor the light intensity of the place as well. We have also enabled to monitor the
atmospheric pressure of the room. We can also monitor the rain value. The brain of the
prototype is the Raspberry Pi 3(Pi Board). There is an integrated temperature, pressure and
humidity sensor in a package BME280, which sends data to the Pi. Pi sends the data to the
cloud and thus broadcasted through a webpage. Thus we are able to model a predictive linear
regressive model for a set of value (here temperature) and how the other values are correlated
to temperature. Thus we can deploy this model which we will do in our future endeavours to
any data set and predict an accurate temperature. The main aim of this project is to identify and
analyse a proper machine learning model which is regression and to know the accuracy of a
model we can use in future combined with other machine learning technologies.

6
List of Figures:

1 Scatter Plot

2 Correlation heatmap

3 Regression Plot

7
List of Tables:

1. The raw data

2. The Statistical table of data

3. Coefficient Table

8
Chapter 1:

Introduction

A weather station is a facility, either on land or sea, with instruments and equipment for
measuring atmospheric conditions to provide information for weather forecasts and to study
the weather and climate. The measurements taken include temperature, atmospheric
pressure, humidity, wind speed, wind direction,
and precipitation amounts. Wind measurements are taken with as few other obstructions as
possible, while temperature and humidity measurements are kept free from direct solar
radiation, or isolation. Manual observations are taken at least once daily, while automated
measurements are taken at least once an hour. Weather conditions out at sea are taken by
ships and buoys, which measure slightly different meteorological quantities such as sea
surface temperature (SST), wave height, and wave period. Drifting weather buoys outnumber
their moored versions by a significant amount. Humidity, Temperature and Pressure are three
basic parameters to build any Weather Station and to measure environmental conditions. We
have previously built a mini Weather Station using BME280 and this time we are
extending the weather station with Raspberry Pi. This IoT based Project aims to show the
current Humidity, Temperature and Pressure parameters on the LCD as well on the
Internet server using Raspberry Pi, which makes it a Raspberry Pi Weather Station.

Literature Review
Weather sensors consist of a wind speed meter, direction meter, rain gauge and
temperature and humidity. It can be considered as a one set. The anemometer is a wind speed
meter, which encodes the speed of wind by just closing a switch for every rotation. A switch
closure once per second is produced by wind speed of 1.492 MPH. The rain gauge is built like
as a bucket type rain gauge with self-emptying facility, which will activate a button closure
momentarily for every 0.011" (0.2794mm) of rain that are collected. Finally, the wind vane is
used to report the wind direction which is produced by the combination of resistors inside the
sensor. To any promising sixteen positions, it is converted while applying the voltage. Design
can be prepared as own or if it is bought then it can be mounted on hardware. In this study the

9
given hardware is utilized [1]. Big Data contains tremendous and mammoth information in the
organized, semi-organized and unstructured manner. That is the reason it is extremely hard to
process, oversee and store to this kind of information. As of overdue extraordinary sorts of
mechanism, techniques and procedures are there to deal with Big Data. Data mining[3] using
machine learning is one of them which we have utilized as a part of this paper to oversee climate
related information and predict the forecast and certain condition of future weather. Under this
scheme we suggest that how to utilized the data mining and in order retrieval of data using
machine learning in the expectation of climate and forecasting of the weather. Presently and
now a days, we the people of India experiencing changing bad weather, pollution and their
reactions [2]. Weather forecasting for the future is one of the most important attributes to
forecast because agriculture sectors as well as many industries are largely dependent on the
weather conditions. It is often used to predict and warn about natural disasters that are caused
by abrupt change in climatic conditions. At macro level, weather forecasting is usually done
using the data gathered by remote sensing satellites. Weather parameters like maximum
temperature, minimum temperature, extent of rainfall, cloud conditions, wind streams and their
directions, are projected using images taken by these meteorological satellites to assess future
trends. The satellite-based systems are inherently costlier and require complete support system.
Moreover, such systems are capable of providing only such information, which is usually
generalized over a larger geographical area[3]. The project is based on application of raspberry
pi in weather station to get the data about temperature, atmospheric pressure, humidity, wind
speed, wind direction, and precipitation amounts. Information about current air temperature,
air humidity, atmospheric pressure and relative altitude is collected from appropriate sensors.
Received data are processed and transmitted from measuring point to the distant location via
UDP protocol. Sensors data acquisition and UDP server are implemented on Raspberry Pi
platform. On the other side, an android application which requests and presents acquired
weather data at distant location is developed. Proposed solution provides real-time data
acquisition and transfer of measured parameters, like much more expensive commercial
systems. Moreover, it is very flexible and can be easily adapted to various applications [4].
This complete paper narrates different data mining techniques and methodology for weather
prediction. Based on result, it can be concluded that the support vector machine algorithm can
gives better weather prediction with higher than 90% accuracy and provides better result [5].
There are various types of sensors present in the project, using which all the aforementioned
parameters can be measured. It can be used to monitor the temperature or humidity of a
particular room/place. With the help of temperature and humidity we can calculate other data

10
parameters, such as the dew point. In addition to the above mentioned functionalities, we can
monitor the light intensity of the place as well. We have also enabled to monitor the
atmospheric pressure of the room. We can also monitor the rain value. The brain of the
prototype is the ESP8266 based Wi-Fi module Node MCU (12E). Four sensors are connected
to the Node MCU namely temperature and humidity sensor (DHT11), pressure
sensor(BMP180), raindrop module, and light dependent resistor(LDR). Whenever these values
exceed a chosen threshold limit for each an SMS, an E-mail and a Tweet post is published
alerting the owner of the appliance to take necessary measures [7]. The example discussed here
is just one of many emerging applications of applied weather forecasting that blends the best
of our knowledge of physics, numerics, and artificial intelligence using smart Big Data and
leveraging the Internet of Things. Applications such as these are the future of improved weather
forecasting [7]. In our study, we have observed accuracy, precision, recall and F1 score of the
used model and made a comparison between these models based on the values. We got these
values by pre-processing the dataset with two methodsstandardization and normalization and
one with no-pre-processing. We can see in each case the values are increased after pre-
processing the dataset. It is also seen that the algorithm Gradient Boosting has worked well
over ANN giving better results in most of the cases. Now we come to the confusion matrix
from which we can calculate those things [8]. The project objective is to build our very own
weather dashboard, using Raspberry pi Sense Hat and Wi-Fi USB nano adapter which captures
the weather inside and outside of house over time and sends the data to ThingSpeak. The code
used for the proposed method is developed in python language, which is a default programming
language provided by Raspberry Pi and Store’s the results in new channel API Thing speak
key, which is an IoT application [9]. Extreme Learning Machine possesses features like
generalization performance, less human interference, and far lesser computational time in
training. These features makes it more suitable than existing techniques such as regression,
SVR, hyper spectral imaging for prediction of disease manifestation using weather data [10].
Traffic management in real time has become a complex task as the adverse weather condition
affects the driving conditions badly and it has a big impact on road accidents rates. This paper
present a new autonomous system which give the real-time weather conditions in a short time
and informs the driver the upcoming weather situation to avoid the fatal crashes [11]. In this
paper, we developed a deep learning weather forecast system with Python Keras library and
Pandas library. Based on this system, we use real-world weather data set to test two proposed
hypotheses. Through the extensive evaluations, we found out that increasing the volume of
data used to train a deep learning model used for weather predictions could positively impact

11
the model performance. Additionally, the recency of that data used to train the deep learning
model is not as significant as the amount of data used. In the future, we will use additional
meteorological data sources in addition to the monthly average temperature data used for
weather forecast and apply our deep learning forecast system for other big data [12]. The
professional weather forecasting service consistently outperformed our models across all seven
days, with a large discrepancy in earlier days and a small discrepancy in later days. This was
expected since the physical models of the atmosphere can be accurately solved for short time
periods, but the instability of the physical models causes errors to accumulate quickly for longer
time periods. On the contrary, machine learning algorithms are robust to perturbations in initial
conditions, and over longer periods of time, perhaps our models would outperform the
professional weather forecasting services [13]. Weather forecasting is an application of science
and technology which collects the quantitative data of current state of atmospheric weather and
predict the future state by analyzing the past and present conditions. After, reviewing many
articles one such proposed system is discussed in this paper. The main aim of this article is to
develop an arduino based weather monitoring system which automatically collects the data of
temperature and humidity that store in the database management system [14]. The main motto
was to use the inexpensive components and attain to maximum best accurate system which
could monitor the weather in real time application in agricultural lands and use this data to
make more accurate future weather predictions using machine learning algorithms. Compared
to the Decision Tree, ARIMA can more efficiently capture dynamic behavior of the weather
temperature, resulting in a more compact and natural internal representation of the temporal
information contained in the weather profile [15]. In our work, both linear regression and
functional regression are used to predict the weather parameters. The same dataset is used in
both the algorithms, so that a comparative analysis could be made. Forecasting weather
parameters for a longer duration with more parameters involves the use of artificial Neural
Network. To check the validation of prediction model for weather conditions, both systems are
compared to check the fitness of applicability. The future work involves building a prediction
model using Deep Neural Network [16]. Internet of things (IOT) is a network of interconnected
devices with local intelligence that share access to push and pull the information or status from
the networked world. In this approach the weather information is collected from the
environment and is displayed on the webpage using LPC1768 microcontroller and GSM
network [17]. The system proposed in this paper is an advanced solution for monitoring the
weather conditions at a particular place and make the information visible anywhere in the
world. The technology behind this is Internet of Things (IoT), which is an advanced and

12
efficient solution for connecting the things to the internet and to connect the entire world of
things in a network. Here things might be whatever like electronic gadgets, sensors and
automotive electronic equipment. The system deals with monitoring and controlling the
environmental conditions like temperature, relative humidity and CO level with sensors and
sends the information to the web page and then plot the sensor data as graphical statistics. The
data updated from the implemented system can be accessible in the internet from anywhere in
the world [18]. For the current application of data mining in weather prediction domain, the
analysis of Naïve Bayes and C4.5 Decision Tree algorithm was done simultaneously with
dataset containing weather data collected over a period of 2 years. It was found that the
performance of C4.5 (J48) decision tree algorithm was far better than that of Naïve Bayes. The
accuracy for C4.5 was 88.2% with respect to classifying the instances correctly. On the other
hand, Naïve Bayes showed a poor performance of 54.8% while classifying the instances. The
confusion matrix also supported the above made statement of C4.5 being a better performer in
case of weather dataset. The number of instances that were true positives, i.e., true instances
and also were predicted true by C4.5 was higher than that of Naïve Bayes and in case of number
instances that were true negatives, i.e., false and were predicted as false showed a similar result.
Even the precision of C4.5 was considerable higher in this case. Only the time taken to build
the model was less in case if Naïve Bayes as compared to C4.5 decision tree [19]. In this paper,
k-means clustering and decision tree building process were implementation; both are the most
common data mining techniques tried to highlight the method that the stored data about past
measures can be used for the future ones. Here, j48 (decision tree algorithm) was tried to create
decision-trees & rules for the classification of parameters of weather such as minimum
temperature, maximum temperature, precipitation and wind-speed per months and years.
Experimental trends about sufficient data over-time was analyzed and the significant deviations
was identified that showing the change in climate patterns. Future work can include expanded
database with other important weather parameters and include using this weather information
in agriculture sector reform with cutting edge technologies [20]. In this work, artificial neural
networks are used to predict temperature. Four separate models were trained to predict the
temperature 1, 3, 6, and 12 hours ahead. In the first experiment, only temperature was used as
input to the networks. This constitutes an auto-regressive neural network (AR-NN). In the
second experiment, precipitation data was introduced into the network, forming an
autoregressive neural network with exogenous input (ARXNN). After extensive tuning of
hyper parameters for all eight models, the prediction results of the models were compared.
Introducing precipitation as an input in the ARX model was shown to slightly improve the

13
prediction performance. Hence, it may be interesting to extend the model with other inputs.
Mainly, it is of interest to study whether introduction of data from other geographical locations
can improve the prediction results. Based on knowledge of how the jet stream moves and
influences the weather, together with local pressure variations, it would be natural to add
weather information from, e.g., Kristiansand, Oslo, etc. as exogenous inputs. This will for
future research [21]. In this paper we used data mining technique and Decision tree algorithm
for classifying weather parameters such as maximum temperature, minimum temperature in
terms of the day, month and year. The data used from wounder ground weather site between
2012 and 2015 from different cities. The results show how these parameters have influenced
the weather observed in these months over the study period. Given enough data the observed
trend over time could be studied and important deviations which show changes in climatic
patterns identified. Decision trees prove as an effective method of Decision making in Weather
prediction. As, decision trees are ideal for multiple variable analyses, it is particularly important
in current problem-solving task like weather forecasting. This work is important to climatic
change studies because the variation in weather conditions in term of temperature, rainfall and
wind speed can be studied using these data mining techniques [22]. Weather forecasting is a
meteorological work that easy to modify researcher work by applying the numerical weather
prediction method. Weather forecasted by using various data mining techniques especially
classification clustering and neural network, decision tree. The key aim for improving the
classification and prediction performance for the traditional; weather prediction model is
designed and developed in this work. but some limitation of the model is also observed, thus
in near future need to be review before use of the proposed technique. and also soil there are
some issues and challenges in which better implement of data mining technique should be
implemented in field of weather forecasting [23]. We conclude that using Data mining
techniques for weather prediction yields good results and can be considered as an alternative
to traditional metrological approaches. The study describes the capabilities of various
algorithms in predicting several weather phenomena such as temperature, rainfall and
concluded that major techniques like decision trees, clustering and regression algorithms are
suitable to predict weather phenomena. A comparison is made in this project, which shows that
decision trees and k-medoid clustering are best suited data mining technique for this application
[24]. This research suggests and proposes an efficient and accurate weather prediction and
forecasting model using linear regression concepts and normal equation model. All these
concepts are a part of machine learning. The normal equation is a very efficient weather
prediction model and using the entities temperature, humidity and dewpoint, it can be used to

14
make reliable weather predictions. This model also facilitates decision making in day to day
life. It can yield better results when applied to cleaner and larger datasets. Preprocessing of the
datasets can be effective in the prediction as unprocessed data can also affect the efficiency of
the model [25]

15
Chapter 2
Methodology
First, we have need to put the BME280 sensor on breadboard. We want a 12C Raspberry pi
connection
We prepare the header strip by cutting the strip to length if necessary. It will be easier to solder
if we insert it into a breadboard - long pins down.
Add the breakout board: We place the breakout board over the pins so that the short pins poke
through the breakout pads.
And then we solder.

Block Diagram:

16
The above block diagram states the following steps:

1. The BME 280 is a pressure temperature and humidity sensor it senses the data from
environment.
2. We will then store the stream of Data collected from BME 280 into a database, we will
use Google Firebase as our primary Database.
3. Raspberry Pi will send and receive data from the database.
4. We will use Python Environment to directly fetch those data from Firebase.
5. We will again use json and asynchronous javascript to post those data back to a web
page.

17
Chapter 3
Regression And Prediction
Regression is a statistical measurement used in finance, investing, and other disciplines that
attempts to determine the strength of the relationship between one dependent variable
(usually denoted by Y) and a series of other changing variables (known as independent
variables).
The two basic types of regression are linear regression and multiple linear regression,
although there are non-linear regression methods for more complicated data and analysis.
Linear regression uses one independent variable to explain or predict the outcome of the
dependent variable Y, while multiple regression uses two or more independent variables to
predict the outcome.
Regression can help prediction of weather phenomenon such as temperature, pressure and
rainfall. Regression is a basic Machine Learning Algorithm obtained from Statistics.
When Regression is chosen?
A regression problem is when the output variable is a real or continuous value, such as
“salary” or “weight”. Many different models can be used, the simplest is the linear
regression. It tries to fit data with the best hyperplane which goes through the points.
Broadly Diving Regression:
 Linear Regression
 Logistic Regression
Linear Regression can be subdivided into:
 Simple Linear Regression
 Multiple Linear Regression

18
Simple Linear Regression

Linear regression is a basic and commonly used type of predictive analysis. The overall idea
of regression is to examine two things: (1) does a set of predictor variables do a good job in
predicting an outcome (dependent) variable? (2) Which variables in particular are significant
predictors of the outcome variable, and in what way do they–indicated by the magnitude and
sign of the beta estimates–impact the outcome variable? These regression estimates are used
to explain the relationship between one dependent variable and one or more independent
variables. The simplest form of the regression equation with one dependent and one
independent variable is defined by the formula y = c + b*x…..(1), where y = estimated
dependent variable score, c = constant, b = regression coefficient, and x = score on the
independent variable.

Home | Academic Solutions | Directory of Statistical Analyses | Regression Analysis | What


is Linear Regression?

What is Linear Regression?

Linear regression is a basic and commonly used type of predictive analysis. The overall idea
of regression is to examine two things: (1) does a set of predictor variables do a good job in
predicting an outcome (dependent) variable? (2) Which variables in particular are significant
predictors of the outcome variable, and in what way do they–indicated by the magnitude and
sign of the beta estimates–impact the outcome variable? These regression estimates are used
to explain the relationship between one dependent variable and one or more independent
variables. The simplest form of the regression equation with one dependent and one
independent variable is defined by the formula y  c  b * x , where y = estimated dependent
variable score, c = constant, b = regression coefficient, and x = score on the independent
variable.

Naming the Variables. There are many names for a regression’s dependent variable. It may
be called an outcome variable, criterion variable, endogenous variable, or regressand. The
independent variables can be called exogenous variables, predictor variables, or regressors.

19
Three major uses for regression analysis are (1) determining the strength of predictors, (2)
forecasting an effect, and (3) trend forecasting.

First, the regression might be used to identify the strength of the effect that the independent
variable(s) have on a dependent variable. Typical questions are what is the strength of
relationship between dose and effect, sales and marketing spending, or age and income, or
temperature and pressure, etc.

Second, it can be used to forecast effects or impact of changes. That is, the regression
analysis helps us to understand how much the dependent variable changes with a change in
one or more independent variables. A typical question is, “how much additional temperature
change do I get for each additional 10cm on a typical rainy day?”

Linear Regression is a machine learning algorithm based on supervised learning. It performs


a regression task. Regression models a target prediction value based on independent
variables. It is mostly used for finding out the relationship between variables and forecasting.
Different regression models differ based on – the kind of relationship between dependent and
independent variables, they are considering and the number of independent variables being
used.

Hypothesis function for Linear Regression:

y (x) = 1   2 .X ………… (2)

While training the model we are given:

x: input training data (univariate – one input variable(parameter))

y: labels to data (supervised learning)

When training the model – it fits the best line to predict the value of y for a given value of x.
The model gets the best regression fit line by finding the best θ1 and θ2 values.

20
θ1: intercept
θ2: coefficient of x

Fig 1.0a Fig 1.0b

Above figure describes a scatter plot of simple linear regression, x and y variable .

Multiple Linear Regression


Multiple linear regression (MLR), also known simply as multiple regression, is a statistical
technique that uses several explanatory variables to predict the outcome of a response
variable. The goal of multiple linear regression (MLR) is to model the linear relationship
between the explanatory (independent) variables and response (dependent) variable.

In essence, multiple regression is the extension of ordinary least-squares (OLS) regression


that involves more than one explanatory variable.

yi   0  1 x1   2 x2   p x p ………………….. (3)

yi =dependent variable

xi = explanatory variables

21
β0 = y-intercept (constant term)

βp = slope coefficients for each explanatory variable

ϵ = the model’s error term (also known as the residuals)

A simple linear regression is a function that allows an analyst or statistician to make


predictions about one variable based on the information that is known about another variable.
Linear regression can only be used when one has two continuous variables—an independent
variable and a dependent variable. The independent variable is the parameter that is used to
calculate the dependent variable or outcome. A multiple regression model extends to several
explanatory variables.

The multiple regression model is based on the following assumptions:

There is a linear relationship between the dependent variables and the independent variables.

The independent variables are not too highly correlated with each other.

yi observations are selected independently and randomly from the population.

Residuals should be normally distributed with a mean of 0 and variance σ.

The coefficient of determination (R-squared) is a statistical metric that is used to measure


how much of the variation in outcome can be explained by the variation in the independent
variables. R2 always increases as more predictors are added to the MLR model even though
the predictors may not be related to the outcome variable.

R2 by itself can't thus be used to identify which predictors should be included in a model and
which should be excluded. R2 can only be between 0 and 1, where 0 indicates that the
outcome cannot be predicted by any of the independent variables and 1 indicates that the
outcome can be predicted without error from the independent variables. When interpreting
the results of a multiple regression, beta coefficients are valid while holding all other

22
variables constant ("all else equal"). The output from a multiple regression can be displayed
horizontally as an equation, or vertically in table form.

Chapter 4

Modelling And Prototyping

Hardware Implementation

1. BME 280 sensor will sense the temperature, humidity, pressure al this data.
2. Raspberry Pi will fetch the data from BME 280
3. All these data will be stored into Firebase or a Database Cloud Server.
4. Now the machine learning algorithm will analyse the data.
5. Depending upon the analysis the output will be displayed into a webpage.

Hardware prototyping:

BME 280 12c Wiring:


It's easy to use the BME280 sensor with Python or Circuit Python or Raspberry Pi and the
Adafruit Circuit Python BME280 module. This module allows you to easily write Python
code that reads the humidity, temperature, pressure, and more from the sensor.

We can use this sensor with any Circuit Python microcontroller board or with a computer that
has GPIO and Python thanks to Adafruit_Blinka, our Circuit Python-for-Python compatibility
library.

BME 280 pin configuration: Power Pins: -

Vin - this is the power pin. Since the sensor chip uses 3 VDC, Bosch have included a voltage
regulator on board that will take 3-5VDC and safely convert it down. To power the board, we

23
give it the same power as the logic level of your microcontroller - e.g. for a 5V micro like
Arduino, use 5V.

3Vo - this is the 3.3V output from the voltage regulator, we can grab up to 100mA from this
if we like.

GND - common ground for power and logic.

SPI Logic pins:

All pins going into the breakout have level shifting circuitry to make them 3-5V logic level
safe. Use whatever logic level is on Vin!

SCK - This is the SPI Clock pin, it’s an input to the chip

SDO - this is the Serial Data Out / Master in Slave Out pin, for data sent from the BMP183 to
the processor

SDI - this is the Serial Data in / Master Out Slave in pin, for data sent from processor to the
BME280.

CS - this is the Chip Select pin, drop it low to start an SPI transaction. It’s an input to the chip

If we want to connect multiple BME280's to one microcontroller, have them share the SDI,
SDO and SCK pins. Then assign each one a unique CS pin.

I2C Logic pins:

SCK - this is also the I2C clock pin, connect to the microcontrollers I2C clock line.

SDI - this is also the I2C data pin, connect to the microcontrollers I2C data line.

Wiring Config with Pi: -

 Pi 3V3 to sensor VIN.


 Pi GND to sensor GND.
 Pi SCL to sensor SCK.
 Pi SDA to sensor SDI.

24
Software platform: -
Python Installation of BME280 Library: -

We'll need to install the Adafruit_Blinka library that provides the Circuit Python
support in Python. This may also require enabling I2C on your platform and verifying
you are running Python 3.

The Adafruit_Blinka Library provides with specific commands which helps python to
interface with Raspberry pi and fetch the data from the sensors.

Executing a Python Program: -


The Python program will thus help to obtain certain values of temp, pressure and
humidity for a certain number of days which can be certainly fed back to the Firebase
Cloud with the help of again a python code. The stored values will be form of a tree
database

Fetching Data from Firebase and Manipulating it in Python:


The firebase Library in Python will obtain the data as Json Object from Firebase. We
can use pandas (python Library) to organize them in rows and columns.
Rows and column in pandas are series of object.

25
Software Implementation

Applying Machine Learning Model (Linear Regression) with Weather


Data.

The Weather Data:


We have taken a weather data from Kaggle, and we have trimmed out the unnecessary data.

We have taken 100 datasets for purpose of this machine learning model.

The linear Regression Algorithm:


The input vector X consist of features:

1. Dew point

2. Humidity

3. Pressure

4. Wind

These data are taken as Pandas Data Frame.

The output vector Y consist of prediction feature:

1: Temperature.

26
Step 1: Importing Libraries

Step 2: Implementation

27
Chapter 5

Data Visualisation and Result

Scatter Plot : A scatter plot (also called a scatterplot, scatter graph, scatter chart,
scattergram, or scatter diagram) is a type of plot or mathematical diagram using Cartesian
coordinates to display values for typically two variables for a set of data. If the points are
coded (color/shape/size), one additional variable can be displayed. The data are displayed as
a collection of points, each having the value of one variable determining the position on the
horizontal axis and the value of the other variable determining the position on the vertical
axis.
Dewpoint vs Temperature : (dewpoint on x axis and temperature on y axis)

Humidity Vs Temperature : (Humidity on x axis and Temperature on y axis)

28
Pressure vs Temperature : (Pressure on x axis while temperature on y axis)

WindSpeed vs Temperature : (Windspeed on x axis while temperature on y axis)

Correlation:

Correlation is any statistical association, though it commonly refers to the degree to


which a pair of variables are linearly related. Correlations are useful because they can
indicate a predictive relationship that can be exploited in practice.

29
Correlational Heatmap of different variables :

The Darker color Indicates more correlationship with one variable with the other.
The number indicates the correlationship value.

Tables :

Raw Data : A typical climatic data set of New Delhi from kaggle.

30
Statistical Table of Data:

Std : Standard Deviation


Mean: Mean Value
Min: Minimum Value
Count: Number of variables

Coefficient Table and Regression Plot:


Case 1:
Test Set: 30%
Training Set: 70%
Intercept : 30.947
Metric Score : 0.96893
Coefficient Table:

31
Scatter Plot (X-axis-Testset , y-axis-Prediction):

Regression Plot(X-axis-Testset , y-axis-Prediction):

Case 2:

Test Set: 40%


Training Set: 60%
Intercept : 30.946

32
Metric Score : 0.96572
Coefficient Table:

Scatter (X-axis-Testset , y-axis-Prediction):

33
Regression Plot (X-axis-Testset , y-axis-Prediction):

Case 3:
Test Set: 20%
Training Set: 80%
Intercept : 30.945
Metric Score : 0.97457

Coefficient Table :

34
Scatter Plot (X-axis-Testset , y-axis-Prediction):

Regression Plot (X-axis-Testset , y-axis-Prediction):

35
Chapter 6

Conclusion:

We finally conclude following things:

1.Humidity and temperature has the most correlationship. Thus increase and decrease in
humidity changes the temp for this dataset.

2.The case 3 model gives the most accurate plot without distortion and with better rank.

3.Thus humidity and wind speed are related in some ways. Therefore, wind speed also will
affect the temperature.

4. In our future endeavours we will implement hardware and collect data from real time
database and implement this model paired with other ML technologies.

36
Chapter 7
Reference
1. Indian Journal of Science and Technology, Vol 9(35), DOI:
10.17485/ijst/2016/v9i35/95768, September 2016

2. 2018 International Conference on Advances in Computing and Communication


Engineering (ICACCE-2018) Paris, France 22-23 June 2018

3. Paras, S. Mathur and A. Kumar are with Department of Electronics &


Communication Engineering, College of Technology, India. M. Chandra is with
Department of Mathematics, Statistics and Computer Science, College of Basic
Sciences and Humanities, G. B. Pant University of Agriculture & Technology,
Pantnagar, 263 145, India.

4. Karthik Krshnamurthi, Suraj Thapa, Lokesh Kothari, Arun Prakash, Arduino based
Weather Monitoring System International Journal of Engineering Research and
General Sicence Vol3, ISSN 2091-2730.

5.Proc. IEEE Conference on Emerging Devices and Smart Systems (ICEDSS 2018) 2-
3 March 2018, Mahendra Engineering College, Tamilnadu, India.

6.International Journal of Engineering Research & Technology (IJERT) ISSN: 2278-


0181 Published by, www.ijert.org NCESC - 2018 Conference Proceedings.

7.Sue Ellen Haupt, Jim Cowie, Seth Linden, Tyler McCandless, Branko Kosovic,
Stefano Alessandrini Research Applications Laboratory National Center for
Atmopsheric Research Boulder, CO 80301 USA haupt@ucar.edu

37
8.Anisha Datta , Shukrity Si , and Sanket Biswas , 1. Department of Computer Science
and Engineering, Jalpaiguri Government Engineering College, Jalpaiguri, India, Pin-
735102 dattaanishadatta@gmail.com,sukriti.si98@gmail.com 2. Computer Vision and
Pattern Recognition Unit, Indian Statistical Institute, Kolkata-700108, India.
sanketbiswas1995@gmail.com

9.Adnan Shaout, Yulong Li, Mohan Zhou and Selim Awad, Low cost Embedded
Weather Station with Intelligent System, IEEE

10.B. K. Singh, R. P. Singh, Tejasvee Bisen, Shweta Kharayat Dept. of Computer


Engineering, Dept. of Plant Pathology, Dept. of Computer Engineering.

11.International Research Journal of Engineering and Technology (IRJET) Volume: 06


Issue: 01 | Jan 2019 e-ISSN: 2395-0056

12.Jarrett Booz, Wei Yu, Guobin Xu, David Griffit, and Nada Golmie, Towson
University, MD, USA. Emails: jbooz1@students.towson.edu, wyu@towson.edu
†Frostburg State University, MD, USA. Email: gxu@frostburg.edu ‡National Institute
of Standards and Technology, Emails: david.griffith, nada.golmie@nist.gov .

13.Mark Holmstrom, Dylan Liu, Christopher Vo Stanford University (Dated:


December 15, 2016)

14.Journal of Chemical and Pharmaceutical Sciences ISSN: 0974-2115

15.International Journal of Recent Technology and Engineering (IJRTE) ISSN: 2277-


3878, Volume-7 Issue-5S2, January 2019 .

16.1 Jitcha Shivang, 2S.S Sridhar 1Student, Department of Computer Science and
Engineering SRM IST 2Professor, Department of Computer Science and Engineering
SRM IST 1 shivang_jitul@srmuniv.edu.in, 2 sridhar.s@ktr.srmuniv.ac.in .

38
17.23rd Telecommunications forum TELFOR 2015 Serbia, Belgrade, November 24-
26, 2015 .

18.ARPN Journal of Engineering and Applied Sciences ISSN 1819-6608

19.Indian Journal of Science and Technology, Vol 9(38), DOI:


10.17485/ijst/2016/v9i38/101962, October 2016

20. IJCSNS International Journal of Computer Science and Network Security, VOL.17
No.6, June 2017.

21.. E. B. Abrahamsen, O. M. Brastein, B. Lie, Department of Electrical Engineering,


Information Technology and Cybernetics University of South-Eastern Norway, N-3918
Porsgrunn, *(Bernt.Lie@usn.no) .

22 International Journal of Advanced Research in Computer and Communication


Engineering Vol. 5, Issue 5, May 2016.

23. International Journal of Computer Science Trends and Technology (IJCST) –


Volume 6 Issue 3, May - June 2018.

24. Prashant Biradar[i], Sarfraz Ansari[ii], Yashavant Paradkar[iii], Savita Lohiya[iv].


(i),(ii),(iii)Student, Department of Information Technology, SIES Graduate School of
Technology, Nerul, Navi Mumbai, India.(iv)Professor, Department of Information
Technology, SIES Graduate School of Technology, Nerul, Navi Mumbai, India.

25. Sanyam Gupta et al, / (IJCSIT) International Journal of Computer Science and
Information Technologies, Vol. 7 (3), 2016, 1490-1493 www.ijcsit.

39

Вам также может понравиться