Paper—Application of Wireless Sensor Network based on LoRa in City Gas Meter Reading Application of Wireless Sensor Network based on LoRa in City Gas Meter Reading

At present, the common meter reading method in gas meter reading system is manual. The meter reader enters the meter reading system to calculate the cost after getting the reading. This work is not only labour-intensive, but also inefficient. In addition, incorrect reading may occur due to human errors. With the development of the wireless communication technology, a wireless communication technology named LoRa for long-distance and low-powerconsumption devices appeared. LoRa is a wireless communication technology with long transmission distance, low power consumption, low transmission speed, low complexity and low cost. It is mainly used in automatic control and internet of things. Through the comparison and analysis of several wireless communication technologies, a gas meter reading platform based on LoRa spread spectrum and wireless sensors is proposed. First of all, this paper briefly introduces the LoRa wireless communication technology and machine vision technology. Secondly, it gives a detailed introduction to the overall design of the system which includes system architecture design, information acquisition terminal, image acquisition module and wireless sensor module. Finally, an experiment is carried out in a residential area. The results show that the gas meter reading platform based on LoRa and wireless sensor network has a high practical value. Keywords—LoRa, wireless sensor network, gas meter reading


Introduction
In many cities, most of the gas meters are still traditional mechanical ones, which require meter readers to enter users' homes regularly to obtain meter readings. However, with the acceleration of pace of life and the development of urbanization, the success rate of meter reading is becoming lower and lower, which makes it more difficult for gas companies to calculate the gas bill. In this context, the wireless meter reading technology has received great attention and saw significant development [1,2].
The wireless remote meter reading system is an innovative, advanced, economical, efficient and safe program for meter reading, which solves the problem that meter readers are unable to obtain the readings and greatlyimproves the service quality of gas companies. So, the wireless remote technology is very suitable for new high-rise residential areas [3]. The traditional wireless remote meter reading system has the problems such as complex network, high cost, high power consumption and high error rate. Low Power Wide Area Network (LPWAN) has emerged and received a great deal of attention [4]. Compared with traditional wireless networks, LPWAN requires lower cost and lower power consumption. In addition, it has a strong penetrating power, which means a greater signal transmission range. Over the years, several communications technologies such as Sigfox, LoRa and Weightless have appeared. Among them, LoRa technology is the most widely used technology in LPWAN [5,6].
For the existing traditional gas meters in the society, due to their economic cost, they cannot be replaced completely by remote wireless meters. For this kind of meter, we can use the machine vision technology and wireless sensor to realize remote meter reading. The basic idea is to convert the mechanical readings into digital signals and transmit them through the LoRa wireless communication technology by adding the image recognition module and the information transfer module on a traditional meter [7]. The meter reading method based on machine vision avoids the waste of resources brought by meter replacement, and effectively improves the economic benefits of gas companies [8].
In this paper, a gas meter reading platform based on LoRa spread spectrum and wireless sensor is proposed through the comparison and analysis of several wireless communication technologies. First of all, this paper briefly introduces the LoRa wireless communication technology and machine vision technology. Secondly, it gives a detailed introduction to the overall design of the system which includes system architecture design, information acquisition terminal, image acquisition module and wireless sensor module [9]. Finally, an experiment is carried out in a residential area. The results show that the gas meter reading platform based on LoRa and wireless sensor network has a high practical value.

Basic Theory and Technology
LoRa (Long Rang) is a low-power spread spectrum wireless communication technology proposed by Semtech in 2013. The overall communication rate is low because it is based on the Sub-GHz frequency band, which leads to the increase in battery life and the expansion of network capacity. Another characteristic of LoRa is its penetrating power, so it can cover a relatively wide area, especially in the complex urban construction environment. A range of features of LoRa make it ideal for large-scale, low-cost deployments. Prior to the advent of LORA technology, the main short-range wireless communications technologies are Blutooth, RFID, Wifi, ZigBee, and LoRa [10]. !" #" !"" $"" !""" #""" %"""" #"""" As can be seen from the above figure, the higher the data transmission rate is, the farther the communication distance will be, and the greater the power consumption will be. However, LoRa not only achieve long-distance communication, but also requires lower power consumption, so it is very suitable for large-scale networks.
LoRa packets consist of preamble, header, data payload, and CRC payload. The packet format is shown in Figure. 2.

Fig. 2. Packet format of LoRa
When the terminal device is initialized, the key parameters, which the system can set, include signal bandwidth (BW), spread spectrum factor (SF) and coding rate (CR). The range of CR and SF are as follows.
The average transmission speed of the LoRa wireless communication network can be calculated by the following formula.
Then, the transmission time of the preamble can be obtained by the following formula.

4.25)
pre pre In the above formula, N pre represents the length of the preamble, and its value can be determined by the algorithm. The number of transmission times for headers and payloads can be calculated by the following formula: In the above formula, PL and CRC respectively represent the payload and the number of bytes of the CRC load, which meet the following conditions. 1 255 Therefore, we can get the transmission time of the header and payload and the CRC load by the following formula.
pay pay Finally, the formula for calculating the transmission time of the entire packet is as follows.
p pre pay

Machine Vision Technology
Machine vision is a technology that converts the target image into image signals and then converts the image information into digital information. Machine vision is a comprehensive technology, which includes digital processing, mechanical engineering, lighting, optical imaging, sensor technology, analog and digital video technology, computer technology and human-computer interface technology. The coordination of all technologies constitutes a complete machine vision system [11][12].
The complete machine vision system consists of an optical imaging module, an image acquisition module, an image processing module and a signal output module. Under certain illumination conditions, the optical imaging module and image acquisition module are used to record the image signals of the target scene. The image processing module uses the image processing technology to process the image which is obtained by A/D conversion. Finally, the signal output module is used to extract the interesting feature information and send it out. The structure of the machine vision system is shown in Figure.  The gas meter reading recognition technology based on machine vision mainly uses tilt correction technology and image enhancement technology to obtain reading information. When the image acquisition device has a certain angle deviation, it will cause the actual image to produce a certain tilt. When the tilt is large enough, it will affect the subsequent image segmentation. Therefore, the tilt correction technique is an essential step.
Suppose that (x, y) are the coordinates of any point on the image, and the angle between the abscissa is !, then the coordinates can be expressed in the following formula.
cos sin x r y r Where, r is the distance between (x, y) and the origin of coordinates. After tilting by the angle !, the coordinate becomes (x 1 , y 1 ). x r x y y r y x ! " " " ! " " " Thus, the relationship between (x, y) and (x 1 , y 1 ) can be represented by the following formula.
The purpose of image enhancement is to improve the quality of images, enrich the amount of information, and enhance the image interpretation and recognition effect.
In general, image enhancement mainly consists of five steps. Due to its high efficiency, high precision and low cost, machine vision is widely used in industrial inspection, automatic driving, intelligent transportation, military and other fields.

4
Design of System Platform

Design of overall architecture
The wireless meter reading platform based on LoRa mainly consists of terminal nodes, routing nodes, coordination nodes, 4G communication network, server and terminal equipment. The overall structure is shown in the Figure 4.
The terminal node mainly refers to a wireless gas meter installed in user's home, which can be a new type of LoRa wireless gas meter, or a traditional mechanical meter with a wireless sensor module. The wireless sensor module is composed of an image recognition module and a wireless transmission module. The image recognition module is mainly used to recognize the gas readings, while the wireless transmission module is mainly responsible for transmitting the information to coordination nodes. The routing node mainly refers to the signal transceivers distributed in a residential area. Compared with the traditional ZigBee wireless communication network, the communication range of LoRa is much larger, so the distribution density of routing nodes is low, which can save costs. Coordination node is the most important node in a Lora network. In general, there is only one coordinator in a network.
LoRa network is a typical star topology, and the terminal node can directly interact with the coordination node, which effectively reduces the network complexity and energy consumption. The server is responsible for cost calculation and other business analysis, and the results are shown to users on user terminal.

Design of system hardware
The hardware structure of new meter is shown in Figure 5. The information acquisition terminal mainly consists of a micro control unit (MCU), a power supply module, buzzer, an electronic clock/storage, a signal transmission module, a double channel pulse sampling module and a valve control module.

! !" " $%&' ' '( () ) )* * !"#$%&'()*
MCU is the brain of the whole terminal device, which is responsible for controlling the operation of other modules of the terminal and the analysis of the signals. The signal transmission module is responsible for transmitting gas meter information to the routing nodes and transferring the control instructions from the routing node to the MCU. The valve control module is mainly responsible for controlling the gas pipeline. When receiving the closing instruction from MCU, the valve control module in the gas meter drives the valve to close by a direct current motor. Only when receiving the unsealed instruction, the valve control module will open again. The buzzer is used to make a prompt when the power is low. The function of memory is to provide power-down storage for the system, while the electronic clock provides the time basis for the measurement work of the system.
In order to reduce the power consumption of the equipment, MCU keeps the sleep state before being activated, and periodically monitors the wireless signals. Once the activation signal is received, the MCU will enter the communication program. The terminal has the function of carrying out bidirectional communication with the sink node, which brings it the ability of reading instructions and returning data.
The main working flow of the new terminal which can transfer information by Lo-Ra is shown in Figure.

Experiment and Result Analysis
In order to verify the comprehensive performance of LoRa wireless meter reading network, this paper analyzes from meter reading success rate and meter reading accuracy. Through cooperation with the gas company, we conducted experiments on the new wireless gas meter in area A. At the same time, in order to verify the performance of the machine vision module, we carried out experiments by adding relevant modules on traditional mechanical meters in the old residential area B. During the experiment, each meter in residential area was read four times. Generally, we use the success rate R s to represent the performance of gas meters for transmitting information over the Lora network.
The success rate of meter reading is shown in Table. 2. From Table. 2, we can find that the success rate of the new LoRa wireless gas meter is 100%, which means that the new meter has a good signaling transmission effect. The reason for this performance is that the LoRa uses low frequency bands, leading to its stronger penetration. What is more, the success rate of old meters added with the machine identification module and signal transmission module is relatively low because of the compatibility between different modules.
In order to verify the accuracy of the two kinds of meters, we randomly sampled some meters from residential area A and B for verification, and the verification results are shown in Table. 3. Meanwhile, ! ! X is used to represent the accuracy of data collection.  Through onsite verification, we found that the accuracy of the meter reading in residential area A was 100%, which means that the whole performance of new meters is very excellent. The new type of gas meter fully meets the needs of actual management. On the other hand, the accuracy of the gas meter combined with different modules is relatively low. Through the analysis, we find that only when the situation like Figure. 7 occurs, the transmitted readings are not correct. Since the rotor of the gas meter can deviate from normal operation, the machine vision module cannot extract the correct reading information if the deviation reaches a certain extent. Thus, an excellent image processing algorithm is the key to improving the accuracy. Due to the limited computing power of MPU, and the relatively small memory capacity, the machine vision module cannot run a complex image processing algorithm. In a word, despite some errors in the wireless meter reading system based on machine vision, the errors are basically within the acceptable range, so we still consider it as a very practical solution.
Through the experiment we can find that the wireless meter reading scheme has great practicability for most gas users. From the economic point of view, the wireless meter reading technology reduces labor costs and brings great benefits to gas companies. From the management point of view, it improves the quality of meter reading, which improves service satisfaction.