Development and Application of a ZigBee-Based Building Energy Monitoring and Control System

Increasing in energy consumption, particularly with the ever-increasing growth and development of urban systems, has become a major concern in most countries. In this paper, the authors propose a cost-effective ZigBee-based building energy monitoring and control system (ZBEMCS), which is composed of a gateway, a base station, and sensors. Specifically, a new hardware platform for power sensor nodes is developed to perform both local/remote power parameter measurement and power on/off switching for electric appliances. The experimental results show that the ZBEMCS can easily monitor energy usage with a high level of accuracy. Two typical applications of ZBEMCS such as subentry metering and household metering of building energy are presented. The former includes lighting socket electricity, HVAC electricity, power electricity and special electricity. The latter includes household metering according to the campus's main function zone and each college or department. Therefore, this system can be used for energy consumption monitoring, long-term energy conservation planning, and the development of automated energy conservation for building applications.


Introduction
With the emergence of new and innovative technologies, living standards and quality of life have reached an all-time high.A significant part of the modern lifestyle is intertwined with the usage of electronic and electrical devices.However, increases in the utilization of electronics and electrical appliances have adversely resulted in an unprecedented increase in energy consumption.Subsequently, due to the demand-supply gap, the price paid by the end user continues to increase annually.As a result, there is a serious need to optimize energy consumption and develop more energy-efficient technologies and electronic systems.This need has resulted in the development of new fundamental and applied research fields in the area of energy conservation.Among these research areas, with the potential to result in significant developments in energy consumption, is the design of integrated advanced monitoring and control mechanisms with the capability to better monitor and control power consumption, so that users can easily measure the power consumption of electronic devices and optimize their usage to enhance their energy consumption performance [1].
With advancements in wireless technologies and through the implementation of distributed sensor networks, residential energy consumption systems are beginning to take advantage of these systems for reducing energy consumption and thus increasing energy efficiency.By eliminating the need to run wires in an existing facility, wireless technologies can help reduce the cost of construction in an "intelligent" building.Due to their small footprints, wireless nodes can be easily mounted without interruption of usage and without inconveniencing building occupants with renovations and changes.Another benefit of wireless technologies that makes them appropriate for residential use is their low energy consumption, as they can be powered by batteries with long service lives [2].

2
The Scientific World Journal Table 1 outlines the key characteristics of some common wireless mechanisms [3].From an application perspective, Bluetooth is intended for cordless mice, keyboards, and hands-free headsets.As an improved Bluetooth version, BLE (Bluetooth low energy) is intended to provide considerably reduced power consumption and cost while maintaining a similar communication range.The ultrawideband (UWB) is oriented to high-bandwidth multimedia links.The wireless universal serial bus (wireless USB) is the personal interconnect technology used to meet the needs of multimedia consumer electronics, PC peripherals, and mobile devices.Wi-Fi is directed at computer-to-computer connections as an extension or substitution for cabled networks [4,5].Infrared (IR) wireless approaches are used for short-and mediumrange communications and control.Unlike radio-frequency (RF) wireless links, IR wireless links cannot penetrate walls or other obstructions [6].
In contrast to other listed wireless protocols in Table 1, ZigBee is designed for reliable wirelessly networked monitoring and control networks.An example of comparison between ZigBee and BLE, two most popular techniques for wireless measurement applications, demonstrates the reason why the former is favorable for our application.BLE is more oriented towards user mobility whereas ZigBee aims for automation and remote control.Bluetooth supports 8 nodes per network whereas ZigBee supports up to 255 nodes per network.In addition, the advantage of ZigBee in mesh networking capabilities allows itself to be very easy to install without the need for any special installation services.Therefore, ZigBee is more suitable for remote energy monitoring and control.
Due to the above reason, in this paper a ZigBee-based building energy monitoring and control system (ZBEMCS) is presented, which offers a promising solution for the aforementioned objective.For monitoring, the hardware is based on current and voltage measuring circuits, a microcontroller unit (MCU), a control module, and a ZigBee module.The current/voltage measuring circuit measures the current and voltage and sends the information to the MCU.The MCU checks for power abnormalities and sends information to the building server, where a database is maintained through ZigBee.For control, a relay is added to the power monitoring hardware.In the case of an emergency found by the MCU, the relay cuts the power supply to the electric building appliances after receiving the control command.A graphic user interface (GUI) software program is used as an interface between the user and the end devices.Subsequently, the user can control all electric appliances through a cell phone or a desktop or laptop computer.

Related Work
Energy monitoring is essential for understanding the sources of consumption inside a building and to take appropriate measures to save energy.Generally, building energy monitoring and control efforts can be divided in two broad categories: hardware-and software-based.
Hardware-based approaches focus on involving physical equipment such as smart plugs and smart plug strips for controlling information and communication technologies (ICTs) devices.The studies performed in [7][8][9] indicate the perspective of considerable savings.In addition, replacing equipment with more energy-efficient one can be effective, as observed in [10,11], with savings around 40-60%.Kamilaris et al. [12] believed that the contribution of hardware-based methods for savings needs to be quantified.In this way, companies and organizations would be aware about the return of investment when considering any of these approaches.
Software-based techniques consider mainly power management (PM) and virtualization.Somniloquy [13] and Sleep-Server [14] are pioneering efforts regarding PM, claiming significant savings exceeding 60%.LiteGreen [15] and VMware [16] are dominating in the field of virtualization.Current commercial products for PM and virtualization are efficient and reliable, offering advanced features and large potential for savings.
A comparison among hardware and software-based techniques [11] shows that hardware-based approaches are more effective, for example, by replacing desktop computers with laptops.Other approaches stress the role of commercial buildings in smart grid scenarios [17,18] and the importance of combining sensing with actuation [19].
Meanwhile, relevant efforts recognize the large impact of occupants, affecting 20-50% of total building's energy use [10,20], and focus on motivating the occupants towards energy savings through suggestions and advice, timely and comparative eco-feedback techniques [21][22][23].
While hardware and software-based techniques can affect electricity consumption in a large degree, provisioning is crucial for conservation.Decisions made during the early design stage can influence about 60% of total energy usage life cycle, leaving the impact of user behavior and real-time control to the rest 40%.Still, even small savings can have significant effects on the overall costs of companies and on the environment [12].
Apparently, in order to achieve standardized, effective, and objective green standards for commercial buildings and miscellaneous electric loads, international energy policies and regulations need to be defined by stakeholders and key players, involving legislative measures, economic instruments, voluntary agreements, and technology and innovation specifications.
Lastly, embedded ICTs, although increasing their collective energy consumption globally, are expected to play a crucial role in energy efficiency across the economy, helping office equipment to operate in a more intelligent, automated, and efficient way.
Compared with the abovementioned related work, the contributions of our proposed system combine hardware and software-based techniques.Firstly, our system accommodates both traditional building energy meters and environmental sensors, for wireless data transmission and management in an integrated framework, which empowers the collection and monitoring of various types of measurements that reflect the energy consumption and environmental status of buildings.Secondly, the system is further extended with webbased management software, which offers rich analysis and   advanced report functions for monitoring both energy consumption and environment.

System Architecture
The ZBEMCS consists of a gateway, a base station, and sensors, as shown in Figure 1.The gateway is also named the client, and its purpose is to connect sensor nodes to an existing Ethernet network.The base station provides a connection between the sensor nodes and the gateway.The sensors monitor and control the energy usage of the electrical equipment and transmit data to the base station.
3.1.Gateway.For this implementation, the gateway is assigned the name SQ120 ("Client" in Figure 1) and is based on an Intel IXP420 XScale processor running at 266 MHz, which features one wired Ethernet port and two USB 2.0 ports.The device is further equipped with 8 MB of the program FLASH, 32 MB of RAM, and a 2 GB USB 2.0 system disk.SQ120 runs the Debian Linux operating system, which is a full-fledged standard Linux distribution for the ARM architecture that comes preloaded with Crossbow's sensor network management and data visualization software packages, XServe and MoteExplorer.These programs are started automatically at the boot time of the SQ120.To set up a sensor network gateway configuration, a base station should be plugged into the secondary USB port of the SQ120.SQ120 contains a built-in web server (MoteExplorer) and a sensor network management tool (XServe).The latter can automatically identify what types of sensor boards are plugged into the nodes of the wireless sensor network and instructs MoteExplorer to display the data accordingly [24].

Base Station.
The base station is the monitoring and controlling center of all branch circuits and the gateway for external communication and the user interface; its main functions are as follows [25]: (1) executing control instructions through the Internet; (2) monitoring the energy consumption of the sensor nodes; (3) calculating the remaining power capacity of each branch circuit; (4) indicating all energy consumption information.
As shown in Figure 2, the base station, which is a full function device (FFD), consists of the mote processor/radio platforms (XM2110) and a gateway (MIB520CB) via a 51-pin expansion connector.Thus, the base station is configured as a ZigBee coordinator (ZC) of WSNs.The base station receives the data sent by all nodes in the network and sends a message across the USB connection to the computer.The base station runs the Debian Linux operating system preloaded with Crossbow's sensor network management and data visualization software packages, including EcoView and Xserve [26].
Figure 3 shows a software flow chart of the base station.

Sensor Nodes.
The sensor node, which is the measure and control node, is shown in Figure 4.The sensor node is comprised of a direct current (DC) power module, a MCU, an alternating current (AC) power control module, and a ZigBee module.The MCU module communicates with the power measurement module by an analog front end (AFE) and with the ZigBee module through universal asynchronous receiver/transmitter (UART) interfaces.Communication between the ZigBee module and the control module is achieved by the pulse width modulation (PWM) technique.
The main functions of the sensor node are as follows [25]: (1) measurement of power parameters, such as the voltage, current, and power of the outlet; (2) control of the power output of the outlet; (3) security protection from overload; (4) transmission of the information of each node to the base station through ZigBee.

DC Power Module.
The main function of the DC power module is to convert 220 V of AC power into 5 V and 3.3 V of DC power to provide the operating power for all modules in the sensor node.The module's circuit structure is shown in Figure 5.The AC 220 V is converted by switching the power module to DC 5 V and 3.3 V by a linear regulator.

Power Measurement Module.
The power-measurement module is composed of the power-measuring integrated circuit (IC) 71M6541D, which is a Teridian 4th generation single-phase metering system on a chip (SoC), with an error margin of 0.1% that meets all ANSI and IEC electricity metering standards.This IC is an integrated power-measurement device that combines a 22-bit second-order delta-sigma  power , active power , apparent power , power factor PF, total voltage harmonic distortion  THD , total current harmonic distortion  THD , and so on [27].The circuit of this module is shown in Figure 6.
The flow chart for calculating the RMS voltage and current can be divided into two parts: AD conversion and digital signal processing [25].

Part 1 (Analog-to-Digital Conversion
).An ADC is used to convert an analog signal into a digital signal.The measuring IC has a 22-bit second-order sigma-delta ADC, which is used to convert the voltage signal and current signal.The ADC output is decimated by the finite impulse response (FIR) filter and is stored in CE random access memory (RAM), where it can be The Scientific World Journal      accessed and processed by the CE.The maximum signal input into the measuring IC is ±0.25 V. Therefore, a high-resistance voltage divider with a properly designed resistance, which can convert AC 250 V into ±0.25 V, is used.In addition, the current sampling can use a current transformer to measure the current signal with proper resistance and can convert AC 30 A into ±0.25 V.The converted voltage and current are input into the measuring IC to proceed to the next calculation, as shown in Figure 6.
Part 2 (Digital Signal Processing).Various power parameters can be computed in real time, including the root-meansquare voltage  rms , root-mean-square current  rms , reactive power , active power , apparent power , power factor PF, total voltage harmonic distortion  THD , and total current harmonic distortion  THD .The formulations adopted for computing the power parameters are described below [28].
Although the fast Fourier transform (FFT) is efficient, it has a strict requirement for the collected data; namely, the number of collected data points must be exactly a power of 2 (2  ) [29].If we use the FFT to process data, the reducing spectrum leakage problem or the hurdle effect is likely to arise, which does not suit our goals.Thus, in this system, we use the discrete Fourier transform (DFT) algorithm, which requires only 100 data samples/points during a period and has an acceptable time range, instead of using the FFT to process the collected data [30].
Assume that a voltage or current signal () having a sampled sequence () is sampled at a regular time interval , that is, {(0), (), . . ., (( − 1))}.The DFT of () is (), defined as the sequence of complex values {(0), ( 0 ), . . ., (( − 1) 0 )} in the frequency domain, where  0 is the fundamental frequency given by  0 = 2/.According to the decimation-in-time FFT algorithm [31], the DFT values () at frequency  0 are computed as follows: where    =  −(2/) is the twiddle factor.Given the DFT values () and (), the root-meansquare values  rms and  rms of the sampled voltage and the current values () and () can be computed as follows: where Re[⋅] and Im[⋅] represent the real and imaginary parts, respectively.The reactive power  and the active power  can be computed as follows: (3) The apparent power  and the power factor PF are calculated as follows: Finally, the total voltage harmonic distortion  THD and the total current harmonic distortion  THD are computed as follows: (5)

Control Module.
The control module includes a relay and its driving circuit, as shown in Figure 6.This module mainly receives control instructions from the ZigBee module to acquire the status of the relay and to then control the output power of the outlet.The controller signal from the ZigBee module is amplified by the transistor and is then transmitted to the drive relay.The freewheeling diodes set on both sides of the relay are used to provide a release method for the diode to generate a reversed voltage, instantly changing the relay from ON to OFF and preventing damage to the transistor [25].
Figure 7 shows a software flow chart of the sensor node.Figure 8 displays the function of the control module.

ZigBee Module.
The ZigBee module is composed of mote processor/radio platforms (XM2110), which use the Atmel RF230, IEEE 802.15.4 compliant, ZigBee-ready radio frequency transceiver integrated with an Atmega1281 MCU.These enhancements provide up to three times the radio range and twice the program memory of previous-generation MICA motes [32].A block diagram of XM2110 is shown in Figure 2. In the sensor node, XM2110 connects with the sensor board via a 51-pin expansion connector, whose structure is shown in Figure 6.ZigBee is a wireless network protocol and an adapted IEEE 802.15.4 standard owned by ZigBee Alliance, which defines the media layer and the objective layer.ZigBee exhibits low transmission speed at low cost and low energy consumption, with high security, and supports a large number of web node operations.Therefore, ZigBee is very suitable for use in building monitoring and controlling systems.
In the ZigBee module, the effective transmission distance between nodes is determined by the transmission energy designed for the module.At present, the transmission distance of the commercial module can reach approximately 100 m under the barrier-free condition.Although the partition blocks of buildings may reduce the communication distance, the use of ZigBee can support the network structure with a tree or mesh, and setting certain nodes in the network to the router function can effectively overcome the issues of transmission in the same horizontal floor and at different vertical floors over a long distance.Conceptually, ZigBee communication can be applied to buildings without restrictions on the transmission distance [25,33].
To help resolve the noise interference issue, ZigBee uses the direct sequence spread spectrum (DSSS) to reduce the environmental interference and uses a carrier sense multiple access with collision avoidance (CSMA/CA) channel access The Scientific World Journal  mechanism, dynamic frequency selection, and transmission power control to avoid channel collisions [4,34,35].

Accuracy Verification.
To verify the accuracy and implementation of the ZBEMCS, a practical demonstration system was produced; the methods, design procedures, and practical work are shown in Figure 9.This demonstration system is equipped with one base station that manages two branch circuits, each of which includes one sensor node.Each smart node is composed of a ZigBee module, a MCU, a powermeasuring IC, voltage and current measure circuits, and relays.The physical system is shown in Figure 10.In this system, VB.NET is used to program the user interface of the remote monitoring and control center, which would communicate with the base station through Internet.The operating screen is shown in Figure 11.First, we use the ZBEMCS and a standard clamp meter to measure the current and voltage usage of a lamp, a hair dryer, and an electric heater simultaneously, as shown in Figures 12  and 13.Table 2 indicates the experimental results.From The Scientific World Journal 9   Table 2, we can see that the average deviation of the measured current between the ZBEMCS and the standard clamp meter is 0.051 A, and the average deviation of the voltage is 2.0 V; the corresponding standard deviation of the current is 0.017 A, and that of the voltage is 0.545 V. Next, we use the ZBEMCS and a standard wattmeter to measure the energy consumption of two electric heaters.The experimental results are shown in Table 3. From this table, we find that although the measurement values of the ZBEMCS  and the standard wattmeter are both larger than those of the nominal power, the average deviation and standard deviation between them are negligible.The average deviation of branch 1 is 0.058 kW⋅h, that of branch 2 is 0.060 kW⋅h, and that of the trunk is 0.118 kW⋅h; the standard deviation of branch 1 is 0.035 kW⋅h, that of branch 2 is 0.035 kW⋅h, and that of the trunk is 0.071 kW⋅h.Therefore, this system can be used for energy consumption monitoring, long-term energy conservation planning, and the development of automated energy conservation for building applications.One typical application of ZBEMCS is subentry metering of building energy.For example, for most campus buildings whose energy consumed is mainly power in hot and humid climate, ZBEMCS collects the data according to the electricity system, which can be divided into the following four separate items, as shown in Figure 16: (1) lighting socket electricity, which mainly includes the lighting and power sockets (indoor lighting electricity, air terminal socket electricity, and regular socket electricity), the corridor and emergency light electricity, and the outdoor landscape lighting; (2) HVAC (heating, ventilation, and air conditioning) electricity, which mainly includes the electricity of the heating and cooling source equipment (refrigerating electricity, fan electricity of the cooling tower, and electricity of the electric boiler), air terminal socket electricity, and electricity of the transportation equipment (chilled water pump, cooling water pump, and hot water circulation pump electricity); (3) power electricity, which mainly includes the electricity for the elevator, water pump, fan, and special electricity (where special electricity refers to the special power consumption that does not belong to the normal function of the electrical equipment).The special characteristic of special electricity is a high energy density; it uses more power than the major electricity facilities and equipment.According to the campus building characteristics, special electric facilities generally include laboratories, clean rooms, information centers, dining rooms, laundry rooms, swimming pools, and other special facilities; (4) special electricity for large special equipment for scientific research or other auxiliary equipment.
Another typical application of ZBEMCS is household metering of building energy.For example, one household metering method is implemented according to the campus's main function zone, as shown in Figure 17.It considers the campus as an energy management subcenter and divides every campus building into four components: the administrative area, office area, study area, and living area.Then, it finds the sum of the energy consumption of each building.We perform the statistics step by step from the room to building, namely, in the order of the classroom, floors, building, and energy management center.
The other household metering method is implemented according to each college or department, as shown in Figure 18, which is campus-college-function-energy consumption monitoring.The specific metering method is similar to the first method.It is applicable to the campus that needs separate metering for every college.In particular, this method divides the campus into different small campuses and builds a subcenter of the building energy consumption monitoring system so that each small campus can independently monitor its energy consumption.Each small campus can build its own college energy consumption monitoring system.In addition, each campus can also be divided into an administrative area, a teaching area, a library, a living area, an office area, and other different areas.Then, a subset partition system of the energy consumption monitoring system is established.To improve the management convenience, the office area and laboratory can be allocated to the college management and monitoring system and conducted by each college.We also perform the statistics step by step from rooms to buildings using the same statistical method as in the first method.

Conclusions
In this paper, the authors propose a cost-effective ZBEMCS, which consists of a gateway, a base station, and sensors.Specifically, a new hardware platform for power sensor nodes is developed to perform both local/remote power parameter measurement and power on/off switching for electric appliances.The experimental results demonstrate that the ZBEMCS can easily monitor energy usage with a high level of accuracy.Two typical applications of ZBEMCS such as subentry metering and household metering of building energy are presented.The former includes lighting socket electricity, HVAC electricity, power electricity, and special electricity.The latter includes household metering according to the campus's main function zone and each college or department.Therefore, this system can be used for energy consumption monitoring, long-term energy conservation planning, and the development of automated energy conservation for building applications.

Figure 3 :Figure 4 :
Figure 3: Software flow chart for the base station.

Figure 5 :
Figure 5: Circuit structure of the DC power module.

Figure 6 :
Figure 6: Circuit diagram of the sensor node.

Figure 7 :Figure 8 :
Figure 7: Flow chart of the sensor node.

Figure 10 :
Figure 10: Circuits of the sensor node.

Figure 11 :
Figure 11: GUI showing the local and remote monitoring and control screen.

Figure 15 :
Figure 15: Electric power consumption of the testing rooms.

Table 1 :
Key characteristics of common wireless standards.
Figure 2: Structure of the base station.

Table 2 :
Current and voltage data comparison between the ZBEMCS and a standard clamp meter.