An Ad-Hoc Low Cost Wireless Sensor Network for Smart Gas Metering

The monitoring of power consumption has become of a great interest in recent years as well as the innovative technologies available to realize Wireless Sensor Networks (WSNs) have experienced a great growth. While smart metering technologies for electric energy are already established, as sensors power supply comes directly from power lines, WSN nodes for gas metering should necessarily be equipped with long life batteries. The presented work describes a new prototypal low cost WSN designed ad hoc for gas smart metering. The network has a star topology: each sensor node can be completely integrated with standard reed relay gas meter, and it is capable to measure the gas consumption. The information is sent to the central node (the Access Point, AP) through an RF links. The sensor nodes have been designed with custom electronics and a proprietary firmware, in order to work with a common 3.6 V lithium battery which is able to ensure a life period of about 10 years for each node. Only the AP must be connected directly to electric power. The AP is connected through the RS-232 interface to a control embedded PC equipped with a LAMP (Linux, Apache, MySQL, PHP) framework: it stores all the information coming from each node in a coherent database and allows authorized users to check the network status using a web interface. The WSN is self-learning and it is capable to detect new nodes joining the network without altering the normal operative flow. Moreover e-mail and SMS alerts can be activated to alert if a node is disconnected from the network or some problems occur. A first prototype of the WSN has been already tested achieving good results.


Introduction
Wireless Sensor Networks (WSNs) have become very important in recent years because of their numerous possible applications.They are used for collecting, storing and sharing data, for environmental monitoring application [1,2], surveillance purposes [3], sport performance evaluation [4], agriculture [5], home automation applications and, very important and topical, they are increaseingly used for energy management.
The Smart Grids, which are particular WSNs devoted to energy management, are emerging as a convergence of information technology and communication technology with power system engineering and metering technologies.A more detailed definition can explain better what are the "Smart Grids" today emphasizing their relevance.They can be defined as networks that can intelligently integrate the actions of all users connected to them using digital technologies.Basically their goal is a modernization of already existing energy grids with ICT technolo-gies, joining power-delivery systems and customers, and allowing a two-way communication between them.A paper of Panajotovic et al. [6], presents a very detailed description of the state of the art of the smart grid and their close relationship with ICT.
The Smart Grids will have a key role in the transformation of the current functionality of the energy distribution system, aiming both to offer a user-oriented service and to help energy distribution companies.They will help European countries to achieve the so called objecttives "20/20/20" (Horizon, 2020) the next European framework program for research and innovation.
It has to be noted that a Smart Grid should be able to provide one or more of the following new capabilities: self-healing, high reliability, energy management, and real-time pricing for every kind of energy sources [7].Therefore, from a design perspective, Smart Grids will incorporate new technologies as advanced metering, automation, communication, distributed generation, and distributed storage.
Usually the words "Smart Grids" are referred to the electrical distribution systems because the grids usually have strict power requirements.By using more modern technologies for WSN it is also possible to implement Smart Grids for different energy sources such as the gas energy.
A new experimental and prototypal Wireless Sensor Network has been completely designed, realized and tested as an ad-hoc smart grid for gas metering able to give to gas operators a simple and cheap tool to keep under control the costumers gas consumption.
In the next paragraphs all aspects of the prototypal smart grid will be described.

General Description of the Grid for Smart Gas Metering
The smart grid for gas metering has been designed with a master-slave architecture and star topology.A central node, called Master Node or Access Point (AP), receives data coming from all the peripheral nodes and dialogues with an embedded control PC.It has to be noted that each slave nodes communicates only with the master node with a unidirectional link.The control PC is a common commercial embedded PC which can be connected to internet using either a GPRS router or a wired internet connection.It allows both locally and remotely authorized users (e.g. the gas company which delivers the service) to control the gas consumption.Moreover the PC stores all the data coming from the sensor node in a dedicated database and can send SMS and e-mail alerts, if such functionalities are turned on.Both the control PC and AP node are connected to power lines because of their high computational load.
Each slave node is directly connected to a gas meter equipment, which is almost never connected to power lines.To ensure a life period of almost 10 years (avoiding a too frequent battery replacements by maintenance workers), the nodes' electronics have been designed to have an almost irrelevant current consumption and they can be fed up by a common 3.6 V lithium battery.
The sensor node has been designed in order to receive information coming from a commercial pulse transmitter.It is connected to a common commercial gas meter in order to count the pulses detected by its reed relay switch.In fact, even if some high resolution electronic gas meter systems have been experimentally realized [8], most gas meters used for residential purposes are still using mechanical diaphragms technology connected to reed pulse gas meter.The number of counted pulses are sent to the AP using the standard Wireless M-BUS protocol [9].Knowing the correspondence between a single count and the gas consumption it will be possible to evaluate the gas consumption by each meter installed by the customers.
On the basis of such information, each other operation (e.g.suggest a reduction of the gas consumption, alert that the consumption are different from the average ones… ) can be performed in future developments of the prototypal wireless sensor network.

Sensor Node Description
The sensor node (Figure 1) is developed to perform the following tasks:  Reading pulses from gas meter equipments;  Storing the temporary number of counted pulses on local memory waiting to send to the AP;  Managing Wireless Meter Bus protocol for download data to the AP;  Error handling.
The system on chip (SoC) used for the node of the smart grid is the Texas Instruments CC430F5135: it integrates in a single solution both the microcontroller and the radio, thus reducing costs and power consumption.The radio can operate in different frequency bands (300 -348 MHz, 389 -464 MHz, 779 -928 MHz) with very little firmware and hardware modifications.The developed smart grid prototype operates a 868 MHz.
The board power consumption depends on the chosen operating modes.In particular it is very sensitive to the selected output power (up to a maximum of 10 dBm) which cause a consumption to a few tens of milli-Amperes [10].In the described prototype, low power firm ware techniques have been adopted in order to properly managed the board, reducing the power consumption, keeping the microcontroller in the so called "Low Power Mode" as long as possible, since in that condition the amount of absorbed current is equal to a few micro-Amperes.It is possible to achieve a theoretical durations of 10 years using commercial standard lithium batteries of 3.6 V.

Reading Pulses from Gas Meter Equipments
The electronic boards for the described smart grid have been completely designed: they have two interfaces to manage both open collector output than reed relay switches.For the smart grid, only the second interface has been used (Figure 2).
The microcontroller acquires the pulse thanks to the right setting of the dedicated pin.The pulse trigger a software interrupt able to update the pulse count.

Storing Pulse on Local Memory
The pulses read by the electronic board are stored on the local flash memory of the microcontroller waiting to be send to the AP.The available memory size is enough for the purposes of the described smart grid.

The Communication Protocol
A detailed description of the wireless metering protocol state of art is reported in a work by A. Sikora et al. [11].Anyway the Meter Bus (M-BUS) protocol and the wireless version (Wireless M-BUS or WM-BUS) are the "de-facto" standard for all the smart metering grid.
The M-BUS protocol is the most common standard used for the so called Automatic Meter Reading (AMR) implementation, very useful for remote energy meter reading.It is based on European standard EN 13757-2 (for physical and link layers) and EN 13757-3 (for application layer).The M-BUS can be used in different topologies of Smart Grids, including the star topology used for the presented network.When interrogated, the meter nodes (the slave nodes) send the data to a concentrator (the master node devoted to receive and manage data from each slave node) that can be also remotely placed if an internet connection is available.
The WM-BUS standard is another European standard defined in EN 13757-4 (for physical and data link layers) and in EN 13757-3 (for the application layer).It defines different possibilities of communication between remote meters and mobile devices, stationary receivers, and data collectors and storage devices [12].
The WM-BUS standard is designed to give a long battery life for grid nodes powered with batteries, to avoid often battery replacements during the normal life time of a network node.Moreover it has to be noted that the presented smart grid for gas metering does not require the complete version of the WM-BUS protocol which has more complete and complex features [13].It is sufficient a limited version which is currently in use in a lot of experimental and prototypal grids and which can be freely downloaded from the web.It is only necessary to adapt such protocol to the system on chip used in the custom realized electronic boards, thus reducing the realization costs of the WSN.
Among the different modes available with WM-BUS protocol, the described network uses the Stationary Mode (S-Mode), which allows an unidirectional link between meter nodes and the AP.It is in fact only necessary that each sensor node sends its data to the central node, without waiting any acknowledgement answer.
The S-Mode defines a radio link type with the following characteristics:  Manchester data coding;  32.768 k baud typical;  868 MHz ± 100 kHz as operational frequency;  Typical receiver sensitivity of −105 dBm to ensure a BER of 10 −2 .All the described characteristics, including the packet length, suit very well with the proposed WSN solution for smart gas metering.
To handle the WM-BUS protocol, dedicated firmware functions have been developed and integrated on the microcontroller.A proprietary algorithm, based on the approach "listen before talk", has been developed to manage and avoid the collision when more than one node want to transmits at the same time.

Error Handling
The electronic board of each sensor node is able to handle any failure such as low battery, possible short-circuits on reading pin, quartz and clock problems.Its firmware is realized to switch on a specific led for different error or malfunctioning, and to stop sending data to the AP in case of failure.An authorized user connected to the smart grid web interface, or whose e-mail address or phone number is part of the list at which the AP sends e-mails and SMS, can thus note that a specific node is no longer active, and can program a maintenance field intervention in order to repair or substitute the damaged node.The specific failure is identified by the corresponding led turned on without performing difficult tests.

Central node Description
The central node is made up by the Access Point (AP) node, which is directly connected to the embedded PC.The communication between the AP and the embedded PC is performed through the standard RS-232.

The Access Point Node
To further reduce the production costs of the electronic boards, the hardware of the AP electronic board is the same of the one adopted for the meter nodes.In fact, even if the AP is the only node which uses the RS-232 standard, the interface has been placed on all the node to serialize the board production.It possible to substitute each node of the smart grid with another by only modifying the firmware.
The AP receives WM-BUS packets coming from each nodes and forwards each packets to the embedded PC.

The Embedded PC
The embedded PC performs four basic functions:  reception of the information acquired from the AP;  storage of node values in a coherent database, thus providing a database server;  representation of the network status on the web interface, thus providing a web server;  sending e-mails and SMS alerts if the dedicated functionalities are active.All the functions are performed simultaneously while the PC is connected to internet through a GPRS router or a wired connection, if available.
The PC is equipped only with open source software and a LAMP platform is installed on it, in order to create an easy to use system, compliant with international standards.The LAMP platform includes Linux (Debian 6.0) as operative system, Apache as web server, MySQL as database server and PHP as scripting and programming language.This is one of the most globally used framework and allow the prototypal grid to be a base for a future more complex system development.
The reception of the information on RS-232 interface is managed by an ad-hoc developed C software which stores the read values coming from each node in the database.It uses open source libraries and checks if a node is still connected to the smart grid (a node is assumed to be disconnected or not active if does not transmit any data for 10 minutes).The same software creates a specific log file which allows to control the correct functioning of the network and the correct reception of the packet coming from the AP.
The web interface has been realized using both HTML and PHP languages.It is accessible only after an authentication procedure, and it is made up by two sections.The main section shows the last read values coming from each node, with the corresponding timestamp, while a graphical indicator shows if a node is still active and connected to the smart grid (Figure 3).The second section shows the last 10 rows of the log file and allows to have an immediate indication in case of network problems (Figure 4).
If a node becomes disconnected from the smart grid or some problems occur, e-mail or SMS alerts are also sent by the AP to a list of selected addresses or phone numbers.Such functionalities can be turned on or off using a configuration file editable by authorized users.The database is made up by two tables: the first contains the information related to the smart grid nodes and the seconds contains the data related to the pulse detected by each sensor node and sent through radio channel to the central node (Figure 5 shows the implemented structure).
The tables respect the referential integrity constraint.If a node is connected for the first time to the grid its insertion into the database is managed by well designed store procedures and triggers.Such triggers are activated before the record containing the data read by the node is stored into the right table of the database.It is thus   possible to avoid writing specific C procedures to add a new node in the database, making the entire database more robust and efficient.

Test
A first experimental smart grid for gas metering, made by one AP connected to the embedded PC and 5 sensor nodes, have been tested in the laboratory achieving very good results.The WSN has proven to be "self-learning", and each new node connected to smart grid has been correctly recognized and added into the database as soon as it has been turned on.
A massive stress test have been performed by connecting each sensor node to a tool able to simulate the pulses coming from the commercial pulse generator connected to the gas meter (Figure 6).The sampling time has been set to 1 minute, in order to have a large amount of data to be stored on the embedded PC of the central node.The simulated network has been kept "operational" for almost 14 consecutive days.Each node sent to the AP an average of 18600 values (out of the theoretically expected 20152).Details about data transmitted by each node and correctly managed by the simulated network are shown in Table 1.
Sampling interval equal to 1 minute is definitely excessive in a real context of application of the smart grid for smart gas metering.It is more likely that each grid node will perform a sampling operation 4 times per day in order to allow the AP to receive 1460 packets per year.With 20152 packets received at the end of the test, a period of activity of the entire smart grid equal approximately to 14 years (actually 13.8 years) was estimated.
Experimental current consumption was very low in 4 out of 5 test nodes, in accordance to datasheet information, allowing a life period of each node of almost 10 years, as decided in designing stage.The higher current absorption of the fifth node is due to imperfections in the realization of electronic boards (e.g.not perfect components welding).

Conclusions and Outlooks
This paper presents a new prototypal low cost smart grid ad-hoc designed for gas metering.All the hardware, the firmware, the software and the solutions are ad-hoc designed and developed for this purposes, paying particular attention to the overall cost reduction of the custom realized electronic board, which was designed to be compatible with the already available commercial gas metering equipments.
The present version of the prototypal smart grid stores into the database the number of pulses coming from the gas meter equipments and detected by each node.
All the tests performed in laboratory show that the developed smart grid acquires information from comercial gas meter equipments with very few errors, assuring a good reliability of the systems.
The described network has been developed in a cooperative project with the Italian gas company Piceno Gas S.R.L..The gas company presented to the Italian Office for Patent and Marks (Ufficio Italiano Brevetti e Marchi) the patent application for the utility model No.

TO2013U000009.
In the future a complete experimental installation of the prototypal smart grid will be realized in order to test the wireless sensor network in a fully operative situation.Moreover it will also be possible to realize a specific procedure to store in the database the amount of gas consumed by each user.Finally other services can be implemented to improve the gas metering grid and make it more complete and efficient.

Figure 1 .
Figure 1.Realized electronic board for smart grid nodes.

Figure 2 .
Figure 2. Example of common gas metering system.The black box is the commercial pulse transmitter which is connected to the sensor board of the smart grid shown in Figure 1.

Figure 3 .
Figure 3. Example of web interface.It reports the information about each network node.In the reported situation node 5 is no longer connected to the smart grid.

Figure 4 .
Figure 4. Example of web interface.It reports the last information reported in the log file.

Figure 5 .
Figure 5. Entity-relationship scheme for central node database.

Figure 6 .
Figure 6.Smart grid node during the massive stress test connected to commercial pulse generator which will be connected to the gas meter in a real application.