Sensor network infrastructure for intelligent building monitoring and management system

– The aim of this study was to present that it is possible to design and implement an eﬃcient and functional intel-ligent building management system based on free tools, own project and self-realization of sensor network sys-tem which may be a low cost alternative to commercial ones. The paper presents the designed system consisting of implemented devices on the basis of sensor network technology and own hardware project in a building manage-ment system. At the application level there was designed and implemented the building management system which allows communication between the sensors, data exchange between the sensors and the database as well as the system parameters visualization panel used for intelligent building monitoring.


Introduction
With the increase in quality of life, people look for opportunities to improve the tasks of everyday life as well as its protection. Most of his time a man spends at home which should be a place where you can relax, spend a nice time and feel safe. In recent decades, the concept was to put up intelligent buildings that can take over household duties and tasks as well as people residing in them. In addition, a considerable amount of time we spend at work, so also the work environment, its functionality, security, etc. play an important role in this context. Intel-ligent buildings allow the integration of all existing systems in one complex system automat-ically implementing safety features, of the fan or the power consumption. A dominant trend in the measurement technique is to achieve miniaturization of sensors using the silicon structures MST (Micro System Technology) or MEMS (Micro-Electrical-Mechanical Systems) and integration of mechanical, electrical and logical elements within one system SoC (System on Chip). In addition to minimizing, the next crucial step was the sensors ability to communicate with one another, enabling the realization of the concept of wireless sensor networks [7,5]. The main challenge to create the sensor network cells is to create energy-efficient sensor nodes of small size. Sensor network nodes differ in structure depending on the destination and the working environment, however, each node consists of similar basic components, such as [8,6]: • Measurement module, which collects information from the sensor network area. Signal corresponding to a certain physical value is converted and transmitted to the processing unit.
• Processing module, consisting of a microcontroller and memory.
• Transmission module receives and transmits information between the sensor network nodes that communicate with each other wirelessly using radio waves, infrared or other optical media.
• Power supply module consists mainly of batteries and additionally may be completed with the charging module (e.g. solar panels).
Theoretically, the nodes have similar functional modules, but most manufacturers intro-duced their implementations of these assumptions. One of the leading manufacturers of wire-less sensor network nodes are: MEMSIC and Libelium Distribuidas Comunicaciones S.L. [9,10]. MEMSIC offers a wide range of wireless sensor networks, including the sensors: MICAz, Eko, Imote2, TelosB and IRIS Wireless Development Kit, which allows choosing the optimal solution due to the use and geographical requirements. For example, the sensors family MI-CAz/MICA2 are used to create wireless sensor networks enabling low power consumption and transmission with the frequencies 2.4 GHz and 868/916 MHz. A node allows building a sensor network ad-hoc. Another Pobrane z czasopisma Annales AI-Informatica http://ai.annales.umcs.pl Data: 26/07/2023 04:46:23 U M C S product of MEMSIC is the sensor node EKO. It creates a wireless outdoor sensor system for measuring the environmental values, climate, manage-ment of water resources, protection and use in precision agriculture [9,10].
Intelligence is the ability to use information in order to adapt to the environmental conditions. Such a definition of intelligence inspires realization of the idea of automating everyday life [11,12]. An intelligent building is more than just a building structure, it is a network of modern electrical and telecommunication installations. Intelligent installation consists of a series of managing solutions for example: light, heating, air conditioning and sound manage-ment systems. Building adjusts automatically to the atmospheric conditions, time of a day as well as to random events such as burglary, fire, etc. Thus it provides residents safety, comfort, and economical benefits. The intelligent building is a building which will automatically be able to perform most tasks performed by humans. The systems implementing these expectations should allow the inspection of the relevant parameters, control the individual devices and adapt to the occurred events. These expectations relate primarily to the three areas: security, energy savings and comfort of the household residents. The idea of intelligent buildings allows creating a coherent system for managing tasks in a global manner and receiving information used simultaneously in different systems. The solution of the optimal project performance selection problem is achieved thanks to the automatic responding and adapting to the environment, adaptation to changes and requirements of users, safety, energy savings, having information about its status and configuration. The intelligent building monitoring and management system visualization layer based on the sensor network infrastructure is also one of the main development issues [13,14,15].
3 Hardware layer of the designed system -the sensor network structure design The intelligent building management system should have data gathering and control elements. In this paper we focus on presenting our complete project of the intelligent building monitoring and management system implementation based on our hardware sensors designs, sensor network infrastructure and web based management application. This paragraph is devoted to the hardware layer of our system presentation, especially the sensor architecture and the sensor network structure designs. The first step in achieving the objectives of the project is the construction of the measuring sensor node and the parent sensor node, acting as a sensor network gateway. The hardware implementation project includes the use of electronic devices available on the market. The diagram of the hardware sensor system project implementation presented in this work, its basic elements, relationships, communication mode and software components (software drivers, communication, management and monitoring application) is shown in Fig. 2. For the construction of the measuring node and the sensor network gateway node in our design a microprocessor, executing calculations and programmed control functions was used. The role of microprocessors in the designed devices is played by Pobrane z czasopisma Annales AI-Informatica http://ai.annales.umcs.pl Data: 26/07/2023 04:46:23 U M C S Atmel AVR family chips. The AVR microcontrollers are a family of eight-bit, RISC architecture based on the principles of Har-vard architecture processors [16,17,18]. A characteristic feature of the Harvard architecture is to separate memory address space of the program and data memory address space, obtained by using a separate address bus. The systems belonging to the RISC processors have a simplified list of commands and high computational efficiency (most commands are executed in one clock rate). In addition, the AVR microcontrollers have implemented many operating registers, which can simultaneously perform storage functions in arithmetic and logical operations processing. The result of this design is minimization of the internal interregister communication and thus increasing the speed of program execution. Combination of 8-bit RISC computing unit, high-level language programming techniques and reprogrammable flash memory on a single chip, allows the use of microcontrollers in a variety of functional solutions [16,17,18]. Sensor measuring node -the node acts as a measurement system that collects data, in the case of this project, the temperature of the surroundings. Our sensor node has an additional wireless remote light control function. The device transmits data or controls commands wire-lessly to the parent node (sensor network gateway). The node is built based on the microprocessor ATmega16L, RFM12S transmitter and the temperature sensor DS18B20. In addition, the sys-tem is equipped with six-contact pushbuttons and the LED diode indicating correct send-ing of the information. Four buttons stand for the light control, one for a temperature measuring frequency change and one for a reset of the entire set [16,17,18,19,20].
Sensor network gateway node -Gateway is a device having the task of enabling com-munication between various elements of a building management system. The designed node architecture contains the following units: the microprocessor ATmega32, RFM12S transmit-ter/receiver, the temperature sensor DS18B20 and the converter FT232RS. Gateway acts as the parent node performing the receiving data from the Pobrane z czasopisma Annales AI-Informatica http://ai.annales.umcs.pl Data: 26/07/2023 04:46:23 U M C S remote measuring node. The data is then transmitted using the USART bus of the module FT232RS to a PC, updating the MySQL database. Another task of the device is to measure the temperature. The DS18B20 module is con-nected to the microprocessor's PC0 port which functions as the 1-wire bus interface. In order to increase the functionality the DS18B20 is connected by a telephone cable of a length of 6 m (1-wire allows transmission for a distance up to 60 m) [16,17,18,19,20].
In addition to these functions, the gateway creates a lighting control system (in our design light in the intelligent building is simulated by four LEDs). It receives control signals transmitted from the sensor measuring node (playing the functions of remote control) and control signals transferred from a computer (web based application). Communications between the measuring sensor node and the gateway node are a key role in the data transport. The idea of sensor net-works is based on a wireless communication. Data from the measuring node are routed directly to the receiver -a sensor network gateway. Wireless communication is implemented through the RFM12S transmitter module, which requires proper configuration of the microprocessor and setting appropriate transmission parameters (AVR ports) [16,17,18,19,20].

The functionality of the intelligent building wireless sensor management system
The functionality of the intelligent building management system requires communication between two platforms: hardware and software as presented in Fig. 3. Data transfer is real-ized from the gateway microprocessor to the database and vice versa. Created software appli-cation can receive and send data using a virtual serial port (COM). Application supporting PC communication with the parent sensor node (gateway) is built based on the functional blocks and libraries of the serial port and functions connected to the database [16,17,18,19,20]. The first main task of our application is to support communication using the RS232 interface. The application created in Java due to very easy programming of a serial port owing to the dedicated serial port library (rxtxSerial.dll). The main function get-Ports() searches the system available COM ports and maps the USB connection (thus Pobrane z czasopisma Annales AI-Informatica http://ai.annales.umcs.pl Data: 26/07/2023 04:46:23 U M C S our application is called the USB converter). In the main window the user can select the appropriate interface and change the baud rate (Fig. 4). The default value of the transmission is 57600 Kbps. After the successful connec-tion between the PC and the gateway sensor the application window (Fig. 5) presents the con-nection status and transmission notifications.  The USB Converter is an application that supports the exchange of data between the RS232 interface, and the database trough the USB connection. The user has the ability to preview the received information (Fig. 5), but it is not possible to control and change device parameters (program should work in the background). After starting the serial communication, the database con-nection is initialized using com.mysql.jdbc driver. In the following Listing 1 the function im-plementing the MySQL database connection is presented. Accessing the MySQL database is confirmed in the working application (Fig. 5). Exchange of data is carried out in two directions. The data received from the microprocessor via the USB port are handled by the functions gotchar (). It recognizes the information required to update the temperature along with the identification of the temperature from the measuring node and from the gateway node. The database used to store measurement data and information about the managed building is divided into four main tables: customer, house, room sensor. The relational database structure is presented in Fig. 6. Each client has the data: name, surname, login, password and assigned to him unique identifier. Login and password are the information you need to log in and manage the building through the website. They are also used to search the customer in the database. Customer ID is a foreign key that is used in relation to table the house. Analyzing ID we look for a house or houses of the client. The ID and the house address are often obtained information from the table house. The additional information is number of floors in the house used to handle different levels of the building in the parameters visualization. Each house has many rooms, hence the need for their unique identification. Rooms have names, and data indicating the floor on which they are located. The table sensor, is a source of information about the type and status of the sensors. The sensors are grouped in relation to the room in which they are located. The assignment of sensor identifiers allows easy reading and updating data. Updating the temperature records is achieved by using the function updateTemperature0(String temp) and updateTemperature1(String temp). The status is changed after searching for a suitable sensor using a SQL query such as: The final element of the system operation is to update the state of illumination. Changing parameters using the website is done by sending commands to the microprocessor, which up-dates the status of the port A pins. Updated parameters of the respective sensors are displayed in a working window of application. The four Gate parameters correspond to four LEDs positioned in the gateway node (Listing 2). The Pobrane z czasopisma Annales AI-Informatica http://ai.annales.umcs.pl Data: 26/07/2023 04:46:23 U M C S second source of illumination parameters change is the remote sensor node implemented based on the measurement system. The parent node receives the control signals, and then changes the microcontroller ports. There is need to update the corresponding entries in the MySQL database. In the Java application the code function responsible for this action is updateOutputs() shown in Listing 2.
Listing 2. Updating the illumination parameters in the database.
One of the criteria of sensor network design is low sensor nodes power consumption. In order to verify the designed sensor set parameters, the measurements of the system current con-sumption were made during data transmission, and during active and idle work. For a sensor during the transmission mode the average value of the measured current is maintained at the value of 37 mA. The idle sensor state has the current consumption at the level of the 18 mA. The difference may arise due to the activation of the LEDs during the data transfer. The measurement results are shown in Fig. 6. The sensors work time interval, on a pair of 1.5 volt battery, fluctuates within 60 hours.   Fig. 7 the statistics of the correct received data in the distance function are shown.

The application layer of the designed intelligent building management system based on the implemented sensor layer
Visualizing interface is one of the most important places of the user communication with the management system. The building management system must have appropriate methods of individual elements communication, the data collection and storage and user interaction. Data transport at the appropriate system structure levels is a key role in the functionality of the installation. Project assumptions are based on easy access to the information about the sensors measurements and parameters, or data describing the building condition. The technologies used to implement the visual part of the project are: XHTML, PHP, CSS, and MySQL. The advantage of web solutions is that it allows a very easy way to remote access. Furthermore, the used technologies are free, which may be an alternative to licensed and often expensive solutions. Application is designed as a web page to support visualization and interactive operation of the building management system. Data Storage is based on the server environment running XAMP. XAMPP (acronym X (Cross-platform), Apache, MySQL, PHP, Perl) is a simple, multi-platform, integrated package consisting of Apache server, MySQL database, and interpreters for scripts written in PHP and Perl. This software is distributed under the GNU Li-cense as a free web server to serve dynamic pages. The project has used the XAMP dis-tribution under the Microsoft Windows platform. The information obtained in order to present the user interface -the Web site is delivered using the SQL queries. Access to the database using PHP is obtained by suitable connection: Pobrane z czasopisma Annales AI-Informatica http://ai.annales.umcs.pl Data: 26/07/2023 04:46:23 The command mysql_query("SET NAMES utf8"); is used due to the storage and handling of words containing Polish characters. For proper connection to the database we are able to search relevant information using the SQL queries. The administration panel allows the user not only to read sensor measurements, parameters and building equipment state, but also creates an area in which the user can affect the status of the devices. The intuitive, simple and transparent form of the panel allows each user to create a friendly management system of the building. Not logging we have access to the general information and contact details. Only after logging into the system by a given login and pass-word (stored in the customer table), we get the possibility to read and control our building. The administration panel (Fig. 9) contains three main tabs: the sensor state, control and reports. The sensor state tab is a typical information place. It is also divided into three areas. The first is the visual area in which we can see our house, and the floors along with the plan and rooms arrangement.The functional aspect of this area is displaying the devices state and place of their location. Figure 9 shows that in our building on the ground floor we have lights in the bedroom, living room and bathroom switched on. The temperature icon is also displayed in the kitchen informing about the active  sensor work. The floor map is created based on the building plan, CSS styles, and information retrieved from the database. The database records retrieve information about the position of the sensor and the type of device. The function used to build an information bar first gets the records of sensors assigned to the house and grouped by the floors. Then the multidimensional table is created where appropriate sensors (CID) are assigned to rooms (PID). Sensors are catalogued in the first place by floor, and then are assigned to suitable rooms. For easy identification of individual components state, the colours were used: green (active device) and red (inactive) one. The control tab takes us to page through which we can control the selected devices. In the case of this project it is the lighting and temperature. Sensor configuration is obtained by finding an item on the list of available ob-jects, and then changing its status using the mouse context menu and checkbox on/off option.

Summary
Sensor networks represent a new approach using computer network solutions and wireless measurement technologies. Sensor networks deployed in space allow monitoring envi-ronmental parameters and response to physical factors operating. The integration of the indi-vidual components enables implementation of complex systems improving human performance in many areas. Additionally, sensor networks are characterized by low power consumption, fault tolerance and reliable communication which ensure an increasing interest in many implementations of wireless sensor networks. Sensing, processing, communication and self powering are the main elements whose Pobrane z czasopisma Annales AI-Informatica http://ai.annales.umcs.pl Data: 26/07/2023 04:46:23 U M C S combination in a small device causes an increasing number of applications providing endless opportunities.
In the future this work may provide a good basis for further expansion of the system by adding sensor nodes, as well as further functionality (e.g. integration of building control sys-tems, alarm functions, SMS notification). Moreover, increasing the number of sensor nodes and adding routing nodes enabling data transfer between the sensors to the gateway nodes, is an interesting subject of further research.