Home automation system with web interface in the JdeRobot ... · Prosegur [11] provides...

11
XV WORKSHOP OF PHYSICAL AGENTS, JUNE 2014, LE ´ ON (SPAIN) 1 Home automation system with web interface in the JdeRobot framework Daniel Castellano, Jos´ e Mar´ ıa Ca˜ nas Abstract—Despite the current real estate crisis, the ratio of houses that include home automation systems is increasing. For the seller it is an aditional value, for the buyer it is a trustworthy technology that will help to improve their comfort, power efficiency and safety. The interest of companies in this field is also growing. Home automation systems share with physical agents the usage of sensors and actuators, but they are usually installed in the facilities instead of on mobile platforms. In this work we present the fourth generation of a home automation system that uses the opensource JdeRobot framework. The system consists of a central node and a distributed set of ZigBee wireless nodes (sensor or actuator ones) and video camera nodes. A web interface has been deployed for the human user access and interaction with the system, so the user can remotely read the current sensor data, see statistics, receive alarms and deactivate them, see the video in streaming and send commands to the actuators. This ongoing work builds a framework to develop home automation applications for comfort, safety, monitoring and alarms involving sensors and actuators at home. It has been validated and tested in a real home. Index Terms—Home automation, sensors, actuators, software framework I. I NTRODUCTION The home automation systems use devices (sensors, actuators and/or control elements) that allow the automation of different tasks related with the control of different aspects at home or other buildings. Generally speaking the object is to increase comfort, reduce energy consumption and increase Universidad Rey Juan Carlos. E-mails: [email protected], [email protected] security. These devices are usually integrated using indoor and/or outdoor communication networks, both wired or wireless, and their control can be done either within or outside the home. This field has many applications. As a security element it can be oriented toward personal security or material objects. As an energy efficiency element, light intensity sensors can be used to keep the light level withing a range controlling shutters to reduce the power consumption. Combining light sensors with presence sensors lights in bedroom can be turned off when not required significantly reducing the power consumption. As a comfort element a reasonable temperature can be maintained in different rooms with changing outdoor conditions. The most commonly used home sensors are the regular RGB cameras (they do not work in the dark) and motion sensors (currently they not distinguish between people, animals or other objects). The most commonly used home actuators are the acoustic alarms and relays to turn on/off lights as people walk passed, saving electricity. As the need to connect different home devices arose, standards were proposed. The most important ones are reviewed. X10 [6], developed in 1975, is the initial communication standard to remotely control electric devices. It uses the power network to communicate the different composing devices through predefined commands as specified in the standard. It is still in use today, although it has been redefined to include increased functions.

Transcript of Home automation system with web interface in the JdeRobot ... · Prosegur [11] provides...

XV WORKSHOP OF PHYSICAL AGENTS, JUNE 2014, LEON (SPAIN) 1

Home automation system with webinterface in the JdeRobot framework

Daniel Castellano, Jose Marıa Canas

Abstract—Despite the current real estatecrisis, the ratio of houses that include homeautomation systems is increasing. For the sellerit is an aditional value, for the buyer it isa trustworthy technology that will help toimprove their comfort, power efficiency andsafety. The interest of companies in this field isalso growing. Home automation systems sharewith physical agents the usage of sensors andactuators, but they are usually installed in thefacilities instead of on mobile platforms. Inthis work we present the fourth generationof a home automation system that uses theopensource JdeRobot framework. The systemconsists of a central node and a distributed setof ZigBee wireless nodes (sensor or actuatorones) and video camera nodes. A web interfacehas been deployed for the human user accessand interaction with the system, so the usercan remotely read the current sensor data, seestatistics, receive alarms and deactivate them,see the video in streaming and send commandsto the actuators. This ongoing work buildsa framework to develop home automationapplications for comfort, safety, monitoringand alarms involving sensors and actuators athome. It has been validated and tested in areal home.

Index Terms—Home automation, sensors,actuators, software framework

I. INTRODUCTION

The home automation systems use devices(sensors, actuators and/or control elements)that allow the automation of different tasksrelated with the control of different aspectsat home or other buildings. Generallyspeaking the object is to increase comfort,reduce energy consumption and increase

Universidad Rey Juan Carlos.

E-mails: [email protected],[email protected]

security. These devices are usually integratedusing indoor and/or outdoor communicationnetworks, both wired or wireless, and theircontrol can be done either within or outsidethe home.

This field has many applications. As asecurity element it can be oriented towardpersonal security or material objects. Asan energy efficiency element, light intensitysensors can be used to keep the lightlevel withing a range controlling shutters toreduce the power consumption. Combininglight sensors with presence sensors lightsin bedroom can be turned off when notrequired significantly reducing the powerconsumption. As a comfort element areasonable temperature can be maintainedin different rooms with changing outdoorconditions.

The most commonly used home sensorsare the regular RGB cameras (they donot work in the dark) and motion sensors(currently they not distinguish betweenpeople, animals or other objects). Themost commonly used home actuators arethe acoustic alarms and relays to turnon/off lights as people walk passed, savingelectricity.

As the need to connect different homedevices arose, standards were proposed.The most important ones are reviewed.X10 [6], developed in 1975, is the initialcommunication standard to remotely controlelectric devices. It uses the power networkto communicate the different composingdevices through predefined commands asspecified in the standard. It is still in usetoday, although it has been redefined toinclude increased functions.

2 XV WORKSHOP OF PHYSICAL AGENTS, JUNE 2014, LEON (SPAIN)

KNX [7] is the european standard for theautomation of homes and offices. Internet,wireless, high voltage (electric power) andlow voltage (the most commong) cablingcan be used for data transmission. It is anopen standard that allows a larger numberof commands and more varied sensor typesthan X10. KNX is not compatible with X10but there are many gateways that allow forthe use of multiprotocol systems.

SCP (Simple Control Protocol) is aMicrosoft and General Electric standard andis currently royalty free. It requires point-to-point connections and low voltage wiring,so it is not viable for systems with a largenumber of sensors. It is uncompatible withEuropean legislation, more specificaly withEN-50065[8].

In the last few years the EU has financedvarious projects which research on homeautomation systems, aiming to ease theintroduction of this technology in homes andto increase the standarization of platforms,gateways, sensors, etc.. This effort, whenapplied to the elderly care, coincideswith another high priority research linein the last European Research Framework:Ambient Assisted Living (AAL). AAL aims atincreasing artificial intelligence and servicesin houses and Old People’s Homes.

Moreover the number of companies thatoffer home automation systems which areinteroperable is increasing, allowing for theflexible creation of systems at low cost. Arecent sample of this interest is the purchaseof Nest Labs1, the developer of thermostatsand smoke alarms, by Google for 3200M$. There are companies that sell isolatedsensors that do not require interconnection(for instance, vibration sensors which emitsounds), or that have a limited connection(mainly by X10) to link several sensorsto a central node, which will sound thealarm, or visualize the IP camera. Thosesystems are generally cheap and easy toinstall and maintain, but offer little flexibility.

1https://nest.com

Other companies offer design services andimplementation of made to measure homeautomation systems, that can not be reusedand tend to be expensive.

The purpose of this research was todesign, construct and program a wireless,distributed, internet accessible homeautomation system whih also allows for theuse of security cameras. More specificallythe aim was to include it in the softwareframework JdeRobot for physical agents,extending the number of supported sensorsand actuators. In addition the introductionof ZigBee technology in sensor nodes wasanother goal. The wireless technologiesprovide more flexibility when distributingthe sensors, as well as a simpler andcheaper installation. Also some requirementswere considered such as low cost, lowpower consumption, aesthetics, ease of use,access from cell phones, interoperability(that allows for different types of sensors tobe used) and small size.

In the second section sample of varioushome automation products currently avail-able is presented. The system developed isdescribed in the third section along withthe chosen design and each one of itscomponents. The fourth section is devotedto some experiments which validates theimplementation undertaken. The paper endswith the main conclusions of the research.

II. RELATED WORKS AND PRODUCTS

Some representative samples of the homeautomation market in Spain are describedin this section. Z-Wave [9] includes severalinteroperable modules from different provi-ders, with large variety of sensors and actu-ators. It allows the creation of wirelesssystems and their management usingsmartphones. They are proprietary systemsand some of its modules are still ondevelopment. It works with differentproviders and so their prices vary. Forinstance, a central controller node costsbetween 60 and 850 euros (the most basicone does not include ethernet connection),

CASTELLANO AND CANAS: HOME AUTOMATION SYSTEM WITH JDEROBOT AND WEB INTERFACE 3

a sensor between 40 and 60 euros, and acamera between 70 and 130 euros. Themodules are not usually very expensive andZ-Wave providers also offer subscriptionpayment per services.

Verisure [10] is the alarm system ofSecuritasDirect firm. It is not a completehome automation system, as it only includesalarm sensors. The sensor kit is fixed,no made to measure system is available.The kit includes one central module, twocamera-based motion sensors, an open doorsensor, an NFC reader and a siren. Itsmain advantage is the use of volumetricsensors that work even without triggeringfalse alarms in presence of pets. It monthlycharges 99 euros and offers a policecall service (and videosurveillance in theSecuritasDirect headquarters).

Prosegur [11] provides surveillance andhome automation services. They offer acomplete home automation system (security,comfort and power saving), although theirweb site only shows surveillance modules(IP cameras), motion detectors, magneticswitches and switchboards with NFC label.They monthly charge 30 or more euros.The included equipment is similar to thatof Verisure, except for an additional motionsensor instead of an open door one.

Delta Dore [12] is a generic, multipurpose,wireless home automation system. It consistsof several modules depending on thecustomer needs. The system may managethe air conditioning, the home lights, alarmsand automatic door opening. The system iscommanded from a remote controller, froma display or from a smartphone app. It isexpensive. For instance, the central nodecosts more than 200 euros, there are sensorsfor 65 euros, etc.. although several kits areoffered that reduce the final price.

The Spanish firm Libelium [13] provides asensor network system which implements amultiprocol router that may interact from thesame device with several technologies: WiFi,ZigBee, GPRS, Bluetooth and GPS. It is asystem mainly oriented towards development

(it is based on Arduino and XBee) but thefirm may develop customized systems usingits base boards and sensors.

III. HOME AUTOMATION SYSTEM INJDEROBOT

The home automation system developedat the URJC Robotics group is known asSurveillance2. Its most up to date version,presented in this paper, is Surveillance-4. It was built upon the distributed videoSurveillance-23 [1] and upon Surveillance-3 [2], which uses Arduino processors for allthe system nodes, including the central one,and which does not have any video node.

A. DesignSurveillance-4 consists of a central node

and several wireless satellite nodes, in a starconfiguration (Fig. 1). The central node hasa low cost processor, a RaspberryPI one withGNU/Linux inside, WiFi and ZigBee. Thereare several satellite types. ZigBee satellitesinclude a low cost Arduino processor, homeautomation sensor or actuator devices andZigBee connectivity. Video satellites includea RaspberryPi processor and a webcam. Thecentral node is the only one which requiresinternet access, either wired or wireless.

Fig. 1: Designed architecture

ZigBee satellites may be either sensory oractuation nodes. In the first case they include

2http://jderobot.org/Surveillance3http://jderobot.org/Rocapal_

Enabling_Technologies_LS

4 XV WORKSHOP OF PHYSICAL AGENTS, JUNE 2014, LEON (SPAIN)

sensors that detect flood, gas, temperature,humidity, etc.. In the second, they typicallyinclude relays. They have been designed tobe low cost and low power consumption,and hence, the Arduino was chosen asthe processing unit and the ZigBee as thenetworking technology. In addition, thesenodes may be slept most of the time, savingbatteries.

In order to decrease the size of processorsand to distribute the computation loadwe chose a star topology, where thesatellites do some complex tasks, reducingthe central node CPU requirements. Thisstar architecture is flexible and scalable forfuture developments. The main risk of thisarchitecture is the single point of failure atthe central node. The wireless satellite nodesmay be distributed along the home.

The human user interacts with the systemthrough a web interface, from the webbrowser, either on a PC, a laptop, atablet or a smartphone. This interactionallows seeing the current sensor data andsending commands to the actuators. Thisweb interface was chosen to have operatingsystem and platform independence.

B. ZigBee satellite node

The satellite nodes are composed ofan Arduino UNO, a XBee shield with itscorresponding Z24-B module [20], a LED,a 6lr6 battery, a sensor and small electroniccomponents required for its operation. Theyare wireless nodes required to have lowpower consumption, so they have to besimple. The supported sensors in this versionare temperature plus humidity, humidity (forpots), gas (or smoke), light intensity, water,vibration and magnetic switch (open door).They are shown in Fig. 2.

Initially there are two types of ZigBeesatellite nodes: alarm and pure sensory ones.The last may be additionally divided intoanalog and special ones. The alarm nodesgenerate or stop voltage difference on twoof their pins when certain event occurs. In

Fig. 2: Several ZigBee satellite nodes

analog sensory nodes the voltage betweentwo of their pins varies as the measuredphysical quantity does. The software readssuch voltage using the A/D converter insidethe Arduino chip. Such reading is translatedinto a digital level in a byte (0-255 fora voltage between 0-5V). The sensors arenot calibrated, therefore there is no linealcorrespondence between the digital level andthe real value of the measured physicalquantity. In special sensory nodes the DHTprotocol is required to locally obtain thereadings. This is the case of the temperatureplus humidity sensor.

The processing inside the nodes canbe divided into local sensor reading andcommunication with the central node. Eachsensory node sends the sensor measurementsand its battery level every 2 minutes. Analogsensory nodes use their A/D converterto read both the sensor value and thebattery level. Alarm nodes send only thebattery level every 2 minutes and the alarmgeneration is sent asynchronously, just as ittakes place: the sensor itself will wake theprocessor up when the corresponding eventoccurs and the processor will immediatelysend the alarm to the central node.

In order to minimize the power consump-tion the wireless nodes are slept most ofthe time, awaking only to: first, collect thesensor reading; second, to send their data tothe central node; and third, to receive thepossible messages from the central node.

CASTELLANO AND CANAS: HOME AUTOMATION SYSTEM WITH JDEROBOT AND WEB INTERFACE 5

The satellite nodes only remain awake, withtheir ZigBee module actively listening, inthe case of alarm or warning state. This waythey can synchronously receive messagesfrom the central node (for instance, that thealarm has been deactivated by the humanuser).

Although several elements (alarms orsensors) may be included in a singlenode, for the sake of simplicity, only oneelement per node is permitted, except forthe temperature plus humidity sensor, whichphysically is a single device providing twodifferent sensor readings at the same time.

A third ZigBee node type is the actuatornode. The most common actuators are thealarm notifiers (for instance a loud-speaker),and relays to switch on/off a power plug andhence its connected device.

C. WHAP ZigBee protocol

The communication between the centralnode and the satellites is done through Zig-Bee. We have created the WHAP (WirelessHome Automation Protocol) protocol for thesending of alarms, information exchange,etc. between the nodes. Due to the lowbandwidth of ZigBee this protocol is notappropriate for massive data sending (likethe video streaming). It is specially designedto work upon ZigBee (it fits its constraints),although it can be used upon other lessdemanding standards with the number ofbytes per packet such as X10, KNX,Ethernet, etc. Depending on the context itcan be used either as a transport protocol(similar to UDP because it does not providedelivery guarantee) or as an applicationprotocol, just as it has been used inthis project (the ZigBee protocol insidethe XBee already implements the networkand transport levels and provides deliveryguarantee).

The WHAP protocol allows a maximumof 255 sensors/actuators of the same typeinside the same network, up to 255 differenttypes of sensors or actuators, and data up to

6MB (a maximum of 96 bytes in a singlepacket).

Fig. 3: WHAP ZigBee communicationprotocol

The fields inside the WHAP frame (Fig.3) are:

• ID: 2 bytes for uniquely identifyingthe final destination node; inside thisfield, the first byte indicates the typeof sensor/actuator and the secondone is the node identifier inside itstype. Currently the allowed node typesare: (0) central node, (1) temperaturesensor (from the temperature plushumidity sensor), (2) humidity sensor(from the temperature plus humiditysensor), (3) light intensity sensor, (4)humidity sensor for plants, (5) gas andsmoke sensor, (6) vibration sensor, (7)flood sensor, (8) open door/windowsensor, (9) PIR sensor (movement usinginfrared signals), (10) camera and (11)actuator. If a satellite receives a packet,this ID field specifies the destinationnode (a zero value means the messageis a broadcast for all the nodes). If thecentral node receives a packet, this IDfield shows the sender node.

• Sequence: 2 bytes for the number insidethe packet sequence. This field willincrease one unit per packet comingfrom the same data. The data canbe split in several packets to betransmitted. For data smaller than 96bytes this field is always zero.

• Timestamp: 4 bytes with the date andtime (seconds from January 1st, 1970)of when the data was sent. In the case ofa sequence each packet of the sequencemust have the same timestamp, thesame as the first packet.

• Miscellaneous byte: 2 bits are reserved(Res) and must be zeros, 3 bits (Tip) to

6 XV WORKSHOP OF PHYSICAL AGENTS, JUNE 2014, LEON (SPAIN)

indicate the type of data (0 for data froma sensor to the central node, 1 for datafrom the central node to an actuator, 2for data request from the central node toa sensor/actuator, 3 for answer with therequested data, 4 for alarm reset –thehuman user considers the alarm alreadysolved–, 5 for actuation request –onlyin messages to actuators–), 1 bit (A)to distinguish between alarms and othermessages, and 2 bits (Ur) to specifypriority (from 0 meaning not urgent upto 3 meaning very urgent).

• Data size: 1 byte showing the total sizeof the data inside the packet. Maximum96 bytes.

• Data

D. Central node

The central node consists of one Rasp-berryPI processor with GNU/Linux, oneUSB-WiFi converter to talk with videosatellite nodes and one XBee module to talkwith ZigBee satellite nodes. Typically it isdirectly connected to the power line and hasan internet connection. Besides receiving thedata and alarms from the satellites it includesthe software that specifies how to reactafter each alarm and the source code of thehome automation applications themselves(presence simulation, alarm propagation,etc.).

1) Communication with satellites: Eachsatellite sends the information from itssensor and its remaining battery level every2 minutes and sends the alarms when theyocurr. To receive them the central nodeuses its XBee module through the GPIOserial port included in the RaspberryPi,and follows the WHAP protocol. When thearriving packet is a simple sensor readingit checks whether the data are more recentthan the stored one (using the timestampfield inside the WAHP frame). If not, thepacket is discarded. If it is more recentstores it overwritting the previous one. Allthe data are stored in the database shared

with the web application. The central nodealso checks whether the remaining batterylevel falls below 6.5V and initiates the lowbattery warning in such a case.

When the arriving packet is an alarmit fires the alarm protocol. Several LEDsare activated, both in the central node andin the corresponding satellite, an acousticsiren sounds and a visual alarm notificationtriggers in the web interface. When thealarm protocol is started, the red LEDs inthe central node and in the correspondingsatellite are turned on permanently, the loudspeaker in the central node starts to soundintermittently. Once the alarm has beenmanaged and solved the home automationsystem may return to its normal state whenthe human user pushes the hardware alarmreset button or clicks on the alarm resetwidget on the web interface. Both actionscause the LED and loud speaker deactivationin the central node until a new alarm takesplace and cause the sending of a WHAPalarm deactivation message to the sourcesatellite. On the reception of such messagethrough ZigBee the satellite deactivates itsown red LED and resumes its normaloperation. In the case of resetting the alarmwithout solving the real problem the satellitewill detect it once more, send a new alarmpacket and fire the alarm protocol again.

The central node periodically checkswhether its stored data are fresh enough andwhether there is no satellite node with lostconnection. If it has not received any datafrom a given satellite in the last five minutesthe central node executes the ’inactive nodedetected’ warning.

In order to get the sensor readings fromother JdeRobot application components andto send commands to ZigBee actuator nodesfrom those components, a ZigBeeServerhas been developed. This software compo-nent talks to the ZigBee nodes, eithersensory, alarm or actuator nodes and offerstheir data through a standard high level ICEinterface, following the JdeRobot [4] policyfor intercomponent communication. It can

CASTELLANO AND CANAS: HOME AUTOMATION SYSTEM WITH JDEROBOT AND WEB INTERFACE 7

be seen as the driver to manage the ZigBeenodes hiding their low level details.

2) Web interface: The central nodeincludes a web server and a web applicationthat shows the sensor data collected from thesatellite nodes, either ZibBee or video nodes.It allows sending commands to the actuatorsof the corresponding ZibBee satellites. Inadditions it displays the active detectedalarms and allows their reset. This webinterface significantly increases the usabilityof the home automation system.

Fig. 4: Initial page of the web interface

The web server has been implementedusing de Django [24] web framework (1.6release), with its data model, templates,views, automatic administration interfaceand all the power of Python to programthe logic of the application. This frameworkallowed a fast web application developmentusing third party functionality, widely tested,like the Bootstrap[31] and JQuery[30]JavaScript APIs. With them the visualappearance of the application is appealing.Many templates have been used, they aredynamically filled with data coming from thesatellite nodes.

In the presentation layer of the webapplication the simplicity and ease of usehave been prioritized, with small texts andself explanatory images, using a proper sizeto improve visualization without hinderingthe navigation. The web interface use is quitesimple, even for non-technical users. First,the user has to login in the initial page (Fig.

4) and then a menu with all the choicesappears in the upper side of the web page.Several admin pages have been developedto operate the system (only available tousers with permissions), some pages to seethe system and node’s state (the last sensorreading and the remaining battery), to see theactive alarms, when they occurred, a historyalarm log, to display statistic from the sensorreadings, one page to send commands tothe actuator nodes and another to see theimages from the video nodes in streaming.Several CSS style sheets have been created,including some for active alarm state withthe red background. This way, when an alarmoccurs the web interface changes to redbackground allowing an intuitive notificationto the user (Fig 5).

Fig. 5: Web interface with generated alarms

Because the chosen user interface is HTTPit can be accessed from any device witha web browser: smartphones, computers,tablets or even smartTVs. This provides largeaccess flexibility to the user. In the typicalhome configuration two IP ports must beopen to use the system from outside: 80 portfor the central node and 8080 for the videosatellite node.

E. Video satellite node

Video satellite nodes consistof a RaspberryPI processor, a webcam andnetwork connectivity, either WiFi or Ethernet(ZigBee does not offer enough bandwidth).To send the image stream the M-JPEGStreamer[19] open source software has beenused. It allows capturing the images from

8 XV WORKSHOP OF PHYSICAL AGENTS, JUNE 2014, LEON (SPAIN)

the USB camera in JPEG format and servingthem in a stream inside a web page withoutadding any plugin or extra component intothe browser. Some web pages from the M-JPEG Streamer project have been modifiedto make them look like the other pages ofSurveillance-4.

In addition, the Pythonprogram listener.py has been created.It is executed when the satellite starts andallows the communication with the centralnode to initiate the video stream only whenit is going to be visualized, and to stop itwhen such visualization has finished. Thisway the CPU is not continuously requestingimages from the camera, it remains silentwhen the human user does not require anyvideo at all. The listener.py programopens a TCP socket with the central nodeusing the local network and its private IP.When a command is received through thissocket from the central node the programgets the command (“init” to initiate thevideo stream, “stop” to halt it, “switch” tochange the state), checks the current nodestate (transmitting or stopped) and executesit. In order to start the image transmissionlistener.py creates a second socketconnection where listen the requests comingdirectly from the web browser (following thearchitecture shown in the left side of Fig. 6).Once the TCP bind message comes directlyfrom the browser machine the video satellitenode starts the video streaming using suchconnection. In order to halt the video streamlistener.py kills the process that getsthe camera images and closes the TCP socketused for the streaming.

IV. EXPERIMENTS

The system has been installed in a realhome and tested with two ZigBee satellitenodes at the same time. Both ZibBee nodeshave been located in a bedroom 16 meteraway from the central node in the livingroom, with three walls in between. The script“data test.py” has been created to introducedtest data in the database, simulating the

Fig. 6: Video transmission architectures

presence of additional satellites. Due toXBEE module limitations only up to tensatellites can simultaneously connect to thesame central node. The central node hasbeen up and running for a month withoutinterruptions, performance drops nor heating.Several tests have been performed includingaccesses from a computer, from an Androiddevice, from the private LAN and fromthe outside. Simultaneous accesses have alsobeen checked reporting no problem. Thesame tests have been also succesful with thevideo streaming.

One test consisted in suddenly shut thepower of the nodes down, simulating apower blackout. All the nodes recoveredwithout problems and restored the previousconfiguration.

There are several illustrative videos of thesystem working at the Surveillance-44 webpage.

A. Comparing wireless technologies

We wanted a wireless system and sowe studied three options (WiFi, Bluetoothand ZigBee) in terms of speed, powerconsumption, price and scope (Fig. 7).Once the speed was enough for ourapplication requirements we made emphasison the power consumption. Finally we choseZigBee for the nodes with a low datatransmission rate and and WiFi for nodeswith high data throughput (video).

4http://jderobot.org/Surveillance

CASTELLANO AND CANAS: HOME AUTOMATION SYSTEM WITH JDEROBOT AND WEB INTERFACE 9

Technology Speed PowerConsumption Scope PriceWiFi 300 MBps 85 mA 100 m MediumBluetooth 1 MBps 40 mA (0.2mA idle) 10 m SmallZigBee 250 KBps 30 mA (3uA idle) 50 m Medium

Fig. 7: Wireless technologies comparison

B. Alarm generationFig 8 shows the behavior of a ZigBee

satellite node when the human user pouresa water drop over the flood sensor. Thesystem properly detects the alarm, turns thealert LEDs on and activates the loud speakersound until the alarm is deactivated.

Fig. 8: Alarm generated by the watersensor node

C. Using the web interface with ZigBeesensor nodes

The sensor readings are displayed in thenormal web interfaz, as shown in Fig. 9. Agraphical widget has been also included tovisually show the battery level of each node.

Fig. 9: Web interface showing last sensordata and the node battery state

D. Using the web interface with video nodeFig. 10 shows the web interface for

a video satellite node as displayed fromtwo different web browsers, one in apersonal computer and another in an Androidsmartphone.

Fig. 10: Video streaming

E. Using the web interface with ZigBeeactuator node

Fig 11 shows the proper system operationwhen a command is sent to a ZigBeeactuator node. In this case the node relaywas connected to a light. To illustrate theefect a witness camera was also included in avideo node. Initially the light is off, but afterthe corresponding command is sent fromthe web interface it arrives at the actuatornode, which executes it and hence the lightis turned on.

V. CONCLUSIONS

In this paper we have presented a completehome automation system, distributed,wireless and with web interface. The systemhas a star architecture with several satellitenodes distributed throughout the house,which communicate with the central nodeusing ZigBee. A specific protocol hasbeen developed over ZigBee to shape thewireless dialog between the satellites andthe central node. The satellites include themost common sensors in home automationsystems: gas, flood, temperature, vibration...Actuator satellites with relays have been alsocreated. In addition video satellite nodeshave been developed to receive in real timethe images from cameras.

The whole system is low cost. Arduinomicroprocessor in the ZigBee nodes and

10 XV WORKSHOP OF PHYSICAL AGENTS, JUNE 2014, LEON (SPAIN)

Fig. 11: An actuator node used through theweb interface to turn on/off a lamp

RaspberryPi for the central node were cho-sen. Every two minutes the satellite nodessend sensor readings and asynchronouslynotify the alarms just when they occur. Thehuman user deactivates them once they havebeen managed and solved.

The central node includes aweb application developed on Django thatallows the human user to comfortably andremotely interact with the home automationsystem, regardless the operating system andplatform used (smartphone, laptop, etc.).

As shown in section IV the systemhas been experimentally validated. It wasinstalled on a real home and several testswere performed to prove all its functions.

Surveillance-4 is a step forward from theprevious home automation projects of thegroup and a complete proof of concept.It also extends the available sensors andactuators ready to use from any JdeRobotapplication, including the developed ZigBeedevices.

We are actively working on the integrationof new home automation devices like X10nodes, sensors that measure individual powerconsumption and other sensors alreadysupported in JdeRobot like the RGBD(Kinect, Asus Xtion) sensors. The approachis to extend the capabilities of the centralnode to exchange data using standard ICEinterfaces with all the already existingJdeRobot components like CameraServerfor cameras or OpenniServer for RGBDsensors.

ACKNOWLEDGEMENTS

This research has been partially sponsoredby the Community of Madrid through theRoboCity2030-II project (S2009/DPI-1559).

REFERENCES

[1] Sistema distribuido de videovigilancia basado enAndroid. Roberto Calvo Palomino, Master Thesisdissertation, ETSIT Universidad Rey Juan Carlos2010.

[2] Sistemadomotico distribuido, inalambrico, interoperabley opensource. Daniel Castellano, Proyecto Finde Carrera, ETSIT Universidad Rey Juan Carlos,2013.

[3] ORELLANA GALLOSO, RUBEN,Sistema demonitorizacion y control de riego e iluminacionbasado en tecnologıas Arduino, ZigBee, Androidy Bluetooth para un emplazamiento en Cadiz,Espana, 2013.

[4] Proyecto JdeRobot. Middlelware para el desarrollode componentes roboticos y domoticos. http://jderobot.org/index.php/Main Page

[5] Deteccion de caıdas en hogar basado en camarasy kinects. http://jderobot.org/index.php/ElderCare

[6] Monografico sobre el estandar X10.Historia, protocolo, implementaciones, etc. de esteestandar. https://forja.rediris.es/docman/view.php/414/761/X10.pdf

[7] Pagina web del estandar KNX. http://www.knx.org/es/

[8] Norma UNE-EN 50065-1:2012para la transimision de sanales por la red electrica.http://www.aenor.es/aenor/normas/normas/fichanorma.asp?tipo=N&codigo=N0048827

CASTELLANO AND CANAS: HOME AUTOMATION SYSTEM WITH JDEROBOT AND WEB INTERFACE 11

[9] Pagina web del la alianza empresarial para ladifusion de Z-wave. http://www.z-wavealliance.org/

[10] Sistema de seguridad domotica de la empresaSecuritas Direct. http://www.securitasdirect.es/myverisure.html

[11] Alarma para el hogar Prosegur Proview +. http://www.alarmahogarprosegur.com/?o=web

[12] Sistema domotico textitDelta Dore. http://www.deltadore.com/

[13] Pagina web de la companıa Libelium. http://www.libelium.com/company/

[14] Estandar de la ultima especificacion (2011-04-12)del lenguaje de programacionC. http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf

[15] Pagina oficial del lenguaje de programacionJava SE. http://www.oracle.com/technetwork/java/javase/overview/index.html

[16] Documentacion de las funciones del lenguaje JavaSE version 7 (javadoc). http://docs.oracle.com/javase/7/docs/api/

[17] Pagina oficial del lenguaje de programacionPython. http://www.python.org

[18] FIELDING, ROY T.,Architectural Styles and theDesign of Network-based Software Architectures,EE.UU., 2000. http://www.ics.uci.edu/∼fielding/pubs/dissertation/top.htm

[19] Pagina oficial del programa M-JPEG Streamer.http://sourceforge.net/projects/mjpg-streamer/

[20] XBee Multipoint RF Modules, DigiInternational Inc, 2011. http://www.digi.com/pdf/ds xbeemultipointmodules.pdf

[21] Pagina oficial del proyecto Arduino. http://arduino.cc/

[22] Pagina ofical de la Raspberry Pi. http://www.raspberrypi.org/faqs

[23] Esquema hardwarede la Raspberry Pi. http://www.raspberrypi.org/wp-content/uploads/2012/10/Raspberry-Pi-R2.0-Schematics-Issue2.2 027.pdf

[24] APIde programacion en Python para Django. https://docs.djangoproject.com/en/1.6/py-modindex/

[25] Wiki para el sistema de sensores de Seeedstudioutilizados en Surveillance 3 y 4. http://seeedstudio.com/wiki/GROVE System

[26] Pagina oficial de OpenGL ES. http://www.khronos.org/opengles/

[27] Especificaciones de los estandares IEEE 802.11(Wi-Fi). http://standards.ieee.org/about/get/802/802.11.html

[28] Especificacion del estandar IEEE 802.15.4 parala creacion de redes inalambricas. http://standards.ieee.org/getieee802/download/802.15.4a-2007.pdf

[29] Pagina webde la ZigBee Alliance, con informacion sorbe elconsorcio y la especificacion ZigBee. http://www.zigbee.org/Specifications/ZigBee/Overview.aspx

[30] Librerıas de JavaScript “JQuery”, utilizadas en lainterfaz web de Surveillance 4. http://jquery.com/

[31] Librerıas de JavaScript “Bootstrap”, utilizadasen la interfaz web de Surveillance 4. http://getbootstrap.com/

[32] Plugin de JQuery utilizado para la visualizacion delas graficas en la interfaz web. http://www.jqplot.

com