Abstract and Applied Analysis

Abstract and Applied Analysis / 2013 / Article
Special Issue

Switched Dynamics with its Applications

View this Special Issue

Research Article | Open Access

Volume 2013 |Article ID 613043 | https://doi.org/10.1155/2013/613043

Liang Zhao, Jili Zhang, Ruobing Liang, "Data Acquisition and Transmission System for Building Energy Consumption Monitoring", Abstract and Applied Analysis, vol. 2013, Article ID 613043, 8 pages, 2013. https://doi.org/10.1155/2013/613043

Data Acquisition and Transmission System for Building Energy Consumption Monitoring

Academic Editor: Lixian Zhang
Received01 Jul 2013
Accepted30 Jul 2013
Published12 Sep 2013


Building energy consumption monitoring and management system have been developed widely in China in order to gain the real-time data of energy consumption in buildings for analyzing it in the next state work. This paper describes a low-cost and small-sized collector based on the STM32 microcontroller, which can be placed in a building easily to implement the work of data acquisition, storage, and transmission. The collector gathers the electricity, water, heat, and energy consumption data through the RS485 field bus and stores the data into an SD card with mass storage, finally, using Internet to finish the communication and transmission to data server through TCP protocol. The collector has been used in application for two years, and the results show that the system is reliable and stable.

1. Introduction

With the rapid growth of world energy uses, also increases a series of serious problems, such as supply difficulties, exhaustion of energy resources, and negative impact on the environment (atmospheric pollution, greenhouse effect, climate change, destroy of ozonosphere, etc.). According to the IEA (International Energy Agency), primary energy has grown by 49% and CO2 emissions by 43% in the past two decades. Particularly in China, the energy consumption has become 2 times at an average growing rate of 3.7% [1], and China has passed the US to become the world's biggest energy consumer, based on the new data from the IEA. In the future, this growing trend will continue, and the demand is still growing in absolute terms.

In all kinds of energy consumption, industry, transportation, and construction are the three main aspects. Energy consumption of a building can reach 40% of total energy consumption, according to the experience of developed countries. Therefore, energy saving of buildings becomes one of the major tasks of promoting energy conservation and raising the efficiency of energy consumption. Transformation of the old buildings is currently facing a major problem that experts and scholars have repeatedly stressed on when talking about the promotion of energy-saving construction. The dwellers obtain electricity and water bills every month and know the amount of energy consumption exactly. However, almost nobody knows when energy consumption occurs and where it takes place; the users can make more sensible decisions to lower the energy consumption if they find out where and when the energy consumption happens in a well and true way [2].

In order to gain real-time data of energy consumption in buildings and build the platform for evaluating energy-saving effect, the building energy consumption monitoring and management system must be developed [38]. A data acquisition system and a methodology concerning the energy consumption of the government office buildings and large-scale public buildings (GOBLPB), which is the focus of energy-saving target, have been developed in China [3]. In paper [4], Yongpan et al. presented the system architecture of a monitoring system of building energy consumption; software subsystem of the server and database pivotal technologies are also introduced in detail. The studies of asynchronously switched control of linear systems and control synthesis for time-delay systems are also putting forward the energy consumption monitoring platform [57]. In the relevant literature [8], a BACnet-based intelligent energy management network using a surrogate object-communication model is proposed. There are already several researches discussing how to design a system for monitoring energy consumption in buildings, which contains so many techniques, such as data acquisition technique in perception layer, data transmission technique in network layer, data display technique in the presentation layer, database technique, website development, and electronic maps, however, barely on the data collector, a key component between buildings and server, which plays a major role in affecting the performance in realistic implementations.

This paper proceeds with data acquisition, data storage, and data transmission modules, regard STM32 as microcontroller, have made overall and deep analysis to design a collector used in energy monitoring system. The hardware and software designs of these modules are at great length described separately. The paper is organized as follows. In the following section, we introduce the design of data acquisition and transmission system, which includes system overview, microcontroller module, data acquisition module, data store module, data transmission module, and clock module. Application cases study examples are described in Section 4; in this part, the operational features are presented. Finally, we give the summary and make an expectation of the future work.

3. Data Acquisition and Transmission System

3.1. System Overview

The main work for the system of data acquisition and transmission is to collect energy consumption data (electricity, water, gas, heating, etc.) from terminal meters which are installed in buildings periodically, store the data after analyzing and processing, and finally transmit the data to data server through Ethernet. We design a low-cost collector which consists of the following parts.(1)STM32 microcontroller module, communicating with other modules and processing data before it isstored and transmitted,(2)RS485 data collect module, gathering energy consumption data based on an RS485 serial communication bus network,(3)SD card store module, driving mass-storage SD standard based on FAT32 and saving the data into SD card as the format of XML in chronological order,(4)EEPROM store module, taking charge of storing configuration parameters of the collector,(5)network transmit module, mainly communicating with remote data server through Ethernet,(6)clock module, providing time flags for collector to gather, store, and transmit,(7)DC-DC power module, which is an isolated power supply for RS485 module,(8)debug circuit, reset circuit, and power circuit, which are the basic configurations for STM32 microcontroller,(9)the watchdog circuit, which plays a role of anti-interference in working process so that the reliability of system is greatly enhanced.

A block diagram and an actual photograph of the collector are shown in Figures 1 and 2, respectively. The hardware and software designs of these modules are explained in the following discussion in detail.

3.2. STM32 Microcontroller Module

Microcontroller is the main component in this system which acts as a computer to configure the system, communicate with other modules and data analyzing. The microcontroller used in this research is on STM32F103VET6 chip from ST Company, which is a 32-bit microprocessor based on ARM Cortex-M3 core. The chip contains 512 kB Flash, 64 kB SRAM, 8 timers, and multi-interfaces, such as CAN interface, SPI interface, and USART serial communication interface, [9]. Its developing environment, RealView Microcontroller Development Kit (MDK), uses IDE environment Vision, which has the ability to generate reentrant code. It fully meets the requirements of the design of the collector.

The system flowchart is shown in Figure 3. Collector sends a TCP connection to data server after system initialization continuously, until the connection is successful. Then, server will check the validity identification by building ID and collector ID, which is a unique attribute of the collector. With success, the collector could extract useful information from configuration packet received from the data server, which contains collecting and transmitting period, terminal meter parameters that include manufacturer, meter number, and communication address; otherwise, it will close the connection and reconnect. From there, collector begins to enter into the normal work mode, to acquire the energy consumption data by order, to store the data into SD card in the format of XML, and to transmit the XML data packets to the server according the setting period from the configuration packets. Meanwhile, data collector sends a heartbeat packet to the server every minute to maintain the connection, while the server gives a synchronous time packet as a reaction to update the time information of all the collectors in order to guarantee the energy consumption data with a consistent format. When failure occurs in the process of data gathering, the collector records the number of terminal meter and reports it to the server.

3.3. Data Acquisition Module

Field bus is the hottest automation technology today which has been used in building automation widely, such as BACnet, CAN bus, EIB bus, and RS485, [1012]. This research uses RS485 as communication bus, mainly because of its reliable networking communication and lower cost initial capital outlay; besides that, most of the measurement meters in the current situation only support RS485 field bus. The theoretical max distance between slave device and master is 1200 meters; however, when the distance is too long, repeaters must be adopted to ensure the stable transmission.

This paper uses ADM2483 chip, with electrical data isolation, to realize RS485 circuit. The internal diagram is shown as Figure 4; the pins on the left side, VDD1, TxD, DE, RxD,, and GND1, are connecting to the logic side, while the other side pins, VDD2, A, B, and GND2, are in the bus side connecting with theterminal meters. RS485 is bidirectional half-duplex data transmission; here, use an IO pin of STM32 to connect the control pins of ADM2483 DE and together. When the pin output is at high level, the DE enabled and the collector could send data to the bus; otherwise, the enabled and the collector could receive data from the bus through interrupt service routine.

Figure 5 describes the flowchart of acquisition. The collector sends command of gathering to the meters one by one, unless the value of address reaches the configured number by server. If the routine encounters breakdown by accident, we will offer three times to communicate the faulted branch. Finally, the address and number of the faulted branch will be recorded and feedback as an error XML packet to the server, after the last effort. The communication baud rates are different due to a variety of meters installed in the monitoring system. Electrical meters communication speed is almost 9600 bps, while the baud rate of most of water meters is 1200 or 2400 bps. Hence, the parameter of expiration time is critical to obtain a stable and efficient system, and this value could be gained with plentiful experiments.

3.4. Data Store Module

An XML schema defines element and attribute names for a class of XML documents. The schema also specifies the structure that those documents must adhere to and the type of content that each element can hold. The elements in XML are sorted by meter types. Table 1 shows coding of different meters, which can be extended in future.

Meter type ElectricTemperature HeatWater

Code 01020304

In general, electric meter has many parameters to be monitored, including three-phase voltage, three-phase current, three-phase active power, power factor, and active power, with a total of 334 bytes. The layout of electric meter in XML file is shown in Algorithm 1.


Now, suppose that there are 100 electric meters under a collector in a monitoring system, and the polling period is one minute, generating an XML data packet every five minutes. Every collecting period has 73 bytes information on behalf of the sampling time; the head and the end of file have 118 bytes to contain public information (building ID, collector ID, etc.). Calculation of each packet size is as

The number of packets of one day is

So, the total quantity of packets is

namely, 48.24 M bytes. Here, we choose 2 GB SD memory card to store data, and it could store data for 40 days.

3.5. Data Transmission Module

Network transmission module is a critical component in the system. Here, we select W5100 as Ethernet driver chip, made in South Korea Wiznet company. W5100 supports TCP, UDP, ICMP, ARP, IGMP, and PPPOE. The internal block diagram is shown in Figure 6. Since the W5100 working frequency is up to 100 MHz, there are some announcements in the circuit design.(1)The distance between the RJ45 network transformer and W5100 is as close as possible.(2)Two termination matched resistances will try to be close to the network of module transformer.(3)Placement of crystals is away from the transformer and circuit line of TX and RX, and the line as shorter as possible, avoiding high frequency disturbance.The W5100 chip includes fully hardwired TCP/IP stack, which could facilitate easy implementation of Internet connectivity; it has three different interfaces, called direct, indirect bus, and SPI to communicate with microcontroller. Therefore, driving W5100 becomes very easy and simple. In this research, we select SPI mode to drive W5100. The initialization of W5100 includes MAC address, IP address, Gateway address, communication port, and buffer size for send and receive registers. W5100 starts TCP client program to connect the remote server by Ethernet, after finishing the configuration. Communication packets between collector and server are shown in Table 2.

Collector Request packetHeartbeat packetData packetError packet

ServerConfiguration packetTime packetData ack packetError ack packet

The data transmission potentially embraces and closes the TCP connection passively, in case of the slow-speed network at the peak hours. The collector will resend the data to server once the network recovers. In order to avoid losing the data packets collected in the period of network broken down the counter value 1 of sent packets is written into EEPROM, which could save value un changed even when the power is shut off, once the network accident happens. After a new connection is established, the microcontroller will make a comparison between value 1 of sent packets and value 2 of the should be sent packets for the time being. If value 1 is less than value 2, it begins to send historical packets, otherwise, sends current packets. After the server receives the historical packets successfully, value 1 increases by 1, controller stops sending historical packets and enters into normal routine when value 1 catches up with value 2. Figure 7 shows the flow chart of this program.

3.6. Clock Module

Time synchronization is a big problem that must be faced when data is collected from two or more points, as in this system. Paper [13] gives a way to utilize a GPS which receives signals from satellites to realize time synchronization. In this research, we take server’s time as standard signal, which is a convenient and costless method. Precise calendar clock chip PCF8563 takes the real-time clock source. Microcontroller reads time information from PCF8563 at regular time and sends a heartbeat packet to server every minute. Microcontroller will adjust PCF8563 according to the feedback packet from the server if the time changes.

4. Application Case Results

There are some configuration steps to do before the collector begins to work, as Figure 8 shows. (1)IP_set:, set IP address for the collector.(2)Port_set: 9090, set port for the collector.(3)Gateway_set:, set Gateway address for the collector.(4)server_IP_set:, set IP address of server.(5)server_Port_set: 9191, set port of server.(6)Building_ID_set: 210211A004, set building ID.(7)Gateway_ID_set: 210211A00401, set collector ID.local_set, is the end flag of configuration, of which, and should be offered by network administrator in monitored building, (4) and (5) are the fixed address of the data server, collector will send connection to this port when it starts to work, and (6) and (7) are the identity of target building and collector, respectively.

At present, the collector has been used in building energy consumption monitoring platform in Liaoning province and in the superintend platform of economical campus for Taiyuan University of Technology. There are 56 data collectors and 1580 electric meters in Liaoning project; on the other hand, there are 80 data collectors, 299 electric meters, and 241 water meters in Taiyuan project. Two years of continuous running show that the collector is reliable and stable. Figures 9 and 10 show an example of the installation of collector and building energy consumption data display on website, respectively. Figure 10 shows electric energy consumption of every day in October in a building of Dalian in China. From Figure 10, it is clear that the value on the weekends is lower than workdays, especially the Seven-day National Day holiday.

5. Conclusion and Future Work

In this research, a low-cost, small-sized, embedded data acquisition and transmission system has been designed and implemented, which could be used in the area of monitoring systems. The hardware circuit and program algorithm are described in detail. The novelty of this design is summarized as follows.(1)Multiple points: the system adopts RS485 field bus to realize data collection form meters, one channel could handle 64 points at most, and then the gateway has two channels, which could deal with 128 meters at the same time.(2)Storable: the 2 GB SD card supports the gateway for saving energy data up to 1 month, which is necessary to prevent data loss.(3)Scalable: the users do not need to change the structure of system, by just putting a meter in the end of RS485 bus if they want to add an acquisition point.The collector system started operation in October 2010 in Liaoning province and has been running steadily since then. At present, implementing energy-saving construction, developing green buildings, and achieving sustainable development have become a consensus in China, and more widely, the globe. The collector will have a good market prospects in the area of monitoring systems in future.

However, there are still some improvements that need to be further solved, such as adding a GPRS communication interface to solve the problem that cable network cannot reach in some buildings, and the power demand of the device is still in the process of being improved by putting the attached devices into sleep mode at times when they are not in use to conserve power.

Conflict of Interests

The authors declare that they have no conflict of interests.


This work was supported in part by the National Natural Science Foundation of China (Grants no. 51008042 and no. 51078053) and The Key Projects in the National Science & Technology Program in the Twelfth Five-Year Plan Period of China (Grant no. 2011BAJ03B12-3).


  1. L. Pérez-Lombard, J. Ortiz, and C. Pout, “A review on buildings energy consumption information,” Energy and Buildings, vol. 40, no. 3, pp. 394–398, 2008. View at: Publisher Site | Google Scholar
  2. Y. Kim, T. Schmid, Z. M. Charbiwala, and M. B. Srivastava, “ViridiScope: design and implementation of a fine grained power monitoring system for homes,” in Proceedings of the 11th ACM International Conference on Ubiquitous Computing (UbiComp '09), pp. 245–254, Orlando, Fla, USA, October 2009. View at: Publisher Site | Google Scholar
  3. N. Wei, W. Yong, S. Yan, and D. Zhongcheng, “Government management and implementation of national real-time energy monitoring system for China large-scale public building,” Energy Policy, vol. 37, no. 6, pp. 2087–2091, 2009. View at: Publisher Site | Google Scholar
  4. C. Yongpan, M. Xianmin, Z. Jili, and L. Zhen, “Development of monitoring system of building energy consumption,” in Proceedings of the International Forum on Computer Science-Technology and Applications (IFCSTA '09), pp. 363–366, Chongqing, China, December 2009. View at: Publisher Site | Google Scholar
  5. L. Zhang and H. Gao, “Asynchronously switched control of switched linear systems with average dwell time,” Automatica, vol. 46, no. 5, pp. 953–958, 2010. View at: Publisher Site | Google Scholar | Zentralblatt MATH | MathSciNet
  6. L. Zhang and E. Boukas, “Mode-dependent H filtering for discrete-time Markovian jump linear systems with partly unknown transition probabilities,” Automatica, vol. 45, no. 6, pp. 1462–1467, 2009. View at: Publisher Site | Google Scholar | Zentralblatt MATH | MathSciNet
  7. L. Zhang, E. Boukas, and A. Haidar, “Delay-range-dependent control synthesis for time-delay systems with actuator saturation,” Automatica, vol. 44, no. 10, pp. 2691–2695, 2008. View at: Publisher Site | Google Scholar | Zentralblatt MATH | MathSciNet
  8. Y. Sun and Z. Wang, “The energy consumption monitoring platform design for large-scale industry users based on the GPRS,” in Proceedings of the 2nd International Conference on Mechanic Automation and Control Engineering (MACE '11), pp. 7827–7830, Hohhot, China, July 2011. View at: Publisher Site | Google Scholar
  9. W. Yonghong, X. Wei, and H. Liping, STM32 Family of Microcontrollers ARM CortexM3 Principles and Practice, Coal Industry Press, 2008.
  10. A. Jorge, J. Guerreiro, P. Pereira, J. Martins, and L. Gomes, “Energy consumption monitoring system for large complexes,” International Federation for Information Processing, vol. 314, pp. 419–426, 2010. View at: Google Scholar
  11. H. Y. Huang, J. Yen, S. Chen, and F. Ou, “Development of an intelligent energy management network for building automation,” IEEE Transactions on Automation Science and Engineering, vol. 1, no. 1, pp. 14–25, 2004. View at: Publisher Site | Google Scholar
  12. A. Z. Alkar and M. A. Karaca, “An internet-based interactive embedded data-acquisition system for real-time applications,” IEEE Transactions on Instrumentation and Measurement, vol. 58, no. 3, pp. 522–529, 2009. View at: Publisher Site | Google Scholar
  13. T. Nagata, “An electric power energy monitoring system in campus using an internet,” in Proceedings of the EEE Power Engineering Society General Meeting (PES '06), Montreal, Canada, June 2006. View at: Publisher Site | Google Scholar

Copyright © 2013 Liang Zhao et al. This is an open access article distributed under the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

More related articles

 PDF Download Citation Citation
 Download other formatsMore
 Order printed copiesOrder

Related articles

We are committed to sharing findings related to COVID-19 as quickly as possible. We will be providing unlimited waivers of publication charges for accepted research articles as well as case reports and case series related to COVID-19. Review articles are excluded from this waiver policy. Sign up here as a reviewer to help fast-track new submissions.