Vous êtes sur la page 1sur 7

The use of NFC and Android technologies to enable

a KNX-based Smart Home


Gabriele De Luca, Paolo Lillo, Luca Mainetti, Vincenzo Mighali, Luigi Patrono, Ilaria Sergi
Dept. of Innovation Engineering
University of Salento
Lecce, ITALY
Abstract In recent years, due the improvement of humans
living standard, smart homes are receiving an increasing interest.
They can provide several useful services such as support for the
elderly and disabled people, access control, environmental
monitoring, and home automation. Furthermore, with the
widespread diffusion of mobile devices (i.e., smartphones, tablets)
and their integration with new auto-identification technologies
(such as the NFC technology), the need to control and manage the
smart home through these devices is increasing. In this context,
the main goal of this work is to develop and validate an
architecture, both hardware and software, able to monitor and
manage a KNX-based home automation system through an
Android mobile device in an efficient and safe way. More in
detail, a software system able to configure an Android
application consistently with the home automation implant was
designed and implemented as well as an Android application able
to manage the entire home automation system based on the KNX
standard. A further Android module, which exploits NFC
technology, was developed in order to address the access control
issue. A real use case is presented, which demonstrate the
effectiveness of the proposed software system.
Keywords KNX; Android; NFC; Building Automation;
Security.

I.

INTRODUCTION

The increasing success of the Internet of Things (IoT) [1]


has encouraged a rapid movement from the Human-toMachine (H2M) to the new Machine-to-Machine (M2M)
paradigm, so that the end-to-end communication can be
executed without human intervention. Indeed, the IoT vision
refers to the extension of the Internet to the world of concrete
objects and places, which can communicate data about
themselves and access aggregated information from other
objects or places. The IoT concept grows and develops hand in
hand with "Smart Home" vision. In fact, due to the
improvement of humans living standard, people are
increasingly interested in solutions that allow users to not only
make more comfortable their living environment, but also to
remotely monitor the status of their home and reduce the
energy consumption. In this perspective, a smart home should
be able to utilize private and public networks to connect home
devices to each other and to the outside Internet world. It has
to provide a total integration among security systems,
environmental
monitoring and
management,
home
automation, home entertainment, and access control systems,
by reporting the status of all home devices in an intuitive and

user-friendly interface and allowing the user to interact with


them. Moreover, the concept of the smart home is a promising
way of improving home care for the elderly and disabled in a
non-obtrusive way, allowing greater independence,
maintaining good health and preventing social isolation [2].
Smart homes are often equipped with environmental sensors,
actuators, and/or biomedical monitors. The devices operate in
a network connected to a remote center for data collection and
processing. The remote center diagnoses the ongoing situation
and initiates assistance procedures as required [3].
In the recent literature, there are several works addressing
the issue of the management of smart homes. In [4], a software
module able to detect and solve interaction among users
policies, in smart homes based on KNX standard [5], is
designed and implemented as part of the Engineering Tool
Software (ETS) [6], a software tool used to configure a KNXbased implant.
Furthermore, as the mobile devices are increasingly
ubiquitous in our society, the trend to use these devices for the
control of smart homes is becoming more widespread, with
particular attention to home automation services management.
In [7], for instance, the authors present a system to monitor
and control several home system parameters by establishing a
connection among home devices and the user via his
smartphone. The proposed solution is able to provide instant
notification of any failures that may occur in the home. In [8],
an application for mobile devices, in particular for iOS
phones, which combines home automation and security
services, is presented. Again, for the iOS Operating System
(OS), an application for the supervision and control of a home
automation system is also developed in [9]. In addition to
these solutions for iOS devices, other works in the literature
deal with the implementation of systems for home automation
implant management by exploiting the Android OS [10].
Finally, the use of modern mobile devices, which integrate
auto-identification technologies, such as the Near Field
Communications (NFC) [11], offers the possibility to develop
new services for a smart home. The NFC technology builds
upon Radio Frequency Identification (RFID) [12], [13]
systems by allowing two-way communication between
endpoints. By using this technology, dummy things become
smart things able to communicate information to the user
(e.g., identification for access control, instruction for use of an
appliance, dosage of a drug, etc.) [14].

The aim of the present work is to design and develop a


system able to control and manage a smart home by using an
Android smartphone in a flexible, simple, and safe mode. In
particular, on the one hand, it allows controlling, both locally
and remotely, a KNX-based home automation system by
providing a high-level abstraction of real devices, and, on the
other hand, it provides a control access system based on the
NFC technology. More in detail, we present a system that
mainly consists of two components: a Java application that
builds the configuration file for the Android application in
accordance with users requirements, and the Android
application itself that provides the user with intuitive interface
for managing home automation system and home access. To
evaluate the effectiveness of the proposed system, a use case is
presented that demonstrates how our software system is able
to control in real-time each KNX device.
First details of the proposed architecture, related only to
home automation component, are reported in [15]. It does not
include some architecture extensions able to integrate also
auto-identification technologies in Radio Frequency (RF). On
the contrary, in the current work, both major implementing
details of the home automation system and the extension
related to NFC are presented.
The paper is structured as follows. In Section II, the
proposed system architecture is presented, whereas in Section
III, the details of the Home Automation component are
reported. In Section IV, the Control Access component is
described. The use case aimed to validate the Home
Automation system is described in Section V. Conclusions are
drawn in Section VI.
II.

PROPOSED SYSTEM ARCHITECTURE

The proposed system architecture, shown in Fig. 1, mainly


consists of two different sub-systems: (i) Home Automation
module, and (ii) Access Control module. One of the key
elements of this architecture is the KNX/IP router, which
represents a tunnel that links the KNX world to the Internet, so
allowing remote devices (e.g., smartphones, tablets, etc.) to
send, anytime and anywhere, messages to KNX-based home
automation system.
The Home Automation module is split into two different

components: Editor Application, and Android Application


(App). The Editor component is a Java software application
that has been designed in order to create the configuration file
that customizes the Android App in accordance to the user
needs. Before the technician can leverage the functionalities of
the Editor, he must have configured and put into operation the
KNX implant through the ETS tool. Then, he can use the
Editor application to set up the access parameters, build the
Android App screens, and bind the control components to the
created screens. Instead, by using the App, the user is able to
control the home environment both locally and remotely
through his Android mobile device. More in detail, when a
local connection is established between the mobile device and
the home automation system, the smartphone is used as a
smart remote control since it allows an easy management of
devices that are in the same local network. Instead, if the user
exploits the Android App to connect to the home automation
system remotely (that is, when he is away from his own
home), he can monitor and manage home devices anytime and
anywhere, achieving a real advantage in terms of comfort and
safety. Indeed, on the one hand, the user can adapt the
domestic environment to his needs before returning home, on
the other hand, he can verify that no dangerous events happen
such as active electrical loads, undesirable intrusions, and so
on.
The Access Control module exploits the NFC technology
to allow the management of the access attempts. An NFC
reader is located in the house, just near the door and it is
connected to a Linux authentication server. The user can enter
his own home by approaching the smartphone to the NFC
reader so that it can transfer the necessary authentication
information to the server. In order to provide an adequate
security level, the access control module guarantees two
successive security steps. First, the application requires the
user to insert a secret Personal Identification Number (PIN).
Then, it automatically collects a combination of information
related to the smartphone (e.g., MAC address or serial number
of the CPU) and encrypts them according to a public-key
security algorithm. This message, which represents the
footprint of the Android device, is sent to the authentication
server through the NFC reader. The server, after decoding the
authentication message, compares the access credentials with
a list of authorized terminals stored in its memory. If the
applicant's identity is successfully verified, the server sends a
KNX message to the actuator that controls the electronic lock
on the door in order to open it.
III.

DESCRIPTION OF THE HOME AUTOMATION COMPONENT

A. Editor
By using the Editor application, the technician can build
the structure of the Android App, i.e., the screens containing
the controls (lights, blinds, thermostats, etc.) for managing the
home automation system. This structure is not fixed and
predefined, but it is totally based on the end-user
requirements.
Fig. 1. The proposed system architecture.

As first step, the technician imports, in the Editor, the


KNX devices that the user wishes to control through the
Android App. This operation can be executed in two ways: by

directly importing the list of devices from the ETS project


(Fig. 2) or by manually adding them to the Editor project (Fig.
3). After this first step, the Editor project contains all the home
automation devices that the user wishes to manage by
smartphone, and the corresponding addresses, i.e., the unique
identifiers through which the App sends commands to devices
or requires their status. About addresses, it is important to
emphasize that each device can have multiple addresses, each
of which allows accessing one of its features. For example, an
actuator that controls the state of a light has only two
addresses, one for switching the state of the light and one for
reading it. In contrast, a complex device, such as a thermostat,
can have many addresses: an address to read the detected
temperature, an address to read the type of actual
thermoregulation (i.e., hot/cold), an address to write the type
of thermoregulation, an address to set the thermoregulation
profile (e.g., comfort, pre-comfort, and economy), etc.
One of the peculiar characteristics of the Editor application
is that all devices, even those with more functions, and
therefore more addresses, are managed at high level, that is,
considering them as a single entity, without the need of
composing them as a set of basic features. This aspect
represents a very significant advantage, as it allows the
technician to configure the project in a much more simple and
intuitive way. Another interesting aspect is that the features of
each device are not implemented in the source code of the
Editor application, but they are parameterized in a
configuration file written in XML language that is processed
when the application starts. In this way, in order to handle new
devices on the market, it is sufficient to update the XML file
with the characteristics of the new device. The abstraction and
parameterization features of the Editor application are
highlighted in the class diagram shown in Fig. 4. In this
diagram, there is no indication of specific home automation
devices, but only the generic object device (in the data
section) is defined. To manage individual devices, the Editor
application refers to the XML configuration file, which is
shown in Fig. 4 as readConfig (in the persistence section).
From the class diagram, it is also clear that, in accordance with
the software engineering principles, the graphical user
interface (GUI) elements, the business logic, the data, and the

Fig. 2. Automatic import of the KNX devices from the ETS output file.

Fig. 3. Manually input of the KNX devices.

persistence mechanisms were kept separate each other.


In the last step, the technician builds the App screens in
accordance with the user requirements. To do so, there are two
possibilities, which are not mutually exclusive between them:
the technician can build a hierarchy of screens that
corresponds to the building structure or he can realize fully
customized screens that contain the home automation devices
regardless of their actual dislocation in the home. In the first
case, the technician can automatically extracts this information
from the ETS project (Fig. 5), whereas in the second case each
screen is manually defined. For example, the user may wish to
have all the home lights on one screen.
Once the whole procedure is completed, the Editor
application provides an output file that is used to configure the
Android App. This file is in the JSON [16] format, chosen for
its simplicity and flexibility.
B. Android App
The application dedicated to the management of the home
automation system is initially downloaded from the Google
Play as a generic application. Obviously, it is originally not
able to offer any function as it is not associated with any home
automation system. To customize the application according to
the user requirements, the technician sends to the users
smartphone (or smartphones) the JSON file generated as
output by the Editor application. This file is sent through a
reliable and secure communication service (e.g., a certified
email service).
Once the user has completed the uploading of the JSON
file, the application parses it using the JSON-simple library
[17]. This operation leads to both the making of Java objects
required for the management of the home automation devices
and the configuration of the App screens in accordance with
the user requirements. After this easy and fast setting
procedure, the user is able to manage his home automation
system (both locally and remotely) and to monitor, anytime
and anywhere, the status of his home, by using the feedbacks
sent from the KNX implant to the Android App. About the
communication between the Android OS and the KNX
implant, a Java library called Calimero [18] has been used. It
is a very straightforward and easy to use library and it was
chosen because it is open source, flexible, modular, and
strongly stable. Furthermore, among all libraries aimed at
communicating with KNX systems, Calimero seems to be the
most constantly updated and improved. The configuration
phase just described and the interaction between the Android
App and the used libraries are shown in Fig. 6.

Fig. 4. Editor Class Diagram

Since the management (especially the remote


management) of a home automation system represents a very
sensitive service from a security point of view, various
mechanisms to ensure a secure usage of the application have
been implemented. More in detail, while the local access is
guaranteed by connecting the smartphone to the local Wi-Fi
Access Point, the remote access is carried out in a safe way
through a Virtual Private Network (VPN) tunnel between the
mobile device and the local IP router. The establishment of
this secure connection is possible without the need to use
specialized software, since this feature is already provided by
all operating systems for mobile devices.
In order to guarantee an additional security level, a PIN
that the user must enter in order to access the system functions
protects the application. When the application is started for the
first time (after it has been configured through the JSON file),
it asks the user to choose the PIN. In this way, if the
smartphone is lost or stolen, any fraudulent user cannot access

Fig. 5. Building of the Android application screens.

the application and then the home management features.


Finally, it is interesting to highlight another useful feature
of the application for the home automation, i.e. the
management of electrical loads. By using a power meter on
one or more power lines, it is possible to control the
instantaneous power consumption of each device connected to
electrical network. In this way, if any of them is left
inadvertently switched on, the App provides the capability,
also remotely, to act on the corresponding actuator in order to
switch off the device (e.g., hair straightener, iron, etc.), so
avoiding the occurrence of dangerous consequences. In this
way, the App is able to improve the safety level of the house.
IV.

DESCRIPTION OF THE ACCESS SYSTEM BASED ON NFC


TECHNOLOGY

The Access Control module exploits the NFC technology


in Peer-to-Peer (P2P) mode to exchange data. In the proposed
solution, the chosen devices are a NFC enabled smartphone
(i.e., a Samsung Galaxy Nexus) and the SCM Microsystems
SCL3711 USB Dongle NFC reader, as the latter is the bestsupported reader by NFCPY software libraries [19]. These
libraries have been chosen because they are the most advanced
NFC P2P desktop libraries. The NFC reader has been
connected to a Linux authentication server placed in the

Fig. 6. Configuration phase and modules interaction.

house. In this server, a list containing all authorized users is


stored (i.e., a list containing all the identification of the
authorized smartphone).
When the user initiates the Access Control module, he
chooses a PIN code that is encrypted by using the MD5
algorithm, a widely exploited cryptographic hash function that
produces a 128-bit (16-byte) hash value (MD5 checksum).
This checksum is stored in the smartphone memory. In this
way, if the user loses the smartphone, the access in his own
home is protected against ill-intentioned people: only the
smartphone owner knows the PIN, and this code is not clearly
readable from the smartphone memory. Then, in order to enter
the home, the user starts the Access Control module and enters
the personal PIN. The application encrypts the inserted PIN by
using the MD5 algorithm and compare the obtained checksum
with that stored in the smartphone memory. If the comparison
succeeds, then an alert popup on the smartphone prompts the
user to approach the mobile device at the door lock. At this
point, data transfer between the two NFC devices via the P2P
link starts. More in detail, the smartphone transfers an
identification code (ID) to the server in order to uniquely
identify itself. This ID could be the smartphone CPU serial
number, the Bluetooth card MAC address, or a combination of
these parameters.
In order to add a further security level to the system, this
ID is sent to the server by using a double level Public Key
Infrastructure (PKI), that is, the RSA algorithm. Through this
mechanism, the smartphone ID is first encrypted by using the
users private key and then by using the public key of the
server. Once transferred to the server via the P2P link, the
encrypted message is decrypted by the server by using first its
private key, and then the users public key. The first security
level (i.e. the users public/private keys pair) is used in order
to guarantee the information authenticity. Instead, the second
security level, guarantees the information confidentiality.
If the ID matches one of the IDs stored in the server list,
then a KNX message is sent by the server to the KNX implant,
i.e., to the KNX actuator that controls the door lock: the door
is therefore open.
In order to prevent the eavesdropping attack, a counter is
encrypted along with the smartphone ID and the server stores
a copy of the counter of each authorized device. This counter
is incremented, on the smartphone side, at every user access in
the house. In this way, when the server receives an authorized
smartphone ID, if the counter of the message is equal to or less
than the stored value, it does not allow the door opening.

Inherence factor or "something the user is" (e.g.,


biometric characteristic, such as a fingerprint).
In the proposed solution, the PIN represents the knowledge
factor, whereas the smartphone represents the possession
factor.
V.

A USE CASE: HOME AUTOMATION SYSTEM

The scenario used to validate the proposed and developed


system architecture is a three-storey house, as shown in Fig. 7.
The ground floor consists of a garage, which contains a light
control. The first floor consists of two rooms: a bathroom
containing an electrical loads control and a blind control, and a
living room containing a dimmer control and a light control.
Finally, the second floor consists of a bedroom containing a
thermostat control. All devices are compliant with the KNX
standard.
Of course, the first step was dedicated to the configuration
of all devices through the ETS software tool. After
reproducing the building structure within the software and
after distributing the home automation devices in the rooms of
the house, we have set up their operating parameters, first of
all the addresses through which any external application can
exploit their capabilities. Once the entire configuration was
defined by using the ETS software, it was sent to each device
via the KNX bus.
The second step was aimed at preparing the configuration
file for the Android App by using the Editor component. In
this specific use case, the App screens hierarchy reflected the
home structure, with its floors and rooms, as can be observed
in the screenshots reported in Fig. 8.a. This choice has allowed
us to define the structure of the Android application by simply
importing the information contained in the output file of the
ETS software. Afterwards, the JSON configuration file was
sent to the Android smartphone via secure email and it was
imported from the App at the first start. When the configured
App was started, by clicking on the link representing the first
floor and then on the bathroom link, the devices in that room
were shown. In this way, we were able to immediately view
the instantaneous power consumption of the electrical load
and the blind position. This is possible because, once entered
in the bathroom screen, the App sends a KNX message to the

A peculiar feature of the access control module is the use


of an authentication method known as "Two-factor
authentication" (TFA) or Strong authentication [20]. It is an
authentication approach, which requires two of the following
three authentication factors:
Knowledge factor or "something the user knows" (e.g.,
password, PIN);
Possession factor or "something the user has" (e.g.,
smart card, mobile phone);
Fig. 7. The home structure in the use case.

implant installation and it is characterized by high scalability


and ease of use. The Android App provides a user-friendly
interface through which the KNX implant could be easily
controlled and managed. The Android App is also equipped
with an efficient system for controlling electrical loads, which
allows to increase the home security and the energy saving.
To evaluate the effectiveness of the proposed system, we
also presented a real use case through which all features of our
solution are successfully tested.
Future developments of the system are focusing on further
use of NFC technology in order to provide more smart
services, for example to increase the independence of elderly
or disabled people.
a)

ACKNOWLEDGMENT
The authors thank GEWISS S.p.A. of Bergamo, ITALY,
for their precious support.
REFERENCES
[1]

[2]

[3]

[4]
b)

c)

Fig. 8. a) Screenshot of the root screen; b) Instantaneous power


consumption of the electrical load; c) Electrical load disabled.

home automation system for each control on that screen.


These messages are used to interrogate the KNX implant
about the status of devices and therefore, once responses
return, they allow Android App to receive an up-to-date view
of the devices. This example helps to understand that any
status change shown by the Android App is not due to the user
interaction with the graphical controls on the screen, but it is
the result of feedbacks received from the KNX system. The
Fig. 8.b shows the value of the instantaneous power
consumption detected by the power meter and the position of
the blind. Leveraging this information, if the user detects an
abnormal value of the instantaneous power consumption, he
can click the appropriate button in order to disable the
corresponding power line (Fig. 8.c). If so, the App sends a
KNX message to the actuator that manages the electrical load,
asking for its disconnection.
VI.

[5]
[6]
[7]
[8]

[9]

[10]

[11]

[12]

CONCLUSIONS AND FUTURE WORKS

In this work, a complete system able to manage a smart


home is designed and developed. In particular, a software
component (Editor) able to customize an Android App basing
on the user requirements and the Android App itself have been
implemented, as well as a further component able to guarantee
an efficient and secure access control mechanism. The Editor
is a Java application that the technician uses after the KNX

[13]

[14]

L. Mainetti, L. Patrono, and A. Vilei, Evolution of wireless sensor


networks towards the internet of things: a survey, 19th Int. Conf. on
Software, Telecom. and Comp. Net. (SoftCOM), Sept. 2011, pp. 1-6.
M. Fahim, I. fatima, S. Lee, and Y. Lee, Daily life activity tracking
application for smart homes using Android smartphone, 14th Int. Conf.
on Adv. Comm. Tech. (ICACT), 19-22 Feb. 2012, pp. 241-245.
A. dohr, R. Modre-Osprian, M. Drobics, D. Hayn, and G. Schreier, The
internet of things for ambient assisted living, Seventh Int. Confe. on
Inf. Tech.: New generations (ITNG), 12-14 Apr. 2010, pp. 804-809.
M. Shehata, A. Eberlein, and A. O. Fapojuwo, Managing policy
interactions in KNX-based smart homes, 31st Annual Int. Comp. Soft.
and App. Conf. (COMPSAC), 24-27 July 2007, pp. 367-378.
http://www.knx.org/. Retrieved: June, 2013.
http://www.knx.org/knx-tools/ets4/description/. Retrieved: June, 2013.
J. Mandurano and N. Haber, House away: a home management
system, Syst., App. and Tech. Conf. (LISAT), 4 May 2012, pp. 1-4.
S. R. Das, S. Chita, N. Peterson, B. A. Shirazi, and M. Bhadkamkar,
Home automation and security for mobile devices, 1st IEEE PerCom
Workshop on Perv. Comm. and Ser. Clouds, 21-25 Mar. 2011, pp. 141146.
B. Bittins, J. Siek, and M. herzog, Supervision and regulation of home
automation systems with smartphones, Fourth UKSim European
Symposium on Computer Modeling and Simulation (EMS), 17-19 Nov.
2010, pp. 444-448.
A. Zhu, P. Lin, and S. Cheng, Design and realization of home
appliances control system based on the Android smartphone,
International Conference on Control Engineering and Communication
Technology (ICCECT), 7-9 Dec. 2012, pp. 56-59.
L. Mainetti, L. Patrono, and R. Vergallo, IDA-Pay: A secure and
efficient micro-payment system based on Peer-to-Peer NFC technology
for Android mobile devices, Journal of Communications Software and
Systems (JCOMSS), vol. 8, Issue 4, Dec. 2012, pp. 117-125.
L. Catarinucci, R. Colella, M. De Blasi, L. Patrono, L. Tarricone,
Experimental performance evaluation of passive UHF RFID tags in
electromagnetically critical supply chains, Journal of Communications
Software and Systems (JCOMSS), vol. 7, Issue 2, June 2011, pp. 59-70
L. Catarinucci, R. Colella, M. De Blasi, V. Mighali, L. Patrono, L.
Tarricone, High performance RFID tags for item-level tracing
systems, in proc. of the 18th International Conference on Software,
Telecommunications and Computer Networks (SoftCOM 2010), Split,
Croatia, 2010.
L. Chen, G. Pan, and S. Li, Touch-driven interaction via an NFCenabled smartphone, IEEE International Conference on Pervasive

Computing and Communications Workshops (PERCOM Workshops),


19-23 Mar. 2012, pp. 504-506.
[15] G. De Luca, P. Lillo, L. Mainetti, V. Mighali, L. Patrono, and I. Sergi,
KNX-based home automation systems for Android mobile devices,
The Second International Conference on Smart Systems, Devices and
Technologies (SMART 2013), June 23-28, Rome, Italy.
[16] http://www.json.org/. Retrieved: June 2013.

[17]
[18]
[19]
[20]

https://code.google.com/p/json-simple/. Retrieved: June 2013.


http://calimero.sourceforge.net/. Retrieved: June, 2013.
https://launchpad.net/nfcpy. Retrieved: June 2013.
M. L. Das, "Two-Factor User Authentication in Wireless Sensor
Networks", IEEE Trans. Wireless Comm., 2009, pp. 1086-1090.

Vous aimerez peut-être aussi