04 Advanced Home Automation Using Raspberry Pi
04 Advanced Home Automation Using Raspberry Pi
SSN College of Engineering SSN College of Engineering SSN College of Engineering SSN College of Engineering
[email protected] [email protected] [email protected] [email protected]
Abstract—The idea of sustainable energy, imposed people in their house. The paper contains information about the
to think of a new alternative way to conserve energy. With proposed system, hardware and software requirements and
the development of technology and internet, a new sensational implementation
advancement known as Internet of Things (IOT) was created.
This paper mainly focuses on energy conservation through home For planning and finding strategies for effective utilization
automation for which sensors and a microprocessor is used. The load predic-tion is essential. In this paper, the real time load
appliances are sensed and controlled using Raspberry Pi for is evaluated for every hour for a day and for weeks. Based
optimal use of electricity in the building. The unnecessary use on these history of load values future load prediction is
of electricity due to carelessness of the customer is identified implemented with machine learning algorithms namely Neural
and controlled remotely using the mobile application. Machine
learning algorithms are used for accurate load forecasting leading Network, Radial Basis Function(RBF), Random Forest and
to effective home energy management.ML algorithms such as Decision Tree Regression (DTR). The performance of these
K Nearest Neibhour(KNN), Decision Tree Regres-sion (DTR), alogorithm for short term load prediction is compared.
Support Vector Regression and Random Forest are implemented The paper is organized as follows. Section 2 discus about
in TensorFlow for load forecasting. the main operations of proposed system with block diagram.
Index Terms—Raspberry Pi, Home automation, Internet of
Things (IoT), Energy management. Section 3 discus about the hardware implementation details.
The sensing and actuators for home automation are discussed
in section 4. Home automation using bluetooth is discussed
I. I n t r o d u c t io n
in section 5. The complete working of home automation
Internet of Things is emerging as one of the most important operations are discussed in section 6. The IOT implementation
concepts for making the idea of ”smart city” a reality [1-3]. on home automations are discussed in section 7. The machine
It finds applications in various sectors including agriculture, learning for load forecasting is discussed in section 8.
retail, health, automobile, etc. The most popular application
of IOT is found in smart grids and home automation [4-5]. II. IOT BASED ENERGY MANAGEMENT
Home automation aims to monitor and control the lighting, ECOSYSTEM
temperature, humidity, motion of that particular place by A. Home Energy Management
means of sensors[6] All the sensors are ideally connected to All the home appliances are remotedly controlled to reduce
a microprocessor thus making the home automation system, the unwanted use of electricity. We find unnecessary use of
which in turn is connected to a central hub or cloud, and electricity due to carelessness of people. One unit of energy
the entire system is controlled by the user by means of an saved is two units of energy produced so if we can able
app [7]. Here Ubidots is used as a cloud platform which is to conserve energy then we can avoid some of the capital
used to receive data from Raspberry Pi and stores it [8-9]. investment required for generating electrical energy to meet
The proposed system is not limited to home alone. It can the increaing demand.In this work how electrical energy can
be used wherever automation is applicable like offices, labs, be effectively utilized in home environment is discussed in
banks. The electrical load forecasting is discussed in [10]. detail.
Load management strategies are discussed in [11]. Machine
learning algorithms used for load forcasting is discussed in B. Block Diagram
[12-14] In this system, Raspberry Pi 3-B+ is used as the micro
This paper presents an advanced method of home automa processor which controls the entire automation process. The
tion by using Raspberry pi as the microprocessor, several Raspberry Pi is connected to the sensors, actuators, cloud
sensors and an app which enables the user to control the platform and the mobile application, as shown in Fig. 1
electrical appliances and thereby controlling energy consumed The sensors detect the physical quantities like light, sound,
Authorized licensed use limited to: Carleton University. Downloaded on June 02,2021 at 22:30:15 UTC from IEEE Xplore. Restrictions apply.
Fig. 2. IR sensor with Obstacles
2021 7th International Conference on Electrical Energy Systems (ICEES 2021) 601
Authorized licensed use limited to: Carleton University. Downloaded on June 02,2021 at 22:30:15 UTC from IEEE Xplore. Restrictions apply.
and turns off the fan. List of commands in smartphone: Light
on, Light off, Fan on, Fan off, as shown in Fig. 5
602 2021 7th International Conference on Electrical Energy Systems (ICEES 2021)
Authorized licensed use limited to: Carleton University. Downloaded on June 02,2021 at 22:30:15 UTC from IEEE Xplore. Restrictions apply.
it is kept in, without the need of humans. Internet of Things A. Decision trees Algorithm
has simplied our life and has been incorporated in various It is a tree structured algorithm and has features like root
industries in various fields. Any thing can be sensed analysed node (initial node which represents the entire sample), decision
and controlled remotely across the world. In an IoT system, node (its branches represents the decision rules) and leaf
sensors will send sensed data to a control center which will node (outcomes) Trees are divided into Classification and
decide according to this data and sends command to actuators Regression Trees. Regression trees are used when the output
as a response. In our project also, various sensors send the variable is a continuous number value. Classification are used
sensed input to the raspberry pi which sends them to the cloud to classify the dataset into groups according to the output
and hence to the app by which user can control the output of variable.
the electrical appliances. Decision tree regression works better if the output is con
B. Cloud Computing : Ubidots tinuous and has multiple features in the input. As the name
suggests Decision tree regression trains the model in a tree
Using Cloud, we can send and access data remotely since
structure to predict data to give a continuous output. The value
the information in not stored locally in any device, but is stored
of the final leaf node is the output which is visually seen in
in data server from which data can be accessed from anywhere.
the tree. Decision tree regression can give better results for
In the system we use Ubidots Cloud platform. Ubidots is a
nonlinear data. The nonlinearity of data is well managed to
cloud platform which allows us to send data from a device to
form to give accurate predictions. It gives better output than
cloud by the use of internet. In Ubidots dashboard, several
the polynomial regression for nonlinearity. Overfitting is the
variables of devices can be added and sensed values from
only concern for decision trees regression. So, the Random
sensors can be stored in the variables Values from the cloud
Forest and XGBoost are preferred when we have more input
can also be accessed by user in app by connected the app with
features.
Ubidots platform. In the Ubidots dashboard, three variables are
created and the sensed by sensors are stored in the variables. B. Support vector regression
C. Smart Mobile application The objective is to find best fit line or boundary and divide
the data in n-dimensional plane and put the new or test data
The raspberry Pi is connected to sensors which read the
in correct category. We have to consider the points within
real time data from the environment and sends it to pi which
the decision boundary line and maximize the boundary to get
in turn sends the data to cloud. This data stored in the cloud
accurate results.
platform is accessed our app. Thus, the app obtains the current
status of the house i.e. all the devices which are currently using C. KNN K Nearest Neibhour Algorithm
electricity and also the power consumed by each, and shows It is based on supervised learning wherein it assumes
that to the user. Then the user can control which appliances to similarity between new and available data and puts the new
on or off with the app based on information provided. Thus, data into category similar to the available data. The distance
we provide an app- based user control. Hence, we can optimize between the new and training data can be measured (Eu
energy consumption in house and regulate the electricity bill clidean, Manhattan, Minkowski).
cost of the house
D. Random forest regression
VI. MACHINE LEARNING
It is ensemble technique (it predicts the output based on
The Machine learning is a subset of artificial intelligence. It
combining multiple decision tree algorithms) and gives accu
trains the system such that it can provide solutions to problems
rate results than individual models. It uses another technique
based on the patterns in the databases. The performance of
called bagging(it involves random sampling which has bias
the system is improved by using different algorithms based
and improves the accuracy of the output. Random forests or
on the type of datasets used.Machine learning is the ability
random decision forests is an algorithm for classification, re
to teach computer to take decision without programming it.
gression by implementing multiple decision trees at training
Machines can recognize predict and act. In smart grid to
time and outputting the mean forecast of the individual trees
predict electricity consumption of a household for the next
which provides a continuous output hence solving a regression
hour, it can be done with the past data for months. Types of
problem.
machine learning are
• Supervised learning can apply what has been learned in E. Machine learning Algorithm Implementation
the past and use it to predict future events. Initially the required software, ANACONDA, is installed in
• Unsupervised learning can apply based on recognizing the system and create a new environment using ANACONDA
the hidden patterns in the database and give useful prompt. Open a new notebook which by default has all the
insights. required platforms within this environment. Tensor flow is
• Reinforced learning is reward based system and mini installed and Anaconda navigator is used install the necessary
mizes the risk of error. It learns in iterative process and packages like scikit learn, pandas etc., Then by using the
predicts the future events Jupyter code editor the programming is done using Scikit
2021 7th International Conference on Electrical Energy Systems (ICEES 2021) 603
Authorized licensed use limited to: Carleton University. Downloaded on June 02,2021 at 22:30:15 UTC from IEEE Xplore. Restrictions apply.
learn. Jupyter is the code editor for Julia (data science pro and peak time are considered to improve the accuracy of
gramming language), Python and R Languages. Implementa estimation. The coefficients of time are 0.17, price is -0.10 and
tion is done in four steps: Create a new notebook Write the peak hours is 0.12. It shows the rate of change of the features
code Add text if needed Parameters of the algorithm used can (time, price and peak hours) for every change in point in the
be modified to get an accurate output Home appliances loads graph. Accuracy is one of the metric for evaluating the models.
are considered for load observations. The load usage for a day It gives the pattern between input and output variables and
(24 hours) is observed. Then the load Vs time observation is the number of correctly predicted data out of all the dataset.
extended in the department for a period of one year and these The accuracies for each algorithm used shows the difference
are taken as the training data. The load usage dependency is between the measured value and true value. Therefore higher
extended to cost/Kwh and peak hour consumption. Using this the accuracy better is the performance of the model using that
intelligent analysis, the consumer can predict their level of algorithm
usage if they consume at their current rate of consumptions.
It will enable the consumer to use energy sustainably and VII. C o n c l u s io n
optimize the usage. Out of this data 80 percent is taken for This paper discussed about IoT based home automation
only training and the remaining 20 percent data are taken for system which will work effectively to monitor the energy
testing. Data pre-processing is done in order to improve the consumed in our household and will conserve energy. Energy
accuracy of prediction. All the algorithms explained above are conserved is energy generated. Our work is wholesome, re
implemented and the accuracy of the algorithms are shown in newable and proficient with Iot based monitoring and control
Fig. 7 of appliances to conserve energy. Machine learning algorithms
are used for optimal use of electricity through accurate es
A lg o rith m s used A ccu ra cy timation. Since the Load data are nonlinear KNN, Random
Forest,Support vector regression and Decision Tree Regression
D e c isio n tree 99% algorithms are implemented for improving the accuracy of
load forecasting. Along with the existing features many more
Support V ector 9 8 .5 1 %
features like weather, no of persons in house hold, can be
R egression
added to further improve the accuracy. Our system not only
KNN 96 .8 1 %
reduces energy consumption benefiting economically, but also
R andom forest 73.25%
conserves the energy which could be used for the future, hence
R egression
benefitting socially and thereby leading to sustainable growth
of our earth with the available resources. We can further extend
our project to find out the areas which have high level of
Fig. 7. Load forecasting Accuracies of Algorithms electricity usage during certain hours of a day on daily basis
and propose a system to conserve and reduce the electricity
Decision tree algorithm gives the highest accuracy among usage during those maximal usage hours and ensure optimal
all the algorithm considered. The output of decision tree use of the resources at various levels and institution.
algorithm is given in Fig. 8
Re f e r e n c e s
[1] Al-Ali, Al-Rousan, Java based home automation system, IEEE transac
tion on consumerbelectronics, vol.50, no2, pp.498-504,May 2004
[2] Byenogkwan Kang, Sunghoi Park et.al IoT Based monitoring systems
using Tri-level context making model for Smart Home Services, 2015
IEEE International conference on consumerElectronics 9(ICCE), 2015
[3] Dhiraj sunehra, M.Veena, Implementation of interactive home automa
tion systems based onEmail and Bluetooth technologies, 2015 Interna
tional Conference On Information Processing,Vishwakarma Institute of
Technology, Dec 16-19,2015
[4] J.Jeyapadmini, K.R.Kashwan, Effective Power Utilization and conser
vation in Smart HomesUsing IoT, 2015 International Conference on
computation of power ,Information and Communication, 2015.
[5] Jasmeet chhbra, Punita Gupta, IoT based smart home design using power
and security management system,2016 1st International Conference on
Innovation and challenges in cybersecurity(ICICCS)2016
[6] Kumar Mandula et.al, Mobile based Home Automation using Internetof
Things(IoT), 2015
[7] V. Patchava, H. B. Kandala and P. R. Babu, ”A Smart Home Automation
technique with Raspberry Pi using IoT”, 2015 International Conference
Fig. 8. Outout of decision Tree Algorithm on Smart Sensors and Systems (IC-SSS), pp. 1-4.Bangalore, 2015
[8] E. Rammohana Reddy, K. Sankara, Internet of Things Based Home
Automation Control System Using Raspberry Pi, 2018 International
Here the best fit line of the database using decision tree Journal of Scientific Research in Computer Science,Engineering and
algorithm is shown. Initially the time is considered then price Information Technology
604 2021 7th International Conference on Electrical Energy Systems (ICEES 2021)
Authorized licensed use limited to: Carleton University. Downloaded on June 02,2021 at 22:30:15 UTC from IEEE Xplore. Restrictions apply.
[9] K. Venkatesh, P. Rajkum ar et.al IoT Based Home Automation Using
Raspberry Pi, Journal of Adv Research in Dynamical and amp; Control
Systems, Vol. 10, 07-Special Issue, 2018
[10] A. A. A. V. A. Khwaja M. Naeem and B. Venkatesh, Improved short
term load forecasting using bagged neural networks, Electric Power
Systems Research, vol. 125, pp. 109115, 2015.
[11] J. M. Lujano-Rojas, C. Monteiro, R. Dufo-Lopez, and J. L. Bernal-
Agustn, Optim um residential load management strategy for real time
pricing (rtp) demand response programs, in Ener-gy Policy, vol. 45, pp.
671679, 2012.
[12] P. R. P. S. C. Cecati J. Kolbusz and B. M. Wilamowski, A novel rbf
training algorithm for short-term electric load forecasting and compar
ative studies, IEEE Transactions on Industri-al Electronics, vol. 62, pp.
65196529, 2015
[13] Y. Z. L. Wang and T. Chen, Back propagation neural network with
adaptive differential evolution algorithm for time series forecasting,
Expert Systems with Applications, vol. 42, no. 2, pp. 855 863, 2015.
[14] J. H. Friedman, ’’Stochastic gradient boosting” , Computational Statistics
and Data Analysis, vol. 38, no. 4, pp. 367-378, 2002.
2021 7th International Conference on Electrical Energy Systems (ICEES 2021) 605
Authorized licensed use limited to: Carleton University. Downloaded on June 02,2021 at 22:30:15 UTC from IEEE Xplore. Restrictions apply.