You are on page 1of 12

Hindawi Publishing Corporation

International Journal of Distributed Sensor Networks


Volume 2015, Article ID 214805, 11 pages
http://dx.doi.org/10.1155/2015/214805

Research Article
An Intelligent Power Outlet System for the Smart Home of the
Internet of Things

Tiago M. Fernández-Caramés
Department of Electronics and Systems, University of A Coruña, A Coruña, Spain

Correspondence should be addressed to Tiago M. Fernández-Caramés; tmfernandez@udc.es

Received 27 June 2015; Revised 5 October 2015; Accepted 18 October 2015

Academic Editor: Salvatore Distefano

Copyright © 2015 Tiago M. Fernández-Caramés. This is an open access article distributed under the Creative Commons
Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is
properly cited.

This paper presents an intelligent power outlet system that can be controlled wirelessly and that has been specifically designed
to monitor electrical events in low-current loads. Each power outlet of the system embeds a microcontroller, a 2.4 GHz ZigBee
interface, RFID (Radio Frequency Identification) reader, a relay, and a current sensor. The main features of the system include the
remote control of the power outlet, real-time monitoring of the current consumption, the customization and programming of the
power supply time schedule, the automatic interruption of vampire currents, and the prevention of certain types of electrical fires
and electrocutions. A prototype with such features has been implemented and tested in a simple home automation network in order
to validate its functionalities. The results show that the system reacts fast and avoids overconsumptions and electrocutions, being
able to make the next generation of homes safer and smarter.

1. Introduction 1,570 civilian injuries, and $1.4 billion in direct property


damage [2]. In the same report it is also stated that, of all the
Modern homes provide electricity to electrical devices electrical fires whose cause could be determined precisely, the
through the last element of the power supply chain, the power vast majority were caused by short-circuits.
sockets, which have been regarded traditionally as a mere A similar situation occurs with electrical shocks. Accord-
junction. In fact, power sockets have not evolved as fast as ing to the Electrical Safety Foundation [3], in North America
other everyday devices, although they seem to be one of the each day nearly 7 children are treated in hospital emergency
best positioned candidates to be improved as smart homes are rooms for electric shock or burn injuries caused by tampering
becoming increasingly popular. with a wall outlet. In the same region, fires and burns are the
In the last years, different functionalities have been third leading cause of unintentional death among children
added to power sockets, like wireless control or current aged 14 and under.
consumption monitoring, but there are still many others that In order to address the two issues previously mentioned
could make such devices smarter. This paper addresses some this paper presents a smart power outlet system that has the
of the most common problems that arise when interacting following features:
with power sockets and shows a novel approach to two of
(i) It is able to detect overconsumptions that might lead
them: the prevention of electrical fires and the avoidance of
to overheat in low-current systems and, therefore, to
electrical shocks.
an electrical fire.
Regarding electrical fires, they are described as fires that
begin because of some type of electrical failure or malfunc- (ii) It prevents electrocutions, since it only supplies power
tion. The National Fire Protection Association (NFPA) [1] when it identifies a valid appliance.
latest report states that, in 2011, just in the USA, there were (iii) It can be controlled remotely using wireless sensor
47,700 home electrical fires that resulted in 418 civilian deaths, network technology.
2 International Journal of Distributed Sensor Networks

(iv) It is able to monitor in real-time and make available to Finally, [14, 15] present power outlet systems based on
external devices (e.g., PCs connected to the Internet, ZigBee and PLC, respectively. Such systems can control the
smartphones, and tablets) current consumption data. state of the outlets and monitor current consumption, but the
(v) It can disconnect the power supply when a vampire system detailed in [15] includes an additional feature: it is able
current is detected (a vampire current is a current that to issue warnings about possible power overloads.
arises when an appliance consumes power when it is
in stand-by mode or when it claims to be switched 2.2. Commercial Smart Power Sockets. There are smart
off). power sockets already available in the market (e.g., [16–
22]), although, in general, they are a step behind the ones
The next sections of this paper are structured as follows. developed by researchers.
Section 2 reviews the most relevant state-of-the-art smart For instance, the WeMo switch from Belkin [16] is a WiFi-
power sockets developed with academic and commercial
based power outlet that can switch on and off the power from
purposes. Section 3 details the design of the system and gives
an overview of the communications architecture. Section 4 an outlet. The MeterPlug [17] is similar but uses Bluetooth
focuses on the description of the two main components and it can also monitor current consumption. MyPlug, from
of the system: the gateway and the smart power socket. Orange [18], has ZigBee transceiver and GSM interface, but it
Section 5 describes the functionalities and setup of the is only able to control the state of the power socket.
system implemented. Section 6 shows the results for different The SafePlug [19] is probably one of the most advanced
experiments that demonstrate the capabilities of the system. off-the-shelf developments: it can switch on/off the power,
Finally, Section 7 is devoted to the conclusions. monitor current consumption in real-time, and identify
appliances to prevent fires and electrical shocks.
2. State of the Art: Academic and Commercial Finally, it is worth mentioning three other solutions:
PlugWise [20], Modlet [21], and SmartPlug [22]. They all have
Smart Power Sockets very similar functionalities (they can switch on/off the outlets
2.1. Academic Developments. In the last years researchers and monitor energy consumption), but while PlugWise and
have enhanced power outlets by adding different smart SmartPlug use ZigBee, Modlet seems to use a proprietary
functionalities. For instance, [4] presented an outlet system wireless technology.
that can be controlled remotely by using Bluetooth and GSM
wireless interfaces. The system can switch every outlet on 2.3. Analysis. After analyzing all the references previously
and off remotely by sending an SMS (Short Message Service). mentioned, it can be stated that the enhancements performed
An improved version of the system is presented in [5], and over power outlets have been mainly focused on the ability
it includes ethernet support and the capability of measuring to control them remotely, by using wired [6, 9, 11–13, 15],
current consumption. Furthermore, in [6, 7] almost the same wireless [4, 7, 8, 10, 14, 16–22], or hybrid interfaces [5]. Most
authors of [4, 5] describe a similar outlet system with PLC of the wireless power outlets only carry out point-to-point
(Power Line Communication) module. In the case of [7], the communications (e.g., [4, 5, 7, 16, 17]), using technologies like
system is aimed at controlling remotely UPS (Uninterruptible Bluetooth [4, 5, 7, 17], GSM [4, 5, 7, 18], or WiFi [16].
Power System).
However, in the last couple of decades, different alter-
One of the first examples of wireless sensor networks
applied to a power outlet system is described in [8]. The natives were proposed in order to substitute point-to-point
system proposed uses ZigBee to switch on and off remote networks for sensor networks. The first sensor networks were
outlets and to measure their current consumption. initially used in environments where there had to be a strict
A different approach is taken in [9]: the authors make use control of specific parameters like temperature, humidity, or
of a data acquisition system to control the state of the outlets the presence of toxic gases. These kinds of networks could
and to monitor current consumption. either use independent wired infrastructure (e.g., KNX [23]
Another power socket system that uses ZigBee is detailed or LonWorks [24]) or the already existent infrastructure
in [10]. Such a paper proposes communications architecture (e.g., X10). Other alternative communication technologies
that allows for switching off a socket where an appliance in that have achieved certain degree of success on the market are
stand-by mode is plugged in. BACnet (Building Automation and Control Network) [25],
Like in [6, 7], PLC interfaces are embedded into the DALI (Digital Addressable Lighting Interface) [26], EnOcean
designs proposed in [11, 12]. Both power outlet systems can [27], Z-Wave [28], DASH7 [29], and Wireless HART [30].
switch on and off outlets and monitor current consumption, The latest evolution of sensor networks is Wireless Sensor
but the latter is especially interesting: it is able to use different Networks (WSNs), which have been thoroughly studied
sensors to monitor living patterns and then optimize the for their application in different fields [31], from wearable
energy savings of a home. computing [32] to the management of the power grid [33],
The authors of the electrical outlet described in [13] or even to musical activities [34].
embedded an ethernet module for a smart power grid in Currently, ZigBee is arguably the most popular technol-
order to control the loads autonomously. Their system can ogy for creating WSNs and it has been included in the latest
switch on and off the power outlets, it is able to monitor generation of wireless power outlets [8, 10, 14, 18–22].
current consumption, and it has been explicitly designed for Although ZigBee is a well-established technology, it is
working in a network where a large amount of the power worth mentioning that the ZigBee Alliance has been working
comes from renewable sources. recently on an open alternative (ZigBee IP [35]) that includes
International Journal of Distributed Sensor Networks 3

IP connectivity through 6LoWPAN (IPv6 over Low-Power In the case of short-circuits, it is necessary to deter-
Wireless Personal-Area Networks) [36]. There are several mine the maximum short-circuit current. If the short-circuit
manufacturers that are already selling ZigBee IP-compliant release time is under 100 ms, the next rule is usually followed
platforms. Such IP connectivity seems to be one of the keys to prevent electrical fires and avoid damage [38]:
for the future Internet of Things (IoT) [37] and will enable
the interaction among the increasing amount of IP-enabled 𝐾2 𝑆2 ≥ 𝐼𝑘2 𝑡cut-off , (2)
devices present in modern homes (e.g., smart televisions,
home entertainment equipment, and remotely controlled where 𝐾 is coefficient of the material medium (As/mm2 ), 𝑆
appliances). is cross-sectional area of the conductor of the transmission
Besides WSNs, energy efficiency is probably one of the medium (in mm2 ), 𝐼𝑘 is RMS value of the short-circuit
most studied topics in the field of intelligent homes, and some current flowing through the medium (in A), and 𝑡cut-off is
of the smart power outlets previously cited have been pre- release time in seconds of the protection device for the
sented with the objective of monitoring energy consumption current 𝐼𝑘 .
[17, 19–22]. Equation (2) indicates that if a high current is maintained
Related to home energy efficiency is the problem of during too much time, the conductor through which it flows
vampire currents. Surprisingly, just a few smart power outlets might be melted and even catch on fire.
[10, 17] automate the detection of vampire currents and are Such equation in (2) is derived from thermodynamic
able to disconnect appliances after they have been in stand- equations that regulate adiabatic processes and it enables
by for a certain amount of time. designers to check the suitability of a composite cable used
Regarding electrical fires and electrical shocks, there for the c.p.c. (circuit protection conductor, i.e., the earthing
is barely any commercial or academic smart power outlet conductor and all the equipotential bonding conductors).
specifically addressed to tackle them. The exception seems to Equation (2) can be rewritten to determine the maximum
be SafePlug [19]. However, after analyzing all the academic time required to damage a cable:
and commercial devices, it has been found that none imple-
ments all the functionalities offered by the system presented 𝐾2 𝑆2
𝑡cut-off = , (3)
in this paper. 𝐼𝑘 2
3. Design of the System where 𝑡cut-off can now be viewed as the time required by the
Traditionally it has been stated that, for the protection of short-circuit current 𝐼𝑘 to rise the conductor temperature to
electrical installations and people, there is a well-established the highest permissible level (i.e., before damaging the cable).
array of tried and tested hardware technologies (e.g., fuses The constant 𝐾 is calculated as [39]:
and circuit breakers) that are safe and fast. Although such
technologies achieve their goal when configured properly, 𝑄𝑐 (𝐵 + 20) 𝜃𝑓 − 𝜃𝑖
𝐾=√ ln (1 + ), (4)
they usually do not adapt dynamically to the environment or 𝑄20 𝐵 + 𝜃𝑖
to the connected appliances.
The system presented in this paper involves the use of where 𝑄𝑐 is volumetric heat capacity of the conductor
software control, which has been regarded as relatively slow material (J/∘ C mm3 ), 𝐵 is reciprocal of the temperature
and subject to software errors. The latter statement can be coefficient of resistivity at certain ∘ C for the conductor (∘ C),
tackled by performing intensive tests under harsh conditions, 𝑄20 is electrical resistivity of the conductor material at 20∘ C
but the former needs to be studied carefully before imple- (Ωmm), 𝜃𝑖 is initial temperature of the conductor (∘ C), and
menting an electrical safety software-based device. 𝜃𝑓 is final temperature of the conductor (∘ C).
Equation (4) can be simplified by assuming a particular
3.1. On the Prevention of Electrical Fires. Electrical fires can type of conductor:
occur due to different events, with two of the most common
ones being power overloads and short-circuits. In both cases,
𝜃𝑓 − 𝜃𝑖
when they happen, the energy released must be smaller than 𝐾 = 𝐶√ ln (1 + ), (5)
the maximum load capacity of the transmission medium to 𝐵 + 𝜃𝑖
avoid irreparable damage.
In the case of power overloads, the current must remain where 𝐶 is constant for a specific material:
below the maximum permissible load current of the trans-
mission medium (𝐼𝑧 ). The following rule is commonly 𝑄𝑐 (𝐵 + 20)
𝐶=√ . (6)
applied in accordance to IEC/EN 60898-1/-2 and IEC/EN 𝑄20
60947-2 by miniature circuit breakers (MCBs) manufacturers
to determine when the circuit should be opened in the event For instance, 𝐶 for copper is 226 and for aluminum is 148
of an overload: and for steel is 78 and for lead is 41.
Therefore, once the conductor material has been chosen,
𝐼𝑡=30 ≤ 1.45𝐼𝑧 , (1)
the value of 𝐾 will depend solely on the initial and final
where 𝐼𝑡=30 is the monitored current at an ambient tempera- temperatures supported by the insulation. For example, 𝐾
ture of 30∘ C. becomes 115 for a cable made of copper (𝐵 for copper is
4 International Journal of Distributed Sensor Networks

0.02 3.2. Time Constraints for Software-Based Current Monitoring


0.018 Devices. In the case of systems that perform an active
0.016 monitoring of the current in order to prevent certain events,
0.014 what might concern users is the amount of time the system
0.012 needs to react. Such an amount is given by
Time (s)

0.01
0.008 𝑡r = 𝑡d + 𝑡s , (7)
0.006
where 𝑡r (reaction time) is the total time, 𝑡d (detection time) is
0.004
the time required to detect the event, and 𝑡s (switching time)
0.002
is the time it takes to switch off the power supply.
0
0 10 20 30 40 50 60 70 80 90 100 The detection time can be decomposed in the following
Current (A) terms when the detection is performed through a software
algorithm:
Copper, p.v.c., S = 0.10 mm2
Copper, p.v.c. 85∘ C, S = 0.10 mm2 𝑡d = 𝑡ml + 𝑡adq + 𝑡dr + 𝑡cc , (8)
Aluminium, p.v.c., S = 0.10 mm2
Aluminium, p.v.c. 85∘ C, S = 0.10 mm2 where 𝑡ml (main loop time) is the time needed by the main
Aluminium, thermosetting, S = 0.10 mm2
control loop to reach the detection code, 𝑡adq (acquisition
Lead, p.v.c., S = 0.10 mm2
Lead, p.v.c., S = 0.25 mm2
time) is the time consumed by the smart outlet to acquire the
Lead, p.v.c., S = 0.50 mm2 current data, 𝑡dr (data reading time) is the time required by
Lead, p.v.c. 85∘ C, S = 0.10 mm2 the current sensor to actually obtain the current data, and 𝑡cc
Lead, p.v.c. 85∘ C, S = 0.25 mm2 (control code time) is the time the device consumes to verify
Lead, p.v.c. 85∘ C, S = 0.50 mm2 whether the controlled event has happened.
Lead, thermosetting, S = 0.10 mm2 Regarding the term 𝑡s , it may be defined as follows:
Lead, thermosetting, S = 0.25 mm2
Steel, p.v.c., S = 0.10 mm2 𝑡s = 𝑡sc + 𝑡rs , (9)
Steel, p.v.c., S = 0.25 mm2
Steel, p.v.c. 85∘ C, S = 0.10 mm2 where 𝑡sc (switching code time) is the time spent in sending
Steel, p.v.c. 85∘ C, S = 0.25 mm2
Steel, thermosetting, S = 0.10 mm2
the order to the switching device and 𝑡rs (relay switching time)
is the time actually consumed by the hardware to switch off
Figure 1: Maximum release times before damage under 20 ms for the power supply. Thus, it can be found that there are times
different materials, insulations, and cross sections. that depend on the embedded controller and its code (𝑡ml ,
𝑡adq , 𝑡cc , and 𝑡sc ) and times that rely on hardware devices (𝑡dr
and 𝑡rs ). The former times can be reduced up to a certain
degree by optimizing the code or increasing the system’s clock
234.5∘ C) and insulated with p.v.c. when assuming 𝜃𝑖 = 70∘ C frequency, while the latter ones can be considered fixed once
and 𝜃𝑓 = 160∘ C. the hardware has been chosen.
Then, according to (3), Figure 1 plots 𝑡 for different Since a smart outlet would be placed after a regular
values of 𝐼𝑘 for a small installation (up to 100 A) while home circuit breaker, it has to react at least as fast. For
using different conductor materials, insulations, and cross low-load currents (under 100 A) MCBs are commonly used.
sections. Figure 1 only shows the portion of the curves under The time required to switch the breaker contacts in MCB
20 ms, where a regular MCB would cut off the current. For usually oscillates between 20 ms and 50 ms; therefore, it will
instance, if a current of 90 A arises due to a short-circuit in be established as a reference that the detection time 𝑡r should
a p.v.c. insulated copper cable with a cross-sectional area of be less than 20 ms.
0.1 mm2 , after roughly 17 ms, the insulation would melt and Before designing the device, the hardware-related times
might catch on fire. Note that cross section is not the same 𝑡dr and 𝑡rs have to be analyzed since they might constitute time
as diameter, but 0.1 mm2 is really small for regular cables. bottlenecks. The time 𝑡dr is strictly related to the reaction time
However, it is not uncommon to have appliances that include required by the current sensor to sense changes. For instance,
PCB paths and electronic components with conductors of in the case of Hall-effect sensors, the reaction time is in the
such size. order of several microseconds, so it should not constitute a
Therefore, it is possible that an appliance results in severe time constraint in the development of the smart power outlet.
damage and catches on fire before a regular MCB stops the The time required to switch off the power supply (𝑡rs )
current flow. is more restricting since it requires a hardware device to
Finally, it is worth mentioning that (2) assumes that open physically the circuit. For such a purpose relays are
all the heat generated during a short-circuit is retained, commonly used and manufacturers usually call the elapsed
which, in reality, does not occur, but it allows for obtaining time to open the circuit “release time.” The release time
a conservative estimation that provides a safety margin. If varies from one device to another and ranges from tens of
more precision is required, nonadiabatic heating must be microseconds to a few milliseconds. Note that the release
considered [40]. time does not include the bounce time, which accounts for
International Journal of Distributed Sensor Networks 5

the time necessary for stabilizing the contacts after switching electrical system. However, in houses and buildings recently
the relay. Thus, the relay must be chosen not only to meet the built but not explicitly designed for incorporating domotics,
voltage, current, and power constraints but also to reduce the the electrical infrastructure could be added later, which might
release and bounce times as much as possible. become a really cumbersome task and, in some cases, even
In order to perform a fair comparison between relays and impossible.
circuit breakers it is also important to note that the former This problem can be tackled by using wireless power
ones usually include in their datasheets time curves that are outlets interfaces, which can be placed whenever the user
used to show how fast a breaker will trip at any magnitude of wants (not necessarily during the construction stage) and
current. It can be observed in such curves that the larger the that do not require altering the internal decorations or
current is, the faster the breaker will switch and, therefore, modifying the internal wiring of the house. For such a reason,
the shorter the trip time is. The trip time can be defined as the system presented in this paper incorporates wireless
the time required to open the circuit once it has sensed an communications module. In fact, it is incorporated wireless
event. By comparing commercial MCB datasheets it can be sensor network module since it allows for extending the
concluded that the trip time is at least equal to 3 ms for a communications range just by adding relay nodes. This is key
current that is 3 times the nominal current. indoors, where the regular range in the 2.4 GHz band reaches
between 40 and 100 meters. Furthermore, some construction
3.3. On the Prevention of Electrical Shocks. Power outlets usu- materials like concrete or certain metallic structures alter
ally include different safety measures in order to prevent elec- signal propagation, deriving into its attenuation and, in
trical shocks. The most common one is the addition of a third consequence, into a remarkable decrease in wireless coverage.
prong (ground) that reduces the risk of electric shock and Thanks to the ability of relaying the wireless signals received
protects equipment from electrical damage. There are also from other sockets, the communications towards and from a
power sockets that are encapsulated into a tamper-resistant gateway can easily reach several hundred meters.
receptacle that prevents the insertion of objects. There are Figure 2 shows the communications architecture of the
also power outlets (AFCI, Arc Fault Circuit Interrupters) that system proposed. Each smart power outlet is able to transmit
reduce the risk of electrical shock by interrupting power when and receive data directly to/from a central gateway or by
arc fault occurs in the circuit. Moreover, there is another using intermediate power outlets. The gateway is responsible
kind of outlets (GFCI, Ground Fault Circuit Interrupters) that for connecting the power outlet system to a wide variety of
prevents shocks by shutting off the power when the electricity remote devices that may be attached to the Internet.
flowing into the circuit is superior to the one returning (i.e., This communications architecture is possible thanks to
when there is a leakage). the use of WSN technology like ZigBee. ZigBee is actu-
All these traditional solutions work in most situations, ally a set of wireless protocols for performing low-energy
especially when the same outlet combines different function- consumption and low data rate communications. A deep
alities (e.g., ground fault protection and tamper resistance), description of ZigBee is beyond the scope of this paper, but
but there are still cases when they fail (e.g., when the ground the interested reader can refer to [41] to get a good overview
is not properly set or when a kid is able to tamper the outlet). on the basics of ZigBee.
The system proposed in this paper prevents electrical
shocks based on the following principle: if there is no 4. Components of the System
appliance connected to the outlet, electricity will not be
supplied. In this way, most of the tampering will have no As it can be observed in Figure 3, the system consists of two
consequences and no electrical shocks should occur. main components: the smart sockets and the gateway, which
To achieve this goal it is necessary to identify when are described in the next subsections.
an appliance is connected to an outlet. There are different
4.1. Gateway. The gateway is responsible for exchanging
mechanisms that allow for identifying appliances, but most
information with the smart sockets and for making the
of them rely on mechanical systems, nonautomated systems
data available to remote users through a web application.
(e.g., pressing a button to indicate that the appliance is con-
Its hardware consists of two subsystems dedicated to tasks
nected), or proprietary technologies. The proposed solution
related to control and communications.
uses RFID (Radio Frequency Identification): RFID reader is
embedded into the power outlet, while RFID tags are attached 4.1.1. Control Subsystem. It is made of two main components:
to the appliance electrical connector or to its cord. Therefore,
electricity is only supplied if a valid RFID tag is attached to the (i) The web application. It allows users to configure
appliance and if its connector/cord is very close to the smart and interact with each individual power socket. It
power outlet (within several centimeters). is currently running on a PC, but it could be easily
Regarding electrical shocks caused by arc faults, they are embedded into smaller platforms.
mostly suppressed by using the design principles detailed in (ii) The ZigBee interface. It is connected through USB to
Section 3.1. the PC that runs the web application. It consists of
a microcontroller (ATmega328P) that transmits and
3.4. Communications Architecture. In an automated home, receives information through the communications
the domotic installation is ideally deployed during the con- subsystem and exchanges data with the web applica-
struction stage, in conjunction with the deployment of the tion.
6 International Journal of Distributed Sensor Networks

Internal LAN
or Internet

Figure 2: Overview of the communications architecture proposed.

ZigBee network

Smart power sockets

reader socket
RFID Power
IP-based network Microcontroller
ATmega328P
RFID tag
Gateway
PC

reader socket
RFID Power
Microcontroller +
USB

Web Microcontroller
application ZigBee interface ATmega328P

Remote users RFID tag


socket
Power

Microcontroller
ATmega328P
reader
RFID

RFID tag

Figure 3: Main components of the smart power socket system.

4.1.2. Communications Subsystem. Communications are per- estimating the amount of power consumed by an
formed by using ZigBee module connected to the con- appliance connected to the smart power outlet.
trol subsystem. The gateway acts as a coordinator of PAN (ii) Communications subsystem: it includes a ZigBee
(Personal-Area Network) composed by all the sockets. The wireless interface loaded with either the “End Device”
ZigBee module is Xbee PRO ZB Series 2 from Digi [42] that or the “Router” version of the firmware. The latter is
works at 2.4 GHz and that is loaded with the “Coordinator” chosen when it is required to relay data from other
version of the firmware. sockets. Note that thanks to using ZigBee the system
nodes are automatically discovered and conform a
4.2. Smart Power Outlet. The smart power socket consists of mesh that directs the data towards the gateway.
the five different subsystems:
(iii) Actuation subsystem: it is responsible for switching
(i) Sensing subsystem: it basically includes a Hall-effect on and off the appliance connected. Like other sub-
current sensor (LEM, HXS 10-NP/SP3) that permits systems, it has to react as fast as possible when cutting
International Journal of Distributed Sensor Networks 7

Status LEDs

ZigBee module

ATmega328P

16 MHz Xtal

ICSP

Figure 4: Components of the control and communications subsystems.

Relay Current sensor

RFID reader Microcontroller


RFID antenna

RFID tag
Power regulator

Figure 5: Disassembled outlet exposing the internal components of a smart power socket.

off the power supply to prevent fires and damage. 5. Implementation


Specifically, this subsystem is based on a relay (OEG
OJ-SH-105LM) with additional simple circuitry to 5.1. Testbed Setup. A testbed was built in order to test all the
control it with the microcontroller. features of the proposed system. It was designed to represent
a simple home automation network and was composed by a
(iv) Identification subsystem: it uses RFID to perform
gateway and several smart power sockets.
the identification: RFID reader is embedded into
Figures 6 and 7 show a couple of snapshots of the admin-
the power outlet, while RFID tags are attached to
istration software, which was developed in C# with ASP.net
the appliance electrical connector or to its cord. In
using Microsoft SQL Server 2008 Express as local database.
the system proposed RFID reader (ID-12LA) that is
The reason why it was developed as a web application is
capable of reading 125 KHz EM4001-compatible tags
that, thanks to that, it can be used from multiple hardware
was used.
devices (PCs, Macs, tablets, smartphones, etc.) with the only
(v) Control subsystem: its core is ATmega328P micro- requirement of installing a web-browser.
controller that controls all the other subsystems. It has
to be programmed efficiently in order to manage all 5.2. Implemented Features. The testbed developed currently
the incoming requests. The most critical requests are monitors the following events:
the ones coming from the current sensor, since there
is only a small fraction of time for detecting overcon- (i) If an appliance with a valid RFID tag is plugged
sumptions. Figure 4 shows the main components of into the smart power outlet, the power supply is
the subsystem, which has been designed explicitly to enabled. Note that RFID tag is always associated
fit the small space behind a regular wall outlet (see with the same appliance (it would be ideally attached
Figure 5). by the manufacturer), but every valid appliance is
8 International Journal of Distributed Sensor Networks

Other functionalities that are not currently implemented


but that would be straightforward to implement on the
testbed are as follows:
(i) Power load balance mode. The intelligent sockets can
exchange information to avoid overloads or to respect
a maximum power limit imposed by the user.
(ii) Appliance fail pattern. By monitoring current it is
possible to detect when a device is malfunctioning
and predict when it is going to fail [43].
(iii) Smart powering. The system can embed sensors that
Figure 6: Administration application screen for configuring a determine the value of parameters like temperature,
power socket. humidity, or presence that might lead to an intelligent
powering of the connected appliances. For instance, it
may not make sense to activate a heating system when
a room is hot enough or when it has not detected
the presence of people in the environment for certain
amount of time.
(iv) Cost-efficient powering. In some European countries
the cost of residential electricity oscillates throughout
the day. The system may be adapted to obtain the
prices from the Internet and only power certain
Figure 7: Example of the screen for enumerating and adding new appliances when the electricity cost is below a value
power sockets to the system. previously set.

5.3. Cost of the System. The components of the testbed can


authorized by default to be used in every smart power be manufactured currently for 45C (the smart power outlet)
outlet of the system. and 20C (the gateway, without the PC), when buying in bulk
10,000 units. The most expensive component is the ZigBee
(ii) If the current exceeds the maximum allowed during
module (around 15C in bulk), which can be replaced by other
𝑡cut-off (according to (3)), the system turns off the
RF interfaces with mesh capabilities (e.g., ESP8266), which
power supply to avoid damage and electrical fires.
would make the cost of both devices go down to 32C and 7C,
(iii) If the maximum current slope is exceeded, an over- respectively.
current is detected and the relay opens the circuit. It is worth also noting that the cost can also be reduced
Note that the slope can be adjusted to the envi- by not using certain subsystems. For instance, if the identi-
ronment to get a trade-off between detections and fication subsystem is removed (its functionalities would be
false positives. A commercial implementation would carried out partially by the user, who would be responsible
require testing the system in real-world situations and for associating every outlet with an appliance), the manufac-
adjusting accurately the rate of false positives. If the turing cost of the smart power outlet in bulk would be around
inner workings of an appliance would result in sudden 25C.
rises of current, its power profile should be configured On the contrary, the system could be enhanced by
properly to filter them out. replacing some of the components with more accurate ones at
the expense of increasing the cost of the system. For example,
(iv) If the current remains below the recommended min- more expensive current sensors would allow for obtaining
imum during at least the vampire current detection more precise measurements and, thus, fine-tune vampire
time indicated in the power profile, a vampire current current and overcurrent detection. The actuation subsystem
is detected and the system stops supplying current. could also be improved by incorporating relays that feature
(v) If there is a powering schedule for the power outlet higher maximum currents, reduced switching time, and more
setup, the appliance will be powered off during the durability, but the cost of the smart power outlet would be
time intervals indicated by such a schedule. increased significantly.
(vi) Remote user management commands are the sixth
item. Users can list and add new power outlets to the 6. Experimental Analysis
system.
6.1. Signal Attenuation. One of the problems of indoor wire-
(vii) If a remote user carries out certain action (e.g., less communications is that signals are reflected, refracted,
switching on/off an outlet or viewing the historical absorbed and, therefore, attenuated by the multiple obstacles
current consumption), it will be executed if there are present in the environment. In order to test the commu-
no other more critical tasks running. nications architecture, the testbed was placed in an indoor
International Journal of Distributed Sensor Networks 9

Power level 2 Power level 3 both cases the detection time is modeled as exposed in (7),
9000 (8), and (9). Note that, as it was previously mentioned, there
are times that are exclusively dependent on the hardware (𝑡dr
7000 and 𝑡rs ), while the others are software-related.
5000
6.3.1. Hardware Detection Times. The time 𝑡dr required to
3000 read the current data by the sensor depends solely on the
Current (mA)

1000 sensor. In this specific case, according to the datasheet of the


selected current sensor, the time required to obtain a new
−1000
value of the current when it changes oscillates between 3 and
−3000 5 microseconds.
−5000
In the case of 𝑡rs , which indicates the time needed by the
relay to open the circuit, it was initially estimated to be 1 ms,
−7000 Power level 0 since this is the deactivation time indicated by the chosen
−9000 Power level 1 (switched off) relay datasheet. If it is installed in the electrical system MCB
0 1000 2000 3000 4000 5000 6000 7000
that reacts faster than 1 ms, a really fast relay would have to be
Time (ms)
used. That is the case of reed relays, whose release times range
from several tens of microseconds to 1 millisecond. However,
Figure 8: Current oscillation when monitoring a hairdryer. it is important to take into account that, in most cases, reed
relays are only valid for low-load circuits.

6.3.2. Theoretical Software Detection Times. The time


environment and the attenuation of the signals was measured.
required by the ATmega328P to execute the code can be
Specifically, the mean RSSI (Received Signal Strength Indi-
estimated before its execution by counting the number of
cator) value obtained during the reception of 100 messages
cycles it requires. To estimate such a number it is necessary to
sent from a smart socket to the gateway was measured. Each
count, for each type of instruction, the number of assembler
measure was averaged five times for each measurement to
instructions required by the code and then multiply it by the
counteract the signal fluctuations caused by indoor fading.
number of cycles per instruction and by the period of the
Both the gateway and the smart socket transmitted with a
system (the inverse of the microcontroller clock frequency):
power of 3 dBm and boost mode was enabled. The results
obtained show that, as it was expected, the signal attenuates #types
1
with the distance (e.g., the signal mean attenuation with line- 𝑡code = ∑ #instructions𝑖 ∗ #cycles𝑖 . (10)
of-sight at 2 m was 12.05 dB, while at 8 m it was 22.99 dB) 𝑓clock 𝑖=1
and depending on the material of the obstacles the signal
encounters (e.g., the mean attenuation at 50 cm for a brick In the case of the ATmega328P, it runs at 16 MHz.
wall was 1.46 dB, but it was 3.95 dB for a window with According to its datasheet there are no dividers for the
closed metallic blinds). Such results highlight the need for external clock signal; therefore the period is 62.5 nS.
a WSN-based communications architecture, whose use of The counting of the assembler instructions is a tedious
certain nodes as repeaters allows for compensating signal task since it requires following the right branch of every jump
attenuations. in the code (that is not always obvious) and counting the
cycles consumed by every executed instruction (indicated
in the microcontroller’s datasheet). As an example, Table 1
6.2. Current Monitoring. It is possible to monitor remotely
shows the instruction count for some of the most common
the state of the network of smart sockets. The management
instructions of the executed code (the first row of Table 1
system offers the possibility of monitoring the current con-
indicates the number of clock cycles consumed by each
sumption in real-time and obtain the historical consumption
of the instructions). Table 2 contains the total number of
during a specific time interval.
cycles required by each segment of code and shows the total
Figure 8 shows an example of the current consumed by a
theoretical time of 𝑡ml , 𝑡adq , 𝑡cc , and 𝑡sc . As it can be observed,
hairdryer. Such a figure was obtained when the hairdryer was the time required by each section of the code is really small
turned on and then switched between the different numbers and their sum is less than 0.2 ms. Such pieces of code could be
that are associated with power levels (it can be observed that further optimized to decrease execution time, but they have
there are four different consumption levels). been considered fast enough.
It is important to note that 𝑡adq is the largest software
6.3. Electrical Event Reaction and Detection Times. A key time because an average of 0.112 ms is required to perform
feature of the system is the possibility of stopping the current the analog to digital conversion of the current value.
from flowing when detecting an abnormal electrical behavior
before electrical fire or damage occurs in the cases when the 6.3.3. Empirical Software Detection Times. With the objective
circuit breaker does not open the circuit fast enough. of verifying the empirical detection times, the real execution
In order to determine the detection time of an electrical time of the different parts of the code was quantified by
event, theoretical and empirical analysis were performed. In using functions that rely on the timers of the microcontroller.
10 International Journal of Distributed Sensor Networks

Table 1: Count of the most common instructions executed in different segments of code.

ADD CALL CPC LDI LDS MOV MOVW RET STS SUBI
Cycles per instruction 1 4 1 1 3 1 1 5 2 1
#of instructions
𝑡ml 10 3 14 20 4 8 32 3 0 14
𝑡adq 2 1 0 2 6 2 1 1 2 1
𝑡cc 0 1 3 1 7 0 1 1 1 0
𝑡sc 2 2 0 8 2 4 10 3 5 8

Table 2: Theoretical and empirical reaction times. obtained confirm the feasibility of the system and, after
analyzing the results, it can be stated that it provides a fast and
Theoretical Empirical
flexible alternative to make future homes smarter and safer.
# of cycles Time (𝜇s) Time (𝜇s)
𝑡ml 471 29.44 111.59 Conflict of Interests
𝑡adq 33 114.06
The author declares that there is no conflict of interests
𝑡cc 24 1.5 117.60
regarding the publication of this paper.
𝑡sc 142 8.87
𝑡dr (average) 4
Acknowledgments
𝑡rs 1,000
Reaction time 1,157.87 1,233.19 This work has been funded by Xunta de Galicia, Ministerio
de Economı́a y Competitividad of Spain, and FEDER funds
of the European Union under Grants 2012/287, R2014/037,
Table 2 shows on the right the empirical times when averaging and TEC2013-47141-C4-1-R. The author would like to thank
10,000 times the measurement for each section of the code. Rafael Constenla Casal for his assistance during the whole
Note that the main loop section requires roughly 111.6 𝜇s, development of the system.
in contrast to the theoretical time, which only requires
29.4 𝜇s. This difference is due to the fact that it also includes References
the time required to handle certain asynchronous inter-
[1] National Fire Protection Association Website, June 2015, http:
ruptions and verifications, which were not computed when //www.nfpa.org/.
counting instructions during the theoretical analysis. [2] J. R. Hall, “Home electrical fires,” NFPA Report, 2013.
There is only one software function that carries out the [3] Electrical Safety Foundation International (ESFi), June 2015,
task of acquiring the current sensor data and that determines http://www.esfi.org/.
whether the relay has to be opened. An average of 117.6 𝜇s [4] C.-H. Lien, C.-H. Lin, Y.-W. Bai, M.-F. Liu, and M.-B. Lin,
elapsed when executing such a function, which is really “Remotely controllable outlet system for home power manage-
similar to the sum of the theoretical values of 𝑡adq , 𝑡cc , and ment,” in Proceedings of the IEEE 10th International Symposium
𝑡sc (124.4 𝜇s). on Consumer Electronics (ISCE ’06), pp. 1–6, Saint Petersburg,
Russia, July 2006.
6.3.4. Reaction Time Comparison. After all the theoretical [5] C.-H. Lien, Y.-W. Bai, and M.-B. Lin, “Remote-controllable
and empirical measurements it can be observed that both power outlet system for home power management,” IEEE
approximations yield similar values (with a difference of Transactions on Consumer Electronics, vol. 53, no. 4, pp. 1634–
75 𝜇s) and that the software side of the system does not 1641, 2007.
constitute a bottleneck: even in the worst case (empirical [6] C.-H. Lien, H.-C. Chen, Y.-W. Bai, and M.-B. Lin, “Power
measurements) it would be clearly less than the average monitoring and control for electric home appliances based on
circuit breaker trip time (20 ms). It can be also concluded that power line communication,” in Proceedings of the IEEE Interna-
the time required by the relay to open the circuit is critical and tional Instrumentation and Measurement Technology Conference
(IMTC ’08), pp. 2179–2184, IEEE, Vancouver, Canada, May
restricts the ability of the system to react faster to electrical
2008.
events. [7] C.-H. Lien, J.-C. Lin, and Y.-W. Bai, “Design and implemen-
tation of a remotely controllable UPS outlet system,” in Pro-
7. Conclusions ceedings of the 12th IEEE International Symposium on Consumer
Electronics (ISCE ’08), pp. 1–4, IEEE, Vilamoura, Portugal, April
This paper has presented the design and implementation of 2008.
a ZigBee-based smart power socket system whose function- [8] Y.-W. Bai and C.-H. Hung, “Remote power on/off control
alities include remote control, current consumption moni- and current measurement for home electric outlets based on
toring, avoidance of overconsumptions, detection of vampire a low-power embedded board and ZigBee communication,”
currents, and the prevention of electrical fires and shocks. in Proceedings of the 12th IEEE International Symposium on
In order to demonstrate such features, a simple testbed was Consumer Electronics (ISCE ’08), pp. 1–4, Vilamoura, Portugal,
set up and several experiments were performed. The results April 2008.
International Journal of Distributed Sensor Networks 11

[9] H. G. R. Tan, A. C. Tan, M. Iriana, and V. H. Mok, “Power socket [33] S. J. Isaac, G. P. Hancke, H. Madhoo, and A. Khatri, “A survey
programmable circuit breaker system,” in Proceedings of the of wireless sensor network applications from a power utility’s
IEEE 2nd International Power and Energy Conference (PECon distribution perspective,” in Proceedings of the EEE African Con-
’08), pp. 574–577, IEEE, Johor Baharu, Malaysia, December ference (Africon ’11), pp. 1–5, Livingstone, Zambia, September
2008. 2011.
[10] J. Han, H. Lee, and K. R. Park, “Remote-controllable and [34] S. J. Barro, T. M. Fernández-Caramés, and C. J. Escudero,
energy-saving room architecture based on ZigBee communica- “Enabling collaborative musical activities through wireless
tion,” IEEE Transactions on Consumer Electronics, vol. 55, no. 1, sensor networks,” International Journal of Distributed Sensor
pp. 264–268, 2009. Networks, vol. 2012, Article ID 314078, 13 pages, 2012.
[11] C. H. Lien, Y. W. Bai, H. C. Chen, and C. H. Hung, “Home appli- [35] ZigBee IP, June 2015, http://www.zigbee.org/ip.
ance energy monitoring and controlling based on power line [36] IETF 6LoWPAN Working Group, RFC 4919: IPv6 over Low-
communication,” in Proceedings of the IEEE International Sym- Power Wireless Personal Area Networks (6LoWPANs): Overview,
posium on Consumer Electronics (ISCE ’09), IEEE Consumer Assumptions, Problem Statement, and Goals, IETF 6LoWPAN
Electronics Society, Las Vegas, Nev, USA, January 2009. Working Group, 2008.
[12] M. Lee, Y. Uhm, Y. Kim, G. Kim, and S. Park, “Intelligent power [37] F. Mattern and C. Floerkemeier, “From the internet of comput-
management device with middleware based living pattern ers to the internet of things,” in From Active Data Management
learning for power reduction,” IEEE Transactions on Consumer to Event-Based Systems and More, vol. 6462 of Lecture Notes
Electronics, vol. 55, no. 4, pp. 2081–2089, 2009. in Computer Science, pp. 242–259, Springer, Berlin, Germany,
[13] A. L. Lentine, J. R. Ford, J. R. Finn et al., “An intelligent electrical 2010.
outlet for autonomous load control for electric power grids with [38] J. Blaus and D. Allan, Electrical Installations: NVQ and Technical
a large percentage of renewable resources,” in Proceedings of the Certificate Book 2, Heinemann Educational Publishers, 2005.
IEEE Power and Energy Society General Meeting (PES ’12), pp. [39] G. Stokes, A Practical Guide to the Wiring Regulations, Blackwell
1–8, IEEE Power & Energy Society, San Diego, Calif, USA, July Publishing, 1994.
2012.
[40] IEC, “Calculation of thermally permissible short-circuit cur-
[14] L.-J. Kau, B.-L. Dai, C.-S. Chen, and S.-H. Chen, “A cloud net-
rents, taking into account non-adiabatic heating effects,” IEC
work-based power management technology for smart home
Standard 949, IEC, 1988.
systems,” in Proceedings of the IEEE International Conference on
[41] C. M. Ramya, M. Shanmugaraj, and R. Prabakaran, “Study
Systems, Man, and Cybernetics (SMC ’12), pp. 2527–2532, IEEE,
on ZigBee technology,” in Proceedings of the 3rd International
Seoul, Republic of Korea, October 2012.
Conference on Electronics Computer Technology (ICECT ’11), pp.
[15] G. Horvat, D. Vinko, and D. Zagar, “Household power outlet
297–301, IEEE, Kanyakumari, India, April 2011.
overload protection and monitoring using cost effective embed-
ded solution,” in Proceedings of the IEEE Mediterranean Confer- [42] Digi International, June 2015, http://www.digi.com/.
ence on Embedded Computing (MECO ’13), Budva, Montenegro, [43] T. Ganu, D. Rahayu, D. P. Seetharam et al., “SocketWatch: an
2013. autonomous appliance monitoring system,” in Proceedings of
[16] Belkin WeMo Switch, June 2015, http://www.belkin.com/. the 12th IEEE International Conference on Pervasive Computing
[17] MeterPlug, June 2015, http://meterplug.com/. and Communications (PerCom ’14), pp. 38–43, IEEE, Budapest,
Hungary, March 2014.
[18] Orange MyPlug, June 2015, http://www.my-plug.fr/.
[19] SafePlug, June 2015, http://www.safeplug.com/.
[20] PlugWise, June 2015, http://www.plugwise.com/.
[21] Modlet, June 2015, http://themodlet.com/.
[22] Ecobee SmartPlug, June 2015, https://www.ecobee.com/.
[23] KNX Assocation, June 2015, http://www.knx.org/.
[24] Echelon LonWorks, June 2015, http://www.echelon.com/tech-
nology/lonworks.
[25] BACnet Official Website, June 2015, http://www.bacnet.org/.
[26] DALI Activity Group, June 2015, http://www.dali-ag.org/.
[27] ISO/IEC, “Information technology—home electronic systems
(HES)—part 3–10: wireless short-packet (WSP) protocol opti-
mized for energy harvesting—architecture and lower layer
protocols,” ISO/IEC 14543-3-10:2012, ISO/IEC, 2012.
[28] Z-Wave Official Website, June 2015, http://www.z-wave.com/.
[29] Dash7 Alliance Website, June 2015, http://www.dash7.org/.
[30] Hart Communication Foundation, June 2015, http://www.hart-
comm.org/.
[31] T. Arampatzis, J. Lygeros, and S. Manesis, “A survey of appli-
cations of wireless sensors and wireless sensor networks,” in
Proceedings of the Mediterranean Conference on Control and
Automation (MED ’05), pp. 719–724, IEEE Control Systems
Society, Limassol, Cyprus, June 2005.
[32] S. Barro-Torres, T. M. Fernández-Caramés, H. J. Pérez-Iglesias,
and C. J. Escudero, “Real-time personal protective equipment
monitoring system,” Computer Communications, vol. 36, no. 1,
pp. 42–50, 2012.
International Journal of

Rotating
Machinery

International Journal of
The Scientific
Engineering Distributed
Journal of
Journal of

Hindawi Publishing Corporation


World Journal
Hindawi Publishing Corporation Hindawi Publishing Corporation
Sensors
Hindawi Publishing Corporation
Sensor Networks
Hindawi Publishing Corporation
http://www.hindawi.com Volume 2014 http://www.hindawi.com Volume 2014 http://www.hindawi.com Volume 2014 http://www.hindawi.com Volume 2014 http://www.hindawi.com Volume 2014

Journal of

Control Science
and Engineering

Advances in
Civil Engineering
Hindawi Publishing Corporation Hindawi Publishing Corporation
http://www.hindawi.com Volume 2014 http://www.hindawi.com Volume 2014

Submit your manuscripts at


http://www.hindawi.com

Journal of
Journal of Electrical and Computer
Robotics
Hindawi Publishing Corporation
Engineering
Hindawi Publishing Corporation
http://www.hindawi.com Volume 2014 http://www.hindawi.com Volume 2014

VLSI Design
Advances in
OptoElectronics
International Journal of

International Journal of
Modelling &
Simulation
Aerospace
Hindawi Publishing Corporation Volume 2014
Navigation and
Observation
Hindawi Publishing Corporation
http://www.hindawi.com Volume 2014
in Engineering
Hindawi Publishing Corporation
http://www.hindawi.com Volume 2014
Engineering
Hindawi Publishing Corporation
http://www.hindawi.com Volume 2014
Hindawi Publishing Corporation
http://www.hindawi.com
http://www.hindawi.com Volume 2014

International Journal of
International Journal of Antennas and Active and Passive Advances in
Chemical Engineering Propagation Electronic Components Shock and Vibration Acoustics and Vibration
Hindawi Publishing Corporation Hindawi Publishing Corporation Hindawi Publishing Corporation Hindawi Publishing Corporation Hindawi Publishing Corporation
http://www.hindawi.com Volume 2014 http://www.hindawi.com Volume 2014 http://www.hindawi.com Volume 2014 http://www.hindawi.com Volume 2014 http://www.hindawi.com Volume 2014

You might also like