Smart Home Energy Management System Monitoring and Control of Appliances Using An Arduino Based Network in The Context of A Micro Grid
Smart Home Energy Management System Monitoring and Control of Appliances Using An Arduino Based Network in The Context of A Micro Grid
3|Page
The role of Batteries ..................................................................................................................... 25
The Capacity of the battery .......................................................................................................... 25
c- The controller ........................................................................................................................... 26
The role of the controller ............................................................................................................. 26
The structure of the controller ..................................................................................................... 27
The characteristics of the controller ............................................................................................ 27
d- The inverter .............................................................................................................................. 27
The role of the inverter ................................................................................................................ 27
2.5 Sizing an off-grid solar power system ............................................................................................ 28
3. Case Study: Sizing Pv Panels for a house located in Ifrane. ............................................................. 29
4. RENEWABLE ENERGY IN THE MOROCCAN CONTEXT ....................................................................... 35
4.1 Creation of favorable conditions, incentives, support measures .................................................. 36
4.2 Energy reserves and regulation ...................................................................................................... 37
4.3 Impact on the national electricity grid ........................................................................................... 37
5-GENERAL DESCRIPTION OF THE SMART HOME ENERGY MANAGEMENT SYSTEM ............................... 38
5-1 SMART PLUG............................................................................................................................. 38
5-1-1 Smart plug definition: ............................................................................................................. 38
5-1-2 Smart plug components .......................................................................................................... 38
5.2 Gateway .......................................................................................................................................... 42
5.2.1 Gateway description: .............................................................................................................. 42
5.2.2Gateway components description: .......................................................................................... 42
6- Implementation of a Smart plug in a Home Energy Management System ......................................... 44
6.1 ARDUINO DIRECT SENSORS READING ............................................................................................ 44
6.2 XBEE SENSOR READING PAIR TOPOLOGY ............................................................................. 46
6.3 XBEE SENSOR READING STAR TOPOLOGY ........................................................................... 47
6.4 WIRELESS SENSING AND CONTROL NETWORK .............................................................................. 49
6.5 SYSTEM INTEGRATION WITH APPLICATION ................................................................................... 55
7- COST STUDY.......................................................................................................................................... 57
8- Conclusion ............................................................................................................................................ 59
9-Future Work .......................................................................................................................................... 60
12. References .......................................................................................................................................... 61
11. Appendices ......................................................................................................................................... 63
4|Page
List of Tables
Table1: Comparison between the characteristics of the current .............................................................. 8
Table2. Total electricity consumption in a home with specific appliances .............................................. 29
Table 3. Power needed to cover total consumption ................................................................................ 31
Table 4. Smart plug price approximation ................................................................................................. 57
Table5. Gateway Price estimation ............................................................................................................ 58
List of figures
Figure1: A solar cell using amorphous silicon [12] ................................................................................... 14
Figure2:A solar cell using thin film technology[13] .................................................................................. 15
Figure 3. Example of an Energy Management System in a smart grid [17] ............................................. 17
Figure 4. Schematic representation of an off-grid solar system [22] ....................................................... 22
Figure5. Schematic Represenation of a PV installation with a feed-in tarrif system.[22] ....................... 23
Figure6. Schematic Represenation of a PV installation with net-metering system. [22] ........................ 23
Figure7 .Schematic Representation (a) and (b) of an installation connected to the grid with a net-metering
system[22]. ............................................................................................................................................... 24
Figure8 . Schematic representation of the PV system needed for this case study .................................. 33
Figure 9. Arduino Uno [17] ....................................................................................................................... 38
Figure 10. Xbee Radio Series 2 [18] .......................................................................................................... 39
Figure 11 . Light Sensor [19] ..................................................................................................................... 40
Figure 12. Temperature sensor [24] ......................................................................................................... 40
Figure 13. Temperature sensor[25].......................................................................................................... 41
Figure 14. Gateway prototype ................................................................................................................. 42
Figure 15 . Xbee Shield[23] ....................................................................................................................... 43
Figure 16. Ethernet Shield [27] ................................................................................................................ 43
Figure 17. Architectural Design-Sensor Reading ...................................................................................... 45
Figure 18. Uploaded code in the Arduino ................................................................................................ 46
Figure19. Architectural Design-Data communication .............................................................................. 46
Figure 20. Architectural design of two smart plugs sensor reading......................................................... 48
Figure 21. Smart plug Arduino code ......................................................................................................... 51
Figure 22 .Serial Arduino display .............................................................................................................. 52
Figure 23. Gateway Arduino code ............................................................................................................ 54
Figure24. Serial Arduino display in the gateway ...................................................................................... 55
Figure25. Appliaction interface ................................................................................................................ 56
5|Page
Abstract
The United States, European Union, China and Russia, which are among the regions of
the wider world and the most populated, consume over 61% of global electricity. Between 2001
and 2012, consumption of some developing countries has increased significantly: it has been
multiplied by 3.3 for China, India by 2.2 and 1.6 for Brazil [1].The energy used is most of the
times produced from nonrenewable sources that may be causing the global warming that the
planet is presently experiencing. People are not aware of threats of energy wastage and are
increasingly looking for more comfort by having many devices in their home that are turned on
the whole day , and sometimes leaving their houses and leaving a bulb on , heaters , or TVs
,etc . In this work, we suggest the design and implementation of a home energy management
system to enable households to have continuous data on their energy consumption to save
energy. The solution already exists in the market, but the purpose of project is to design and
implement a home energy management system that provides users with detailed information
about their energy consumptions and permit sensing, control, and smart algorithms with the use
of renewable energy as a source of electricity at the residential level within the Moroccan
context in a micro-grid. Renewable energy is increasingly at the heart of conversations and
many economic and political debates in Morocco. With the rising number of photovoltaic
installations worldwide, arise to a greater extent the question of the attitude of this technology
for integration into the network of distribution and transmission. The potential studies
developed so far in the field of solar energy in Morocco determine, on the basis of the surface,
the theoretical and technical national potential, which is huge because of the intensity of solar
radiation and availability large spaces. This project emphasizes the importance of the use of
renewables in a micro-grid and also on implementing two Smart Plugs using an Arduino-based
network.
6|Page
1. Introduction
1.1 Context
The development in the renewable energy field and the increasing number of new
uses of electricity generated a need to modernize the electrical system. Some existing uses have
grown considerably like heaters, air conditioners and other uses like hybrid electrical vehicles
and heat pumps are developing and increasing the power consumption .These changes are
forcing the control of power systems because of electricity consumption variations: electricity
is more consumed in winter than in summer which makes it subject to daily peaks and hollows.
And also due to the fact that power generation means are increasingly varying because of
alternating renewable sources. The last reason is the development of distributed generation
leads to a significant increase in the production sites and also to inject energy on distribution
networks designed to deliver it, not to collect it.
Making the electrical network smart is therefore largely instrumenting them to make
them able to communicate. Currently the transportation network is already instrumented
particularly for reasons related to security of supply. However, distribution networks are poorly
endowed with communication technologies, due to the large number of works (stations, lines,
etc.) and consumers connected to these networks. The challenge of smart grids thus lies mainly
in the distribution networks. The following table (table 1) represents the advantages of the
smart grid comparing to the existing electricity grids. Unlike the current grid, the smart grid has
better communication that is on both ways, the power system management according to the
consumption and there is not only a consumer but the consumer that is in the same time an
actor.
7|Page
Table1: Comparison between the characteristics of the current
electricity grid and the smart grid [2]
Many projects have been done previously by Capstone Students and laid the ground for this
project. The first one was done by two Capstone students Abdelkarim Adyel and Soukaina
Mouatadid on Load Profiling in the Moroccan Residential Sector. They tackled the different
load profiling types and methods, smart houses, and methodologies of energy audit. Another
point of their project was the approximation of Moroccan consumption profiles which was
achieved by using surveys. Then, with the collected data from surveys, simulations were
conducted and energy efficiency recommendations were formulated. Another interesting
project on the implementation of a Home Energy Management Android Application by
capstone students Imane Lhadi and Sarah Lahtani. The purpose of this application was the
monitoring and management of household appliances and renewable sources of energy in terms
of consumption and generation. This Home Energy Management Android Application was
updated by research student Mohammed Bakr Sikal as new features were added to meet the
SHEMS requirements. In parallel to this work, Zineb Chelh another capstone student
performed research about Challenges of implementing the Smart Grid in developing
8|Page
countries with an emphasis on the challenges facing the transition towards a smart grid in
Morocco.
The last projects were done by two other capstone students Soukaina Brangui and Ismail El
Hamzaoui. The purpose of this project was the implementation of an Arduino based Smart
Home Energy Management System.
The expected Results of this project is to design an efficient Smart Home Energy Management
system that make use of Renewable Energy sources. This project analyses the possibility of
implementing a SHEMS in a micro-grid context that makes use of Renewable Energy in
Morocco in the residential sector.
Given the growing energy demand and declining fossil energy supply, the design of SHEMS
will help increase the use of renewable energies and decrease households dependency on the
grid by providing automatic energy saving measures and better manage the use of Renewable
Energy sources within the household. The overall project will have as intent, to design a
SHEMS. The system will be able to control and monitor the different appliances in a house.
The problem tackled in this report is the monitoring and control of the different appliances in
a house. There will be also an analysis of the possibility of the use of renewable energy in
Morocco in a Micro-Grid through a case study.
The steeple analysis is method or tool used to help taking decision by taking into consideration
seven macro-environmental factors which initials form the name of the method used: Societal,
Technology, Environment, Ethics, Political, Legal, and Economic. The macro-environment
includes the factors that influence the position of the company in its market by changing its
offer and demand, but in an exogenous manner. These are factors over which we dont have
any effect and we cannot handle, but must anticipate because they are sources of opportunities
and in the same time threats. This method is going to be used to analyze the macro-
environmental factors of this research paper:
9|Page
World's population is increasing which gave birth to changes in social
S ocietal behavior.People are looking for more comfort using new devices
extencively which creates an increase in energy demand
Privacy is a very important concern for the implementation of the SHEMS. The data
E thics collected must be secure.
Some countries that do not produce oil will be more independent from other producing
P olitical coutries
there are many laws about renewable energies . In the moroccan context , there is a law
N16-09 for the implementation of the policy of energy efficiency and renewable
L egal energy.And due to the law 13-09 that is related to renewable energies a new law is
discussed about low voltage integration.
E conomic The implementation of the SHEMS has many effects on the economy because of lowering
the cost of energy .
10 | P a g e
1. Literature Review
Between 2010 and 2030, the economic growth should lead to a global energy demand
twice as large as the one we know today. At the same time, global carbon dioxide emissions are
expected to increase at a rate even greater than the energy demand. The largest source of CO2
is the generation of electrical energy which makes important climate change .To solve this
problem many modifications should be made regarding the existing electrical system.
Electricity is the most adaptable and extensively used form of energy with a continuous
growing global demand. Generation of electrical energy is currently the largest single source of
carbon dioxide emissions, making a significant contribution to climate change. To diminish the
implications of climate change, the current electrical system needs to undergo significant
adjustments.
The electrical power system distributes electrical energy to industry, commercial and
residential users, to meet the ever-growing demand. Most of today's generation capacity relies
on fossil fuels and contributes significantly to the increase of carbon dioxide in the world's
atmosphere, with negative consequences for the climate and society in general[3].
Renewable energy sources, such as solar power, wind power and fuel cell etc., should
be used to meet the increasing energy. There are many challenges caused by integrating
renewable energy sources into grid that can be solved by redesigning the conventional power
system infrastructure and architecture. The conventional power system should be more reliable,
environmental friendly and intelligent comparing to the existing systems. [4]
To satisfy both the increasing demand for power and the need to reduce carbon dioxide
emissions, we need an electric system that can handle these challenges in a sustainable, reliable
and economic way. To realize these capabilities, a new concept has emerged; the smart grid [5].
11 | P a g e
Capacity : achieving the increasing global demand of electricity
Efficiency: making power generation more efficient and reduce losses from
distribution, transmission and consumption.
United States Department of Energy has defined the functions required for smart grids
in [7]: the ability to heal itself; to motivate consumers to actively participate in operations of
the grid, to resist attack, to provide higher power quality, to accommodate all generation and
storage options, to enable electricity markets to flourish, to manage more efficiently the assets
and costs. In other terms, the smart grid can be defined as the next generation, distribution and
consumption. [8]
The Smart Grid concept is still a new and young idea, the term was first introduced in
the late 1990s and the first practical large-scale example established in the early 2000s[9]. Most
electric power systems rely on older ideas and old infrastructure, therefore the grid is not well
prepared for challenges of the 21st century.
Italy was accredited the implementation of the first Smart Grid by the countrys largest
energy company called Enel S.p.A., starting in 2000. From that time until now, the company
has installed more than 30 million smart meters across the country [9].
12 | P a g e
The US began setting up its Smart Grid in 2003. It has now a total number of 200,000
devices online and another 300,000 that is expected to join the network. Austin was followed
by Boulder, Colorado[9]. Boulder represents the home of the first wholly working Smart Grid-
enabled city in the US, it has a network containing more than 23,000 smart meters.
Since then, many other countries and parts of the US were affected and have taken early
steps toward the implementation of the Smart Grid and moving from one-way systems to fully
bi-directional systems[9] .
13 | P a g e
Solar panels based on crystalline silicon are the oldest. They are split themselves in two
variants: monocrystalline and polycrystalline. Monocrystalline silicon produced by cutting
wafers from a high-purity single crystal block and polycrystalline silicon made by sawing a cast
block of silicon first into bars and then into wafers .These two variants are now very close both
in terms of efficiency in terms of cost. The efficiency of a photovoltaic panel is the amount of
solar energy converted into electricity by the panel consumable, compared to the captured
energy. The average yield of a crystalline panel market is 14.5%.
As shown in Figure 1 , they are using a triple layer system that is optimized to capture light
from the full solar spectrum, and it has a thickness of just 1 micron, or about 1/300th the size of
mono-crystalline silicon solar cell.[12]
The main characteristic of thin film photovoltaic modules is that: they produce power at
low cost per watt. They are ideal for large scale solar farms, as well as Building Integrated
Photovoltaic applications (BIPV). They benefit from generating consistent power, not only at
elevated temperatures, but also on cloudy, overcast days and at low sun angles.[13]
14 | P a g e
Figure2:A solar cell using thin film technology[13]
As shown in Figure 2 and stated in [13] , thin film photovoltaics consist of a stack of
extremely thin photosensitive layers sandwiched between a top Transparent Conductive Oxide
(TCO) coating and a back contact. The photovoltaic layers are laminated between a TCO
glasses.
1.2.2Components of Photovoltaics
The main components of a photovoltaic system:
15 | P a g e
current) into power that can be used by the plugs in your house for your
TV, computer, and other wired products (AC, or alternating current).
Panels cant create AC power by themselves; they need the helping hand
of a solar inverter [14]
HEM system is an important part of the smart grid and has many benefits such as:
Energy prediction for appliances in homes has a great influence in the functioning of a
home energy management system. This system is able to determine the best energy assignment
plan and a good compromise between energy production and energy consumption. [16]
The Home Energy Management System is mainly composed of Smart plugs, Gateway,
Web server, Database and a user devise.
16 | P a g e
1.3.2 Home Energy Management Requirements
Figure3 explains the key parts of the Home Energy Management System and the main
requirements for a HEMS that will help the monitoring and control of energy. The
requirements as stated in [18] are:
Monitoring: provide a frequent energy consumption information by the system to the
consumer.
Disaggregation: the system has to provide disaggregated data about each appliance.
From the information given by the system, the impact of specific appliances and the
impact of long term changes can be clearly highlighted.
Availability and accessibility: Information should be provided at all times with an easy
to use interface.
Information integration: in addition to providing disaggregated data. The system
should provide other kinds of information that are related to different appliances like:
temperature , humidity
Affordability: The system should be easy to install and have minimal consumption.
17 | P a g e
Control: The consumer should be able to control manually its devices.
Cyber-Security and privacy: The system must ensure that consumers data are secure
and private.
Intelligence and Analytics: the system have to be able to take some intelligent
decisions taking into consideration the data available.
Cost: The cost of HEMS is expensive in terms of device prices and the installation
costs. People are not ready to invest in systems whose profits hardly meet their
investment. [20].
No standards for HEMS: There is no specific way for the design and implementation
of the system since each seller offer its own system with a unique design and control
strategies.
Low consumer awareness: Consumers are unaware about the functionality of the
Home Energy Management System .Sometimes costumers are confused between
several HEMS solutions proposed in the market [21].
HEMS aggregation: It is still unclear to integrate the HEMS in the bigger picture of
the smart grid. Research shows that energy management for individual households are
not efficient. Aggregation presents better optimization and utilization of resources.
Choice of Information and Communication Technology (ICT): ICT is an enabling
technology to the successful implementation of HEMS. Some residential customers are
worried about the health effects of the penetration of wireless signals that are part of
their HEMS.
Designing system intelligence: It is difficult to design a system that meets different
levels of consumers knowledge about HEMS.
18 | P a g e
2. GENERAL OVERVIEW OF PHOTOVOLTAICS
Solar photovoltaic cells directly convert solar energy into electrical energy. Over 90% of the
photovoltaic modules are based on crystalline silicon. The remainder, just 10%, consists of
thin-film modules and other new technologies.
The photovoltaic market has grown by an average of 50% over the last decade. This
development has been systematically underestimated for a long time. According to an article in
the publication PHOTON over 40 scientific studies, 38 have underestimated the production
capacity as well as the dynamics of the market for PV, or underestimated the forecast.
Photovoltaics is one of the technologies on which a legislative framework based on a
promotional policy has a strong influence. With a rapidly growing market, photovoltaic
technologies have rapidly diversified. The peculiarity of the photovoltaics is in parallel to the
physical mechanism of transforming sun light to direct current its prodigious modularity: it
can be used by all the orders of magnitude, from Milliwatt in form of cell to hundreds of MW
installations.
In 2010, the volume of the photovoltaic installation worldwide increased, according to the
market research company: IMS Research, to 17.5 GW with an increase of 130% compared to
the previous year. In 2011, a capacity of 20.5 GW installation was planned, which create an
increase in the total installed capacity worldwide to 58 GW until the end of 2011.
Silicon is since decades the essential component of solar cells. Currently produced solar cells
have as base materials the mono- (50%) and poly-crystalline (50%). Purity requirements for
silicon are very high. In 1 billion atoms of silicon atoms, there are only one impurity atom.
Its manufacture is similar to that of electronic chips. The mono-crystalline silicon cells are
made according to the Czochralski method, with extraction of a massif "slug" from a bath of
molten silicon, then cut into thin plates (wafers). The Poly-crystalline silicon is melted and
slowly cooled. This process allows the formation of the typical structure of crystals; this
simplified process reduces manufacturing costs. The disadvantage of poly-crystalline silicon is
the presentation of more contaminations and defects such as grain boundaries and mutations,
affecting the rate of efficiency. To keep the yield energy efficiency high, getters and specific
passivation processes must be carried out.
19 | P a g e
The silicon cells had in 1990 a thickness of 400 microns, while today they generally have a
thickness of 200 microns. The Fraunhofer Institute developed a solar cell with a thickness of 40
microns only an efficiency of 20%. The energy efficiency ratio rose from 10% at baseline to 14
to 16% on average for the poly-crystalline cells and 17-20% for monocrystalline cells.
The silicon demand has increased dramatically. For a long time, solar cells were produced from
residues from the production of microchips. Starting with annual production quantities from 1
to 5 MWp in the 1990s, the quantities produced augmented to several hundred of MWp. After a
phase of scarcity in the years that followed 2003, silicon production capacity was increased
globally and in the same time technological innovations have also been developed: in parallel
to the development of a silicon with a specific "solar grade" (which has a lower degree of
purity), the development of thinner cells was encouraged and thin-film technologies have been
booming.
The category of thin film technology includes different types of materials. They have the
advantage of being 100 times finer than the standard silicon cell. Technologies in most known
thin film is based on amorphous silicon, copper - indium di-selenide (CIS) and cadmium
telluride (SCTD).
Amorphous silicon (a-Si) is composed of unordered silicon atoms that are sprayed on a
substrate. Its high absorption capacity allows to obtain particularly thin layer thicknesses of 3
microns to 20 microns. Moreover, it has the drawback of having a commercial efficiency rate
of 6 to 8% only. To increase this rate, several layers are combined, using silicon-germanium
alloys (a-SiGe) or micro morphs layer (c-Si).
The basic unit of a photovoltaic system is the solar module which are electrically connected to
a plurality of solar cells, also connected together. Several modules are connected to a solar
generator.
If the off grid home has no other power source, the design of both the PV and the battery have
to be meaningfully oversized to account for possibly 4-5 days of inclement weather. To reduce
the size of the battery and the panels, off-grid homes uses solar systems that are often
supplemented with wind turbines that are able to produce electricity during cloudy periods and
at night. The other auxiliary source that is often used are which simplifies the isolated system's
sizing. Another reason batteries should be used off-grid is to operate the PV cells near their
maximum power point.
21 | P a g e
Figure 4. Schematic representation of an off-grid solar system [22]
There are two coupling variants, which have economic consequences for the investor (whether
an individual, a company or a project developer):
22 | P a g e
Figure5. Schematic Represenation of a PV installation with a feed-in tarrif system.[22]
23 | P a g e
If the production of photovoltaic system exceeds the consumer's needs, the excess is fed into
the grid; if lower, the consumer collects electricity in the network. For the realization of this
system, a simple counter is sufficient, but it must be able to measure the flow of electricity in
both directions.
Figure7 .Schematic Representation (a) and (b) of an installation connected to the grid
with a net-metering system[22].
To better understand the operation of the system, it is necessary to know the technological
structure. A photovoltaic is composed of four main parts:
Individual cells constituting the module, being interconnected in series, the resulting voltages
and currents will follow the laws of DC generators. The current output and the power are
consequently proportional to the surface of the module.
The cell
A cell consists of a stack of layers :
24 | P a g e
Protective glass
Antireflection coating
Conductive mesh (cathode)
Silicon doped N (negative)
N / P junction
Silicon doped P (positive)
Metal support (anode)
The qualitative operation of a cell is quite simple: the photons (light particles) hit the cell, they
transfer their energy to the electrons of silicon. The silicon is treated (doped) so that all the
electrons are moving in the same direction, toward the top of the metal grid, thus creating a DC
current which intensity is a function of the insolation.
The characteristics defined by the manufacturers are obtained under standard test conditions
(STC) as follows:
Junction temperature: 25 C
Irradiation or illumination E: 1000 W / m2 (100 mW / cm2)
This corresponds approximately to the power of sunlight at noon on a clear day and on a
surface of 1 m2 perpendicular to the direction of sunlight.
Air mass AM is when the sun is at its zenith. The "air mass" is the atmospheric layer that
radiation must pass.
b- The Battery
V = 48 V
P = 1200 W
Autonomy: 4 hours
U max = 48 V
U min = 40 V
Current: I = 1 200/48 = 25 A
From the discharge curve: 1.85 V 0.2 C20 (C20 0.2 = 25 A) 12.
c- The controller
26 | P a g e
The structure of the controller
The controller has a switching element - relay, bipolar transistor, MOSFET transistor, thyristor
- placed between the solar panel and battery. It is controlled by a logic based on the control of
the voltage of the battery, and can easily switch high currents without internal energy
dissipation.
d- The inverter
For systems connected to the grid, you can use an inverter to transmit energy to the network. In
this case, use a sine wave inverter, which costs 4 to 5 times more expensive than a quasi-sine
wave inverter. The difference is that the signal is pure (sinusoidal) and that to reach this level,
filters had to be used.
27 | P a g e
2.5 Sizing an off-grid solar power system
Assume the battery capacity of the system is large enough to allow necessary charging and
discharging for powering the source(s).
EPV Produced = EDaily Consumed / (Electronics Efficiency Battery Charge/Discharge
Efficiency)
If the PV panel is tilted with an angle of latitude plus 15 degrees (facing south):
Size of PV Panels = ESolar Radiation Needed / Daily Solar Radiatio
28 | P a g e
3. Case Study: Sizing Pv Panels for a house located in
Ifrane.
The purpose of this case study is to design an off-grid solar power system that fits the
conditions of a chosen house with defined appliances. To do so , well start with sizing the PV
needed ,then sizing the battery. The last step of this case study will be an analysis of the return
on investment of using a Photovoltaic system in a SHEMS. The home chosen in this case study
is composed of: a Fridge, an Air conditioner, an LCD TV, a Computer, a Waching machine, an
Iron , a Vacuum cleaner, a Hair dryer , eight Lamps( Energy saving lamps), a Cooker ,an
Electric oven , a Microwave ,a Home Boiler. In this case study, I overestimated the overall
consumption to see the worst case scenario of the return on investment.
The choice of an autonomous solar kit primarily depends on the forecast consumption
appliances. The logic of calculation is to combine the power ratings (W) of your electrical
devices and multiply by the number of hours (h) use per day (Wh / day). Then refer to the solar
output tables to determine the necessary number of solar panels. The following table (Table 2)
calculates the estimated total average consumption for the house in kwh/day.
29 | P a g e
Nof Average annual
Power Period of Average annual Estimated average
Appliances items AverageFrequency consumption for all
(W) utilisation consumption(kwh) consumption(wh/day)
items(kwh)
Fridge 1 up to 200 365 days Continuous 201 201 550
Home Boiler 1 up to 2500 335 days 80l /day 1554 1554 4638,80597
Total in Wh/day : 38858,80597
Total in KWh/day : 38,85880597
30 | P a g e
Total consumption per day ( from Table2 )(Wh/day) 38858,80597
Irradiation optimal (Wh/m2/day)* 5630
Efficiency of the off-grid system 0,66
Power (Kwp) ** 10,45772269
Table 3. Power needed to cover total consumption
*The irradiation of ifrane is available in the following website:
http://re.jrc.ec.europa.eu/pvgis/apps4/pvest.php?map=africa after pressing the button
calculate in the monthly radiation tab. We get the result in AppendixA.
( ) 1/
=
0.66 (//)
Now, we need to calculate the number of panels needed. I choose to use the panel
SOLON Black 220/16 with monocrystalline technology (See appendixB). I choose this
technology because it is the most used in the market and eventhough it is slightly more
expensive than Polycrystalline but it is more efficient.
According to appendix B, the maximum power of the panel is: 250Wp. Therefore, the
number of panels needed are: 10450/250 = 41.84 42 panels.
And according to appendix C, the dimensions of each panel are: 1,640 x 1,000 x
34mm.Then, the surface of each panel is 1.6 m. Therefore, the space needed for all panels is:
1.6*42=67.2 m.
For the inverter, since we need 10450 Wp,(see table3), we need two Sunny Boy
5000TL inverters since each one has a maximum input DC power of 5250 Wp.
The maximum Power Point Voltage range / rated input voltage for the Sunny boy
inverter is from 175V to 500V with an ideal value of 400V ( see AppendixE) . Each series of
panels (11 panels) will give us a voltage of 330, which is within the inverters input voltage
range. The overall power needed is 25930 Watts which means that we need four charge
controllers Sunny Island 5048 (5000 watt for each). It will be costy, therefore well cover
31 | P a g e
only 60% of the total power (all appliances are in load) since not all appliances will be used at
the same time.
The system needs also a fuse that is also called fuse circuit breaker. It is a safety device which
cuts the electric current during a short circuit or overload.
Battery sizing:
( )
=
. ( )
Therefore the battery needs a capacity of 1619 Ah to make all the appliances work for one day
without solar energy nor the grid. According to Appendix F we need a Battery Voltage of 48V
and according to AppendixD we will need 24 batteries in series because each battery has a
voltage of 2V.
The following figure 8 is a schematic representation of the PV system needed for this case
study:
32 | P a g e
.
Figure8 . Schematic representation of the PV system needed for this case study
33 | P a g e
The return on investment:
According to the National Office of Electricity (ONE) , which is the only Moroccan
operator of electricity supply in the country, the price of 1kWh is 0.9Mad ( including VAT ).
For this case study we need 38.85kWh/day. Therefore, the annual cost will be:
0.9(Mad/kWh)*38.85(kwh/day)*365(day/year)=12762.2(Mad/year)
Now, we have to estimate the cost of our system. Ill base my estimation on the invoice
prepared by EUROSOL ENERGY SOLUTION (see Appendix G) for AL AKHAWAYN
UNIVERSITY for the PV installation that satisfies a total power of 1kWp composed of four
250kWp solar panels.
The estimated cost for all panels: 7628*10.45= 79712 Mad without logistics
and other materials prices and maintenance.
The estimated cost for logistics maintenance and other materials prices (based on the
invoice prepared by EUROSOL ENERGY SOLUTION Company) is about: 40000 Mad.
Remark:
This is just an estimated cost and it was based on the invoice already prepared by EUROSOL
ENERGY SOLUTION Company. It is mentioned in the future work that a new invoice
should be prepared for a better estimation. We contacted two companies located in Morocco:
Atlas Solaire and EUROSOL ENERGY SOLUTION Company and we are still waiting for
the new official invoices.
Interpretation of results:
The return on investment is approximately 9 years. Which means that households need 9
years to get back their initial investment. It should be taken into consideration that in this case
34 | P a g e
study we are estimating the worst case scenario, which means that all appliances are working
in the same time (maximum load) , This means that the return on investment is lower than 9
years .
The return on investment period is long because of the high costs of installation of PVs is
high. Morocco imports Pv panels and materials from abroad which makes them more
expensive because of transportation fees. In addition, there isnt much competition in
Morocco in this sector which makes prices high comparing with other countries.
The potential studies developed so far in the field of solar energy in Morocco
determine, on the basis of the surface, the theoretical and technical national potential, which is
huge because of the intensity of solar radiation and availability large spaces: a study of GTZ
(now GIZ) in 2008 figures estimated the technical potential for the production of electricity
from solar power to about 40,000 TWh per year - equivalent to about 1,500 times of the
current consumption of electricity and shows - given the increased competitiveness of
technologies - the enormous strategic importance of solar energy for Morocco.[22]
In his speeches and in the "High Royal Orientations", His Majesty King Mohamed VI
has dedicated the regenerative energy and energy efficiency a significant time. In the "Assises
de lEnergie" in 2009 that represents the biggest event for Moroccan local authorities in the
field of energy. This meeting represents an opportunity to present the goals set by the new
energy strategy of Morocco, which aims to control the country's energy future to ensure its
sustainable development .This event was Organized by the Ministry of Energy, Mines, Water
and Environment, the meeting also aims to share with a wider audience of professionals and
users issues and major challenges of energy Morocco and the need to implement the solutions
proposed to achieve the objectives set by the strategy. These Energy first sittings will
therefore be an opportunity to highlight the need for energy and optimize its use to promote
economic and social development. During this sittings, the government has set an 8% of
regenerative energies in primary energy consumption and 18% of electricity needs for
35 | P a g e
2012.The national program in the sector of solar energy (Integrated Project of solar power
production - 2,000 MW by 2020) was introduced in November 2009, the wind program, also
2,000 MW , in July 2010. At the institutional level, the essential basics for the implementation
of these programs were asked; for the implementation of the solar project, the "Moroccan
Agency for Solar Energy" (MASEN) was founded.[22] The "Center of Renewable Energy
Development (CRED) is transformed into an "Agency for Development of Renewable
Energy and Energy Efficiency" (ADREEE), which allows the integration of energy efficiency
in the portfolio of this National Agency.
A global fund of 1 billion$, to which Saudi Arabia, the UAE and the Hassan II Fund
has contributed , should support primarily the promotion of regenerative energies and energy
efficiency , in equal shares for profitable projects and grant projects. To support of so-called
"profitable" projects, the "Energy Investment Company", a semi-public company that should
support projects for the use of renewable energy sources (including biomass) as well as the
creation of companies through participatory capital [22] .The "Energy Development Fund"
supports projects that are considered unprofitable such as studies, research and development,
and also for example the recapitalization of ONE.
Another political process which importance was graced by His Majesty King
Mohamed VI , in his speech in the 6th of November 2014 , is regionalization [22]. This
process is of great importance to renewable energy, insofar as compared to fossil fuel plants,
they should be much more decentralized; this means that many more actors - including the
private sector and individuals - are involved in decisions about their exploitation and
production of electricity.
36 | P a g e
In this context, to accelerate the introduction of photovoltaics, it is essential to offer
incentives - for example in the form of: investment grants, the decrease in value added tax or
the granting of good loan conditions at least for a limited period, as well as other support
measures (marketing measures for awareness, learning and continuing education, support for
business creation / strengthening of the industrial fabric ...).
It should be noted that other power generation options normally present in a region
(wind, hydro, biomass power plants using fossil fuels) should be maintained and retained for
the future as reserve energy over the non-existent or insufficient solar radiation phases (night
overcast). In this sense, the photovoltaic potential is a maximum value for a power generation
closer to consumers, that should not automatically be used, but remain available for growing
needs. This issue needs further investigation as part of more detailed scenarios.
37 | P a g e
5-GENERAL DESCRIPTION OF THE SMART HOME
ENERGY MANAGEMENT SYSTEM
The Arduino Uno is a microcontroller board based on the ATmega328 (Figure9 ). It has 14
digital input/output pins (of which 6 can be used as PWM outputs), 6 analog inputs, a 16 MHz
ceramic resonator, a USB connection, a power jack, an ICSP header, and a reset button. It
contains everything needed to support the microcontroller; simply connect it to a computer
with a USB cable or power it with a AC-to-DC adapter or battery to get started.
The arduino Uno is the microcontroller used in the Smart Home Energy Management System.
It is linked to a 9V battery and it also supplies the different sensors through a 5V and a ground
pins. The analog pins of the Arduino are connected to the different sensors and the relay to
allow the monitor and control of the appliances. This microcontroller also serves as a support
for the radio communication.
38 | P a g e
Xbee ship
The Xbee ship is a radio that has an embedded solutions providing wireless end-point
connectivity to devices. This ship is the component that allow the communication between
the smart plug and the gateway. All information sent to and received from the device
should be processed by the Xbee ship. The XBee radio series 2 manufactured by Digi
International and illustrated by figure 13, enables a wide range of wireless communication
protocols including Zigbee. The XBee radios are programmed using terminal programs X-
CTU developed by Digi International. The following figure10 is an Xbee Radio Series2.
The light sensor, illustrated in Figure 11, is connected to one of the Arduino analog pins.
The light sensor determines the lightening level of a room, and matches it with the local
hour , the season and the changing price of electricity. By doing so, it will be possible to
increase or decrease the light lever using a voltage divider. The Light Sensor used SEN
11302P and shown in figure 16 incorporates a light dependent sensor (LDR). The
resistance of the LDR or Photoresistor will decrease when the ambient light intensity
increases.
39 | P a g e
Figure 11 . Light Sensor [19]
Temperature sensor
The temperature sensor is also connected to an Arduino analog pin. This sensor enables us
to find the ambient temperature of the room. This temperature is useful when linked to
other data as for example the season, the weather conditions, the costumers preferred
temperature and the dynamic pricing of electricity. By doing so, it will be possible to
adjust automatically the temperature. The Temperature Sensor used is SEN 23292P as
shown in Figure 12, uses a Thermistor to detect the ambient temperature. The resistance
of a thermistor and the ambient temperature are inversely proportional, when the
resistance of the thermistor increases, the ambient temperature decreases.
The current sensor used , showed in figure13, is a 14is a split-core YHDC STC 013-030
CT sensor which is non-invasive sensor that can sense a current up to 30A and outputs a
voltage value of maximum 1V to be interpreted accordingly. A current sensor is a device
40 | P a g e
that enables the monitoring of the current flowing through the appliance. This sensor
needs to be connected to the wire going from the relay box to the appliance. It is then
linked to a voltage divider and then to one of the Arduinos analog pins.By knowing the
amount of current flowing through an appliance, we are able to first deduce the state of
the appliance (ON or OFF) and second to compute the power consumption of the
appliance.
Breadboard
The breadboard is used to gather the overall sensing system and have a compact block
along with the Arduino.
Relay box
The Relay box is responsible of the control part of the smart plug .We cant rely only
on the Arduing because the power given by the arduino pins is not sufficient.
41 | P a g e
5.2 Gateway
As we have already mentioned, the Arduino Uno is the support of the radio
communication. An Xbee shield is placed on top of the Arduino to connect the various
Arduino pins to a new sets of pins compatible with the Xbee ship pins. The Xbee shield is a
platform that allow the connection of the microcontroller to the Xbee radio. The Xbee shield
represented in figure 15, allows an Arduino board to communicate wirelessly using Zigbee.
This Shield will be used to interface the XBee radio Series 2 with our Arduino boards. The
Xbee Shield is responsible of the double Xbee wireless communication between the smart
plugs and the gateway
42 | P a g e
.
Ethernet shield
The Arduino Ethernet Shield illustrated in Figure 16 allows an Arduino board to connect to
the internet. It is based on the Wiznet W5100 ethernet chip .The Wiznet W5100 provides a
network (IP) stack capable of both TCP and UDP. It supports up to four simultaneous socket
connections. Use the Ethernet library to write sketches which connect to the internet using
the shield. The ethernet shield connects to an Arduino board using long wire-wrap headers
which extend through the shield. This keeps the pin layout intact and allows another shield to
be stacked on top.It is used to connect the gateway to the database.
43 | P a g e
6- Implementation of a Smart plug in a Home Energy
Management System
During this capstone project, the main objectives that were achieved can be divided into two
categories. First the intensive research and literature review helped achieve a good
understanding of the smart grid field. Second in the smart grid research lab, we continued the
work done by previous capstone students, the concrete outputs: Reading data from sensors
was previously implemented, we developed this part by adding two-ways communication
between the smart plugs and the gateway and the flow of information to the database.
The purpose of this test is to remotely send the data collected with the sensors from one station to
another using the Xbee communication protocol and a star topology. Two end node stations will be
sending data to the same base station I order to determine the presence of any possible interference
between the two end node stations. The problem that the previous research team was facing was the
use of the Arduino Yun in the gateway, the main problem is the absence of a reliable wireless
communication. In order to solve this issue well use an Aduino Uno and to afford communication
with the database, an Ethernet shield will be used.
The purpose of this test is to display on a computer using serial communication the data collected
with the three different sensors.
The figure represents the schema followed in this test. An Arduino Uno connected to three different
sensors using analog pins is displaying the readings through serial communication.
44 | P a g e
(Light Sensor) (Temperature Sensor)
Arduino Uno
(Current Sensor)
In order for the Arduino Uno to display the data readings through the serial connection, the
following code in figure 18 was uploaded.
45 | P a g e
Figure 18. Uploaded code in the Arduino
The main goal of this step was achieved which was the proof of concept of being able to read data
from different sensors.
The purpose of this test is to remotely send the data collected with the sensors from one station to
another using the Xbee communication protocol.
Xbee Xbee
Ship Ship
Xbee Shield Xbee Shield
(Current Sensor)
46 | P a g e
6.2.1 ROUTER NODE
The router node or end node station is composed of the following hardware pieces:
An XBee Shield: used as a communication platform between the XBee chip and the
ARDUINO UNO.
An XBee Series 2: collects sensing readings from the Arduino and transmit the
information to the base station
An ARDUINO UNO: contains an Arduino program that reads the serial output used
as communication platform between the Xbee chip and the sensors
A sensors circuit: collects data from the environment.
6.2.2 COORDINATOR NODE
The coordinator node or base station is composed of the following hardware pieces:
An XBee Shield: used as a communication platform between the XBee chip and the
ARDUINO UNO.
An XBee Series 2: used to receive sensing readings sent from the radio of the end
node station.
An ARDUINO UNO: used as communication platform between the Xbee chip and
the computer.
An Ethernet shield : used as a communication platform between the coordinator and
the database
The results of the test 2 were very conclusive since the obtained results displayed on the serial
monitor were similar to the one obtained from the direct sensors reading as shown in Figure 41.
The purpose of this test is to remotely send the data collected with the sensors from one station to
another using the Xbee communication protocol and a star topology. Two end node stations will be
sending data to the same base station I order to determine the presence of any possible interference
between the two end node stations.
47 | P a g e
The configuration of the Xbee radios:
In order to establish a star communication topology between two XBee radios, a number of
attributes proper to each XBee radio have to be set using the terminal program X-CTU.
Figure 20 represents the schema followed in this test. A computer is connected to (a coordinator
station) an Arduino Uno with an Xbee shield and an Xbee chip connected through USB to a
computer. Two end node stations are then installed, each of them is constituted of an Arduino with
an Xbee shield and an Xbee chip then the Arduino is connected to the circuit of sensors.
(Temperature
(Light Sensor)
Sensor)
Arduino Uno
Xbee
Ship
Xbee Shield
Xbee
Ship
Xbee Shield Arduino Uno
Xbee
Ship
Xbee Shield
(Current Sensor)
The results of this phase demonstrated that even if both end node stations are sending sensors
reading to the base station at the same, no interferences were produced. The data received from
each station (Arduino 1 or Arduino 2) is correctly displayed.
The data logging is crucial in this project since it will allow the construction of representative
graphs such as the general consumption profiling and eventually manage the appliance using a
48 | P a g e
dynamic pricing scheme. After testing the star topology the data needed to be stored in the systems
database. For this purpose, the Ethernet shield is going to be used to enable the data to be send to
the database after reception from the Xbee radios.
The end node base would be configured the same way this was done in the previous part using the
API mode. However, the Arduino of this station will have a different code. In the previous part,
which was only concerned by the sensing function, the Arduino code had three function that read
the light sensor value , temperature sensor value , current sensor value .Other functions were added
to this part to enable two ways communication between the smart plug and the gateway and also the
control of appliances. The additional functions listens for actuation commands from the base station
and execute them using the relay and also build the message to be sent and read the message from
the gateway. The following Figure21. Represents the code with all the needed functions responsible
of the monitoring and control of the smart plug.
49 | P a g e
50 | P a g e
Figure 21. Smart plug Arduino code
6.4.2 RESULTS
In the same time the sensing is operating, the control of the appliance is achieved. In parallel to this
information is sent from both smart plugs to the gateway and the communication is also available
from the gateway to the smart plugs. Figure represents the Serial Arduino display for both smart
plugs.
51 | P a g e
Figure 22 .Serial Arduino display
The serial monitor box of the coordinator node retrieved the data in Figure 22. Each time it sends
data to the gateway it sends the64-bit source address (ex: 13A200-40ABBC39).
The following Figure represents the code uploaded in the Arduino Uno of the gateway. The gateway
receive the sensed values from both Smart plugs. The data are received with their corresponding smart
plug Mac addresses and classified depending on their address.
52 | P a g e
53 | P a g e
Figure 23. Gateway Arduino code
6.4.4RESULTS
The following Serial Arduino display ( figure 24) represents the way information is received and displayed in
the gateway .
54 | P a g e
Figure24. Serial Arduino display in the gateway
The serial monitor box of the coordinator node retrieved the data in Figure.. Each time it sends
data to the gateway it sends the64-bit source address (ex: 13A200-40ABBC39). It sends the
The database Entity Relationship Diagram used for this application is illustrated in Figure 25, while
the interface of the Android Application is presented in Figure.
55 | P a g e
Figure25. Appliaction interface
The coordinator node, Arduino Uno, has to be equipped with an Xbee shield and an Xbee ship in
order to communicate with the Smart plugs, while the Ethernet Shield is used between the
coordinator node and the web server.
56 | P a g e
7- COST STUDY
The cost study offers another aspect of evaluation to the system. If the STEEPLE model focused on
the macro-environmental factors, the cost study has as objective to assess the systems overall cost.
First the price of one smart plug was evaluated, the prices are in MAD since the retailer
DerbSellicon is Moroccan. In addition to the overall smart plug price Table 4 summarizes the cost
of the different components needed.
Smart Plug
Components Price (MAD)
Arduino Uno 362.21
Arduino XBee Shield v1.1 & XBee 912.60
Series 2
10uF capacitor
3x Resistor 10k Ohm 1/6th Watt
PTH
Total Price Smart Plug: 1991.87
57 | P a g e
Table 5 summarizes the gateway components price and provide an estimate of the gateway total
price. Assume a household who owns 20 appliances wants to install the suggested SHEMS, the
overall cost, computed on the base of the prototype price, would be 41697.98 MAD.
Gateway
Components Price
(MAD)
Arduino UNO 362.21
Arduino XBee Shield v1.1 912.60
XBee Series 2
Arduino Ethernet shield 389.99
Electric Battery 9V 6LR61 62.28
Powering Cable for 9V Electric 9.60
Battery
58 | P a g e
8- Conclusion
The main motivation behind this work of a SHEMS in a micro-grid is to achieve a higher energy
efficiency, to maximize of the return on investment of the solar panels, to maximize the utilization
of the RE and finally to minimize the dependency on the power provided by the utility company.
The primary objective of the capstone project was achieved. This project doesnt only focus only on
the theoretical aspects of the SHEMS but it did yield concrete hardware prototypes.
The first step of this project was the analysis of the possibility of having a photovoltaic system for
power generation in our home energy system. In this step, a case study analysis was done for a
chosen typical home. After the cost analysis, we can conclude that renewable energy use is still
difficult to implement in the Moroccan context because of the limited resources in terms of
materials needed.
The second part of the project consisted of monitoring and control of appliances in a Home Energy
Management System. The first phase was the collection of data from sensors. Then, using Xbee
communication protol , communicate this data with the gateway . After that, make sure that there is
both way communication between the smart plugs and the gateway. The last phase, data must be
transmitted to the database through the Ethernet.
The last part merged the work done (monitoring and control) with the application development
done by teammate Mohammed Bakr Sikal which gave a strong aspect to the project.
The limitations on the project could be stated as follow: first the high cost of the system
implementation. Second, the delay in the control part. Then, lack of accuracy of the current sensor
and the absence of voltage sensor and other sensors like: humidity, motion, gas, etc in the lab.
Finally, the inability to calibrate the light sensor because of the absence of the Lux meter from the
lab.
59 | P a g e
9-Future Work
In the context of the SHEMS, a number of future projects could be undertaken to complete and
enhance this capstone project:
The implementation of the sensing network using both a current sensor and a voltage sensor
along with adding sensors (i.e.: humidity, motion, gas).
Second, the deployment of the system in a sample of Moroccan households to generate a
Moroccan consumption profile.
Third, enhancing privacy and security of the data communicated within the system.
Fourth, Enhancing the systems intelligence by using optimization algorithms
Fifth , A new invoice should be prepared to estimate the cost of the photovoltaic
system.
60 | P a g e
12. References
[1] La consommation d'lectricit en chiffres, Retrieved from :
http://jeunes.edf.com/article/la-consommation-d-electricite-dans-le-monde,273
[6] Gungor VC, Lu B, Hancke GP. Opportunities and challenges of wireless sensor networks
in smart grid. IEEE Trans Ind Electron 2010;57:3557e64.
[9] Smart Grid: The Future of the Electric Power System :An Introduction to the Smart
Grid.(2011) ENBALA Power Networks.
[10] Pearce, Joshua (2002). open access "Photovoltaics A Path to Sustainable Futures".
Futures34 (7): 663674. doi:10.1016/S0016-3287(02)00008-3.) from Wikipedia.
61 | P a g e
[17] Energy Management Systems: State of the Art and Emerging Trends
[18] A.A. Khan et al. / Renewable and sustainable Energy Review 42(2015) 773-785. ]
[21]FrogTM Home energy management Solution beyond numbers. 2011, Available Online:
http://www.frogdesign.cn/files/pdf/Home%20Energy%20Management%20-
%20Beyond%20the%20Numbers.pdf
62 | P a g e
11. Appendices
Appendix A: Irradiation in Ifrane from the European Commission Joint
Research Center
63 | P a g e
Appendix B: Solar Panels SOLON220/16 Electrical and Thermal data
Rated Voltage of
each panel
64 | P a g e
Appendix C : Solar Panels SOLON220/16 Specifications
65 | P a g e
Appendix D : OPzs Solar Power Batteries overview
66 | P a g e
Appendix E: The inverter Sunny Boy 5000TL technical properties
67 | P a g e
Appendix F: Charge controller Sunny Island 5048 Technical properties
68 | P a g e
Appendix G: Invoice by EUROSOL Energy Solutions
69 | P a g e