You are on page 1of 9

Smart Home Control System Based on Raspberry Pi

and ZigBee

Tahar Dahoumane ✉ and Mourad Haddadi


( )

Department of Electrical Engineering, National Polytechnic School of Algiers, ENP,


16200 El-Harrach, Algeria
tahar.dahoumane@g.enp.edu.dz, mourad.haddadi@enp.edu.dz

Abstract. The main benefit of smart home system is controlling and monitoring
of household appliances remotely and flexibly. Control systems for smart home
have been improved with the integration of technologies of communication,
digital information and electronics in the home environment. In this paper, a new
and flexible smart home control system is presented. The proposed system is
based on the Raspberry Pi B+ board, which is programmed as the embedded home
server and the standard ZigBee is used to ensure communications within the home
network. To accomplish this experiment, XBee ZigBee devices, smart plugs, and
Raspberry pi board are used.

Keywords: Smart Home · ZigBee · Embedded server · Web services · Smart plug
HTML user interface

1 Introduction

The area of smart home automation is characterized by an infrastructure that enables


intelligent networking of devices that use different wireless and wired technologies to
ensure seamless integration, making it easier to use the home systems while creating a
personalized and secure home space [1]. Smart home is intended to render the life much
easier and convenient for its occupants, brings security and also provide some energy
efficiency savings [2]. The one important benefit of a smart home is providing an
advanced control system, which permits to users to control the household appliances in
a simple and flexible manner. Smart home control systems are developed using different
technologies of communication, information and electronics. Improving of the smart
home control system is based on the integration suitably of new technologies within the
home environment and implementing low cost and advanced architectures using smart
devices and adequate equipments. The integration of the internet and implementing of
server and gateway enables the remote control of devices and appliances within the home
environment. In this paper, we proposed a reliable and flexible smart home control
system based on different technologies and smart devices.
In the last years, several control system have been proposed based on different tech‐
nologies and standards. The mobile phone is widely used to control appliances remotely
as they presented in [3, 4]. Kaur [5] presents a system of controlling household devices
based on a Micro-controller (ATMEL AT89S52).

© Springer International Publishing AG 2018


M. Hatti (ed.), Artificial Intelligence in Renewable Energetic Systems, Lecture Notes
in Networks and Systems 35, https://doi.org/10.1007/978-3-319-73192-6_4
Smart Home Control System Based on Raspberry Pi and ZigBee 35

These systems suffer from limitations such as the lack of flexibility where the appli‐
ances are controlled via a one type of device (as mobile phone through GSM). Another
inconvenient for systems that proposed SMS messages as solution to remotely control
home appliances is that the user has to remember codes or names of all commands to
include in the message body. Hence, the development of a dynamic and flexible user
interface (UI) for controlling and monitoring applications remain the most promising
solution.
In order to overcome the problem of the intrusiveness of the home installation,
different works were presented that use wireless technologies. Sriskanthan et al. [6]
proposed a system of smart home based on a wireless technology which is a Bluetooth.
Zhang et al. [7] present a Wi-Fi smart plug which permits controlling appliances wire‐
lessly based on the WiFi technology, where services are provided using the REST
(Representation State Transfer) architecture.
In order to ensure a remote controlling and monitoring services for smart home
control systems, the proposed approaches converge to the exploitation of a tiny
computers that can be programmed as embedded server and gateway as it is presented
in [8] where the control system proposed is designed around the Cortex A8 processor.
In this paper a raspberry pi B+ is used and programmed as the home embedded
server. The raspberry pi B+, presented in July 2014, is a tiny computer, which has a size
of 85 mm × 56 mm. This board comes with a 512Mo of RAM and an ARM BCM28351
Broadcom SoC (System on Chip) processor running at 700 MHz. The Raspberry Pi has
many positive aspects such as its flexibility and the possibility of its utilization in varia‐
tion of purposes. The Raspberry Pi is suitable for projects that require a graphic interface
or the Internet, and this advantage makes Raspberry Pi perfect for usage in Internet of
Things vision [9].

2 System Architecture

The Fig. 1 shows the proposed smart home control system. Users can control household
appliances locally using a Desktop PC, which is connected to the LAN network via RJ45
interface or via smart devices such as tablet and smart phones that are connected to the
Wi-Fi network. The user can also control the appliances remotely via internet. A user
interface (UI) is coded in HTML in order to simplify the control task for users and gives
them the possibility to use variety of smart devices, and this increase the flexibility of
the smart home control system.
36 T. Dahoumane and M. Haddadi

Fig. 1. The control system architecture.

2.1 Description of the Central Unit

The Fig. 2 shows the block diagram of the central unit, which is composed from the
Raspberry pi B+ board and an XBee module. This XBee ZigBee module is configured
as the coordinator of the network, which is responsible for forming the network and
assigning addresses for XBee devices within the home network. The Raspberry pi B+
board is programmed as an embedded server, where the home management system is
implemented and data are stored. The implementation details of the home embedded
server are discussed further in the Sect. 3.

Fig. 2. Diagram block of the central unit

The characteristics of the raspberry pi B+ are given as follow:


• 512 MB SDRAM @400 MHz.
• ARM BCM2835 processor
• Dual step-down (buck) power supply for 3.3 V and 1.8 V
• 5 V supply has polarity protection, 2A fuse and hot-swap protection
• New USB/Ethernet controller chip
• 4 USB ports instead of 2 ports in B model and 1 port in A model
Smart Home Control System Based on Raspberry Pi and ZigBee 37

• 40 GPIO pins instead of 26 in A and B model.


• 2 EEPROM Plate identification pins
• Composite (NTSC/PAL) video integrated into 4-pole 3.5 mm ‘headphone’ jack
• MicroSD card socket instead of full size SD in old models
The Raspberry pi supports different distribution (Operating Systems “OS”) as
Ubuntu, Arch Linux, Debian and Raspbian as the default one, and this permits a large
scale of choice about the OS to use.
Commands for controlling appliances or managing the home network are passed
through the central unit. The central unit has the role of a gateway, which permits the
execution, in the real home environment, of commands or requests initiated by remote
users through internet. The received requests via internet will be interpreted by the
gateway and then specifics ZigBee commands will be transmitting by the XBee coor‐
dinator to a specific XBee module in the home network.
Exchanging data between the Raspberry pi and the XBee coordinator is done via the
serial interface (RS232). Parameters of the serial communications are well defined in a
java program and must match the ones entered when configuring the coordinator under
the X-CTU software. The FTDI chip enables conversion of the received data on the
XBee’s pins to the serial protocol, which permits talking suitably with the Raspberry pi
board. Using the java XBee library offered by DiGi international, java programs can be
programmed to enable the raspberry pi to send commands or handle the received data
from the XBee coordinator.
The Raspberry pi is connected to internet via the RJ45 interface, which enables
remote controlling of equipments and appliances by remote users.

2.2 Description of the Smart Plug


The smart plug is composed from two important parts: a power and command circuit
and sensor board. Controlling Appliances by such smart devices in the smart home is
an important task. Smart plug contributes to render smarter the control system and to
provide the flexibility and simplicity for users to control their equipments within the
home network.
Terminal boards (smart plugs) permit controlling the equipments and turn them ON
or OFF and exchange data with a central unit. The data exchanged are the status of the
equipment, the value of the electrical consumption and others environmental values such
as temperature and humidity. In this paper, a smart plug is developed (see Fig. 3) which
is composed from an XBee transceiver module, a sensor board and a power circuit. The
smart plug exchanges data wirelessly with the central unit using the ZigBee standard.
The ZigBee is performed for a short occupation of the transmission medium and trans‐
mitting a low data rate since the commands for controlling equipment in the smart home
network are of low size.
38 T. Dahoumane and M. Haddadi

Fig. 3. Diagram block of the smart plug

The XBee device is chosen to satisfy the need of smart plug. The X-CTU software
from DiGi International is used to configure XBee devices. A mesh network is config‐
ured as the topology of our network. The Coordinator is the responsible of assigning
addresses to XBee Routers that are mounted in the developed boards.

Description of the Command and Power Circuit


Upon configuration under C-XTU, one of the pin of the XBee router is configured as an
analog input and the other as a digital output. The nineteenth (19) pin is configured as
the digital output (DIO1) that serves as a command of the power circuit. As shown in
the Fig. 4, the output of the opto-coupler (6N135) is enabled or disabled via a transistor
that is connected to the XBee DIO1 pin.

Fig. 4. Smart plug’s command and power circuit released under “Proteus”

The power circuit is composed from a relay that receives order from the transistor
relied to the output of the opto-coupler. A command (turn ON or OFF the appliance)
received on the antenna of the XBee device will activate, through the smart plug’s circuit,
the coil of the relay, which provides electrical energy to the appliance.
Smart Home Control System Based on Raspberry Pi and ZigBee 39

Description of the sensor Board


The Fig. 5 represents the circuit of the sensor node, realized under “Proteus”. The XBee
module is equipped with four ADC (Analog Digital Converter) which permit to
configure four analog input/output on the pins 17 to 20 (DIO0 to DIO3). As presented
in the Fig. 5, the pin number (17) is the one used for receiving the lectures from the
LM335 sensor.

Fig. 5. Circuit of the sensor board released under “Proteus”.

3 Software Development

The raspberry pi is programmed as the home embedded server. Different programming


languages can be used in the case of the raspberry pi board such as C, C++, Python or
java. In the proposed architecture, java language is used to power the embedded server.
The JES (Java Embedded Suite) is a lightweight API performed for the embedded envi‐
ronment, which permits creating a java data base (DB) and providing web services for
remote control purposes based on the REST architecture. The Glassfish server is the
platform adopted for the proposed architecture.
The REST architecture provides web services for users based on the client/server
architecture. Controlling of equipment, managing the network and monitoring of
temperature are considered as services that are provided by the smart home system.
The Fig. 6 shows a dynamic UI which is coded in HTML with JavaScript. This UI
permits to users to monitor and control the household equipments in easy and flexible way.
40 T. Dahoumane and M. Haddadi

Fig. 6. The HTML user interface.

The actions performed by users, are traduced in requests. The requests are formed
from two parts, an URI and a specific data.
The URI (Uniform Resource Identifier) is a unique identifier for a resource given as
follow: http://<ip>:<port>/path_to_resouce. The URI points to a resource on the
embedded server, this resource is programmed to satisfy the wanted service (ex. reading
the environmental temperature where the selected smart plug is located).
Generally, resources on the embedded server need some data to be executed correctly
(ex. the MAC address of the smart plug of the equipment that the user wants to turn ON
or OFF). REST is representation-oriented architecture, hence, the data that is exchanged
with the server have the format of JSON (JavaScript Object Notation) and XML (eXten‐
sible Markup Language) or in another formats types.
All requests goes through the embedded server based on the client/server architecture
and this is done locally via the Wi-Fi or LAN network or remotely via internet. Received
requests by the embedded server will be transferred to the XBee coordinator via the
serial RS232 protocol. The coordinator will interrogate or order to the smart plug to
execute the intended commands.

4 System Evaluation

The XBee devices are used in order to form the ZigBee mesh network, and are configured
using the X-CTU software. The XBee coordinator is configured as the trust center where
commands goes through this node. The ‘XBee Java Library’, available in the web page
of Digi International, is exploited to ensure the communication between the coordinator
and the home embedded server.
The proposed architecture relies between the UI (user interface), the embedded
server and the ZigBee home network. The executed commands in the real home envi‐
ronment are initiated by the user through the UI, received by the embedded server and
then transferred as commands to the XBee coordinator. The coordinator sent commands
to a specifics smart plug within the home network. The commands are executed by smart
plugs and then the information are sent back to the server. This proposed architecture
shows a reliable control system for smart home.
Smart Home Control System Based on Raspberry Pi and ZigBee 41

Some proposed control systems are based on GSM or Microcontrollers that have the
disadvantage of the lack of flexibility, where the user have to remember commands or
codes for controlling equipments within the home environment. In this paper, a user
interface is coded in HTML and JavaScript which permit dynamic web page. This UI
can be consulted via PCs, mobiles or other smart devices, which increases in flexibility
of the control system.
The test conducted shows that the proposed system is a flexible and reliable smart
home control system. Smart devices as mobile or GSM modem can be connected to the
Raspberry pi, which gives the possibility to an extension of the system. Thus, the Rasp‐
berry pi represents a good choice for extensible smart home control system.

5 Conclusion

With the emerging of technologies of communication and information, the development


of control systems for household appliances become a necessity. Several control systems
have been proposed, which presents some advantages and disadvantages. In this paper,
a new control system of household appliances is presented. The proposed system is based
on an embedded server, which has the role of a gateway that permits to users to control
their equipments via Wi-Fi, LAN network or internet. The Raspberry pi B+ is used and
programmed as the embedded server, which is powered by java. The REST architecture
is used to provide web services which facilitate controlling and monitoring operations.
The communication within the home network, under the supervision of the central unit,
is based on the ZigBee standard which is adopted for controlling and monitoring appli‐
cations. The proposed system shows the benefit of using the newest technologies to
increase the flexibility and reliability in the smart home system. Such proposed control
system can be incorporated in the future smart home that will be connected to the smart
grid.

References

1. Toschi, G.M., Campos, L.B., Cugnasca, C.E.: Home automation networks: a survey. Comput.
Stand. Interfaces 50, 42–54 (2017). https://doi.org/10.1016/j.csi.2016.08.008
2. Robles, R.J., Kim, T.: Review: context aware tools for smart home development. Int. J. Smart
Home 4(1), 1–12 (2010)
3. Nichols, J., Myers, B.A.: Controlling home and office appliances with smart phones. IEEE
Pervasive Comput. 5(3), 60–67 (2006). https://doi.org/10.1109/MPRV.2006.48
4. Sikandar, M., Khiyal, H., Khan, A., Shehzadi, E.: SMS based wireless home appliance control
system (HACS) for automating appliances and security. Issues Sci. Inf. 6, 887–894 (2009).
https://doi.org/10.28945/3304
5. Kaur, I.: Microcontroller based home automation system with security. IJACSA Int. J. Adv.
Comput. Sci. Appl. 1(6), 60–65 (2010). www.ijacsa.thesai.org. Accessed
6. Sriskanthan, N., Tan, F., Karande, A.: Bluetooth based home automation system. Microprocess.
Microsyst. 26(6), 281–289 (2002). https://doi.org/10.1016/S0141-9331(02)00039-X
7. Wang, L., Peng, D., Zhang, T.: Design of smart home system based on WiFi smart plug. Int.
J. Smart Home 9(6), 173–182 (2015). https://doi.org/10.14257/ijsh.2015.9.6.19
42 T. Dahoumane and M. Haddadi

8. Zhang, S., Xiao, P., Zhu, J., Wang, C., Li, X.: Design of smart home control system based on
Cortex-A8 and ZigBee. In: Proceedings of the IEEE International Conference on Software
Engineering and Service Sciences, ICSESS, pp. 675–678 (2014). https://doi.org/10.1109/
ICSESS.2014.6933658
9. Vujovic, V., Maksimovic, M.: Raspberry Pi as a sensor web node for home automation.
Comput. Electr. Eng. 44, 153–171 (2015). https://doi.org/10.1016/j.compeleceng.2015.01.019

You might also like