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

Intelligent Smart Switch Using IoT

and Machine Learning


Elixir

By
Haris Ijaz
M. Ahsan Raza
M. Bilal Javed

BEE-FA15-013
BEE-FA15-020
BEE-FA15-059
Supervisor
Dr. Asim Khan
Engr. Hafiz Ahsan
School of Electrical Engineering
A thesis submitted in partial fulfillment of the requirements for the degree
of Electrical Engineering Specialization in Computer System

In
School of Electrical Engineering,
The University of Faisalabad (TUF),
Faisalabad, Pakistan.
(27 June 2019)
Abstract

Home Automation Systems have increased worldwide popularity in the last


decade or so. But now world looking towards Intelligent Smart Home Au-
tomation Systems which must be wise to provide efficient electricity usage
plan. Intelligent Smart Switch is based on making user life easier. The Inter-
net of Things makes a vast amount of data. Additionally, it contains a huge
number of sensors and their data which can control or monitor appliances.
This project shows about how the Internet of Things (IoT), Machine Learn-
ing and Data Mining use for converting the normal home to the Intelligent
Smart home. A user of this system can control their appliances using their
smart phone application as well as the web browser which are connected to
the internet. The user will also get efficient usage plan to minimize the power
wastage. This project is divided into four section, Hardware, User Interface
(UI), Cloud Platform and Data mining and Machine Learning.

i
APPROVAL CERTIFICATE

This Project Thesis Report titled ”Intelligent Smart Switch Using IoT
and Machine Learning” has been found satisfactory in terms of scope,
quality and presentation as partial fulfillment of the requirement for the
Bachelor of Electrical Engineering (Computer Systems) in the University of
Faisalabad.

Project Supervisor:

Dr. Asim Khan

Signature:

Date:

Project Co-Supervisor:

Engr. Hafiz Ahsan

Signature:

Date:

ii
Dedication

I dedicate my work to my family and many friends. A special feeling of grati-


tude to my loving parents, our Supervisor Dr. Asim Khan and Co-supervisor
Engr. Hafiz Ahsan. Working them has been a great experience for us. Their
guidance advice has been a great source of inspiration for us throughout
the thesis work. We are grateful to the University of Faisalabad for such a
wonderful education system who welcomed us to complete our BS Electrical
Engineering.

iii
Certificate of Originality

We hereby declare that this submission is our own work and to the best
of our knowledge it contains no materials previously published or written by
another person, nor material which to a substantial extent has been accepted
for the award of any degree or diploma at The University of Faisalabad or
at any other educational institute, except where due acknowledgment has
been made in the thesis. Any contribution made to the research by others,
with whom we have worked at The University of Faisalabad or elsewhere, is
explicitly acknowledged in the thesis. We also declare that the intellectual
content of this thesis is the product of our own work, except for the assistance
from others in the project’s design and conception or in style, presentation
and linguistics which has been acknowledged.

Group Members Name:

Haris Ijaz

M. Ahsan Raza

M. Bilal Javed

iv
Acknowledgment

All praises to Almighty Allah, whose enormous blessings give us strength and
make us able to complete this thesis. We would like to express our gratitude
to our kind Supervisor Dr. Asim Khan and Co-supervisor Engr. Hafiz Ahsan
for their guidance, support and encouragement. Working with them has been
a true privilege and great experience for us. Their guidance and advice has
been a great source of inspiration for us throughout the thesis work. We are
grateful to the The University of Faisalabad for such a wonderful education
system, who welcomed us to complete our BS Electrical Engineering. Finally,
all blessings upon our beloved parents and families whose prayers and moral
support always motivated us to complete our studies.

v
Table of Contents

1 Introduction 1
1.1 Objective . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 Problem statement . . . . . . . . . . . . . . . . . . . . . . . . 2
1.3 Methodology . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.4 Breakdown of Report . . . . . . . . . . . . . . . . . . . . . . . 2

2 Automation 3
2.1 Home Automation . . . . . . . . . . . . . . . . . . . . . . . . 3
2.1.1 History of Home Automation . . . . . . . . . . . . . . 3
2.1.2 Modern Smart Homes . . . . . . . . . . . . . . . . . . 3
2.1.3 Smart Controllers . . . . . . . . . . . . . . . . . . . . . 3
2.1.4 Smart Devices . . . . . . . . . . . . . . . . . . . . . . . 3
2.1.5 Elements of Smart Home Automation . . . . . . . . . . 3
2.2 Application of Smart Home Automation . . . . . . . . . . . . 3
2.3 Automation Office . . . . . . . . . . . . . . . . . . . . . . . . 3
2.4 Building Automation . . . . . . . . . . . . . . . . . . . . . . . 3
2.5 Automatic Power . . . . . . . . . . . . . . . . . . . . . . . . . 3

3 Hardware 4
3.1 ESP8266 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
3.2 Electromagnetic Relay . . . . . . . . . . . . . . . . . . . . . . 4
3.3 ZMCT103C Current Sensor . . . . . . . . . . . . . . . . . . . 4
3.4 Optocoupler . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
3.5 74HC4051 Multiplexer . . . . . . . . . . . . . . . . . . . . . . 4
3.6 Fuse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
3.7 PCB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
3.8 Sensors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

4 Software 5
4.1 Arduino IDE . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
4.2 Arduino Sketches . . . . . . . . . . . . . . . . . . . . . . . . . 5

vi
TABLE OF CONTENTS vii

4.2.1 Elixir Multiple Switch . . . . . . . . . . . . . . . . . . 5


4.2.2 Elixir Double Switch . . . . . . . . . . . . . . . . . . . 5
4.2.3 Elixir Single Switch . . . . . . . . . . . . . . . . . . . . 5
4.2.4 Sensor Module . . . . . . . . . . . . . . . . . . . . . . 6

5 Cloud Platforms 7
5.1 Google Firebase . . . . . . . . . . . . . . . . . . . . . . . . . . 7
5.2 ThingSpeak Server . . . . . . . . . . . . . . . . . . . . . . . . 7

6 User Interface 8
6.1 Android Application . . . . . . . . . . . . . . . . . . . . . . . 8
6.2 Web App . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

7 Hardware Enclosure 9
7.1 3D Modeling . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
7.2 3D Printing . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

8 Implementation and Result 10


List of Figures

viii
List of Tables

ix
Chapter 1

Introduction

Elixir provides a simple and comprehensive solution for saving energy, just by
swapping traditional switches by intelligent smart switches. It is based on a
low-cost wireless controlled IoT based intelligent smart switch for controlling
and monitoring the home appliances. The user can control appliances using
mobile application and web browser. The intelligent smart switch sends the
sensor data to the cloud platform which stores the data for future use.
Elixir provides a simple and comprehensive solution for saving energy,
just by swapping traditional switches by intelligent smart switches. It is
based on a low-cost wireless controlled IoT based intelligent smart switch
for controlling and monitoring the home appliances. The user can control
appliances using mobile application and web browser. The intelligent smart
switch sends the sensor data to the cloud platform which stores the data for
future use.

1.1 Objective
The aim of the project is to eliminate energy wastage by monitoring energy
usage of each appliance in the home and provide an energy proficient plan
to the user. It will be able to predict the behavior of appliances operating in
the location and provide a competent profile of the user. Our intention is to
use modern technologies and advance knowledge to capitalize on the quality
measures.

1. Fabrication of smart switch.


2. Design and development of User Interface (Android app, Web page).
3. Data collection on cloud platform.
4. Effective energy usage plan using Machine Learning.

1
CHAPTER 1. INTRODUCTION 2

We can optimize various parameter using Machine Learning such as Bill,


Load and time. We want to achieve effective usage plan using different
machine learning algorithms.

1.2 Problem statement


As an increase in population and global integration, energy consumption
also increases. This pretense a risk for run-down natural resources, and In-
creases demand of renewable energy systems. The prices of fossil fuel going
up progressively. Pakistan is in front of the energy crisis where electricity
generation is far less than consumption and 50 percent of electricity is con-
sumed by household in Pakistan. By using intelligent smart switches we will
be able to reduce energy wastage by providing efficient usage plan.
It does not lie that the world is moving towards energy crises. The need
of the hour is to save energy by using modern technologies which involve
Internet of Thing (IoT) and Machine Learning. The problem is to monitor
energy usage and provide an effective plan that helps the user in both energy
saving and reducing electricity bills.

1.3 Methodology
Elixir is a low-cost wireless controlled IoT based intelligent smart switch. For
controlling and monitoring the home appliances. User can control appliances
using Android application and Web page. Elixir sends the sensor data to
the cloud platform. Machine Learning algorithms use to get effective energy
plan.

1.4 Breakdown of Report


In Chapter 2, we will study about the automation, elements of automation,
application of smart home systems, history of home automation, modern
technologies of home automation differenct types of automation and smart
devices.
Chapter 2

Automation

2.1 Home Automation


2.1.1 History of Home Automation
2.1.2 Modern Smart Homes
2.1.3 Smart Controllers
2.1.4 Smart Devices
2.1.5 Elements of Smart Home Automation

2.2 Application of Smart Home Automation


2.3 Automation Office
2.4 Building Automation
2.5 Automatic Power

3
Chapter 3

Hardware

3.1 ESP8266
3.2 Electromagnetic Relay
3.3 ZMCT103C Current Sensor
3.4 Optocoupler
3.5 74HC4051 Multiplexer
3.6 Fuse
3.7 PCB
3.8 Sensors

4
Chapter 4

Software

4.1 Arduino IDE


4.2 Arduino Sketches
4.2.1 Elixir Multiple Switch
4.2.2 Elixir Double Switch
4.2.3 Elixir Single Switch
include < T hingSpeak.h > include < F irebaseArduino.h > include <
ESP 8266W iF i.h >
define FIREBASEH OST ”testproject−e50f 7.f irebaseio.com”def ineF IREBASEA U T H”Y m
define Relay1 D7 define ANALOGI N P U T A0
int rel1;
float nVPP1; float nCurrThruResistorPP1; float nCurrThruResistorRMS1;
float nCurrentThruWire1;
String apiWritekey = ”TJ3RGPOEYG50BAOS”; const char* server =
”api.thingspeak.com”; WiFiClient client;
void setup() Serial.begin(115200); pinMode(Relay1, OUTPUT); pin-
Mode(D1, OUTPUT); digitalWrite(Relay1, HIGH); digitalWrite(D1, LOW);
WiFi.begin(WIFIS SID, W IF IP ASSW ORD); Serial.print(”connecting”); while(W iF i.statu
W LC ON N ECT ED)Serial.print(”.”); delay(500);Serial.println(); Serial.print(”connected :
”); Serial.println(W iF i.localIP ());
pinMode(ANALOGI N P U T, IN P U T );
Firebase.begin(FIREBASEH OST, F IREBASEA U T H);
float getVPP() float result; int readValue; int maxValue = 0; uint32t startt ime =
millis(); while((millis()−startt ime) < 1000)readV alue = analogRead(AN ALOGI N P U T ); if (r

5
CHAPTER 4. SOFTWARE 6

(maxV alue ∗ 3.3)/1024.0; returnresult; voidloop()


float value;
rel1 = Firebase.getString(”FB7”).toInt();
if (rel1 == 1) digitalWrite(Relay1, HIGH); Serial.println(”Relay 1 ON”);
nVPP1 = getVPP(); nCurrThruResistorPP1 = nVPP1 / 330.0; nCurrThruRe-
sistorRMS1 = nCurrThruResistorPP1 * 0.707; nCurrentThruWire1 = nCur-
rThruResistorRMS1 * 1000; Serial.println (nCurrentThruWire1, 3); delay(500);
if (rel1 == 0) digitalWrite(Relay1, LOW); Serial.println(”Relay 1 OFF”);
nCurrentThruWire1 = 0; Serial.println (nCurrentThruWire1);
if (client.connect(server, 80)) String tsData = apiWritekey; tsData +=
”field1=”; tsData += String(nCurrentThruWire1, 3); tsData += ”˚˚”;
client.print(”POST /update HTTP/1.1”); client.print(”Host: api.thingspeak.com”);
client.print(”Connection: close”); client.print(”X-THINGSPEAKAPIKEY:
” + apiWritekey + ””); client.print(”Content-Type: application/x-www-
form-urlencoded”); client.print(”Content-Length: ”); client.print(tsData.length());
client.print(””); client.print(tsData); delay(1000);
client.stop();

4.2.4 Sensor Module


Chapter 5

Cloud Platforms

5.1 Google Firebase


5.2 ThingSpeak Server

7
Chapter 6

User Interface

6.1 Android Application


6.2 Web App

8
Chapter 7

Hardware Enclosure

7.1 3D Modeling
7.2 3D Printing

9
Chapter 8

Implementation and Result

10
Bibliography

11

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