SlideShare ist ein Scribd-Unternehmen logo
1 von 241
Downloaden Sie, um offline zu lesen
ABU DHABI UNIVERSITY
Demand Side Load Management to
Match Solar Power Generation
by
Mr. Albert James Nannety
Mr. Faiq Amir
Mr. Mehdi Ismail Sait
Mr. Mohammed Ali Sadi
A thesis submitted in partial fulfillment for the
degree in Bachelors of Computer and Electrical Engineering
to
Dr. Muhammad Akmal. & the Committee
Department of Computer and Electrical Engineering (College Of Engineering)
June 2015
Declaration of Authorship
We, the undersigning authors, declare that this thesis titled, ‘DEMAND SIDE LOAD
MANAGEMENT TO MATCH SOLAR POWER GENERATION’ and the work pre-
sented in it are our own. We confirm that:
This work was done wholly or mainly while in candidature for a research degree
at this University.
Where any part of this thesis has previously been submitted for a degree or any
other qualification at this University or any other institution, this has been clearly
stated.
Where I have consulted the published work of others, this is always clearly at-
tributed.
Where I have quoted from the work of others, the source is always given. With
the exception of such quotations, this thesis is entirely my own work.
I have acknowledged all main sources of help.
Where the thesis is based on work done by myself jointly with others, I have made
clear exactly what was done by others and what I have contributed myself.
Author: Albert James Author: Ali Sadi
Signed: Signed:
Date: Date:
Author: Faiq Amir Author: Mehdi Ismail
Signed: Signed:
Date: Date:
i
“Engineers like to solve problems. If there are no problems handily available, they will
create their own problems. ”
Scott Adams
“In order to change an existing paradigm you do not struggle to try and change the
problematic model. You create a new model and make the old one obsolete. ”
R. Buckminster Fuller
“Simplicity is the ultimate sophistication. ”
Leonardo da Vinci
“Don’t undertake a project unless it is manifestly important and nearly impossible. ”
Edwin Land
“Of all sad words of tongue or pen, the saddest are these, ’It might have been’. ”
John Greenleaf Whittier
“Deleted code is debugged code. ”
Jeff Sickel
“The art of progress is to preserve order amid change and to preserve change amid order.
”
Alfred North Whitehead
“With great power comes a great electric bill. ”
Anonymous
ABU DHABI UNIVERSITY
Abstract
Dr. Muhammad Akmal
Department of Computer and Electrical Engineering (College Of Engineering)
Doctor of Electrical Power Systems
by Mr. Albert James Nannety
Mr. Faiq Amir
Mr. Mehdi Ismail Sait
Mr. Mohammed Ali Sadi
This report is the documentation which serves as the final thesis report for the design
project titled Demand Side management to match Solar Power Generation as Supply
source in Generation. The project has various implications and motivations; from what
propels major developments in this field that is the environmental factor, to being an
investment for financial or locality issues and a lengthy list from there. Our system is
aimed at those who take electrical power security for their systems as core in mountain-
ous and inaccessible regions or as backup system against unforseen situations or voltage
drops would gladly invest in our system, that provides ambience, efficiency, and even
fullfilment to a status-quo for individuals in their houses. Our solution is fairly innova-
tive in considering to provide prioritization to the various components in houses, instead
of voltage drops and damaging household Utilities, and also secures system stability by
cutting off battery from household sources upon falling below a certain level based on
data intelligence from the systems usage. This does relate to the famous concept of UPS
(Uninterruptable Power Supply) but is quite further advanced, to meet future require-
ments and innovate on well-established utility, fully utilizing off-grid Solar power and
simulating reactions that save power and energy.
The two main objectives are to give the user a complete scenario of the power consump-
tion and the facility of turning off the loads of the least priority while keeping the loads
of the highest priority working. Another aspect that is accomplished is the complete
utilization of solar power in off-grid settings. This symbolizes any crises situation or
acute breakdowns that can occur in the national grid. How is the load to be managed
upon voltage and power reduction in an off-grid setting. This is the question answered
to some extent in our project. The user witnesses in front of him the complete picture
of the current supply, battery voltage and thus the power supply. The real time battery
voltage is our deciding factor and as a reaction any reduction in it, the management
aspect comes into action where the switching on and off of loads via relays takes place.
If we consider the existing solutions in the world regarding load management, the region
that comes to one’s mind is South Asia. The prevalent concept used is with complete
grid integration and is often called load-shedding or black-outs. The drawback of such
a system is that it affects every in-house unit and every load indiscriminately. There is
no pre-set priority system that exists that would help in making a regular load manage-
ment system smart. Indiscriminatory systems as a reaction to power cuts and voltage
reductions would mean that no such load exists that can be kept on regardless of the
Priority.
In addition, the ease provided to the user in terms of the complete display of power
supplied is something not seen very often. We aim to develop a webapp that constantly
updates the value of the three main power variables from a server made exclusively for
the system and stores them in a database. Upon set intervals, these variables are re-
trieved from the database and presented in front of the user so that one exactly knows
the status of consumption in details.
Furthermore, we are putting to use the relays in the operations of different loads and
having it communicate with the microcontroller. The arduino in use coordinates with
the relay in such a way that when a voltage drop from the real time battery voltage is
detected too. . .
Acknowledgements
We, the capstone group would like to thank God Almighty for his grace and mercy to-
wards us , neither of which we deserve, but has been given to us freely and abundantly.
We could not have got this far without help from so many people...Our Parents and fam-
ily who have loved and supported us throughout all of this, our professors and faculty
who have helped us gain the knowledge we need for the cause of lifelong learning, our lab
engineers, Engineer Ahmed and Engineer Ibrahim who provided us with the technical
and practical application that we need. Our friends and classmates, who encouraged us
and helped us in many ways. A special thanks to Sifat Sultan who gave us a lot of good
advice and support throughout this project and helped us understand a lot of concepts.
Finally, to our beloved mentor, professor, supervisor, adviser, coach and teacher, Dr.
Muhammad Akmal. We are so privileged that we got to work with him. He is a very
humble, patient, kind and respectful human being. His vast knowledge is something
that we are so proud to be a part in sharing and his work ethic and amazing personality
is very rare to find. We have no idea how this project would have even been possible if
it weren’t for him. We wish him all the best and thank him so very much for guiding
us through this process even when we were really difficult to deal with. We pray that
God blesses him with choicest blessings in all his future endeavors. . . .
vi
Contents
Declaration of Authorship i
Abstract iii
Acknowledgements vi
List of Figures xi
List of Tables xiii
1 Introduction 1
1.1 Problem Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.1.1 Motivations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.2.1 The Arduino-conrolled ACS712 Hall effect sensing . . . . . . . . . 3
1.2.2 The Database and Server . . . . . . . . . . . . . . . . . . . . . . . 3
1.3 Literature Review . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.4 The Contents of the report . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2 Design 8
2.1 Problem Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.1.1 Fritzing Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.1.2 Calculations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.1.2.1 Calibrations for microcontroller . . . . . . . . . . . . . . 13
2.1.2.2 calculations for the Voltage Divider circuit . . . . . . . . 16
2.1.3 Connections between components . . . . . . . . . . . . . . . . . . . 18
2.1.3.1 The battery and arduino: Voltage Divider . . . . . . . . . 18
2.1.3.2 The battery, arduino and inverter: Current readings . . . 20
2.1.3.3 Inverter to the loads . . . . . . . . . . . . . . . . . . . . . 20
2.1.3.4 Loads and the PCB . . . . . . . . . . . . . . . . . . . . . 20
3 Project Implementation 21
3.1 Integration of components with Arduino . . . . . . . . . . . . . . . . . . . 21
3.1.1 Voltage sensing with the Arduino . . . . . . . . . . . . . . . . . . . 22
3.1.2 Current sensing with the Arduino . . . . . . . . . . . . . . . . . . 24
vii
Contents viii
3.1.3 Power supplied reading . . . . . . . . . . . . . . . . . . . . . . . . 25
3.1.4 Relay operation to turn off low priority load via Arduino . . . . . 26
3.1.4.1 SPDT Relays . . . . . . . . . . . . . . . . . . . . . . . . . 26
3.1.4.2 Integration of the Printed Circuit Board: Operation of
relay in the design via Arduino . . . . . . . . . . . . . . . 30
3.1.4.3 1N1418 Diode . . . . . . . . . . . . . . . . . . . . . . . . 30
3.1.4.4 Resistors . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
3.1.4.5 Screw Terminals . . . . . . . . . . . . . . . . . . . . . . . 31
3.1.4.6 2N3904 BJ Transistor . . . . . . . . . . . . . . . . . . . . 31
3.1.5 Printed Circuit Board application . . . . . . . . . . . . . . . . . . 31
3.1.5.1 Problems faced in PCB creation . . . . . . . . . . . . . . 32
3.1.5.2 Relay PCB with the 5A current sensor integrated . . . . 33
3.1.6 The Battery . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
3.1.6.1 AGM and GEL . . . . . . . . . . . . . . . . . . . . . . . 38
3.1.6.2 Battery connections . . . . . . . . . . . . . . . . . . . . . 39
3.1.6.3 Possible improvements with the Use of Voltage Regulators 39
3.1.7 Implementation in terms of software . . . . . . . . . . . . . . . . . 47
3.1.7.1 The Voltage Divider Code . . . . . . . . . . . . . . . . . 47
3.1.8 Current Sensor Code . . . . . . . . . . . . . . . . . . . . . . . . . . 48
3.1.9 Investigation of Load Side Monitoring Methodology . . . . . . . . 48
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
3.2 Web App . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
3.3 HTTP Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
GET . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
HEAD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
POST . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
PUT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
DELETE . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
CONNECT . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
OPTIONS . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
TRACE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
3.3.1 The Web Application . . . . . . . . . . . . . . . . . . . . . . . . . 54
3.3.1.1 HTML . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
3.3.1.2 CSS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
3.3.1.3 JavaScript . . . . . . . . . . . . . . . . . . . . . . . . . . 56
3.3.1.4 Parallax . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
3.3.1.5 Angular JS for the WebApp . . . . . . . . . . . . . . . . 58
3.3.1.6 jQuery . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
3.3.1.7 Json . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
3.3.1.8 Load Management Webapp: Using Json in JavaScript . . 65
3.3.1.9 Load Management Webapp: DOM . . . . . . . . . . . . . 66
3.3.1.10 Load Management Webapp: API or Application Pro-
gramming Interface . . . . . . . . . . . . . . . . . . . . . 67
3.3.1.11 The Final Load Management Web Applciation . . . . . . 68
3.3.1.12 Old Code For the Application . . . . . . . . . . . . . . . 79
Contents ix
3.3.1.13 Mobile Application . . . . . . . . . . . . . . . . . . . . . 82
3.3.1.14 Ionic Framework . . . . . . . . . . . . . . . . . . . . . . . 84
4 Project Management 90
4.1 Team Members . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
4.1.1 Member 1: Albert James Nannety . . . . . . . . . . . . . . . . . . 90
4.1.2 Member 2: Mohammed Ali Sadi . . . . . . . . . . . . . . . . . . . 91
4.1.3 Member 3: Mehdi Ismail Sait . . . . . . . . . . . . . . . . . . . . . 91
4.1.4 Member 4: Faiq Amir . . . . . . . . . . . . . . . . . . . . . . . . . 91
4.1.5 Management techniques . . . . . . . . . . . . . . . . . . . . . . . . 92
4.1.6 Division of Tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
4.2 Problems in Acquisition . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
4.3 Email Exchanges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
5 Results and Discussion 100
5.1 Working of the system . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
5.2 The Impact of the Project on the Society . . . . . . . . . . . . . . . . . . 100
5.2.1 Impact of the Project on the environment . . . . . . . . . . . . . . 101
5.3 Test 1: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
5.3.1 Testing the voltage divider: . . . . . . . . . . . . . . . . . . . . . . 102
5.4 Test 2: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
5.4.1 Testing the current sensor: ADC Values . . . . . . . . . . . . . . . 102
5.5 Test 3: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
5.5.1 ADC Offset adjusted values . . . . . . . . . . . . . . . . . . . . . . 107
5.6 Test 4: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
5.6.1 The true current value . . . . . . . . . . . . . . . . . . . . . . . . . 107
6 Conclusion and Future Work 108
6.1 Report Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
6.2 What we learned technically . . . . . . . . . . . . . . . . . . . . . . . . . . 108
6.3 Experience gained from working as a team . . . . . . . . . . . . . . . . . . 109
A References 111
B Source Codes 117
B.1 Web Application Source Code . . . . . . . . . . . . . . . . . . . . . . . . . 117
B.1.1 HTML Source Code . . . . . . . . . . . . . . . . . . . . . . . . . . 117
B.1.1.1 ”index.html” . . . . . . . . . . . . . . . . . . . . . . . . . 117
B.1.1.2 ”addnew.html” . . . . . . . . . . . . . . . . . . . . . . . . 124
B.1.2 CSS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
B.1.2.1 ”style.css” . . . . . . . . . . . . . . . . . . . . . . . . . . 128
B.1.3 JavaScript . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
B.1.3.1 ”script.js” . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
B.1.4 Arduino Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208
B.1.4.1 Load With Error Detection . . . . . . . . . . . . . . . . . 213
B.1.4.2 Hello World . . . . . . . . . . . . . . . . . . . . . . . . . 214
Contents x
B.1.4.3 Load First Attempt . . . . . . . . . . . . . . . . . . . . . 215
B.1.4.4 Test 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216
B.1.4.5 SocketIO . . . . . . . . . . . . . . . . . . . . . . . . . . . 216
B.1.4.6 Wi-Fi Shield Code . . . . . . . . . . . . . . . . . . . . . . 218
B.1.4.7 Wi-Fi Shield Code New . . . . . . . . . . . . . . . . . . . 220
B.1.5 Mobile Application Codes . . . . . . . . . . . . . . . . . . . . . . . 223
B.1.5.1 Ionic HTML . . . . . . . . . . . . . . . . . . . . . . . . . 223
B.1.5.2 Ionic App JavaScript . . . . . . . . . . . . . . . . . . . . 224
B.1.5.3 Ionic Controllers JavaScript . . . . . . . . . . . . . . . . . 225
List of Figures
1.1 Demand Response . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.2 Demand Response . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.1 An Inverter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.2 PCB Boards . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.3 An SPDT 20A relay from the pin side . . . . . . . . . . . . . . . . . . . . 10
2.4 An SPDT 20A relay from the upper side . . . . . . . . . . . . . . . . . . . 11
2.5 An NPN 2N3904 Transistor used in the PCB for the relay . . . . . . . . . 11
2.6 ACS712 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.7 A simple Voltage divider circuit made on fritzing. A 9V battery is used
becasue a 12V one was not in the fritzing panel . . . . . . . . . . . . . . . 14
2.8 The simple circuit for current measurement using the ACS712 low break-
out with one dummy load. We used low breakout for this because the
dummy load as small as an LED could work well with the low breakout
modulel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
2.9 The simple circuit for current measurement using the ACS712 low break-
out with MULTIPLE dummy loads. We used low breakout for this be-
cause the dummy load as small as an LED could work well with the low
breakout modulel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
2.10 Thecircuit for the voltage divider module and current measurement mod-
ule togetherl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
3.1 The voltage divider concept . . . . . . . . . . . . . . . . . . . . . . . . . . 23
3.2 A Multisim simulation for the application’s voltage divider . . . . . . . . 23
3.3 Voltage divider with the UNO . . . . . . . . . . . . . . . . . . . . . . . . . 24
3.4 Relay concept . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
3.5 Relay concept . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
3.6 Relay concept . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
3.7 The initial open source relay PCB schematic on eagle . . . . . . . . . . . 32
3.8 The initial open source relay PCB board on eagle . . . . . . . . . . . . . . 33
3.9 The modified relay PCB schematic on eagle . . . . . . . . . . . . . . . . . 34
3.10 The modified relay PCB board on eagle . . . . . . . . . . . . . . . . . . . 34
3.11 The modified relay PCB board on eagle . . . . . . . . . . . . . . . . . . . 35
3.12 The modified relay PCB board on eagle . . . . . . . . . . . . . . . . . . . 35
3.13 The modified relay PCB board on eagle . . . . . . . . . . . . . . . . . . . 36
3.14 The modified relay PCB board on eagle . . . . . . . . . . . . . . . . . . . 36
3.15 The modified relay PCB board on eagle . . . . . . . . . . . . . . . . . . . 36
3.16 The modified relay PCB board on eagle . . . . . . . . . . . . . . . . . . . 37
3.17 12V AGM 33AH (at 20Hrs) battery . . . . . . . . . . . . . . . . . . . . . 38
xi
List of Figures xii
3.18 The connections with the ACS712 . . . . . . . . . . . . . . . . . . . . . . 40
3.19 The hooking up of Arduino with the wifi shield . . . . . . . . . . . . . . . 41
3.20 The 5V 4channel Arduino relays are also used. However, we used the
typical SPDT relays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
3.21 A kind of regulator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
3.22 converters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
3.23 Buck converter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
3.24 Boost converter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
3.25 DOM Flowchart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
3.26 The Main Menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
3.27 A screengrab from the Load Management webapp showing the devices
menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
3.28 A screengrab from the Load Management webapp . . . . . . . . . . . . . 71
3.29 The Devices Page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
3.30 Table showing devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
3.31 Warning if you are deleting a device . . . . . . . . . . . . . . . . . . . . . 73
3.32 The Monitor Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
3.33 Supply Side Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
3.34 Design Process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
3.35 The Flow Chart of The Old Web App . . . . . . . . . . . . . . . . . . . . 83
3.36 The Old Version Of The WebApp . . . . . . . . . . . . . . . . . . . . . . . 83
3.37 The Old Version Of The WebApp . . . . . . . . . . . . . . . . . . . . . . . 84
3.38 The Old Version Of The WebApp . . . . . . . . . . . . . . . . . . . . . . . 85
3.39 The Old Version Of The WebApp . . . . . . . . . . . . . . . . . . . . . . . 85
3.40 The Old Version Of The WebApp . . . . . . . . . . . . . . . . . . . . . . . 85
3.41 Mobile App Login Screen . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
3.42 Mobile App Search Function . . . . . . . . . . . . . . . . . . . . . . . . . 89
3.43 Mobile App Devices Page . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
4.1 Email Exchange . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
4.2 Email Exchange . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
4.3 Email Exchange . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
4.4 Email Exchange . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
4.5 Email Exchange . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
4.6 Email Exchange . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
4.7 Email Exchange . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
4.8 Email Exchange . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
4.9 Email Exchange . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
5.1 Testing the current sensor: ADC Values . . . . . . . . . . . . . . . . . . . 103
5.2 Testing the current sensor: ADC Values . . . . . . . . . . . . . . . . . . . 103
5.3 Testing the current sensor: ADC Values . . . . . . . . . . . . . . . . . . . 104
5.4 Testing the current sensor: ADC Values . . . . . . . . . . . . . . . . . . . 105
5.5 Testing the current sensor: ADC Values . . . . . . . . . . . . . . . . . . . 105
5.6 Testing the current sensor: ADC Values . . . . . . . . . . . . . . . . . . . 106
5.7 Testing the current sensor: ADC Values . . . . . . . . . . . . . . . . . . . 106
List of Tables
xiii
Albert: To my best friend, my fiancee, my future wife, Raleigh.
Faiq: To the nation of Pakistan and its people
Mehdi: To my friends and family
Mohammed Ali: To my parents and family
xiv
Chapter 1
Introduction
1.1 Problem Statement
In the 21st century, where the world has become a global village and population explosion
is happening simultaneously, it is no mystery that the electricity demands of the global
population is rising by a great deal with every passing moment. In populous continents
the issue of an ever-rising electricity demand is more magnified than in comparatively less
populous places. One age-old and logical solution to the grave issue of rising demands
is to bring about a mammoth increase in supply to cater to the other side. However,
this solution is tried and tested.
There are certain repercussions to this solution as not every continent and thus every
country is not as developed and the prospect of increasing the supply does not sit well
with the economy. Also, in developing countries either the resources are too scarce
or the investment done on developing the natural resources to increase the electricity
generation is not in abundance. Keeping in consideration these drawbacks of the typical
solution of increasing supply, we developed a simple prototype that utilizes the other
side of the same equation, that is, the demand side instead of the supply.
This project aims to manage loads based on pre-set priorities in times of an off-grid
crises and uses the operation of turning off loads and keeping the required loads on in
situations where the supply or generation cannot be immediately increased.
1.1.1 Motivations
According to PGE, the demand response is a phenomenon that looks at the consumers
side of the equation in the scenario of an electricity demand and supply. It is traditional
1
Chapter 1. Introduction 2
for the suppliers to take an initiative in order to match the generation with supply
but the concept of demand response enables users to contribute to the process of this
matching. This notion of the consumer end making it match was one of the motivations.
Our project follows up with this concept and implements the demand response scenario
by way of automated turning on and off of loads at the demand side. Some typical
household loads are represented by certain dummy loads with a relay to be energized
when needed.
When the generation is increased, it burdens the resources of a country and is sometimes
adverse for them. Besides this, there would be no awareness that the consumers are also
equally responsible to match generations.
Another motivation was the thought that making more and more power plants and
maintaining them just so the supply and demand could be matched would mean wasting
major resources when a better solution is straight-out available.
Major investments with a level of utilization below-par are adverse. Reducing demand
and that too by an automated shutting of loads when required, we have in front of us a
good solution to the problem (PGE, 2015). This was another one of our motivations.
Figure 1.1: Demand Response
Chapter 1. Introduction 3
1.2 Background
As we began this design project, there were somethings that we had to take into con-
sideration and these things included some of the concepts and equipment, programming
languages, platforms and other open-source components that we were not initially aware
of. As went into the thick of the project, we discovered their operating principles and
the way of managing these things without fail. Some of such things are given as follows.
1.2.1 The Arduino-conrolled ACS712 Hall effect sensing
This is a semi-commonly used sensor that typically is a chip that comes embedded on
a breakout board. It is able to measure both AC and DC currents. It is made in such
a way that allows for integration with any kind of system whether it be industrial or
communication. One of the application of the ACS712 is the load detection application
for which we have implemented it. More about the ACS712 will be stated in the design
chapter.
The hall effect sensing that is the working principle of the ACS712 was a new practical
theory. According to Hyper Physics, If a current flows through a conductor in the
presence of a magnetic field, that field causes a force to be exerted on the electrons.
This force makes the electrons be pushed toone pole or edge of a conductor. On either
side of a conductor, a builup of electrons comes to exist that balances out the effect
of the magnetic field initially present in and around the conductor. This buildup of
electrons becomes a cause of substantial voltage in the conductor.
1.2.2 The Database and Server
The setting up of a proper database in order for the real time values to get stored
and then displayed via the server was a new concept for this project. We used the
brackets platform available in all systems to code the database. We used my-SQL for
the database. The integration of the webapp for the project was done with this database.
In this database, we try to read all the analogueRead values that we are getting from
the 2 basic supply side aspects. These readings will get stored in the database as part
of the back-end part of the app. The server then gets this data from the already- set
up database and does certain calculations for the battery voltage and and the real time
current in order to display them back.
Once these calculations are done,the server will retreat these readings that are to be
displayed on the webapp and this will serve as the front end of the webapp.
Chapter 1. Introduction 4
1.3 Literature Review
The project we are undertaking is a demand side management to match the solar power
generation with the load. For this project, we have decided to use solar panels to gener-
ate power and then manage them using a microcontroller and introduce load shedding
according to the fluctuations in power.
The search for such a topic was challenging as, in today?s world, the only major uses of
such a system is done on a very large scale. Since we were trying to build a system where
the primary early adopters would be major power distribution and supply companies,
but the primary target buyers would be the domestic households, we needed to research
a lot on how we were going to accomplish that task. We review numerous scholarly
articles and researches done on this topic.
One of the research articles that was helpful was seeing the average load consumption
recorded data done in one of the villages in a foreign country and it focused on the fun-
damentals of energy conversion and how the appliances used them (Kurtulan and Sevgi,
2009). A table was given there that shows the power required by each of these appliances
and their ratings. This was helpful in understanding how the power generation works
with Power Consumption and how we could use that to formulate our basic ideas and
net averages and estimations. The paper also goes on to describe the workings of the
solar power system used and how that changed the cost and effectiveness of the overall
system in the village. In addition, there was also a table that detailed the solar energy
potential in the area and how it varied over the different months in the place.
Figure 1.2: Demand Response
Chapter 1. Introduction 5
After this, we also researched a number of major power plants that provided load shed-
ding for their areas. This happened to be the case in areas where there was a shortage
of power and hence could not be sustained over a long period of time. In addition to
this, we also found that the efficiency of the power system played a large part in shaping
this. Thus, we had the background information that we needed to start researching on
solar panels and charge controllers and load management.
Load management in our case is the whole basis for our project, hence is was important
for us to research and calculate our desired and ideal values that would help us. We
chose to have three loads for our project and these would be ideal for prototyping and
working on a small scale project like ours. To the end of products that were state of the
art and had been in research and development or any other actual live scale products,
we reviewed some of the major companies that had done some work on this. We found
that, as mentioned earlier, we do not have any major distributors on a small scale level;
hence the importance of what we are doing is unprecedented and has never been done on
a small scale level with a majority focused towards a smart system for load management
and demand side resourcefulness.
The company Quantec prepared a report for PacificCorp that was an Assessment of
Long-Term System-Wide Potential for Demand-Side and Other Supplemental Resources.
This report was very helpful for us to see the Energy focused resource potential and
the capacity focused resources and how this shaped the way that the research and
implementation of the system was done. It also stressed on the energy efficiency resources
in various classes and gave a detailed statistical analysis of the technical, economic
and achievable energy efficiency potential. There were many resource materials and
educational basis for what was to be achieved through this report and how the system
could be implemented on a large scale and be used for demand side and system wide
potential.
Another very helpful resource was seeing hobbyist reports on load shedding and various
projects that are being built into making this kind of a system more popular and afford-
able. There were many useful inventions that we found that helped us gain a proper
understanding of how these systems are supposed to work and what precautions we
could take to avoid unnecessary hassle and make our system as efficient and affordable
as possible. The inconsistencies we saw in other small scale systems were that there
were very few of them that successfully implemented a system using an FPGA or a
microcontroller. The other factor was that this is an unprecedented venture and hence
most of the technology we are coming up with is of first importance.
One of PGE’s Energy Management Systems involves a device called smart AC. This was
employed because the constant usage of Air conditioning devices in California would lead
Chapter 1. Introduction 6
to an extreme crises situation when an emergency arises. With Smart AC, all the Air
conditioning systems in the small business in the state will be automatically cycled to
participate in a system that would enable the temperature of that particular business
to not go above 4 deg celcius.
According to IESO which is short for Independent Electricity System Operator of
Canada, they have their own Demand Response solutions for Ontario. One of this
solutions is the Dispatch Control Program. In this program, businesses and the loads
in their use participate in the national grid market and they tweak their electricity de-
mands as per the immediate directions of IESO. A pre-determined price is set and this
would be the price above which the loads will not continue to consume electricity. If
the general prices in the energy sector of Ontario goes above that value, then the par-
ticipating loads are supposed to reduce their energy or electricity consumption by some
amount.
According to NRG Business’ Demand Response program, they have involved all parties
in concern to their system. They will install a special meter that will track the electric-
ity consumption in a particular company or business. Then NRG plans up a reduction
plan and informs the business about it. Should the crises in the grid begin or if there is
an expected reduction in electricity supply, the business will be alerted so as to imple-
ment the demand reduction plan according to the particular event called at the NRG
headquarters. Later on, the performance review takes place and the business involved
is informed of how much kW was the business able to reduce in the peak hours.
According to the scholarly paper, Demand Response experience in Europe: Programes,
Policies and Implementation, in it’s section that focuses on Demand response programs
in Italy, there exist certain interruptible programs that trigger automatic load-shedding
in situations of crises. Once the load-shedding programs are triggered, it is possible to
shut down the loads of participants.
These programs are basically divided into two. One is the real time program which
means that the participants’ load will be shut off without prior notice and the other
program is the one that enables the participants to get a prior notice. The level of
power this program caters to ranges from 1200 MW to around 18900 MW. A special
Load Shedding Unit is installed at all participating business and residences.
In the same paper, the policies of Spain are also given. Since a long time, the industrial
businesses are able to choose the price policies of their liking. The electricity providing
companies in Spain have to ask the companies to periodically reduce their demands
during the peak electricity usage period.
Chapter 1. Introduction 7
The electricity provider of Spain are to justify completely the reason as to why the
demand reduction is being requested keeping in view the physical imbalance between
the demand and supply.
Given that all these are worthy and applicable solutions, there is an aspect of automation
that one would always like to add. Following up exactly that, we were able to come up
with some automation techniques that would employ the coding aspects and would
involve the operation of SPDT Relays and Arduino microcontrollers.
1.4 The Contents of the report
In this report the following things will be stated
• Design Chapter: This chapter will talk about the problem description with the
assistance of figures and it will also talk about the connections between the different
components used in the project. This includes the description of all the involved
components and the ways that were used to integrate them with their connected
counterparts
• Project Implementation: This chapter talks about the details and the steps that
were taken to make this project close to a successful one. Discussed in this chapter
will be the hardware implementation conceot that talks about the hardware aspect
in detail and the things that were used and how they were used. With this the
software aspect of the project will also be discussed that includes the webapp and
the database and the server
• Project management: this chapter talks about the members of the group and the
tecniques that were employed to manage the project in an orderly fashion
• Discussion: Thus chapter summarizes the project.
Chapter 2
Design
2.1 Problem Description
The objective we are trying to achieve in this design project is the formation of a simple
load-management system which includes providing ease for the user and the provision
of the ability to have a clear idea of the power consumption in a typical housing unit
with the additional facility to turn off the loads or give a warning message to shut off
the loads that are relatively less required as a reaction to a sudden voltage reduction or
power cut following a system of pre-set priorities. That is, upon power cut or voltage
reduction, the relays come into play and the load which is set to the least priority is
first shut off and then the others are shut off when the voltage reduces more and more.
A warning message also comes advising the user to turn off the said load so as to only
make the loads with the high priority work.
In this design project, we have used a variety of components for both the successful
implementation of the supply side and the demand side. The supply side is the root of
the whole load management system. This area requires some commonly used and some
components that are not used often:
• A 12V 7Ah battery
• A 350W square-wave inverter
• thick wires
• PCB Board
• Relays
• Specified Assorted Resistors
8
Chapter 2. Design 9
Figure 2.1: An Inverter
Figure 2.2: PCB Boards
Chapter 2. Design 10
Figure 2.3: An SPDT 20A relay from the pin side
• 2N3904 Transistor
• A diode
• breadboard and breadboard wires
• ACS712 20A Hall effect current sensor
• A couple of Arduino Uno and Mega
• Arduino WiFi Shield
• Solar panels
• Solar charge controllers
The overall system has certain features that cater to both the supply and demand side.
In the supply side the aim is to display the real time readings from the charged battery.
These readings are basically the current supplied from the battery and the real time
battery voltage. The technique by which we detect the current supplied is by using a
Chapter 2. Design 11
Figure 2.4: An SPDT 20A relay from the upper side
Figure 2.5: An NPN 2N3904 Transistor used in the PCB for the relay
Chapter 2. Design 12
Figure 2.6: ACS712
small device called the ACS712 Current sensor and the battery voltage is detected using
the concept of a voltage divider, application of basic mathematics on these readings
gives us the power which will also be displayed. On the demand side, we have certain
AC loads connected to an extension cord. These loads are also strategically connected
to a relay that is mounted atop a PCB along with other components the details which
will be mentioned in the later sections. When the real time battery voltage is below
a specific pre-defined value, the function of these relays start they momentarily go in
a NORMALLY OPEN phase where the circuit between the two ends of the load is
disconnected and it becomes an open circuit and the load shuts off.
2.1.1 Fritzing Software
Once we secured the components that we needed, we were able to negotiate and work
with that from there in terms of how we would be limited and how we had to make
adjustments based on the things we had and the outcome we desired. We started to
Chapter 2. Design 13
develop designs and talk about the theoretical aspect of our project for a long time and
we ordered the parts based on our research and brainstorming.
To prototype, we started going through various designs and ideas and schematics for
making the circuits. We found a software called Fritzing that was very helpful to us in
getting a practical application to our ideas and also in using the Arduino for designing.
Our first step was to design the Voltage Divider circuit that would be used for the
Arduino to read our voltage levels from the battery. So to do this effectively, we had
to find a way of getting the Arduino to read the voltages that were much higher than
its capacity. To do that, we had to design a circuit that stepped down the values of the
battery (which was between 0 12 Volts) and make it readable by Arduino (which reads
between 0 5 Volts). We designed a circuit that would read these values relative to this
measurement. We selected the values of the resistors to be made in such a way that the
code will work as per the given voltage levels from the batteries will be read in terms of
the Arduino capabilities.
In Fritzing, just like any other simulation software, there is a panel from which different
needed things can be dragged onto the large breadboard workspace. These breadboard
drawings are also simultaneously made into PCB viewable drafts and schematic viewable
drafts to have more insight.
On Fritzing, for our initial record, we made the following:
• Voltage divider circuit
• current measurement using current sensor with one dummy DC load
• current measurement using current sensor with multiple dummy DC loads
Following are some images of the Voltage divider and current measurement schematics
made on Fritzing. The Fritzing files are attached with the submission and these were
made in the month of March.
2.1.2 Calculations
2.1.2.1 Calibrations for microcontroller
We looked up a number of links on the internet to gain an insight of the different
calibrations that were used for both the current sensors and the voltage divider.
For the current sensors, the following things had to be taken in consideration:
Chapter 2. Design 14
Figure 2.7: A simple Voltage divider circuit made on fritzing. A 9V battery is used
becasue a 12V one was not in the fritzing panel
Figure 2.8: The simple circuit for current measurement using the ACS712 low break-
out with one dummy load. We used low breakout for this because the dummy load as
small as an LED could work well with the low breakout modulel
• It is a 5A version and the thick copper conductor inside allows for durability in
case of overcurrent
• it gives ampere values for every 66 to 185 mV per Amps
Calibration: Analog read produces a value of 0-1023, equating to 0v to 5v So Analog
read 1 = (5/1024) V =4.89mv Value = (4.89*Analog Read value)/1000 V But as per
data sheets offset is 2.5V (When current zero you will get 2.5V from the sensor’s output)
Actual value = (value-2.5) V Current in amp =actual value*10
ARDUINO CODE:
Chapter 2. Design 15
Figure 2.9: The simple circuit for current measurement using the ACS712 low break-
out with MULTIPLE dummy loads. We used low breakout for this because the dummy
load as small as an LED could work well with the low breakout modulel
Figure 2.10: Thecircuit for the voltage divider module and current measurement
module togetherl
// taking 150 samples from sensors with a interval of 2sec and then average the sam-
ples data collected for(int i=0;i¡150;i++) sample2+=analogRead(A3); //read the cur-
rent from sensor delay(2); sample2=sample2/150; val =(5.0*sample2)/1024.0; actualval
=val-2.5; // offset voltage is 2.5v amps =actualval*10;
For the voltage division, the calibration is as follows
When the battery voltage is 6.5v I got 3.25v from the voltage divider and sample1 =
696 in serial monitor ,where sample1 is ADC value corresponds to 3.25v
Chapter 2. Design 16
Calibration:
3.25v equivalent to 696 1 is equivalent to 3.25/696=4.669mv Vout = (4.669*sample1)/1000
volt Actual battery voltage = (2*Vout) volt
ARDUINO CODE:
// taking 150 samples from voltage divider with a interval of 2sec and then average
the samples data collected for(int i=0;i¡150;i++) sample1=sample1+analogRead(A2);
//read the voltage from the divider circuit delay (2); sample1=sample1/150; volt-
age=4.669*2*sample1/1000;
2.1.2.2 calculations for the Voltage Divider circuit
We performed some calculations as to the kind and what values of resistors we will be
needing for the voltage divider circuit. Since we will be using a 12V battery for the
fulfilment of the purpose. The general Voltage divider formula is given by: Voltage *
[(Resistor 1) / (Resistor 1 + Resistor 2)].
For a 12V battery, the voltage should be divided in such a way that the output voltage
should be equal to a range of values till 5 Volts. After a series of combinations, it turned
out that the ideal values for the resistors will be 3.3 kOhms and 4.7 kOhms. If we applly
this to the said formula and take resistor 1 to be 3.3k and resistor 2 to be 4.7k, we will
have
12 * [(3.3 / 8)] = 4.95 V which is exactly within the arduino readable values.
Chapter 2. Design 17
For the case when the battery is completely discharged when it is 9V, the output voltage
from the voltage divider we will get is equal to 3.7125 V which is still within the arduino
readable ranges.
In one possible scenario, a WiFi Shield is used atop an arduino UNO. We have two
analogueRead values that will get the sensor readings from the battery. One of them
will be the reading of the real time current supplied from the battery to the inverter thus
giving us the true value of the current being drawn by all the loads. The other sensed
value will be of the real time battery voltage that will be read via the arduino with the
use of the voltage divider circuit. Both these readings will go into the analogueRead
of the arduino and these readings will automatically be stored in an MySQL database.
The MySQL data gets saved in the database in the format of a table and gives us back
as such.
There is also a server that was made and this server integrates with the database. From
the wifishield, a URL is set to display the analogueead generated ADC value on the
browser. The ADC value is stored in the database. From the database, these values
then get incorporated into the server. The server does the necessary calculations to give
the final current and voltage reading. We then try to display these readings on our
webapp.
We wanted to today was to monitor the currents and through the current ultimately
the power consumed by every AC load. We worked with an ACS712; a typical bulb,
a battery and an inverter. However, there was some complication involved which had
to do with the waveform of the ac. Unlike the DC which has a constant straight line
voltage value. Also, the complication involved the rate of reading of analog values and
the time it would take to take reading for a complete cycle. This is not constant, since
Chapter 2. Design 18
with every line of code the clock speed changes; with every line the time of analog read
varies as the chip has to go through an extra calculation which in turn takes up more
time.
In our investigation to measure the amount of steps to complete one cycle of 50 Hz AC,
we carried out a study of the behavior of an atmega328p. A maximum sampling rate of
an Atmega chip is 10,000 samples per second. Considering the above stated facts and
assump-tions the plan of action is to acquire a series of readings of ADC values that
correspond to the AC current(I rms) values. We attempt to nd a symmetrical pattern in
the readings that hint to the zero-crossings of the waveform. We then use our intuition
to sketch a rough graph of the AC current with the displayed ADC values and from
here we will know the number of ADC steps to complete one AC cycle. Once we know
that, we do a series of small calculations to convert this current into RMS current which
will then be displayed on the serial monitor. The limitations of ADC is that it cannot
multitask. Each ADC values are consisted of 10.
2.1.3 Connections between components
2.1.3.1 The battery and arduino: Voltage Divider
We connected the battery with the arduino to cater to multiple scenarios. One connec-
tion was the voltage divider circuit. The positive and negative terminal of the battery
are connected to two resistors in series which are the 330kOhm and 470 kOhm and the V
out is taken from the 330kOhm resistor as the voltage divider circuit is completed. From
the Vout of the 330 kilo Ohm the wire goes from there to the arduino’s analogueRead
pin in order to read the real time battery voltage.
Chapter 2. Design 19
Chapter 2. Design 20
2.1.3.2 The battery, arduino and inverter: Current readings
The battery’s connection to the inverter is not done directly except that an ACS712 20A
current sensor is also hooked up between them so that the real time supply current can
be sensed and read. From the positive terminal of the battery the connection is made
to one of the load terminals of the ACS712 current sensor. And from the other load
terminal of the ACS712 the connection is made to the positive terminal of the inverter.
This is the step where actual series connection of the battery, the current sensor and the
inverter is made as the only configuration that allows for a current to be registered in the
sensor is series connection. The negative terminal of the battery is directly connected
to the negative terminal of the inverter directly.
2.1.3.3 Inverter to the loads
From the other side of the inverter that has the AC plug pins, we connect an extension
cord so that other three connections rooms are made available for the three loads that
are going to be connected to the system later.
2.1.3.4 Loads and the PCB
With the Relay PCB, we have two terminals on either side of the PCB and these two
terminals are to be connected to the load. The live and neutral are the wires of concern
and one of each will be soldered to those terminals. This follows that the live and neutral
will be connected to the holes of terminals that are on the PCB. This is as far as the
load is concerned. On the microcontroller side, there will be a relay control pin that
will be connected to the digital output pin of the arduino that states the digitalWrite
Logic. There are other two holes that are for the ground and VCC. Wires are soldered
underneath and connected to the required place.
Chapter 3
Project Implementation
3.1 Integration of components with Arduino
When we went in the thick of the project, we found that some of the core things that
were to be implemented were a part of the course that we had studied in our electrical
engineering degree while some of them were new concepts. The combination of both
inspired us to follow the approach already taken.
The Arduino is an open source physical computing device that results in processing and
wiring language. It is based on a development environment and a simple microcontroller
board. Interactive objects can be developed with the help of Arduino which can be
connected to the software on the computers such as processing, flash etc. It helps in
developing objects which can control motors, light bulbs and other physical loads. It
can be inputted with sensors such as current sensors and voltage sensors and switches
too. Arduino is better than other microcontrollers. It is cheaper and simpler that the
other ones. It provides a variety of options or the inputs and the outputs. This can be
run on different operating systems which mean it is not confined to windows only. It is
very easy to use and is user friendly for the beginners and it provides good grounds for
an advanced user too.
The Arduino uno takes 5 volts which is given by the laptop itself. Firstly the Arduino
helps us know the battery voltage at any instant of time. There is a voltage divider
circuit for the battery whose output is the input to the Arduino. As shown in the
circuits, the output voltage resulting from the voltage division between the two resistors
is the analogueRead input to the Arduino. The voltage divider results in a voltage less
than 5 volts so that the Arduino can handle. The Arduino and its ADC pin will convert
this analogue value to a digital value and display it for us on the screen via the serial
21
Chapter 3. Project Implementation 22
monitor. We wrote a number of codes to give us the proper real time battery voltage
code so that the sensing is done without fail and some of them were working codes. Our
battery which is 12 volts can?t be directly connected to the Arduino as it is harmful for
the Arduino. To consider the durability of Arduino and the fact that we require real
time battery voltage, we used so the voltage divider circuit is introduced. The Arduino
will take the output of the voltage divider and sense the battery real time voltage. As
this output value of the voltage divider circuit will decrease, the Arduino will sense it
and let us know the battery voltage at any instant we want.
3.1.1 Voltage sensing with the Arduino
Voltage divider is also known as the potential divider. We can also say that it is a resistor
or a series of resistors where voltage is provided as fractions of the source to the loads
or resistors. An arrangement of two or more resistors joined in arrangement between
connected voltage, so that the voltage at points between the resistors is a fraction of
the source voltage. Voltage dividers are common in for example amplifiers where each
subcomponent needs special voltage levels for their particular power supplies. The basic
circuit theory of it is that depending on the combination of the pair of resistors that are
connected in series, a supply voltage is given. As we are aware that in a series circuit,
the voltage is divided, this divides the supply voltage in two. There exist an output
voltage that can be checked for via a normal multimeter at a point. The value of this
output voltage is completely dependent on the combination and the ratio of both the
resistors used. Usually when a small output voltage is required from a relatively big
supply or input voltage the ratio of the resistors chosen is big and vice-versa.
The voltage divider has a rule. Voltage across r1 here is the product of r1 and battery
voltage divided by the sum of r1 and r2. [(r1*E) / (r1+r2)] Voltage divider is used where
there is a need of less voltage for a specific component and where the energy efficiency
isn?t seriously being considered. The common application which is seen is the poten-
tiometers. For example the knob that is attached to the music systems such as an audio
speaker for volume adjustments. The simplest design of this potentiometer has three
pins. Two pins are connected to the resistor which is placed inside the potentiometer
and the third pin is connected with a wipe contact which is wiped on the resistor when
the knob is adjusted. The wiping of the wipe contact results in sliding on the resistor
thus the voltage is increased or decreased resulting in the adjustment of the volume.
In our project the voltage divider has served a great use. We need the voltage divider
to give the users a display the supply side of the system. The user must have an idea
of how much battery voltage is being supplied at a particular time and moment. The
Chapter 3. Project Implementation 23
Figure 3.1: The voltage divider concept
Figure 3.2: A Multisim simulation for the application’s voltage divider
Chapter 3. Project Implementation 24
user must also keep track of the battery status in a way that is real-time. The battery
voltage goes from 0-12 Volts and the operating voltage for an Arduino is set as 5V. We
make it such that the range of the battery voltage is scaled down to the range of voltages
accepted by the Arduino. The battery output is 12 volts and we wanted to reduce it to
5 volts.
The voltage divider circuit in this design is made up of two resistors with relatively
of higher values: 330kOhms and 470kOhms. The circuit is completed and from the
330kOhm resistor, we connect a wire from there to the Arduino’s analogueRead pin. and
the gound of the Arduino is connected to the battery’s ground terminal fully completing
the circuit and a code was written to simulate the sensing of this real time battery
voltage using the voltage divider.
The output of the voltage divider circuit that is 5 volts is given to the analogue input
of the Arduino and it takes these readings and a calculation embedded in the code
converts the Arduino readable range back to the real battery voltage. This is done by
multiplying the ratio value of the resistor combinations with the scaled-down real time
voltage. We need to read the battery voltage because our projects working principle is
the voltage. Furthermore we need the battery voltage so that the power at any instant
can be displayed for the user.
Figure 3.3: Voltage divider with the UNO
The picture above shows the voltage divider circuit and the output of that going to the
Arduino.
3.1.2 Current sensing with the Arduino
Now that we have a way of reading the real time battery voltage, we also should read
the real time current that the battery supplies to the inverter. The current sensor that
Chapter 3. Project Implementation 25
is in use is the ACS712 hall effect sensor of the 20A configuration. The reason we used
this curent sensor instead of the old ones of the 5A break out configuration is that they
did not have the filter capacitor already installed which made way for major instability
in the readings. Also, the header pins on the Arduino side wee present in the sensors
of the 20A configuration which made the hardware connections easier. The hall effect
concept introduction is given in the introduction chapter and that is the concept that
helped us read the real time current.
The current sensor was to be connected to the battery, inverter and to the Arduino for
reading purposes. The connections of the current sensor are as shown in the figure. Since
we were reading the current supplied from the battery to the inverter, we connected the
sensor in series with the battery and the inverter. The positive terminal of the battery is
connected to one of the open load terminals of the current sensor, the other ope terminal
of the curent sensor is connected to the positive side of the inverter and we complete the
circuit by directly connecting the negative terminal of the inverter to the ground of the
battery. In this way the main circuit is completed which left us with the integration with
the Arduino which is basically three simple steps. We connect the designated pins to the
anologeRead, VCC and ground. To read this current value there are some calculations
that we have to follow.
For this also, we wrote a series of codes so that we can get the true current values. For
no current passing through the current sensor, we have an offset ADC value of 511. We
recover the current value from the ADC values and for that we have to do a small series
of calculations which in terms of steps is given below
• Get ADC value and adjust for offset by subtracting 511
• display the offset-adjusted ADC value
• multiply the ADC value by the number 0.049 in order to get the current.
So the current supplied from the battery to the inverter is read, the ADC value is
adjusted and then multiplied by a fixed constant that would give us the true current
value. In this way we are able to read the real time current value.
3.1.3 Power supplied reading
Thirdly ardunio helps us find the instantaneous power supplied. The microprocessor in
the Arduino is coded to multiply the values of the current and the voltage to give us
power and then display it for the user.
Chapter 3. Project Implementation 26
Fourthly the Arduino helps us to display everything on a web application through wifi
shield. It will display the battery voltage, the current supplied and the power on the
web application we have designed. The Arduino WiFi Shield connects the Arduino uno
to the internet wirelessly. Arduino wifi shield allows an Arduino board to connect to the
internet using the wifi library and then it reads or writes another library such as from a
SD memory card.
3.1.4 Relay operation to turn off low priority load via Arduino
3.1.4.1 SPDT Relays
Relays are electromechanical devices which work when an electric current is passed
through it. The circuit is switched on or off with the current flowing in another cir-
cuit. Relays are simple, with high reliability and long life which acts as remote control
switches. They are the brain of the circuit. They control the circuit by commanding a
switch when to open or when to close. They rake a very small power to control very
high power systems.
Many common applications of relays are in automation, telephones and digital comput-
ers. Relays are used in power systems to protect them against power cutoff and other
problems which can occur. Relays work along with the circuit breakers for protection
of the system. It helps control, regulation and distribution of power in a system too.
Household applications of relays are in air conditioners, refrigerators, washing machines,
cooking ranges and dish washers etc. For example a relay takes a little power to turn
on or off the circuit of the air conditioner where as the air conditioner runs by taking
about 6600 watts.
Relays are not only used in electrical systems but in mechanical systems too. Relays
used other than in electrical systems are of hydraulic and pneumatic types. Either the
input is mechanical and the output is electrical or the input is electrical and output is
mechanical.
Relays have an electric coil and a sensing unit which is power by a low amount of
alternating current or direct current. There is a preset value of the voltage or current,
when the given current or voltage exceeds that value, the armature is activated by the
coil thus closed contacts are opened or opened contacts are closed. There is a generation
of magnet force when power is supplied to the coil resulting in the closing or opening of
the switches. This magnetic force produced in the coil to power supply acts as a bridge
between the two circuits that are called the control circuit and the load circuit.
There are different types of relays:
Chapter 3. Project Implementation 27
Figure 3.4: Relay concept
• 1) Electromechanical relays: Electromechanical relays are electrically worked switches
that depend on mechanical contacts as the switch system. These are also called
armature transfers. They are made of coils and contacts. At the point when the
coil given power, there is an induced magnetic field which moves the armature
resulting in opening or closing of the contact.
• 2) Reed relays: Reed relays are switches that control one or more reed switch
by using electromagnets. These are similar to electromechanical relays that have
physical contacts which work mechanically to open or close a switch that is turn
on or turn off a circuit. Reed relays have smaller contacts and the contacts are
of lower mass as compared to the contacts of electromechanical relays. Dry reed
relays consist of coils curled over the reed switches. The reed switch is made out
of two ferromagnetic razors sharp edges which are called reeds and are fixed inside
a closed glass that is contains an nonreactive gas. The contacts of the reeds are on
their ends. When power is applied to the coil, the tow reeds join together which
closes the circuit. When the applied power to the coil is turned off, the contacts
are pulled apart by the spring force.
• 3) Solid state relays: Solid state relays are activated when a voltage of small
amount is passed across the terminals of it. There are no mechanical parts so their
life is higher than the electromechanical and reed relays, moreover, they are faster
than the electromechanical relays. A control signal is initiated by a solid state
electronic switching device that changes power to the load circuit resulting in a
coupling mechanism. The solid state relays comprise of a sensor that reacts to an
Chapter 3. Project Implementation 28
Figure 3.5: Relay concept
input when given. This relay is built using a semiconductor and a MOSFET with
an LED.
state relay.jpg state relay.jpg
Figure 3.6: Relay concept
• 4) FET relays: These relays consist of a series of CMOS transistors. The load
circuit that is the source and the drain is connected by control circuit where the
voltage is applied. These are not mechanical devices. These are used for higher
speed and low voltage devices such as in multiplexer configurations. (Insert picture
*FET relays*)
The relays can also be characterized according the need. The characteristics of the relays
are:
• 1) Definite time relays
Chapter 3. Project Implementation 29
• 2) Inverse time relays with definite minimum time(IDMT)
• 3) Instantaneous relays
• 4) IDMT with instant
• 5) Stepped characteristic
• 6) Programmed switches
• 7) Voltage restraint over current relay
The three basic functions of relays are the logic operation, limit control and on or off
control.
(Insert picture 2)
There are different configurations of relays such as single pole single throw (SPST), single
pole double throw (SPDT), double pole single throw (DPST) and double pole double
throw (DPDT). Single pole single throw is the simplest configuration which has only
two contacts, whereas, single pole double throw is the one with three contacts. (Insert
picture 3)
The contacts are COM that is common, NO that is normally open and NC that is
normally closed. The NC is connected to the COM when there is no power applied to
the coil and so is the NO is open when there is no power applied to the coil. When there
is power applied to the coil, the COMM is connected to the NO and the NC is left as it
is without any connection to neither of the contacts that are COMM or NO.
A relay coil is also an inductor apart from being an electromagnet. On power application
there is a build up in the current on the coil and it levels off at its rated current thus
energy gets stored in the magnet field of the coil. As the power applied to the coil is
stopped, the current in the coil is stopped too resulting in the voltage across the coil to
increase so that the current direction can be kept the same.
We are using single pole double throw that is SPDT relay rated 20 amperes in our
project. SPDT relays are sealed and massive. When the current is passed through its
coil, it closes the NO contact and the NC contact is moved to the ground. These are used
to switch high voltage or high current devices. In our project we are using it to control
the loads in the demand side that is to switch off the loads at a particular voltage. The
relay is given an input by the Ardunio so after that it takes the action of switching off
the particular load.
Relay works on the input 0 or 1. It normally is in on state when input 1 is given and
off state when 0 is given. In our project we have made it the opposite by connecting
Chapter 3. Project Implementation 30
the NO and NC contacts oppositely on the printed circuit board (PCB). For this relay
to work it need to be connected to a diode, transistor and come resistors in a specific
manner. The board diagram is shown below for the PCB. (Insert picture *SPDT*)
3.1.4.2 Integration of the Printed Circuit Board: Operation of relay in the
design via Arduino
The software used for the PCB creation in our project was Eagle. Eagle is a freeware
that is very useful for creating comprehensive PCB designs. In Eagle, the control panel
will let us open the project that we have to modify and forms the basis for different
libraries. Once the schematic window is open, we can use a particular library and drag
the components required onto the open work-space, make connections, and give values
to the used components. The libraries can be downloaded and some of them are also
available in the schematic by default.
In our project, we have a Printed Circuit board exclusively for the relay used with the
AC loads. The software used to modify the PCB was EagleCAD. Since the SPDT Relay
that is used for management goes hand in hand and works only when other components
are present considering the use of high voltage and the current associated with it. The
components used on the circuit board are as follows:
• SPDT 20A Relay with NO/NC Contacts
• 1N1418 Diode
• Resistors: 1kOhm and 10kOhms
• Screw terminals of both two and three pin headers
• Bipolar Junction Transistor 2N3904
• LED
3.1.4.3 1N1418 Diode
The reason to add this diode is mostly for safety purposes. It is oddly placed right in the
middle of the power line and ground line so that when the relay control pin is given logic
zero and the relay is de energized, the diode will nullify this current change. However,
the forward bias of the diode makes the current go in just one direction ensuring safety
of the other smaller components and wires that are hooked to Arduino in PCB. Since the
diode is made for restricting the current in a singular direction, any undesired current
flow in the wrong direction will have adverse consequences.
Chapter 3. Project Implementation 31
3.1.4.4 Resistors
We have used a couple of resistors so that the grounding via the BJT when the relay pin
is energized is safer once the relay pin is energized. The combination of resistors used is
the common 1k and 10k duo in order to make the system more efficient. The resistors
are connected to the base of the BJT so that when the relay control pin is given logic
1, the 5V will go through the resistors and then the BJT to initiate the relay operation.
3.1.4.5 Screw Terminals
The screw terminals are used to solidify and simplify the connections on both the sides
of the PCB. That is, the connections to the microcontroller’s 5V, ground pin and the
relay control pin. The other side of the PCB is for the connections between the load
terminals.
3.1.4.6 2N3904 BJ Transistor
The SPDT relay on the PCB has a coil inside it. Also, inside a relay, there are two metal
strips of which one is movable and one is not. These are normally separated in normally
open situations but when the relay coil is energized, these two metal strips join together
forming a contact that allows for bug current amounts to pass through.
The concept that this relay coil follows is that of electromagnetism.
3.1.5 Printed Circuit Board application
The logic to make the relay PCB work is straightforward and it follows that whenever
the system detects any change or reduction in the real time battery voltage readings, a
digital output from the central Arduino gives a logic HIGH to the relay control pin in
the relay PCB that gets energized with operation from the coil to turn off the load that
is not required.
In this design, we acquired an open source relay schematic that was somewhat true given
our project’s application. However, certain major changes had to be made in order for
it to completely cater to our design’s need and requirement. The available schematic
to control loads that require AC voltages was made in such a way that when the relay
control pin is at rest and is not given a high logic, the tansistor and diode do not come
into play and the load remains turned off and no interruption takes place which meant it
was in NO state. As soon as the relay control pin is given a HIGH logic, the connection
Chapter 3. Project Implementation 32
with the transistor is made and the relay contacts are closed and the load is turned on
as the relay goes in the NC state. We wanted the exact opposite of this as the relay
control pin should work in such a way that when the logic is HIGH, the relay contacts
should be open and the loads should turn off.
Considering this change, we made a change in the schematic and tweaked the relay
component in a way it turned to a Normally Closed configuration. The change made in
the schematic is shown in the figures too. A wire that was beneath the second bar of
the relay is joined to the one that is above the second bar in order to make it in an NC
configuration.
3.1.5.1 Problems faced in PCB creation
Figure 3.7: The initial open source relay PCB schematic on eagle
As it can be seen in the figure, the schematic shown is connected in a normally open
configuration in the beginning itself which means that under very normal circumstances,
the load is set to be turned off and only when the control pin is energized the load is
turned off. This defeats the purpose of our concept. The load shall turn off only as
the battery voltage reduction is sensed by the microcontroller from the voltage divider
circuit. As it goes below a certain value, the relay control pin is given the logic in order
for it to be energized.
The above figure shows the the initial board version on eagle that shows how the PCB
would look after printing. Since this was a preliminary board from the open source
file, we had to tweak this from the schematic to make it in NC scheme. Also, another
issue that arose in the making of this was that it could not be printed unless all the
connections were in a single layer. For this we had to decide whether to change the relay
Chapter 3. Project Implementation 33
Figure 3.8: The initial open source relay PCB board on eagle
connections to the load from bottom layer to the top or to change the connections of
secondary components on the PCB from top to the bottom. Since the connections of
the relay and load terminals were already set to the bottom and easy to solder, it was
imperitive to modify the connections of the secondary components that included the
BJT, resistors, diode and the screw terminals at the microcontroller end.
This picture above shows the first draft of the modified version of the Relay PCB in
order for it to be NC. However, another issue that arised before printing it was that
3.1.5.2 Relay PCB with the 5A current sensor integrated
A final improvement was made in the relay PCB with the integration of the 5A ACS712
embedded on the same board. Right beside the Relay section where the load terminals
will beconnected, we have the current sensor section. In this section there are designated
places for the load terminals for the current sensors. In addition to that, there are spaces
to connect the capacitors for both the Vout and at the filter hole. These spaces are
made so that the stability of the current readings is not compromised because of the
unavailability of the capacitors on the break out.
Chapter 3. Project Implementation 34
Figure 3.9: The modified relay PCB schematic on eagle
Figure 3.10: The modified relay PCB board on eagle
Chapter 3. Project Implementation 35
Figure 3.11: The modified relay PCB board on eagle
Figure 3.12: The modified relay PCB board on eagle
Chapter 3. Project Implementation 36
Figure 3.13: The modified relay PCB board on eagle
Figure 3.14: The modified relay PCB board on eagle
Figure 3.15: The modified relay PCB board on eagle
Chapter 3. Project Implementation 37
Figure 3.16: The modified relay PCB board on eagle
3.1.6 The Battery
The battery plays a very important role. For this design, we will be using a 12V battery
which would be a small Deep-cycle battery. The battery in use will have to power the
inverter for the AC loads to operate. The ratings of batteries are given in amphours.
These amphour ratings tell us the amperage the battery provides for a certain number
of hours. Usually, the amphour rating of a certain battery comes with the window of
the time period it can go on for. For example, a 33 AH battery rated at 20 hrs will
discharge over that period with a single load of 1.65 Amps. However, the relationship
of rate of discharging of the battery with time is not linear because of the Peukert’s
effect that says the faster a battery discharges, the more the capacity of the battery in
amphours is reduced.
According to Northern Arizona Wind and Sun, Deep cycle batteries are made to be
discharged down to a level where just 20 percent battery remains each time it is majorly
used and they also have much thicker plates. The increased surface area provided by
the thicker plates will pevent the sudden surge of power that most batteries need.
The benefit owing to the deep cycle battery’s property that it allows for a deep discharge
and then recharge many times is that it can be used more often and regularly with a
solar charge feature. Thus it guarantees that we can use the same battery to discharge
via our loads a few times over.
Chapter 3. Project Implementation 38
Any typical AC load draws a nominal amount of current that amounts to no more than
1 amps. Considering this fact, we have decided to use this type of battery as discharging
could be done more often.
Compared to a typical car battery, the deep cycle battery is advantageous as a car
battery will give precedented and sometimes unprecedented high bursts and surges of
power that will not be always needed for the loads. However, since typical AC loads are
in use we want to make sure that the battery is always discharged at a nominal rate and
can be utilized for a longer period of time.
Previously, our plan included using the battery the 45 Ah battery but since the initial
current surge from such a battery is of a huge amount, it would damage the resistors.
Owing to an acute unavailability of the power resistors that have a rating of more than
1-15W, we dopped the prospect of using a 12V 45Ah battery.
We initially decided to use 12 volts, 45 AMPH battery then we decided to use a smaller
battery because of the fact that the 45 AMPH was a very big one for the prototype and
we were afraid that it might burn some components. For now we are using 12 volts, 7
AMPH deep cycle rechargeable batteries. It is charged through the solar panels.
3.1.6.1 AGM and GEL
There also exist AGM batteries that that have a glass mat within them which keeps
the battery plates in touch with the liquid of electrolyte present in them. They are also
needed when high initial bursts of current are actually required in the system in order
to make it work. Hence they also have enough battery shelf life than some others.
Figure 3.17: 12V AGM 33AH (at 20Hrs) battery
The GEL batteries have relatively similar traits to the AGM but require more temper-
ature while being operated. Also, the method of recharging must be proper so as to not
destroy it soon.
Electricity is generated when photons that are the particle of light hit the electrons free
from atoms on the solar panel. Solar panels have small photovoltaic cells in them which
convert the sunlight into electricity. After the battery is stored with energy given from
Chapter 3. Project Implementation 39
the solar panels, it is then to be given to the loads. This cant be simply supplied to the
loads because it is DC. For the loads it needs to be AC. The battery is connected to the
inverted so that DC can be converted to AC and it can be supplied to the loads. We are
using 350 watt inverter which changes 12 volts DC to 220 volts AC. The inverter gave
us a square wave for the voltage rather than giving us a sine wave.
Initially the current sensors we bought didnt have a filter capacitor which resulted in a
non-uniform output. We even tried to put the filter capacitor but the results werent as
we desired.
For the PCB for the relay we had a lot of problems. Firstly we couldnt find the latest
version of eagle which was a cause for the delay. Then we had to learn eagle from
the start because we werent familiar to it that much. Finally after some help from
our colleagues we had the schematic and the board but the printing was again delayed
because of the fact that our eagle file wasnt converted to a printable format that is
needed for the print. Our PCB was two layered so the engineer instructed us to edit
it and make the board one layered, make it bottom layered. When the first time we
printed the PCB it was small and there were dimension problems.
3.1.6.2 Battery connections
In our project, we are following and tracking the current supplied. This is called the
supply side current tracking. We will be using the ACS712 right in between the battery
and the inverter.
Fifthly the output of the Arduino is connected to three relays that are SPDT relays.
The Arduino after a certain drop in the battery voltage will give the particular relay
a 0 input. After receiving the 0 input the relay will turn on and it will disconnect the
particular load connected to it, thus that load will not be a part of the circuit and it
will turnoff.
3.1.6.3 Possible improvements with the Use of Voltage Regulators
Since powering of the Arduino via a laptop would seem impractical at times however
it would not be completely inaccurate, we still had other options in mind. One such
option was the probable use of Voltage Regulators.
A voltage regulator is intended to consequently keep up a consistent voltage level. A
voltage controller is not a much complicated which has ”feed forward” configuration and
negative feedback control loops. It may be operated by electromechanical method, or
Chapter 3. Project Implementation 40
Figure 3.18: The connections with the ACS712
electronic parts. Voltage regulators provide steady and reliable voltage when needed.
An input unstable or high voltage is given to the voltage regulator and it outputs a fixed,
adjustable, stable voltage. Feedback techniques are responsible to control the output
voltage level. There are simple and complex feedback techniques. Simple techniques
include a zener diode. Complex feedbacks improve reliability, efficiency, performance
and increasing output voltage more than the input voltage.
Some common voltage regulators are:
• The NPN Regulator: It has a NPN Darlington pass resistor which includes PNP
driver requiring a voltage of at least 1.5 to 2.5 volts to be applied from the input
to the output for the device regulation. (Insert picture NPN)
• The LDO regulator: This requires a single PNP transistor as the pass transistor.
With very low voltage drop the PNP pass transistor, the LDO can regulate the
output voltage. (Insert picture LDO)
• The Quasi-LDO regulator: This is really used in the applications where the conver-
sion of about 5 to 3.3 volts is involved. It is a kind of mixture of NPN Darlington
and true LDO. A PNP drives the pass resistor which is made up of a single NPN
Chapter 3. Project Implementation 41
Figure 3.19: The hooking up of Arduino with the wifi shield
transistor. The voltage drop in Quasi-LDO is less than the NPN Darlington reg-
ulator but more than the true LDO.
There are two types of voltage regulators that are linear and switching. A linear
regulator utilizes a dynamic pass device that is a BJT or a MOSFET in series
or shunt which is controlled by a high gain differential amplifier. It compares
the output voltage to the reference voltage and it maintains constant voltage by
adjusting a pass device. There is a known adjusted feedback signal that is set to
maintain a fixed voltage with unknown and noisy input. Basically linear regulators
use BJT or MOSFET which are power transistors as a variable resistor that acts
like a voltage divider circuit. To maintain a constant output voltage, the output
of the voltage divider is fed back to the power transistor. The problem here is that
as the transistor acts as a resistor and we know the resistor wastes energy as it is a
hindrance to the current. The transistor will produce a lot of heat and in a result
huge amount of energy will be wasted. The power dissipated will be very high
resulting in good heat sinks as the wasted energy that is through heat is converted
by the power which is equal to the voltage difference between the output and the
input voltage multiples by the current supplied.
Chapter 3. Project Implementation 42
Figure 3.20: The 5V 4channel Arduino relays are also used. However, we used the
typical SPDT relays
Figure 3.21: A kind of regulator
Chapter 3. Project Implementation 43
Higher output current is achieved by connected two linear regulators in parallel.
In switching regulators the DC voltage is inputted to the power MOSFET or BJT
switch. This voltage is converted to switched voltage. The output voltage remains
constant independent of the input voltage or load current changes as the filtered
power switch output fed back to circuit which handles the on and off times of the
power switch. Switching regulators needs ways to change their output voltage in
a result of input and output voltage changes. One methodology is to utilize PWM
that controls the input to the related power switch, which controls its on and off
time that is the duty cycle.
While its operation, the duty cycle is controlled by the feeding back of the regu-
lator’s filtered output voltage to the PWM controller. To keep the output voltage
constant when the filtered output changes, the feedback applied to the PWM
changes the duty cycle. However, switching voltage regulators works differently
than the linear voltage regulators. A minimum voltage ripple is kept constant with
the charge level by using feedback and the switching regulator will store energy at
a particular fixed level which results in a constant output voltage rather than it
acts as a voltage or current sink to keep the output voltage constant. The switch-
ing regulator turns a transistor fully on with the least amount of resistance only
when a boost of energy is needed by the energy storage circuit. This was it makes
the switching regulator work way more efficiently than the linear regulator.
Other small circuit losses and the total power which is wasted because of the tran-
sistors resistance is reduces as when the switching occurs in switching regulators
there is a transition from conduction which is very low resistance to non conduct-
ing which is very high resistance. Smaller components can be used as less energy
storing capacity is needed to keep a specific output voltage constant when the
switching in the switching regulator is very fast. More is the speed of switching of
the switching regulator, less is the energy storage capacity is needed for the con-
stant output voltage. In faster switching of the witching regulators more power is
lost due to the heating in the resistor that is resistive heating as much more time is
passed in the transition between the conduction state which is very low resistance
state and the non conduction state which is very high resistance state which results
in the loss of efficiency. Moreover, the noise at the output is increased which is
produced by faster switching of the switching regulators.
These different switching techniques of switching regulators result in different types
of switching regulator such as buck which lets the switching regulator step-down
the voltage, boost which lets the switching regulator step-up the voltage and buck-
boost which lets the switching regulator both step-up and step-down the voltage.
Moreover the types of switching regulators also include full bridge, half bridge,
Chapter 3. Project Implementation 44
push-pull, forward, CUK and SEPIC. These different and unique techniques give
the switching regulators an upper hand on the linear regulators and it makes the
switching regulators the best choice for the battery powered applications as thee
switching regulator can step up or boost the voltage at the input from the battery
when the battery is discharging. This gives an edge for the circuit to continue to
work at desired conditions as the circuit is directly supplied with the right voltage
it needs from the battery.
Figure 3.22: converters
We are using a switching regulator in our project. As explained above that the
switching regulators include buck, boost and buck-boost converters. We in our
project, to be specific, attempted to use a buck converter which is also known as
step-down converter as it steps down the voltage.
The Buck Converter is utilized as a part of SMPS circuits where the DC output
voltage should be lower than the DC input voltage. The DC input can be gotten
from redressed AC or from any DC supply. It is valuable where electrical separa-
tion is not required between the switching circuit and the output, however where
the input is from an amended AC source, seclusion between the AC source and
the rectifier could be given by a mains disconnecting transformer. The exchang-
ing transistor between the input and output of the Buck Converter persistently
switches on and off at high frequency. To keep up a ceaseless output, the circuit
Chapter 3. Project Implementation 45
utilizes the vitality put away as a part of the inductor, amid the on times of the
switching transistor, to keep supplying the load amid the off periods. The circuit
operation relies on upon what is in some cases additionally called a Flywheel Cir-
cuit. This is on account of the circuit demonstrations rather like a mechanical
flywheel that, given routinely divided pulses of energy continues turning easily
(outputting energy) at a consistent rate.
Figure 3.23: Buck converter
The buck Converter circuit comprises of the switching transistor, together with
the flywheel circuit While the transistor is on, current is coursing through the load
by means of the inductor. The activity of any inductor contradicts changes in
current stream furthermore goes about as a store of energy. For this situation the
exchanging transistor output is kept from expanding quickly to its top esteem as
the inductor stores energy taken from the expanding output; this put away energy
is later discharged once more into the circuit as a back e.m.f. as present from the
switching transistor is quickly closed off.
Boost converter is also known as step-up voltage converter.
Switched mode supplies can be used for many purposes including DC to DC con-
verters. Often, although a DC supply, such as a battery may be available, its
available voltage is not suitable for the system being supplied. For example, the
motors used in driving electric automobiles require much higher voltages, in the re-
gion of 500V, than could be supplied by a battery alone. Even if banks of batteries
Chapter 3. Project Implementation 46
Figure 3.24: Boost converter
were used, the extra weight and space taken up would be too great to be practical.
The answer to this problem is to use fewer batteries and to boost the available DC
voltage to the required level by using a boost converter. Another problem with
batteries, large or small, is that their output voltage varies as the available charge
is used up, and at some point the battery voltage becomes too low to power the
circuit being supplied. However, if this low output level can be boosted back up
to a useful level again, by using a boost converter, the life of the battery can be
extended. Sources such as batteries, such as rectified AC from the mains supply,
or DC from solar panels, fuel cells, dynamos and DC generators provide the DC
input to the boost converter. Due to the simplicity with which boost converters
can supply extensive over voltages, they will quite often incorporate some regula-
tion to control the yield voltage, and there are numerous I.Cs fabricated for this
reason. Other safety elements given by the I.C. are over current shutdown, which
impairs the switch on a cycle-by-cycle premise if an excessive amount of current is
detected, and an over temperature close down facility.
A buck converter is just stepping down dc voltage in a very power efficient way
without using too much energy/heat to accomplish this. A boost dc converter will
do the opposite, step up the dc voltage such as voltage multipliers in computer and
monitors are a good example of this. It is the same with a buck/boost transformer
as well. The boost transformer will step-up the ac voltage for a small application
in a circuit and the buck transformer will step down the ac voltage. One exception
to a buck/boost application of controlling ac voltage is also the control of pulsed
dc voltage as well.
Chapter 3. Project Implementation 47
3.1.7 Implementation in terms of software
3.1.7.1 The Voltage Divider Code
To implement the voltage divider code, we wrote a series of codes on the Ar-
duino platform. The approach taken was having the variable names matching the
concept.
float scale = 41.25;
//const float scale = 300/800;//(330 / (330 + 470));
const int relayPin = 9;
void voltRead(){
delay(4000);
float voltageADC = 0.0;
float averageVoltageADC = 0.0;
float voltage = 0.0;
float voltTotalADC = 0.0;
While declaring the variables we have the Scale variable which is the mathematical
scale to recover the original voltage value that was there before the voltage division
effect took place, other variables include VoltageADC that would give the voltage-
divided ADC value coming directly from the analogueRead. In our code, we also
have the average voltage ADC variable. The reason we are using this is that the
voltage readings as read from the analogueRead from the voltage divider circuit is
very unstable. Therefore we have a for loop that adds the voltage vaules for fifteen
times. Once the readings are taken for fifteen times, we add them and divide by
the same number so as to average the voltage readings out.
Once we have the average readings taken we multiply this with our scale so as to
recover the original battery voltage as it was prior to the division of voltage from
the circuit. This reading is displayed on the serial monitor as an initial test and
later on we attempt to display the real time battery voltage on the web-app that
was made. Also, we have a digitalWrite for the relay control pin. Since we have
the relay control pin as a digital output, we link this digitalWrite to our battery
voltage with a condition. In order to make the logic work and to see the practical
load-shedding, we condition the relay control pin to the battery voltage. As the
battery voltage falls below a certain value, the relay control pin is given the high
logic.
Chapter 3. Project Implementation 48
3.1.8 Current Sensor Code
The current sensors that were used in the project were of two kinds. The ACS712
20A current sensor that has the filter capacitor already and the ACS712 5A which
has the small break-out board and is void of filter capacitors. The coding for the
current sensors was done step-wise. For the 20A ACS712, which reads the battery
current that is being provided from the battery to the inverter, after making the
necessary connections which are stated in the design chapter, we code the sensor
in Arduino. It is known to us that the offset ADC value when no current is being
registered in the current sensor is 512, so we display the readings of these ADC
values in the serial monitor to make sure the sensor was operational by using the
Serial.print command. We then adjust the offset so that the original current values
can be seen. To do that, in our code we subtract the registered ADC value from the
offset so we get the actual ADC value. After this we perform certain calculations
to change the ADC values from their basic form to an acceptable current value.
The figure to be multiplied to the ADC value after certain calculations was found
to be 0.049. In the code, this number is multiplied to the ADC value and that
gives us the true current value.
3.1.9 Investigation of Load Side Monitoring Methodology
We wanted to today was to monitor the currents and through the current ulti-
mately the power consumed by every AC load. We worked with an ACS712; a
typical bulb, a battery and an inverter. However, there was some complication
involved which had to do with the waveform of the ac. Unlike the DC which has
a constant straight line voltage value. Also, the complication involved the rate of
reading of analog values and the time it would take to take reading for a complete
cycle. This is not constant, since with every line of code the clock speed changes;
with every line the time of analog read varies as the chip has to go through an
extra calculation which in turn takes up more time.
In our investigation to measure the amount of steps to complete one cycle of
50 Hz AC, we carried out a study of the behavior of an atmega328p. A maximum
sampling rate of an Atmega chip is 10,000 samples per second.[? ]
Considering the above stated facts and assumptions the plan of action is to
acquire a series of readings of ADC values that correspond to the AC current (I
rms) values. We attempt to find a symmetrical pattern in the readings that hint
to the zero-crossings of the waveform. We then use our intuition to sketch a rough
Chapter 3. Project Implementation 49
graph of the AC current with the displayed ADC values and from here we will
know the number of ADC steps to complete one AC cycle. Once we know that,
we do a series of small calculations to convert this current into RMS current which
will then be displayed on the serial monitor.
The limitations of ADC is that it cannot multitask. Each ADC values are
consisted of 10
Chapter 3. Project Implementation 50
3.2 Web App
3.3 HTTP Server
To create the server we import the http module which comes packed with all the
functions that makes our app live.
server.listen(port[, hostname][, backlog][, callback])
This function accepts connections on the specified port and host. In our case we
did not specify the host and hence the server will accept connections directed to
any IPv4 address. We also assigned the port
This function is asynchronous. When the server has been bound, ’listening’ event
will be emitted. The last parameter callback will be added as an listener for the
’listening’ event.
One issue some users run into is getting EADDRINUSE errors. This means that
another server is already running on the requested port. One way of handling this
would be to wait a second and then try again. This can be done with
...
var http = require(’http’).Server(app),
...
http.listen(3000, function() {
console.log(’Server listening on port: 3000’);
});
The app will be uses the node framework http for web server capabilities. This is
the core library we need to import if we wish to make our app live, respond to all
the core requests that includes:
– GET
– HEAD
– POST
– PUT
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis
Solar Power Management System Thesis

Weitere ähnliche Inhalte

Andere mochten auch

EE-42 Energy Conservation Demand Side Load Management
EE-42 Energy Conservation Demand Side Load ManagementEE-42 Energy Conservation Demand Side Load Management
EE-42 Energy Conservation Demand Side Load ManagementRina Florentes
 
Chelsea Gondeck - Final Thesis
Chelsea Gondeck - Final ThesisChelsea Gondeck - Final Thesis
Chelsea Gondeck - Final ThesisChelsea Gondeck
 
emPower: Accurately Valuing Distributed Energy Resources
emPower: Accurately Valuing Distributed Energy ResourcesemPower: Accurately Valuing Distributed Energy Resources
emPower: Accurately Valuing Distributed Energy ResourcesPrivate Consultants
 
California Energy Policy & Native American Tribes: Consultation, Collaboratio...
California Energy Policy & Native American Tribes: Consultation, Collaboratio...California Energy Policy & Native American Tribes: Consultation, Collaboratio...
California Energy Policy & Native American Tribes: Consultation, Collaboratio...Amanda Cárdenas, Esq.
 
Pedro Esteban - Thesis - Towards the Smart Wind Farm - Abstract and Table of ...
Pedro Esteban - Thesis - Towards the Smart Wind Farm - Abstract and Table of ...Pedro Esteban - Thesis - Towards the Smart Wind Farm - Abstract and Table of ...
Pedro Esteban - Thesis - Towards the Smart Wind Farm - Abstract and Table of ...Pedro Esteban
 
Optimization of Distributed Energy Resources to Balance Power Supply and Dem...
Optimization of Distributed Energy  Resources to Balance Power Supply and Dem...Optimization of Distributed Energy  Resources to Balance Power Supply and Dem...
Optimization of Distributed Energy Resources to Balance Power Supply and Dem...Shah Mohammad Al Imran
 
Reactive power control of three phase grid-connected pv system during grid fa...
Reactive power control of three phase grid-connected pv system during grid fa...Reactive power control of three phase grid-connected pv system during grid fa...
Reactive power control of three phase grid-connected pv system during grid fa...I3E Technologies
 
final thesis submission presentation
final thesis submission presentation final thesis submission presentation
final thesis submission presentation Vikas 8126266867
 
Phd Successful Approach
Phd Successful Approach Phd Successful Approach
Phd Successful Approach Najib Altawell
 
Multilevel inverter technology
Multilevel inverter technologyMultilevel inverter technology
Multilevel inverter technologygmrit
 
cascaded multilevel inverter project
cascaded multilevel inverter projectcascaded multilevel inverter project
cascaded multilevel inverter projectShiva Kumar
 
Resume - Electrical Engineer (MEP) 9+ Years Exp
Resume - Electrical Engineer (MEP) 9+ Years ExpResume - Electrical Engineer (MEP) 9+ Years Exp
Resume - Electrical Engineer (MEP) 9+ Years ExpSubhash +966535838322
 
Space Vector Modulation(SVM) Technique for PWM Inverter
Space Vector Modulation(SVM) Technique for PWM InverterSpace Vector Modulation(SVM) Technique for PWM Inverter
Space Vector Modulation(SVM) Technique for PWM InverterPurushotam Kumar
 

Andere mochten auch (20)

Internship report
Internship reportInternship report
Internship report
 
EE-42 Energy Conservation Demand Side Load Management
EE-42 Energy Conservation Demand Side Load ManagementEE-42 Energy Conservation Demand Side Load Management
EE-42 Energy Conservation Demand Side Load Management
 
Demand Side Management
Demand Side ManagementDemand Side Management
Demand Side Management
 
Chelsea Gondeck - Final Thesis
Chelsea Gondeck - Final ThesisChelsea Gondeck - Final Thesis
Chelsea Gondeck - Final Thesis
 
poster
posterposter
poster
 
emPower: Accurately Valuing Distributed Energy Resources
emPower: Accurately Valuing Distributed Energy ResourcesemPower: Accurately Valuing Distributed Energy Resources
emPower: Accurately Valuing Distributed Energy Resources
 
Cv mail
Cv mailCv mail
Cv mail
 
Summary of thesis
Summary of thesisSummary of thesis
Summary of thesis
 
California Energy Policy & Native American Tribes: Consultation, Collaboratio...
California Energy Policy & Native American Tribes: Consultation, Collaboratio...California Energy Policy & Native American Tribes: Consultation, Collaboratio...
California Energy Policy & Native American Tribes: Consultation, Collaboratio...
 
Pedro Esteban - Thesis - Towards the Smart Wind Farm - Abstract and Table of ...
Pedro Esteban - Thesis - Towards the Smart Wind Farm - Abstract and Table of ...Pedro Esteban - Thesis - Towards the Smart Wind Farm - Abstract and Table of ...
Pedro Esteban - Thesis - Towards the Smart Wind Farm - Abstract and Table of ...
 
Optimization of Distributed Energy Resources to Balance Power Supply and Dem...
Optimization of Distributed Energy  Resources to Balance Power Supply and Dem...Optimization of Distributed Energy  Resources to Balance Power Supply and Dem...
Optimization of Distributed Energy Resources to Balance Power Supply and Dem...
 
Reactive power control of three phase grid-connected pv system during grid fa...
Reactive power control of three phase grid-connected pv system during grid fa...Reactive power control of three phase grid-connected pv system during grid fa...
Reactive power control of three phase grid-connected pv system during grid fa...
 
final thesis submission presentation
final thesis submission presentation final thesis submission presentation
final thesis submission presentation
 
Phd Successful Approach
Phd Successful Approach Phd Successful Approach
Phd Successful Approach
 
Tesla coil thesis
Tesla coil thesisTesla coil thesis
Tesla coil thesis
 
Demand side management
Demand side managementDemand side management
Demand side management
 
Multilevel inverter technology
Multilevel inverter technologyMultilevel inverter technology
Multilevel inverter technology
 
cascaded multilevel inverter project
cascaded multilevel inverter projectcascaded multilevel inverter project
cascaded multilevel inverter project
 
Resume - Electrical Engineer (MEP) 9+ Years Exp
Resume - Electrical Engineer (MEP) 9+ Years ExpResume - Electrical Engineer (MEP) 9+ Years Exp
Resume - Electrical Engineer (MEP) 9+ Years Exp
 
Space Vector Modulation(SVM) Technique for PWM Inverter
Space Vector Modulation(SVM) Technique for PWM InverterSpace Vector Modulation(SVM) Technique for PWM Inverter
Space Vector Modulation(SVM) Technique for PWM Inverter
 

Ähnlich wie Solar Power Management System Thesis

Automatic power factor_detection_and_cor
Automatic power factor_detection_and_corAutomatic power factor_detection_and_cor
Automatic power factor_detection_and_corhadafree
 
Raffaele Salvucci s111179 Thesis
Raffaele Salvucci s111179 ThesisRaffaele Salvucci s111179 Thesis
Raffaele Salvucci s111179 Thesisraffaele00
 
Bidirectional Visitor Counter for efficient electricity usage.
Bidirectional Visitor Counter for efficient electricity usage.Bidirectional Visitor Counter for efficient electricity usage.
Bidirectional Visitor Counter for efficient electricity usage.NandaVardhanThupalli
 
From nwokolo eric onyekachi(mini project 492)
From nwokolo eric onyekachi(mini project 492)From nwokolo eric onyekachi(mini project 492)
From nwokolo eric onyekachi(mini project 492)Eric Brendan
 
Design Document - Remote Solar Monitoring and Bateery Optimzation System
Design Document - Remote Solar Monitoring and Bateery Optimzation SystemDesign Document - Remote Solar Monitoring and Bateery Optimzation System
Design Document - Remote Solar Monitoring and Bateery Optimzation SystemMamoon Ismail Khalid
 
Wireless charger for_low_power_devices_ excellent one same
Wireless charger for_low_power_devices_ excellent one sameWireless charger for_low_power_devices_ excellent one same
Wireless charger for_low_power_devices_ excellent one sameIbrahim Khleifat
 
B.E thesis Shubham Nivasarkar
B.E thesis Shubham NivasarkarB.E thesis Shubham Nivasarkar
B.E thesis Shubham Nivasarkarshubhamnivasarkar
 
Supercoducting Cables in Grid
Supercoducting Cables in GridSupercoducting Cables in Grid
Supercoducting Cables in Gridprajesh88
 
DC VOLTAGE MEASUREMENT USİNG THE WITH PIC MICROCONTROLLER
DC VOLTAGE MEASUREMENT USİNG THE WITH PIC MICROCONTROLLERDC VOLTAGE MEASUREMENT USİNG THE WITH PIC MICROCONTROLLER
DC VOLTAGE MEASUREMENT USİNG THE WITH PIC MICROCONTROLLERDursun Kalpak
 
Solar Refrigeration System
Solar Refrigeration SystemSolar Refrigeration System
Solar Refrigeration SystemOrindomChowdhury
 
MelendyDaniel2003_Thesis
MelendyDaniel2003_ThesisMelendyDaniel2003_Thesis
MelendyDaniel2003_ThesisDaniel Melendy
 
"Black Box for a Car" report
"Black Box for a Car" report"Black Box for a Car" report
"Black Box for a Car" reportsubrat manna
 
Geldenhuys model 20418
Geldenhuys model 20418Geldenhuys model 20418
Geldenhuys model 20418hajarchokri1
 
Manuscrit de Doctorat_El Abdellaouy Hanane
Manuscrit de Doctorat_El Abdellaouy HananeManuscrit de Doctorat_El Abdellaouy Hanane
Manuscrit de Doctorat_El Abdellaouy HananeElabdellaouy Hanane
 
KEB supply failure
KEB supply failureKEB supply failure
KEB supply failuregayatrigayu1
 

Ähnlich wie Solar Power Management System Thesis (20)

Automatic power factor_detection_and_cor
Automatic power factor_detection_and_corAutomatic power factor_detection_and_cor
Automatic power factor_detection_and_cor
 
Raffaele Salvucci s111179 Thesis
Raffaele Salvucci s111179 ThesisRaffaele Salvucci s111179 Thesis
Raffaele Salvucci s111179 Thesis
 
Bidirectional Visitor Counter for efficient electricity usage.
Bidirectional Visitor Counter for efficient electricity usage.Bidirectional Visitor Counter for efficient electricity usage.
Bidirectional Visitor Counter for efficient electricity usage.
 
From nwokolo eric onyekachi(mini project 492)
From nwokolo eric onyekachi(mini project 492)From nwokolo eric onyekachi(mini project 492)
From nwokolo eric onyekachi(mini project 492)
 
Design Document - Remote Solar Monitoring and Bateery Optimzation System
Design Document - Remote Solar Monitoring and Bateery Optimzation SystemDesign Document - Remote Solar Monitoring and Bateery Optimzation System
Design Document - Remote Solar Monitoring and Bateery Optimzation System
 
Wireless charger for_low_power_devices_ excellent one same
Wireless charger for_low_power_devices_ excellent one sameWireless charger for_low_power_devices_ excellent one same
Wireless charger for_low_power_devices_ excellent one same
 
VENDING_MACHINE_2023-2024
VENDING_MACHINE_2023-2024VENDING_MACHINE_2023-2024
VENDING_MACHINE_2023-2024
 
B.E thesis Shubham Nivasarkar
B.E thesis Shubham NivasarkarB.E thesis Shubham Nivasarkar
B.E thesis Shubham Nivasarkar
 
Final report
Final reportFinal report
Final report
 
fac_alahari001_planczhaov1
fac_alahari001_planczhaov1fac_alahari001_planczhaov1
fac_alahari001_planczhaov1
 
Hybrid inverter project report
Hybrid inverter project reportHybrid inverter project report
Hybrid inverter project report
 
H1011v2
H1011v2H1011v2
H1011v2
 
Supercoducting Cables in Grid
Supercoducting Cables in GridSupercoducting Cables in Grid
Supercoducting Cables in Grid
 
DC VOLTAGE MEASUREMENT USİNG THE WITH PIC MICROCONTROLLER
DC VOLTAGE MEASUREMENT USİNG THE WITH PIC MICROCONTROLLERDC VOLTAGE MEASUREMENT USİNG THE WITH PIC MICROCONTROLLER
DC VOLTAGE MEASUREMENT USİNG THE WITH PIC MICROCONTROLLER
 
Solar Refrigeration System
Solar Refrigeration SystemSolar Refrigeration System
Solar Refrigeration System
 
MelendyDaniel2003_Thesis
MelendyDaniel2003_ThesisMelendyDaniel2003_Thesis
MelendyDaniel2003_Thesis
 
"Black Box for a Car" report
"Black Box for a Car" report"Black Box for a Car" report
"Black Box for a Car" report
 
Geldenhuys model 20418
Geldenhuys model 20418Geldenhuys model 20418
Geldenhuys model 20418
 
Manuscrit de Doctorat_El Abdellaouy Hanane
Manuscrit de Doctorat_El Abdellaouy HananeManuscrit de Doctorat_El Abdellaouy Hanane
Manuscrit de Doctorat_El Abdellaouy Hanane
 
KEB supply failure
KEB supply failureKEB supply failure
KEB supply failure
 

Solar Power Management System Thesis

  • 1. ABU DHABI UNIVERSITY Demand Side Load Management to Match Solar Power Generation by Mr. Albert James Nannety Mr. Faiq Amir Mr. Mehdi Ismail Sait Mr. Mohammed Ali Sadi A thesis submitted in partial fulfillment for the degree in Bachelors of Computer and Electrical Engineering to Dr. Muhammad Akmal. & the Committee Department of Computer and Electrical Engineering (College Of Engineering) June 2015
  • 2. Declaration of Authorship We, the undersigning authors, declare that this thesis titled, ‘DEMAND SIDE LOAD MANAGEMENT TO MATCH SOLAR POWER GENERATION’ and the work pre- sented in it are our own. We confirm that: This work was done wholly or mainly while in candidature for a research degree at this University. Where any part of this thesis has previously been submitted for a degree or any other qualification at this University or any other institution, this has been clearly stated. Where I have consulted the published work of others, this is always clearly at- tributed. Where I have quoted from the work of others, the source is always given. With the exception of such quotations, this thesis is entirely my own work. I have acknowledged all main sources of help. Where the thesis is based on work done by myself jointly with others, I have made clear exactly what was done by others and what I have contributed myself. Author: Albert James Author: Ali Sadi Signed: Signed: Date: Date: Author: Faiq Amir Author: Mehdi Ismail Signed: Signed: Date: Date: i
  • 3. “Engineers like to solve problems. If there are no problems handily available, they will create their own problems. ” Scott Adams “In order to change an existing paradigm you do not struggle to try and change the problematic model. You create a new model and make the old one obsolete. ” R. Buckminster Fuller “Simplicity is the ultimate sophistication. ” Leonardo da Vinci “Don’t undertake a project unless it is manifestly important and nearly impossible. ” Edwin Land “Of all sad words of tongue or pen, the saddest are these, ’It might have been’. ” John Greenleaf Whittier “Deleted code is debugged code. ” Jeff Sickel “The art of progress is to preserve order amid change and to preserve change amid order. ” Alfred North Whitehead “With great power comes a great electric bill. ” Anonymous
  • 4. ABU DHABI UNIVERSITY Abstract Dr. Muhammad Akmal Department of Computer and Electrical Engineering (College Of Engineering) Doctor of Electrical Power Systems by Mr. Albert James Nannety Mr. Faiq Amir Mr. Mehdi Ismail Sait Mr. Mohammed Ali Sadi
  • 5. This report is the documentation which serves as the final thesis report for the design project titled Demand Side management to match Solar Power Generation as Supply source in Generation. The project has various implications and motivations; from what propels major developments in this field that is the environmental factor, to being an investment for financial or locality issues and a lengthy list from there. Our system is aimed at those who take electrical power security for their systems as core in mountain- ous and inaccessible regions or as backup system against unforseen situations or voltage drops would gladly invest in our system, that provides ambience, efficiency, and even fullfilment to a status-quo for individuals in their houses. Our solution is fairly innova- tive in considering to provide prioritization to the various components in houses, instead of voltage drops and damaging household Utilities, and also secures system stability by cutting off battery from household sources upon falling below a certain level based on data intelligence from the systems usage. This does relate to the famous concept of UPS (Uninterruptable Power Supply) but is quite further advanced, to meet future require- ments and innovate on well-established utility, fully utilizing off-grid Solar power and simulating reactions that save power and energy. The two main objectives are to give the user a complete scenario of the power consump- tion and the facility of turning off the loads of the least priority while keeping the loads of the highest priority working. Another aspect that is accomplished is the complete utilization of solar power in off-grid settings. This symbolizes any crises situation or acute breakdowns that can occur in the national grid. How is the load to be managed upon voltage and power reduction in an off-grid setting. This is the question answered to some extent in our project. The user witnesses in front of him the complete picture of the current supply, battery voltage and thus the power supply. The real time battery voltage is our deciding factor and as a reaction any reduction in it, the management aspect comes into action where the switching on and off of loads via relays takes place. If we consider the existing solutions in the world regarding load management, the region that comes to one’s mind is South Asia. The prevalent concept used is with complete grid integration and is often called load-shedding or black-outs. The drawback of such a system is that it affects every in-house unit and every load indiscriminately. There is no pre-set priority system that exists that would help in making a regular load manage- ment system smart. Indiscriminatory systems as a reaction to power cuts and voltage reductions would mean that no such load exists that can be kept on regardless of the Priority. In addition, the ease provided to the user in terms of the complete display of power supplied is something not seen very often. We aim to develop a webapp that constantly updates the value of the three main power variables from a server made exclusively for
  • 6. the system and stores them in a database. Upon set intervals, these variables are re- trieved from the database and presented in front of the user so that one exactly knows the status of consumption in details. Furthermore, we are putting to use the relays in the operations of different loads and having it communicate with the microcontroller. The arduino in use coordinates with the relay in such a way that when a voltage drop from the real time battery voltage is detected too. . .
  • 7. Acknowledgements We, the capstone group would like to thank God Almighty for his grace and mercy to- wards us , neither of which we deserve, but has been given to us freely and abundantly. We could not have got this far without help from so many people...Our Parents and fam- ily who have loved and supported us throughout all of this, our professors and faculty who have helped us gain the knowledge we need for the cause of lifelong learning, our lab engineers, Engineer Ahmed and Engineer Ibrahim who provided us with the technical and practical application that we need. Our friends and classmates, who encouraged us and helped us in many ways. A special thanks to Sifat Sultan who gave us a lot of good advice and support throughout this project and helped us understand a lot of concepts. Finally, to our beloved mentor, professor, supervisor, adviser, coach and teacher, Dr. Muhammad Akmal. We are so privileged that we got to work with him. He is a very humble, patient, kind and respectful human being. His vast knowledge is something that we are so proud to be a part in sharing and his work ethic and amazing personality is very rare to find. We have no idea how this project would have even been possible if it weren’t for him. We wish him all the best and thank him so very much for guiding us through this process even when we were really difficult to deal with. We pray that God blesses him with choicest blessings in all his future endeavors. . . . vi
  • 8. Contents Declaration of Authorship i Abstract iii Acknowledgements vi List of Figures xi List of Tables xiii 1 Introduction 1 1.1 Problem Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1.1.1 Motivations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1.2 Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 1.2.1 The Arduino-conrolled ACS712 Hall effect sensing . . . . . . . . . 3 1.2.2 The Database and Server . . . . . . . . . . . . . . . . . . . . . . . 3 1.3 Literature Review . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 1.4 The Contents of the report . . . . . . . . . . . . . . . . . . . . . . . . . . 7 2 Design 8 2.1 Problem Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 2.1.1 Fritzing Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 2.1.2 Calculations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 2.1.2.1 Calibrations for microcontroller . . . . . . . . . . . . . . 13 2.1.2.2 calculations for the Voltage Divider circuit . . . . . . . . 16 2.1.3 Connections between components . . . . . . . . . . . . . . . . . . . 18 2.1.3.1 The battery and arduino: Voltage Divider . . . . . . . . . 18 2.1.3.2 The battery, arduino and inverter: Current readings . . . 20 2.1.3.3 Inverter to the loads . . . . . . . . . . . . . . . . . . . . . 20 2.1.3.4 Loads and the PCB . . . . . . . . . . . . . . . . . . . . . 20 3 Project Implementation 21 3.1 Integration of components with Arduino . . . . . . . . . . . . . . . . . . . 21 3.1.1 Voltage sensing with the Arduino . . . . . . . . . . . . . . . . . . . 22 3.1.2 Current sensing with the Arduino . . . . . . . . . . . . . . . . . . 24 vii
  • 9. Contents viii 3.1.3 Power supplied reading . . . . . . . . . . . . . . . . . . . . . . . . 25 3.1.4 Relay operation to turn off low priority load via Arduino . . . . . 26 3.1.4.1 SPDT Relays . . . . . . . . . . . . . . . . . . . . . . . . . 26 3.1.4.2 Integration of the Printed Circuit Board: Operation of relay in the design via Arduino . . . . . . . . . . . . . . . 30 3.1.4.3 1N1418 Diode . . . . . . . . . . . . . . . . . . . . . . . . 30 3.1.4.4 Resistors . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 3.1.4.5 Screw Terminals . . . . . . . . . . . . . . . . . . . . . . . 31 3.1.4.6 2N3904 BJ Transistor . . . . . . . . . . . . . . . . . . . . 31 3.1.5 Printed Circuit Board application . . . . . . . . . . . . . . . . . . 31 3.1.5.1 Problems faced in PCB creation . . . . . . . . . . . . . . 32 3.1.5.2 Relay PCB with the 5A current sensor integrated . . . . 33 3.1.6 The Battery . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 3.1.6.1 AGM and GEL . . . . . . . . . . . . . . . . . . . . . . . 38 3.1.6.2 Battery connections . . . . . . . . . . . . . . . . . . . . . 39 3.1.6.3 Possible improvements with the Use of Voltage Regulators 39 3.1.7 Implementation in terms of software . . . . . . . . . . . . . . . . . 47 3.1.7.1 The Voltage Divider Code . . . . . . . . . . . . . . . . . 47 3.1.8 Current Sensor Code . . . . . . . . . . . . . . . . . . . . . . . . . . 48 3.1.9 Investigation of Load Side Monitoring Methodology . . . . . . . . 48 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 3.2 Web App . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 3.3 HTTP Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 GET . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 HEAD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 POST . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 PUT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 DELETE . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 CONNECT . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 OPTIONS . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 TRACE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 3.3.1 The Web Application . . . . . . . . . . . . . . . . . . . . . . . . . 54 3.3.1.1 HTML . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 3.3.1.2 CSS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 3.3.1.3 JavaScript . . . . . . . . . . . . . . . . . . . . . . . . . . 56 3.3.1.4 Parallax . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 3.3.1.5 Angular JS for the WebApp . . . . . . . . . . . . . . . . 58 3.3.1.6 jQuery . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 3.3.1.7 Json . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 3.3.1.8 Load Management Webapp: Using Json in JavaScript . . 65 3.3.1.9 Load Management Webapp: DOM . . . . . . . . . . . . . 66 3.3.1.10 Load Management Webapp: API or Application Pro- gramming Interface . . . . . . . . . . . . . . . . . . . . . 67 3.3.1.11 The Final Load Management Web Applciation . . . . . . 68 3.3.1.12 Old Code For the Application . . . . . . . . . . . . . . . 79
  • 10. Contents ix 3.3.1.13 Mobile Application . . . . . . . . . . . . . . . . . . . . . 82 3.3.1.14 Ionic Framework . . . . . . . . . . . . . . . . . . . . . . . 84 4 Project Management 90 4.1 Team Members . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90 4.1.1 Member 1: Albert James Nannety . . . . . . . . . . . . . . . . . . 90 4.1.2 Member 2: Mohammed Ali Sadi . . . . . . . . . . . . . . . . . . . 91 4.1.3 Member 3: Mehdi Ismail Sait . . . . . . . . . . . . . . . . . . . . . 91 4.1.4 Member 4: Faiq Amir . . . . . . . . . . . . . . . . . . . . . . . . . 91 4.1.5 Management techniques . . . . . . . . . . . . . . . . . . . . . . . . 92 4.1.6 Division of Tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93 4.2 Problems in Acquisition . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94 4.3 Email Exchanges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 5 Results and Discussion 100 5.1 Working of the system . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100 5.2 The Impact of the Project on the Society . . . . . . . . . . . . . . . . . . 100 5.2.1 Impact of the Project on the environment . . . . . . . . . . . . . . 101 5.3 Test 1: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102 5.3.1 Testing the voltage divider: . . . . . . . . . . . . . . . . . . . . . . 102 5.4 Test 2: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102 5.4.1 Testing the current sensor: ADC Values . . . . . . . . . . . . . . . 102 5.5 Test 3: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107 5.5.1 ADC Offset adjusted values . . . . . . . . . . . . . . . . . . . . . . 107 5.6 Test 4: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107 5.6.1 The true current value . . . . . . . . . . . . . . . . . . . . . . . . . 107 6 Conclusion and Future Work 108 6.1 Report Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108 6.2 What we learned technically . . . . . . . . . . . . . . . . . . . . . . . . . . 108 6.3 Experience gained from working as a team . . . . . . . . . . . . . . . . . . 109 A References 111 B Source Codes 117 B.1 Web Application Source Code . . . . . . . . . . . . . . . . . . . . . . . . . 117 B.1.1 HTML Source Code . . . . . . . . . . . . . . . . . . . . . . . . . . 117 B.1.1.1 ”index.html” . . . . . . . . . . . . . . . . . . . . . . . . . 117 B.1.1.2 ”addnew.html” . . . . . . . . . . . . . . . . . . . . . . . . 124 B.1.2 CSS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128 B.1.2.1 ”style.css” . . . . . . . . . . . . . . . . . . . . . . . . . . 128 B.1.3 JavaScript . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148 B.1.3.1 ”script.js” . . . . . . . . . . . . . . . . . . . . . . . . . . . 148 B.1.4 Arduino Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208 B.1.4.1 Load With Error Detection . . . . . . . . . . . . . . . . . 213 B.1.4.2 Hello World . . . . . . . . . . . . . . . . . . . . . . . . . 214
  • 11. Contents x B.1.4.3 Load First Attempt . . . . . . . . . . . . . . . . . . . . . 215 B.1.4.4 Test 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216 B.1.4.5 SocketIO . . . . . . . . . . . . . . . . . . . . . . . . . . . 216 B.1.4.6 Wi-Fi Shield Code . . . . . . . . . . . . . . . . . . . . . . 218 B.1.4.7 Wi-Fi Shield Code New . . . . . . . . . . . . . . . . . . . 220 B.1.5 Mobile Application Codes . . . . . . . . . . . . . . . . . . . . . . . 223 B.1.5.1 Ionic HTML . . . . . . . . . . . . . . . . . . . . . . . . . 223 B.1.5.2 Ionic App JavaScript . . . . . . . . . . . . . . . . . . . . 224 B.1.5.3 Ionic Controllers JavaScript . . . . . . . . . . . . . . . . . 225
  • 12. List of Figures 1.1 Demand Response . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 1.2 Demand Response . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 2.1 An Inverter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 2.2 PCB Boards . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 2.3 An SPDT 20A relay from the pin side . . . . . . . . . . . . . . . . . . . . 10 2.4 An SPDT 20A relay from the upper side . . . . . . . . . . . . . . . . . . . 11 2.5 An NPN 2N3904 Transistor used in the PCB for the relay . . . . . . . . . 11 2.6 ACS712 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 2.7 A simple Voltage divider circuit made on fritzing. A 9V battery is used becasue a 12V one was not in the fritzing panel . . . . . . . . . . . . . . . 14 2.8 The simple circuit for current measurement using the ACS712 low break- out with one dummy load. We used low breakout for this because the dummy load as small as an LED could work well with the low breakout modulel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 2.9 The simple circuit for current measurement using the ACS712 low break- out with MULTIPLE dummy loads. We used low breakout for this be- cause the dummy load as small as an LED could work well with the low breakout modulel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 2.10 Thecircuit for the voltage divider module and current measurement mod- ule togetherl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 3.1 The voltage divider concept . . . . . . . . . . . . . . . . . . . . . . . . . . 23 3.2 A Multisim simulation for the application’s voltage divider . . . . . . . . 23 3.3 Voltage divider with the UNO . . . . . . . . . . . . . . . . . . . . . . . . . 24 3.4 Relay concept . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 3.5 Relay concept . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 3.6 Relay concept . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 3.7 The initial open source relay PCB schematic on eagle . . . . . . . . . . . 32 3.8 The initial open source relay PCB board on eagle . . . . . . . . . . . . . . 33 3.9 The modified relay PCB schematic on eagle . . . . . . . . . . . . . . . . . 34 3.10 The modified relay PCB board on eagle . . . . . . . . . . . . . . . . . . . 34 3.11 The modified relay PCB board on eagle . . . . . . . . . . . . . . . . . . . 35 3.12 The modified relay PCB board on eagle . . . . . . . . . . . . . . . . . . . 35 3.13 The modified relay PCB board on eagle . . . . . . . . . . . . . . . . . . . 36 3.14 The modified relay PCB board on eagle . . . . . . . . . . . . . . . . . . . 36 3.15 The modified relay PCB board on eagle . . . . . . . . . . . . . . . . . . . 36 3.16 The modified relay PCB board on eagle . . . . . . . . . . . . . . . . . . . 37 3.17 12V AGM 33AH (at 20Hrs) battery . . . . . . . . . . . . . . . . . . . . . 38 xi
  • 13. List of Figures xii 3.18 The connections with the ACS712 . . . . . . . . . . . . . . . . . . . . . . 40 3.19 The hooking up of Arduino with the wifi shield . . . . . . . . . . . . . . . 41 3.20 The 5V 4channel Arduino relays are also used. However, we used the typical SPDT relays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 3.21 A kind of regulator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 3.22 converters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 3.23 Buck converter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 3.24 Boost converter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 3.25 DOM Flowchart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 3.26 The Main Menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 3.27 A screengrab from the Load Management webapp showing the devices menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71 3.28 A screengrab from the Load Management webapp . . . . . . . . . . . . . 71 3.29 The Devices Page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72 3.30 Table showing devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72 3.31 Warning if you are deleting a device . . . . . . . . . . . . . . . . . . . . . 73 3.32 The Monitor Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 3.33 Supply Side Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 3.34 Design Process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 3.35 The Flow Chart of The Old Web App . . . . . . . . . . . . . . . . . . . . 83 3.36 The Old Version Of The WebApp . . . . . . . . . . . . . . . . . . . . . . . 83 3.37 The Old Version Of The WebApp . . . . . . . . . . . . . . . . . . . . . . . 84 3.38 The Old Version Of The WebApp . . . . . . . . . . . . . . . . . . . . . . . 85 3.39 The Old Version Of The WebApp . . . . . . . . . . . . . . . . . . . . . . . 85 3.40 The Old Version Of The WebApp . . . . . . . . . . . . . . . . . . . . . . . 85 3.41 Mobile App Login Screen . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 3.42 Mobile App Search Function . . . . . . . . . . . . . . . . . . . . . . . . . 89 3.43 Mobile App Devices Page . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 4.1 Email Exchange . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96 4.2 Email Exchange . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96 4.3 Email Exchange . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97 4.4 Email Exchange . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97 4.5 Email Exchange . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 4.6 Email Exchange . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 4.7 Email Exchange . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99 4.8 Email Exchange . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99 4.9 Email Exchange . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99 5.1 Testing the current sensor: ADC Values . . . . . . . . . . . . . . . . . . . 103 5.2 Testing the current sensor: ADC Values . . . . . . . . . . . . . . . . . . . 103 5.3 Testing the current sensor: ADC Values . . . . . . . . . . . . . . . . . . . 104 5.4 Testing the current sensor: ADC Values . . . . . . . . . . . . . . . . . . . 105 5.5 Testing the current sensor: ADC Values . . . . . . . . . . . . . . . . . . . 105 5.6 Testing the current sensor: ADC Values . . . . . . . . . . . . . . . . . . . 106 5.7 Testing the current sensor: ADC Values . . . . . . . . . . . . . . . . . . . 106
  • 15. Albert: To my best friend, my fiancee, my future wife, Raleigh. Faiq: To the nation of Pakistan and its people Mehdi: To my friends and family Mohammed Ali: To my parents and family xiv
  • 16. Chapter 1 Introduction 1.1 Problem Statement In the 21st century, where the world has become a global village and population explosion is happening simultaneously, it is no mystery that the electricity demands of the global population is rising by a great deal with every passing moment. In populous continents the issue of an ever-rising electricity demand is more magnified than in comparatively less populous places. One age-old and logical solution to the grave issue of rising demands is to bring about a mammoth increase in supply to cater to the other side. However, this solution is tried and tested. There are certain repercussions to this solution as not every continent and thus every country is not as developed and the prospect of increasing the supply does not sit well with the economy. Also, in developing countries either the resources are too scarce or the investment done on developing the natural resources to increase the electricity generation is not in abundance. Keeping in consideration these drawbacks of the typical solution of increasing supply, we developed a simple prototype that utilizes the other side of the same equation, that is, the demand side instead of the supply. This project aims to manage loads based on pre-set priorities in times of an off-grid crises and uses the operation of turning off loads and keeping the required loads on in situations where the supply or generation cannot be immediately increased. 1.1.1 Motivations According to PGE, the demand response is a phenomenon that looks at the consumers side of the equation in the scenario of an electricity demand and supply. It is traditional 1
  • 17. Chapter 1. Introduction 2 for the suppliers to take an initiative in order to match the generation with supply but the concept of demand response enables users to contribute to the process of this matching. This notion of the consumer end making it match was one of the motivations. Our project follows up with this concept and implements the demand response scenario by way of automated turning on and off of loads at the demand side. Some typical household loads are represented by certain dummy loads with a relay to be energized when needed. When the generation is increased, it burdens the resources of a country and is sometimes adverse for them. Besides this, there would be no awareness that the consumers are also equally responsible to match generations. Another motivation was the thought that making more and more power plants and maintaining them just so the supply and demand could be matched would mean wasting major resources when a better solution is straight-out available. Major investments with a level of utilization below-par are adverse. Reducing demand and that too by an automated shutting of loads when required, we have in front of us a good solution to the problem (PGE, 2015). This was another one of our motivations. Figure 1.1: Demand Response
  • 18. Chapter 1. Introduction 3 1.2 Background As we began this design project, there were somethings that we had to take into con- sideration and these things included some of the concepts and equipment, programming languages, platforms and other open-source components that we were not initially aware of. As went into the thick of the project, we discovered their operating principles and the way of managing these things without fail. Some of such things are given as follows. 1.2.1 The Arduino-conrolled ACS712 Hall effect sensing This is a semi-commonly used sensor that typically is a chip that comes embedded on a breakout board. It is able to measure both AC and DC currents. It is made in such a way that allows for integration with any kind of system whether it be industrial or communication. One of the application of the ACS712 is the load detection application for which we have implemented it. More about the ACS712 will be stated in the design chapter. The hall effect sensing that is the working principle of the ACS712 was a new practical theory. According to Hyper Physics, If a current flows through a conductor in the presence of a magnetic field, that field causes a force to be exerted on the electrons. This force makes the electrons be pushed toone pole or edge of a conductor. On either side of a conductor, a builup of electrons comes to exist that balances out the effect of the magnetic field initially present in and around the conductor. This buildup of electrons becomes a cause of substantial voltage in the conductor. 1.2.2 The Database and Server The setting up of a proper database in order for the real time values to get stored and then displayed via the server was a new concept for this project. We used the brackets platform available in all systems to code the database. We used my-SQL for the database. The integration of the webapp for the project was done with this database. In this database, we try to read all the analogueRead values that we are getting from the 2 basic supply side aspects. These readings will get stored in the database as part of the back-end part of the app. The server then gets this data from the already- set up database and does certain calculations for the battery voltage and and the real time current in order to display them back. Once these calculations are done,the server will retreat these readings that are to be displayed on the webapp and this will serve as the front end of the webapp.
  • 19. Chapter 1. Introduction 4 1.3 Literature Review The project we are undertaking is a demand side management to match the solar power generation with the load. For this project, we have decided to use solar panels to gener- ate power and then manage them using a microcontroller and introduce load shedding according to the fluctuations in power. The search for such a topic was challenging as, in today?s world, the only major uses of such a system is done on a very large scale. Since we were trying to build a system where the primary early adopters would be major power distribution and supply companies, but the primary target buyers would be the domestic households, we needed to research a lot on how we were going to accomplish that task. We review numerous scholarly articles and researches done on this topic. One of the research articles that was helpful was seeing the average load consumption recorded data done in one of the villages in a foreign country and it focused on the fun- damentals of energy conversion and how the appliances used them (Kurtulan and Sevgi, 2009). A table was given there that shows the power required by each of these appliances and their ratings. This was helpful in understanding how the power generation works with Power Consumption and how we could use that to formulate our basic ideas and net averages and estimations. The paper also goes on to describe the workings of the solar power system used and how that changed the cost and effectiveness of the overall system in the village. In addition, there was also a table that detailed the solar energy potential in the area and how it varied over the different months in the place. Figure 1.2: Demand Response
  • 20. Chapter 1. Introduction 5 After this, we also researched a number of major power plants that provided load shed- ding for their areas. This happened to be the case in areas where there was a shortage of power and hence could not be sustained over a long period of time. In addition to this, we also found that the efficiency of the power system played a large part in shaping this. Thus, we had the background information that we needed to start researching on solar panels and charge controllers and load management. Load management in our case is the whole basis for our project, hence is was important for us to research and calculate our desired and ideal values that would help us. We chose to have three loads for our project and these would be ideal for prototyping and working on a small scale project like ours. To the end of products that were state of the art and had been in research and development or any other actual live scale products, we reviewed some of the major companies that had done some work on this. We found that, as mentioned earlier, we do not have any major distributors on a small scale level; hence the importance of what we are doing is unprecedented and has never been done on a small scale level with a majority focused towards a smart system for load management and demand side resourcefulness. The company Quantec prepared a report for PacificCorp that was an Assessment of Long-Term System-Wide Potential for Demand-Side and Other Supplemental Resources. This report was very helpful for us to see the Energy focused resource potential and the capacity focused resources and how this shaped the way that the research and implementation of the system was done. It also stressed on the energy efficiency resources in various classes and gave a detailed statistical analysis of the technical, economic and achievable energy efficiency potential. There were many resource materials and educational basis for what was to be achieved through this report and how the system could be implemented on a large scale and be used for demand side and system wide potential. Another very helpful resource was seeing hobbyist reports on load shedding and various projects that are being built into making this kind of a system more popular and afford- able. There were many useful inventions that we found that helped us gain a proper understanding of how these systems are supposed to work and what precautions we could take to avoid unnecessary hassle and make our system as efficient and affordable as possible. The inconsistencies we saw in other small scale systems were that there were very few of them that successfully implemented a system using an FPGA or a microcontroller. The other factor was that this is an unprecedented venture and hence most of the technology we are coming up with is of first importance. One of PGE’s Energy Management Systems involves a device called smart AC. This was employed because the constant usage of Air conditioning devices in California would lead
  • 21. Chapter 1. Introduction 6 to an extreme crises situation when an emergency arises. With Smart AC, all the Air conditioning systems in the small business in the state will be automatically cycled to participate in a system that would enable the temperature of that particular business to not go above 4 deg celcius. According to IESO which is short for Independent Electricity System Operator of Canada, they have their own Demand Response solutions for Ontario. One of this solutions is the Dispatch Control Program. In this program, businesses and the loads in their use participate in the national grid market and they tweak their electricity de- mands as per the immediate directions of IESO. A pre-determined price is set and this would be the price above which the loads will not continue to consume electricity. If the general prices in the energy sector of Ontario goes above that value, then the par- ticipating loads are supposed to reduce their energy or electricity consumption by some amount. According to NRG Business’ Demand Response program, they have involved all parties in concern to their system. They will install a special meter that will track the electric- ity consumption in a particular company or business. Then NRG plans up a reduction plan and informs the business about it. Should the crises in the grid begin or if there is an expected reduction in electricity supply, the business will be alerted so as to imple- ment the demand reduction plan according to the particular event called at the NRG headquarters. Later on, the performance review takes place and the business involved is informed of how much kW was the business able to reduce in the peak hours. According to the scholarly paper, Demand Response experience in Europe: Programes, Policies and Implementation, in it’s section that focuses on Demand response programs in Italy, there exist certain interruptible programs that trigger automatic load-shedding in situations of crises. Once the load-shedding programs are triggered, it is possible to shut down the loads of participants. These programs are basically divided into two. One is the real time program which means that the participants’ load will be shut off without prior notice and the other program is the one that enables the participants to get a prior notice. The level of power this program caters to ranges from 1200 MW to around 18900 MW. A special Load Shedding Unit is installed at all participating business and residences. In the same paper, the policies of Spain are also given. Since a long time, the industrial businesses are able to choose the price policies of their liking. The electricity providing companies in Spain have to ask the companies to periodically reduce their demands during the peak electricity usage period.
  • 22. Chapter 1. Introduction 7 The electricity provider of Spain are to justify completely the reason as to why the demand reduction is being requested keeping in view the physical imbalance between the demand and supply. Given that all these are worthy and applicable solutions, there is an aspect of automation that one would always like to add. Following up exactly that, we were able to come up with some automation techniques that would employ the coding aspects and would involve the operation of SPDT Relays and Arduino microcontrollers. 1.4 The Contents of the report In this report the following things will be stated • Design Chapter: This chapter will talk about the problem description with the assistance of figures and it will also talk about the connections between the different components used in the project. This includes the description of all the involved components and the ways that were used to integrate them with their connected counterparts • Project Implementation: This chapter talks about the details and the steps that were taken to make this project close to a successful one. Discussed in this chapter will be the hardware implementation conceot that talks about the hardware aspect in detail and the things that were used and how they were used. With this the software aspect of the project will also be discussed that includes the webapp and the database and the server • Project management: this chapter talks about the members of the group and the tecniques that were employed to manage the project in an orderly fashion • Discussion: Thus chapter summarizes the project.
  • 23. Chapter 2 Design 2.1 Problem Description The objective we are trying to achieve in this design project is the formation of a simple load-management system which includes providing ease for the user and the provision of the ability to have a clear idea of the power consumption in a typical housing unit with the additional facility to turn off the loads or give a warning message to shut off the loads that are relatively less required as a reaction to a sudden voltage reduction or power cut following a system of pre-set priorities. That is, upon power cut or voltage reduction, the relays come into play and the load which is set to the least priority is first shut off and then the others are shut off when the voltage reduces more and more. A warning message also comes advising the user to turn off the said load so as to only make the loads with the high priority work. In this design project, we have used a variety of components for both the successful implementation of the supply side and the demand side. The supply side is the root of the whole load management system. This area requires some commonly used and some components that are not used often: • A 12V 7Ah battery • A 350W square-wave inverter • thick wires • PCB Board • Relays • Specified Assorted Resistors 8
  • 24. Chapter 2. Design 9 Figure 2.1: An Inverter Figure 2.2: PCB Boards
  • 25. Chapter 2. Design 10 Figure 2.3: An SPDT 20A relay from the pin side • 2N3904 Transistor • A diode • breadboard and breadboard wires • ACS712 20A Hall effect current sensor • A couple of Arduino Uno and Mega • Arduino WiFi Shield • Solar panels • Solar charge controllers The overall system has certain features that cater to both the supply and demand side. In the supply side the aim is to display the real time readings from the charged battery. These readings are basically the current supplied from the battery and the real time battery voltage. The technique by which we detect the current supplied is by using a
  • 26. Chapter 2. Design 11 Figure 2.4: An SPDT 20A relay from the upper side Figure 2.5: An NPN 2N3904 Transistor used in the PCB for the relay
  • 27. Chapter 2. Design 12 Figure 2.6: ACS712 small device called the ACS712 Current sensor and the battery voltage is detected using the concept of a voltage divider, application of basic mathematics on these readings gives us the power which will also be displayed. On the demand side, we have certain AC loads connected to an extension cord. These loads are also strategically connected to a relay that is mounted atop a PCB along with other components the details which will be mentioned in the later sections. When the real time battery voltage is below a specific pre-defined value, the function of these relays start they momentarily go in a NORMALLY OPEN phase where the circuit between the two ends of the load is disconnected and it becomes an open circuit and the load shuts off. 2.1.1 Fritzing Software Once we secured the components that we needed, we were able to negotiate and work with that from there in terms of how we would be limited and how we had to make adjustments based on the things we had and the outcome we desired. We started to
  • 28. Chapter 2. Design 13 develop designs and talk about the theoretical aspect of our project for a long time and we ordered the parts based on our research and brainstorming. To prototype, we started going through various designs and ideas and schematics for making the circuits. We found a software called Fritzing that was very helpful to us in getting a practical application to our ideas and also in using the Arduino for designing. Our first step was to design the Voltage Divider circuit that would be used for the Arduino to read our voltage levels from the battery. So to do this effectively, we had to find a way of getting the Arduino to read the voltages that were much higher than its capacity. To do that, we had to design a circuit that stepped down the values of the battery (which was between 0 12 Volts) and make it readable by Arduino (which reads between 0 5 Volts). We designed a circuit that would read these values relative to this measurement. We selected the values of the resistors to be made in such a way that the code will work as per the given voltage levels from the batteries will be read in terms of the Arduino capabilities. In Fritzing, just like any other simulation software, there is a panel from which different needed things can be dragged onto the large breadboard workspace. These breadboard drawings are also simultaneously made into PCB viewable drafts and schematic viewable drafts to have more insight. On Fritzing, for our initial record, we made the following: • Voltage divider circuit • current measurement using current sensor with one dummy DC load • current measurement using current sensor with multiple dummy DC loads Following are some images of the Voltage divider and current measurement schematics made on Fritzing. The Fritzing files are attached with the submission and these were made in the month of March. 2.1.2 Calculations 2.1.2.1 Calibrations for microcontroller We looked up a number of links on the internet to gain an insight of the different calibrations that were used for both the current sensors and the voltage divider. For the current sensors, the following things had to be taken in consideration:
  • 29. Chapter 2. Design 14 Figure 2.7: A simple Voltage divider circuit made on fritzing. A 9V battery is used becasue a 12V one was not in the fritzing panel Figure 2.8: The simple circuit for current measurement using the ACS712 low break- out with one dummy load. We used low breakout for this because the dummy load as small as an LED could work well with the low breakout modulel • It is a 5A version and the thick copper conductor inside allows for durability in case of overcurrent • it gives ampere values for every 66 to 185 mV per Amps Calibration: Analog read produces a value of 0-1023, equating to 0v to 5v So Analog read 1 = (5/1024) V =4.89mv Value = (4.89*Analog Read value)/1000 V But as per data sheets offset is 2.5V (When current zero you will get 2.5V from the sensor’s output) Actual value = (value-2.5) V Current in amp =actual value*10 ARDUINO CODE:
  • 30. Chapter 2. Design 15 Figure 2.9: The simple circuit for current measurement using the ACS712 low break- out with MULTIPLE dummy loads. We used low breakout for this because the dummy load as small as an LED could work well with the low breakout modulel Figure 2.10: Thecircuit for the voltage divider module and current measurement module togetherl // taking 150 samples from sensors with a interval of 2sec and then average the sam- ples data collected for(int i=0;i¡150;i++) sample2+=analogRead(A3); //read the cur- rent from sensor delay(2); sample2=sample2/150; val =(5.0*sample2)/1024.0; actualval =val-2.5; // offset voltage is 2.5v amps =actualval*10; For the voltage division, the calibration is as follows When the battery voltage is 6.5v I got 3.25v from the voltage divider and sample1 = 696 in serial monitor ,where sample1 is ADC value corresponds to 3.25v
  • 31. Chapter 2. Design 16 Calibration: 3.25v equivalent to 696 1 is equivalent to 3.25/696=4.669mv Vout = (4.669*sample1)/1000 volt Actual battery voltage = (2*Vout) volt ARDUINO CODE: // taking 150 samples from voltage divider with a interval of 2sec and then average the samples data collected for(int i=0;i¡150;i++) sample1=sample1+analogRead(A2); //read the voltage from the divider circuit delay (2); sample1=sample1/150; volt- age=4.669*2*sample1/1000; 2.1.2.2 calculations for the Voltage Divider circuit We performed some calculations as to the kind and what values of resistors we will be needing for the voltage divider circuit. Since we will be using a 12V battery for the fulfilment of the purpose. The general Voltage divider formula is given by: Voltage * [(Resistor 1) / (Resistor 1 + Resistor 2)]. For a 12V battery, the voltage should be divided in such a way that the output voltage should be equal to a range of values till 5 Volts. After a series of combinations, it turned out that the ideal values for the resistors will be 3.3 kOhms and 4.7 kOhms. If we applly this to the said formula and take resistor 1 to be 3.3k and resistor 2 to be 4.7k, we will have 12 * [(3.3 / 8)] = 4.95 V which is exactly within the arduino readable values.
  • 32. Chapter 2. Design 17 For the case when the battery is completely discharged when it is 9V, the output voltage from the voltage divider we will get is equal to 3.7125 V which is still within the arduino readable ranges. In one possible scenario, a WiFi Shield is used atop an arduino UNO. We have two analogueRead values that will get the sensor readings from the battery. One of them will be the reading of the real time current supplied from the battery to the inverter thus giving us the true value of the current being drawn by all the loads. The other sensed value will be of the real time battery voltage that will be read via the arduino with the use of the voltage divider circuit. Both these readings will go into the analogueRead of the arduino and these readings will automatically be stored in an MySQL database. The MySQL data gets saved in the database in the format of a table and gives us back as such. There is also a server that was made and this server integrates with the database. From the wifishield, a URL is set to display the analogueead generated ADC value on the browser. The ADC value is stored in the database. From the database, these values then get incorporated into the server. The server does the necessary calculations to give the final current and voltage reading. We then try to display these readings on our webapp. We wanted to today was to monitor the currents and through the current ultimately the power consumed by every AC load. We worked with an ACS712; a typical bulb, a battery and an inverter. However, there was some complication involved which had to do with the waveform of the ac. Unlike the DC which has a constant straight line voltage value. Also, the complication involved the rate of reading of analog values and the time it would take to take reading for a complete cycle. This is not constant, since
  • 33. Chapter 2. Design 18 with every line of code the clock speed changes; with every line the time of analog read varies as the chip has to go through an extra calculation which in turn takes up more time. In our investigation to measure the amount of steps to complete one cycle of 50 Hz AC, we carried out a study of the behavior of an atmega328p. A maximum sampling rate of an Atmega chip is 10,000 samples per second. Considering the above stated facts and assump-tions the plan of action is to acquire a series of readings of ADC values that correspond to the AC current(I rms) values. We attempt to nd a symmetrical pattern in the readings that hint to the zero-crossings of the waveform. We then use our intuition to sketch a rough graph of the AC current with the displayed ADC values and from here we will know the number of ADC steps to complete one AC cycle. Once we know that, we do a series of small calculations to convert this current into RMS current which will then be displayed on the serial monitor. The limitations of ADC is that it cannot multitask. Each ADC values are consisted of 10. 2.1.3 Connections between components 2.1.3.1 The battery and arduino: Voltage Divider We connected the battery with the arduino to cater to multiple scenarios. One connec- tion was the voltage divider circuit. The positive and negative terminal of the battery are connected to two resistors in series which are the 330kOhm and 470 kOhm and the V out is taken from the 330kOhm resistor as the voltage divider circuit is completed. From the Vout of the 330 kilo Ohm the wire goes from there to the arduino’s analogueRead pin in order to read the real time battery voltage.
  • 35. Chapter 2. Design 20 2.1.3.2 The battery, arduino and inverter: Current readings The battery’s connection to the inverter is not done directly except that an ACS712 20A current sensor is also hooked up between them so that the real time supply current can be sensed and read. From the positive terminal of the battery the connection is made to one of the load terminals of the ACS712 current sensor. And from the other load terminal of the ACS712 the connection is made to the positive terminal of the inverter. This is the step where actual series connection of the battery, the current sensor and the inverter is made as the only configuration that allows for a current to be registered in the sensor is series connection. The negative terminal of the battery is directly connected to the negative terminal of the inverter directly. 2.1.3.3 Inverter to the loads From the other side of the inverter that has the AC plug pins, we connect an extension cord so that other three connections rooms are made available for the three loads that are going to be connected to the system later. 2.1.3.4 Loads and the PCB With the Relay PCB, we have two terminals on either side of the PCB and these two terminals are to be connected to the load. The live and neutral are the wires of concern and one of each will be soldered to those terminals. This follows that the live and neutral will be connected to the holes of terminals that are on the PCB. This is as far as the load is concerned. On the microcontroller side, there will be a relay control pin that will be connected to the digital output pin of the arduino that states the digitalWrite Logic. There are other two holes that are for the ground and VCC. Wires are soldered underneath and connected to the required place.
  • 36. Chapter 3 Project Implementation 3.1 Integration of components with Arduino When we went in the thick of the project, we found that some of the core things that were to be implemented were a part of the course that we had studied in our electrical engineering degree while some of them were new concepts. The combination of both inspired us to follow the approach already taken. The Arduino is an open source physical computing device that results in processing and wiring language. It is based on a development environment and a simple microcontroller board. Interactive objects can be developed with the help of Arduino which can be connected to the software on the computers such as processing, flash etc. It helps in developing objects which can control motors, light bulbs and other physical loads. It can be inputted with sensors such as current sensors and voltage sensors and switches too. Arduino is better than other microcontrollers. It is cheaper and simpler that the other ones. It provides a variety of options or the inputs and the outputs. This can be run on different operating systems which mean it is not confined to windows only. It is very easy to use and is user friendly for the beginners and it provides good grounds for an advanced user too. The Arduino uno takes 5 volts which is given by the laptop itself. Firstly the Arduino helps us know the battery voltage at any instant of time. There is a voltage divider circuit for the battery whose output is the input to the Arduino. As shown in the circuits, the output voltage resulting from the voltage division between the two resistors is the analogueRead input to the Arduino. The voltage divider results in a voltage less than 5 volts so that the Arduino can handle. The Arduino and its ADC pin will convert this analogue value to a digital value and display it for us on the screen via the serial 21
  • 37. Chapter 3. Project Implementation 22 monitor. We wrote a number of codes to give us the proper real time battery voltage code so that the sensing is done without fail and some of them were working codes. Our battery which is 12 volts can?t be directly connected to the Arduino as it is harmful for the Arduino. To consider the durability of Arduino and the fact that we require real time battery voltage, we used so the voltage divider circuit is introduced. The Arduino will take the output of the voltage divider and sense the battery real time voltage. As this output value of the voltage divider circuit will decrease, the Arduino will sense it and let us know the battery voltage at any instant we want. 3.1.1 Voltage sensing with the Arduino Voltage divider is also known as the potential divider. We can also say that it is a resistor or a series of resistors where voltage is provided as fractions of the source to the loads or resistors. An arrangement of two or more resistors joined in arrangement between connected voltage, so that the voltage at points between the resistors is a fraction of the source voltage. Voltage dividers are common in for example amplifiers where each subcomponent needs special voltage levels for their particular power supplies. The basic circuit theory of it is that depending on the combination of the pair of resistors that are connected in series, a supply voltage is given. As we are aware that in a series circuit, the voltage is divided, this divides the supply voltage in two. There exist an output voltage that can be checked for via a normal multimeter at a point. The value of this output voltage is completely dependent on the combination and the ratio of both the resistors used. Usually when a small output voltage is required from a relatively big supply or input voltage the ratio of the resistors chosen is big and vice-versa. The voltage divider has a rule. Voltage across r1 here is the product of r1 and battery voltage divided by the sum of r1 and r2. [(r1*E) / (r1+r2)] Voltage divider is used where there is a need of less voltage for a specific component and where the energy efficiency isn?t seriously being considered. The common application which is seen is the poten- tiometers. For example the knob that is attached to the music systems such as an audio speaker for volume adjustments. The simplest design of this potentiometer has three pins. Two pins are connected to the resistor which is placed inside the potentiometer and the third pin is connected with a wipe contact which is wiped on the resistor when the knob is adjusted. The wiping of the wipe contact results in sliding on the resistor thus the voltage is increased or decreased resulting in the adjustment of the volume. In our project the voltage divider has served a great use. We need the voltage divider to give the users a display the supply side of the system. The user must have an idea of how much battery voltage is being supplied at a particular time and moment. The
  • 38. Chapter 3. Project Implementation 23 Figure 3.1: The voltage divider concept Figure 3.2: A Multisim simulation for the application’s voltage divider
  • 39. Chapter 3. Project Implementation 24 user must also keep track of the battery status in a way that is real-time. The battery voltage goes from 0-12 Volts and the operating voltage for an Arduino is set as 5V. We make it such that the range of the battery voltage is scaled down to the range of voltages accepted by the Arduino. The battery output is 12 volts and we wanted to reduce it to 5 volts. The voltage divider circuit in this design is made up of two resistors with relatively of higher values: 330kOhms and 470kOhms. The circuit is completed and from the 330kOhm resistor, we connect a wire from there to the Arduino’s analogueRead pin. and the gound of the Arduino is connected to the battery’s ground terminal fully completing the circuit and a code was written to simulate the sensing of this real time battery voltage using the voltage divider. The output of the voltage divider circuit that is 5 volts is given to the analogue input of the Arduino and it takes these readings and a calculation embedded in the code converts the Arduino readable range back to the real battery voltage. This is done by multiplying the ratio value of the resistor combinations with the scaled-down real time voltage. We need to read the battery voltage because our projects working principle is the voltage. Furthermore we need the battery voltage so that the power at any instant can be displayed for the user. Figure 3.3: Voltage divider with the UNO The picture above shows the voltage divider circuit and the output of that going to the Arduino. 3.1.2 Current sensing with the Arduino Now that we have a way of reading the real time battery voltage, we also should read the real time current that the battery supplies to the inverter. The current sensor that
  • 40. Chapter 3. Project Implementation 25 is in use is the ACS712 hall effect sensor of the 20A configuration. The reason we used this curent sensor instead of the old ones of the 5A break out configuration is that they did not have the filter capacitor already installed which made way for major instability in the readings. Also, the header pins on the Arduino side wee present in the sensors of the 20A configuration which made the hardware connections easier. The hall effect concept introduction is given in the introduction chapter and that is the concept that helped us read the real time current. The current sensor was to be connected to the battery, inverter and to the Arduino for reading purposes. The connections of the current sensor are as shown in the figure. Since we were reading the current supplied from the battery to the inverter, we connected the sensor in series with the battery and the inverter. The positive terminal of the battery is connected to one of the open load terminals of the current sensor, the other ope terminal of the curent sensor is connected to the positive side of the inverter and we complete the circuit by directly connecting the negative terminal of the inverter to the ground of the battery. In this way the main circuit is completed which left us with the integration with the Arduino which is basically three simple steps. We connect the designated pins to the anologeRead, VCC and ground. To read this current value there are some calculations that we have to follow. For this also, we wrote a series of codes so that we can get the true current values. For no current passing through the current sensor, we have an offset ADC value of 511. We recover the current value from the ADC values and for that we have to do a small series of calculations which in terms of steps is given below • Get ADC value and adjust for offset by subtracting 511 • display the offset-adjusted ADC value • multiply the ADC value by the number 0.049 in order to get the current. So the current supplied from the battery to the inverter is read, the ADC value is adjusted and then multiplied by a fixed constant that would give us the true current value. In this way we are able to read the real time current value. 3.1.3 Power supplied reading Thirdly ardunio helps us find the instantaneous power supplied. The microprocessor in the Arduino is coded to multiply the values of the current and the voltage to give us power and then display it for the user.
  • 41. Chapter 3. Project Implementation 26 Fourthly the Arduino helps us to display everything on a web application through wifi shield. It will display the battery voltage, the current supplied and the power on the web application we have designed. The Arduino WiFi Shield connects the Arduino uno to the internet wirelessly. Arduino wifi shield allows an Arduino board to connect to the internet using the wifi library and then it reads or writes another library such as from a SD memory card. 3.1.4 Relay operation to turn off low priority load via Arduino 3.1.4.1 SPDT Relays Relays are electromechanical devices which work when an electric current is passed through it. The circuit is switched on or off with the current flowing in another cir- cuit. Relays are simple, with high reliability and long life which acts as remote control switches. They are the brain of the circuit. They control the circuit by commanding a switch when to open or when to close. They rake a very small power to control very high power systems. Many common applications of relays are in automation, telephones and digital comput- ers. Relays are used in power systems to protect them against power cutoff and other problems which can occur. Relays work along with the circuit breakers for protection of the system. It helps control, regulation and distribution of power in a system too. Household applications of relays are in air conditioners, refrigerators, washing machines, cooking ranges and dish washers etc. For example a relay takes a little power to turn on or off the circuit of the air conditioner where as the air conditioner runs by taking about 6600 watts. Relays are not only used in electrical systems but in mechanical systems too. Relays used other than in electrical systems are of hydraulic and pneumatic types. Either the input is mechanical and the output is electrical or the input is electrical and output is mechanical. Relays have an electric coil and a sensing unit which is power by a low amount of alternating current or direct current. There is a preset value of the voltage or current, when the given current or voltage exceeds that value, the armature is activated by the coil thus closed contacts are opened or opened contacts are closed. There is a generation of magnet force when power is supplied to the coil resulting in the closing or opening of the switches. This magnetic force produced in the coil to power supply acts as a bridge between the two circuits that are called the control circuit and the load circuit. There are different types of relays:
  • 42. Chapter 3. Project Implementation 27 Figure 3.4: Relay concept • 1) Electromechanical relays: Electromechanical relays are electrically worked switches that depend on mechanical contacts as the switch system. These are also called armature transfers. They are made of coils and contacts. At the point when the coil given power, there is an induced magnetic field which moves the armature resulting in opening or closing of the contact. • 2) Reed relays: Reed relays are switches that control one or more reed switch by using electromagnets. These are similar to electromechanical relays that have physical contacts which work mechanically to open or close a switch that is turn on or turn off a circuit. Reed relays have smaller contacts and the contacts are of lower mass as compared to the contacts of electromechanical relays. Dry reed relays consist of coils curled over the reed switches. The reed switch is made out of two ferromagnetic razors sharp edges which are called reeds and are fixed inside a closed glass that is contains an nonreactive gas. The contacts of the reeds are on their ends. When power is applied to the coil, the tow reeds join together which closes the circuit. When the applied power to the coil is turned off, the contacts are pulled apart by the spring force. • 3) Solid state relays: Solid state relays are activated when a voltage of small amount is passed across the terminals of it. There are no mechanical parts so their life is higher than the electromechanical and reed relays, moreover, they are faster than the electromechanical relays. A control signal is initiated by a solid state electronic switching device that changes power to the load circuit resulting in a coupling mechanism. The solid state relays comprise of a sensor that reacts to an
  • 43. Chapter 3. Project Implementation 28 Figure 3.5: Relay concept input when given. This relay is built using a semiconductor and a MOSFET with an LED. state relay.jpg state relay.jpg Figure 3.6: Relay concept • 4) FET relays: These relays consist of a series of CMOS transistors. The load circuit that is the source and the drain is connected by control circuit where the voltage is applied. These are not mechanical devices. These are used for higher speed and low voltage devices such as in multiplexer configurations. (Insert picture *FET relays*) The relays can also be characterized according the need. The characteristics of the relays are: • 1) Definite time relays
  • 44. Chapter 3. Project Implementation 29 • 2) Inverse time relays with definite minimum time(IDMT) • 3) Instantaneous relays • 4) IDMT with instant • 5) Stepped characteristic • 6) Programmed switches • 7) Voltage restraint over current relay The three basic functions of relays are the logic operation, limit control and on or off control. (Insert picture 2) There are different configurations of relays such as single pole single throw (SPST), single pole double throw (SPDT), double pole single throw (DPST) and double pole double throw (DPDT). Single pole single throw is the simplest configuration which has only two contacts, whereas, single pole double throw is the one with three contacts. (Insert picture 3) The contacts are COM that is common, NO that is normally open and NC that is normally closed. The NC is connected to the COM when there is no power applied to the coil and so is the NO is open when there is no power applied to the coil. When there is power applied to the coil, the COMM is connected to the NO and the NC is left as it is without any connection to neither of the contacts that are COMM or NO. A relay coil is also an inductor apart from being an electromagnet. On power application there is a build up in the current on the coil and it levels off at its rated current thus energy gets stored in the magnet field of the coil. As the power applied to the coil is stopped, the current in the coil is stopped too resulting in the voltage across the coil to increase so that the current direction can be kept the same. We are using single pole double throw that is SPDT relay rated 20 amperes in our project. SPDT relays are sealed and massive. When the current is passed through its coil, it closes the NO contact and the NC contact is moved to the ground. These are used to switch high voltage or high current devices. In our project we are using it to control the loads in the demand side that is to switch off the loads at a particular voltage. The relay is given an input by the Ardunio so after that it takes the action of switching off the particular load. Relay works on the input 0 or 1. It normally is in on state when input 1 is given and off state when 0 is given. In our project we have made it the opposite by connecting
  • 45. Chapter 3. Project Implementation 30 the NO and NC contacts oppositely on the printed circuit board (PCB). For this relay to work it need to be connected to a diode, transistor and come resistors in a specific manner. The board diagram is shown below for the PCB. (Insert picture *SPDT*) 3.1.4.2 Integration of the Printed Circuit Board: Operation of relay in the design via Arduino The software used for the PCB creation in our project was Eagle. Eagle is a freeware that is very useful for creating comprehensive PCB designs. In Eagle, the control panel will let us open the project that we have to modify and forms the basis for different libraries. Once the schematic window is open, we can use a particular library and drag the components required onto the open work-space, make connections, and give values to the used components. The libraries can be downloaded and some of them are also available in the schematic by default. In our project, we have a Printed Circuit board exclusively for the relay used with the AC loads. The software used to modify the PCB was EagleCAD. Since the SPDT Relay that is used for management goes hand in hand and works only when other components are present considering the use of high voltage and the current associated with it. The components used on the circuit board are as follows: • SPDT 20A Relay with NO/NC Contacts • 1N1418 Diode • Resistors: 1kOhm and 10kOhms • Screw terminals of both two and three pin headers • Bipolar Junction Transistor 2N3904 • LED 3.1.4.3 1N1418 Diode The reason to add this diode is mostly for safety purposes. It is oddly placed right in the middle of the power line and ground line so that when the relay control pin is given logic zero and the relay is de energized, the diode will nullify this current change. However, the forward bias of the diode makes the current go in just one direction ensuring safety of the other smaller components and wires that are hooked to Arduino in PCB. Since the diode is made for restricting the current in a singular direction, any undesired current flow in the wrong direction will have adverse consequences.
  • 46. Chapter 3. Project Implementation 31 3.1.4.4 Resistors We have used a couple of resistors so that the grounding via the BJT when the relay pin is energized is safer once the relay pin is energized. The combination of resistors used is the common 1k and 10k duo in order to make the system more efficient. The resistors are connected to the base of the BJT so that when the relay control pin is given logic 1, the 5V will go through the resistors and then the BJT to initiate the relay operation. 3.1.4.5 Screw Terminals The screw terminals are used to solidify and simplify the connections on both the sides of the PCB. That is, the connections to the microcontroller’s 5V, ground pin and the relay control pin. The other side of the PCB is for the connections between the load terminals. 3.1.4.6 2N3904 BJ Transistor The SPDT relay on the PCB has a coil inside it. Also, inside a relay, there are two metal strips of which one is movable and one is not. These are normally separated in normally open situations but when the relay coil is energized, these two metal strips join together forming a contact that allows for bug current amounts to pass through. The concept that this relay coil follows is that of electromagnetism. 3.1.5 Printed Circuit Board application The logic to make the relay PCB work is straightforward and it follows that whenever the system detects any change or reduction in the real time battery voltage readings, a digital output from the central Arduino gives a logic HIGH to the relay control pin in the relay PCB that gets energized with operation from the coil to turn off the load that is not required. In this design, we acquired an open source relay schematic that was somewhat true given our project’s application. However, certain major changes had to be made in order for it to completely cater to our design’s need and requirement. The available schematic to control loads that require AC voltages was made in such a way that when the relay control pin is at rest and is not given a high logic, the tansistor and diode do not come into play and the load remains turned off and no interruption takes place which meant it was in NO state. As soon as the relay control pin is given a HIGH logic, the connection
  • 47. Chapter 3. Project Implementation 32 with the transistor is made and the relay contacts are closed and the load is turned on as the relay goes in the NC state. We wanted the exact opposite of this as the relay control pin should work in such a way that when the logic is HIGH, the relay contacts should be open and the loads should turn off. Considering this change, we made a change in the schematic and tweaked the relay component in a way it turned to a Normally Closed configuration. The change made in the schematic is shown in the figures too. A wire that was beneath the second bar of the relay is joined to the one that is above the second bar in order to make it in an NC configuration. 3.1.5.1 Problems faced in PCB creation Figure 3.7: The initial open source relay PCB schematic on eagle As it can be seen in the figure, the schematic shown is connected in a normally open configuration in the beginning itself which means that under very normal circumstances, the load is set to be turned off and only when the control pin is energized the load is turned off. This defeats the purpose of our concept. The load shall turn off only as the battery voltage reduction is sensed by the microcontroller from the voltage divider circuit. As it goes below a certain value, the relay control pin is given the logic in order for it to be energized. The above figure shows the the initial board version on eagle that shows how the PCB would look after printing. Since this was a preliminary board from the open source file, we had to tweak this from the schematic to make it in NC scheme. Also, another issue that arose in the making of this was that it could not be printed unless all the connections were in a single layer. For this we had to decide whether to change the relay
  • 48. Chapter 3. Project Implementation 33 Figure 3.8: The initial open source relay PCB board on eagle connections to the load from bottom layer to the top or to change the connections of secondary components on the PCB from top to the bottom. Since the connections of the relay and load terminals were already set to the bottom and easy to solder, it was imperitive to modify the connections of the secondary components that included the BJT, resistors, diode and the screw terminals at the microcontroller end. This picture above shows the first draft of the modified version of the Relay PCB in order for it to be NC. However, another issue that arised before printing it was that 3.1.5.2 Relay PCB with the 5A current sensor integrated A final improvement was made in the relay PCB with the integration of the 5A ACS712 embedded on the same board. Right beside the Relay section where the load terminals will beconnected, we have the current sensor section. In this section there are designated places for the load terminals for the current sensors. In addition to that, there are spaces to connect the capacitors for both the Vout and at the filter hole. These spaces are made so that the stability of the current readings is not compromised because of the unavailability of the capacitors on the break out.
  • 49. Chapter 3. Project Implementation 34 Figure 3.9: The modified relay PCB schematic on eagle Figure 3.10: The modified relay PCB board on eagle
  • 50. Chapter 3. Project Implementation 35 Figure 3.11: The modified relay PCB board on eagle Figure 3.12: The modified relay PCB board on eagle
  • 51. Chapter 3. Project Implementation 36 Figure 3.13: The modified relay PCB board on eagle Figure 3.14: The modified relay PCB board on eagle Figure 3.15: The modified relay PCB board on eagle
  • 52. Chapter 3. Project Implementation 37 Figure 3.16: The modified relay PCB board on eagle 3.1.6 The Battery The battery plays a very important role. For this design, we will be using a 12V battery which would be a small Deep-cycle battery. The battery in use will have to power the inverter for the AC loads to operate. The ratings of batteries are given in amphours. These amphour ratings tell us the amperage the battery provides for a certain number of hours. Usually, the amphour rating of a certain battery comes with the window of the time period it can go on for. For example, a 33 AH battery rated at 20 hrs will discharge over that period with a single load of 1.65 Amps. However, the relationship of rate of discharging of the battery with time is not linear because of the Peukert’s effect that says the faster a battery discharges, the more the capacity of the battery in amphours is reduced. According to Northern Arizona Wind and Sun, Deep cycle batteries are made to be discharged down to a level where just 20 percent battery remains each time it is majorly used and they also have much thicker plates. The increased surface area provided by the thicker plates will pevent the sudden surge of power that most batteries need. The benefit owing to the deep cycle battery’s property that it allows for a deep discharge and then recharge many times is that it can be used more often and regularly with a solar charge feature. Thus it guarantees that we can use the same battery to discharge via our loads a few times over.
  • 53. Chapter 3. Project Implementation 38 Any typical AC load draws a nominal amount of current that amounts to no more than 1 amps. Considering this fact, we have decided to use this type of battery as discharging could be done more often. Compared to a typical car battery, the deep cycle battery is advantageous as a car battery will give precedented and sometimes unprecedented high bursts and surges of power that will not be always needed for the loads. However, since typical AC loads are in use we want to make sure that the battery is always discharged at a nominal rate and can be utilized for a longer period of time. Previously, our plan included using the battery the 45 Ah battery but since the initial current surge from such a battery is of a huge amount, it would damage the resistors. Owing to an acute unavailability of the power resistors that have a rating of more than 1-15W, we dopped the prospect of using a 12V 45Ah battery. We initially decided to use 12 volts, 45 AMPH battery then we decided to use a smaller battery because of the fact that the 45 AMPH was a very big one for the prototype and we were afraid that it might burn some components. For now we are using 12 volts, 7 AMPH deep cycle rechargeable batteries. It is charged through the solar panels. 3.1.6.1 AGM and GEL There also exist AGM batteries that that have a glass mat within them which keeps the battery plates in touch with the liquid of electrolyte present in them. They are also needed when high initial bursts of current are actually required in the system in order to make it work. Hence they also have enough battery shelf life than some others. Figure 3.17: 12V AGM 33AH (at 20Hrs) battery The GEL batteries have relatively similar traits to the AGM but require more temper- ature while being operated. Also, the method of recharging must be proper so as to not destroy it soon. Electricity is generated when photons that are the particle of light hit the electrons free from atoms on the solar panel. Solar panels have small photovoltaic cells in them which convert the sunlight into electricity. After the battery is stored with energy given from
  • 54. Chapter 3. Project Implementation 39 the solar panels, it is then to be given to the loads. This cant be simply supplied to the loads because it is DC. For the loads it needs to be AC. The battery is connected to the inverted so that DC can be converted to AC and it can be supplied to the loads. We are using 350 watt inverter which changes 12 volts DC to 220 volts AC. The inverter gave us a square wave for the voltage rather than giving us a sine wave. Initially the current sensors we bought didnt have a filter capacitor which resulted in a non-uniform output. We even tried to put the filter capacitor but the results werent as we desired. For the PCB for the relay we had a lot of problems. Firstly we couldnt find the latest version of eagle which was a cause for the delay. Then we had to learn eagle from the start because we werent familiar to it that much. Finally after some help from our colleagues we had the schematic and the board but the printing was again delayed because of the fact that our eagle file wasnt converted to a printable format that is needed for the print. Our PCB was two layered so the engineer instructed us to edit it and make the board one layered, make it bottom layered. When the first time we printed the PCB it was small and there were dimension problems. 3.1.6.2 Battery connections In our project, we are following and tracking the current supplied. This is called the supply side current tracking. We will be using the ACS712 right in between the battery and the inverter. Fifthly the output of the Arduino is connected to three relays that are SPDT relays. The Arduino after a certain drop in the battery voltage will give the particular relay a 0 input. After receiving the 0 input the relay will turn on and it will disconnect the particular load connected to it, thus that load will not be a part of the circuit and it will turnoff. 3.1.6.3 Possible improvements with the Use of Voltage Regulators Since powering of the Arduino via a laptop would seem impractical at times however it would not be completely inaccurate, we still had other options in mind. One such option was the probable use of Voltage Regulators. A voltage regulator is intended to consequently keep up a consistent voltage level. A voltage controller is not a much complicated which has ”feed forward” configuration and negative feedback control loops. It may be operated by electromechanical method, or
  • 55. Chapter 3. Project Implementation 40 Figure 3.18: The connections with the ACS712 electronic parts. Voltage regulators provide steady and reliable voltage when needed. An input unstable or high voltage is given to the voltage regulator and it outputs a fixed, adjustable, stable voltage. Feedback techniques are responsible to control the output voltage level. There are simple and complex feedback techniques. Simple techniques include a zener diode. Complex feedbacks improve reliability, efficiency, performance and increasing output voltage more than the input voltage. Some common voltage regulators are: • The NPN Regulator: It has a NPN Darlington pass resistor which includes PNP driver requiring a voltage of at least 1.5 to 2.5 volts to be applied from the input to the output for the device regulation. (Insert picture NPN) • The LDO regulator: This requires a single PNP transistor as the pass transistor. With very low voltage drop the PNP pass transistor, the LDO can regulate the output voltage. (Insert picture LDO) • The Quasi-LDO regulator: This is really used in the applications where the conver- sion of about 5 to 3.3 volts is involved. It is a kind of mixture of NPN Darlington and true LDO. A PNP drives the pass resistor which is made up of a single NPN
  • 56. Chapter 3. Project Implementation 41 Figure 3.19: The hooking up of Arduino with the wifi shield transistor. The voltage drop in Quasi-LDO is less than the NPN Darlington reg- ulator but more than the true LDO. There are two types of voltage regulators that are linear and switching. A linear regulator utilizes a dynamic pass device that is a BJT or a MOSFET in series or shunt which is controlled by a high gain differential amplifier. It compares the output voltage to the reference voltage and it maintains constant voltage by adjusting a pass device. There is a known adjusted feedback signal that is set to maintain a fixed voltage with unknown and noisy input. Basically linear regulators use BJT or MOSFET which are power transistors as a variable resistor that acts like a voltage divider circuit. To maintain a constant output voltage, the output of the voltage divider is fed back to the power transistor. The problem here is that as the transistor acts as a resistor and we know the resistor wastes energy as it is a hindrance to the current. The transistor will produce a lot of heat and in a result huge amount of energy will be wasted. The power dissipated will be very high resulting in good heat sinks as the wasted energy that is through heat is converted by the power which is equal to the voltage difference between the output and the input voltage multiples by the current supplied.
  • 57. Chapter 3. Project Implementation 42 Figure 3.20: The 5V 4channel Arduino relays are also used. However, we used the typical SPDT relays Figure 3.21: A kind of regulator
  • 58. Chapter 3. Project Implementation 43 Higher output current is achieved by connected two linear regulators in parallel. In switching regulators the DC voltage is inputted to the power MOSFET or BJT switch. This voltage is converted to switched voltage. The output voltage remains constant independent of the input voltage or load current changes as the filtered power switch output fed back to circuit which handles the on and off times of the power switch. Switching regulators needs ways to change their output voltage in a result of input and output voltage changes. One methodology is to utilize PWM that controls the input to the related power switch, which controls its on and off time that is the duty cycle. While its operation, the duty cycle is controlled by the feeding back of the regu- lator’s filtered output voltage to the PWM controller. To keep the output voltage constant when the filtered output changes, the feedback applied to the PWM changes the duty cycle. However, switching voltage regulators works differently than the linear voltage regulators. A minimum voltage ripple is kept constant with the charge level by using feedback and the switching regulator will store energy at a particular fixed level which results in a constant output voltage rather than it acts as a voltage or current sink to keep the output voltage constant. The switch- ing regulator turns a transistor fully on with the least amount of resistance only when a boost of energy is needed by the energy storage circuit. This was it makes the switching regulator work way more efficiently than the linear regulator. Other small circuit losses and the total power which is wasted because of the tran- sistors resistance is reduces as when the switching occurs in switching regulators there is a transition from conduction which is very low resistance to non conduct- ing which is very high resistance. Smaller components can be used as less energy storing capacity is needed to keep a specific output voltage constant when the switching in the switching regulator is very fast. More is the speed of switching of the switching regulator, less is the energy storage capacity is needed for the con- stant output voltage. In faster switching of the witching regulators more power is lost due to the heating in the resistor that is resistive heating as much more time is passed in the transition between the conduction state which is very low resistance state and the non conduction state which is very high resistance state which results in the loss of efficiency. Moreover, the noise at the output is increased which is produced by faster switching of the switching regulators. These different switching techniques of switching regulators result in different types of switching regulator such as buck which lets the switching regulator step-down the voltage, boost which lets the switching regulator step-up the voltage and buck- boost which lets the switching regulator both step-up and step-down the voltage. Moreover the types of switching regulators also include full bridge, half bridge,
  • 59. Chapter 3. Project Implementation 44 push-pull, forward, CUK and SEPIC. These different and unique techniques give the switching regulators an upper hand on the linear regulators and it makes the switching regulators the best choice for the battery powered applications as thee switching regulator can step up or boost the voltage at the input from the battery when the battery is discharging. This gives an edge for the circuit to continue to work at desired conditions as the circuit is directly supplied with the right voltage it needs from the battery. Figure 3.22: converters We are using a switching regulator in our project. As explained above that the switching regulators include buck, boost and buck-boost converters. We in our project, to be specific, attempted to use a buck converter which is also known as step-down converter as it steps down the voltage. The Buck Converter is utilized as a part of SMPS circuits where the DC output voltage should be lower than the DC input voltage. The DC input can be gotten from redressed AC or from any DC supply. It is valuable where electrical separa- tion is not required between the switching circuit and the output, however where the input is from an amended AC source, seclusion between the AC source and the rectifier could be given by a mains disconnecting transformer. The exchang- ing transistor between the input and output of the Buck Converter persistently switches on and off at high frequency. To keep up a ceaseless output, the circuit
  • 60. Chapter 3. Project Implementation 45 utilizes the vitality put away as a part of the inductor, amid the on times of the switching transistor, to keep supplying the load amid the off periods. The circuit operation relies on upon what is in some cases additionally called a Flywheel Cir- cuit. This is on account of the circuit demonstrations rather like a mechanical flywheel that, given routinely divided pulses of energy continues turning easily (outputting energy) at a consistent rate. Figure 3.23: Buck converter The buck Converter circuit comprises of the switching transistor, together with the flywheel circuit While the transistor is on, current is coursing through the load by means of the inductor. The activity of any inductor contradicts changes in current stream furthermore goes about as a store of energy. For this situation the exchanging transistor output is kept from expanding quickly to its top esteem as the inductor stores energy taken from the expanding output; this put away energy is later discharged once more into the circuit as a back e.m.f. as present from the switching transistor is quickly closed off. Boost converter is also known as step-up voltage converter. Switched mode supplies can be used for many purposes including DC to DC con- verters. Often, although a DC supply, such as a battery may be available, its available voltage is not suitable for the system being supplied. For example, the motors used in driving electric automobiles require much higher voltages, in the re- gion of 500V, than could be supplied by a battery alone. Even if banks of batteries
  • 61. Chapter 3. Project Implementation 46 Figure 3.24: Boost converter were used, the extra weight and space taken up would be too great to be practical. The answer to this problem is to use fewer batteries and to boost the available DC voltage to the required level by using a boost converter. Another problem with batteries, large or small, is that their output voltage varies as the available charge is used up, and at some point the battery voltage becomes too low to power the circuit being supplied. However, if this low output level can be boosted back up to a useful level again, by using a boost converter, the life of the battery can be extended. Sources such as batteries, such as rectified AC from the mains supply, or DC from solar panels, fuel cells, dynamos and DC generators provide the DC input to the boost converter. Due to the simplicity with which boost converters can supply extensive over voltages, they will quite often incorporate some regula- tion to control the yield voltage, and there are numerous I.Cs fabricated for this reason. Other safety elements given by the I.C. are over current shutdown, which impairs the switch on a cycle-by-cycle premise if an excessive amount of current is detected, and an over temperature close down facility. A buck converter is just stepping down dc voltage in a very power efficient way without using too much energy/heat to accomplish this. A boost dc converter will do the opposite, step up the dc voltage such as voltage multipliers in computer and monitors are a good example of this. It is the same with a buck/boost transformer as well. The boost transformer will step-up the ac voltage for a small application in a circuit and the buck transformer will step down the ac voltage. One exception to a buck/boost application of controlling ac voltage is also the control of pulsed dc voltage as well.
  • 62. Chapter 3. Project Implementation 47 3.1.7 Implementation in terms of software 3.1.7.1 The Voltage Divider Code To implement the voltage divider code, we wrote a series of codes on the Ar- duino platform. The approach taken was having the variable names matching the concept. float scale = 41.25; //const float scale = 300/800;//(330 / (330 + 470)); const int relayPin = 9; void voltRead(){ delay(4000); float voltageADC = 0.0; float averageVoltageADC = 0.0; float voltage = 0.0; float voltTotalADC = 0.0; While declaring the variables we have the Scale variable which is the mathematical scale to recover the original voltage value that was there before the voltage division effect took place, other variables include VoltageADC that would give the voltage- divided ADC value coming directly from the analogueRead. In our code, we also have the average voltage ADC variable. The reason we are using this is that the voltage readings as read from the analogueRead from the voltage divider circuit is very unstable. Therefore we have a for loop that adds the voltage vaules for fifteen times. Once the readings are taken for fifteen times, we add them and divide by the same number so as to average the voltage readings out. Once we have the average readings taken we multiply this with our scale so as to recover the original battery voltage as it was prior to the division of voltage from the circuit. This reading is displayed on the serial monitor as an initial test and later on we attempt to display the real time battery voltage on the web-app that was made. Also, we have a digitalWrite for the relay control pin. Since we have the relay control pin as a digital output, we link this digitalWrite to our battery voltage with a condition. In order to make the logic work and to see the practical load-shedding, we condition the relay control pin to the battery voltage. As the battery voltage falls below a certain value, the relay control pin is given the high logic.
  • 63. Chapter 3. Project Implementation 48 3.1.8 Current Sensor Code The current sensors that were used in the project were of two kinds. The ACS712 20A current sensor that has the filter capacitor already and the ACS712 5A which has the small break-out board and is void of filter capacitors. The coding for the current sensors was done step-wise. For the 20A ACS712, which reads the battery current that is being provided from the battery to the inverter, after making the necessary connections which are stated in the design chapter, we code the sensor in Arduino. It is known to us that the offset ADC value when no current is being registered in the current sensor is 512, so we display the readings of these ADC values in the serial monitor to make sure the sensor was operational by using the Serial.print command. We then adjust the offset so that the original current values can be seen. To do that, in our code we subtract the registered ADC value from the offset so we get the actual ADC value. After this we perform certain calculations to change the ADC values from their basic form to an acceptable current value. The figure to be multiplied to the ADC value after certain calculations was found to be 0.049. In the code, this number is multiplied to the ADC value and that gives us the true current value. 3.1.9 Investigation of Load Side Monitoring Methodology We wanted to today was to monitor the currents and through the current ulti- mately the power consumed by every AC load. We worked with an ACS712; a typical bulb, a battery and an inverter. However, there was some complication involved which had to do with the waveform of the ac. Unlike the DC which has a constant straight line voltage value. Also, the complication involved the rate of reading of analog values and the time it would take to take reading for a complete cycle. This is not constant, since with every line of code the clock speed changes; with every line the time of analog read varies as the chip has to go through an extra calculation which in turn takes up more time. In our investigation to measure the amount of steps to complete one cycle of 50 Hz AC, we carried out a study of the behavior of an atmega328p. A maximum sampling rate of an Atmega chip is 10,000 samples per second.[? ] Considering the above stated facts and assumptions the plan of action is to acquire a series of readings of ADC values that correspond to the AC current (I rms) values. We attempt to find a symmetrical pattern in the readings that hint to the zero-crossings of the waveform. We then use our intuition to sketch a rough
  • 64. Chapter 3. Project Implementation 49 graph of the AC current with the displayed ADC values and from here we will know the number of ADC steps to complete one AC cycle. Once we know that, we do a series of small calculations to convert this current into RMS current which will then be displayed on the serial monitor. The limitations of ADC is that it cannot multitask. Each ADC values are consisted of 10
  • 65. Chapter 3. Project Implementation 50 3.2 Web App 3.3 HTTP Server To create the server we import the http module which comes packed with all the functions that makes our app live. server.listen(port[, hostname][, backlog][, callback]) This function accepts connections on the specified port and host. In our case we did not specify the host and hence the server will accept connections directed to any IPv4 address. We also assigned the port This function is asynchronous. When the server has been bound, ’listening’ event will be emitted. The last parameter callback will be added as an listener for the ’listening’ event. One issue some users run into is getting EADDRINUSE errors. This means that another server is already running on the requested port. One way of handling this would be to wait a second and then try again. This can be done with ... var http = require(’http’).Server(app), ... http.listen(3000, function() { console.log(’Server listening on port: 3000’); }); The app will be uses the node framework http for web server capabilities. This is the core library we need to import if we wish to make our app live, respond to all the core requests that includes: – GET – HEAD – POST – PUT