Research on Data Secure Transmission and Processing Method of a LoRa IoT System

The smart grid covers the traditional power grid and the Internet of Things network, including smart meters, which helps manage and monitor various customer consumption patterns in near real-time. To achieve data reading and effective management of terminal, smart meters connected to the power metering system, the article proposes using low-power wireless network (LPWAN) technology to connect terminal, smart meters to data gateways and private power clouds to achieve smart power metering Technical solutions. The solution uses the LoRa wireless module to realize the two-way interaction of power metering data and has the advantages of reliable operation, low cost, low power consumption, and remote access. This article also focuses on using emerging LPWAN technology to help build smart meter wireless access solutions and demonstrates the system implementation for smart meter end-to-end LoRa connection.


Introduction
The smart grid covers the traditional power grid and the Internet of Things network, including smart meters, which helps manage and monitor various customer consumption patterns in near real-time. The smart grid is transformed by introducing new smart technologies into the traditional grid, including smart sensors, new back-end IT systems, smart meters, and communication networks. Besides, smart grids integrate different technologies to automate the entire grid's operation, including power generation, transmission, and distribution. For example, smart grids are used to improve operational accuracy and reduce costs during the deployment of power infrastructure. The introduction of small "remote" systems for rural electrification is a cost-effective way to quickly expand the national grid's infrastructure. However, due to the high infrastructure costs of installing and rebuilding the new environment, extending this to grid infrastructure seems to be a very challenging task.
One of the "six-full visions" of the full-service ubiquitous power Internet of Things, the "all-link IoT," covers all aspects of power system generation, transmission, transformation, distribution, utilization, dispatching, and operation and management. The full-service ubiquitous power Internet of Things is located at the terminal layer in the Internet of Things' overall architecture. As a necessary technical means to ensure the reliable and stable operation of the high-voltage transmission grid, with The wireless data transmission technology of the Internet of Things is classified according to the communication transmission distance, which can be divided into short-distance transmission communication and long-distance transmission communication. Different communication technologies can be applied to scenarios with different transmission distances. There are many current mainstream wireless data transmission technologies at short distances, such as 4G, 5G, Bluetooth, and WIFI. With the explosive growth of the Internet of Things, short-distance transmission technology can no longer meet the deployment and application of the Internet of Things devices, so LPWAN for longdistance transmission has emerged. LPWAN mainly meets the needs of large-connection, low-speed Internet of Things services. It has the characteristics of comprehensive coverage, low connection cost, and low power consumption. It supports a large number of devices to access the network [2]. It is mainly used in low power consumption, low bandwidth, and long-distance. Or in an IoT environment where a large number of devices are connected. LPWAN technology can be divided into two categories according to channel authorization: LoRa, SIGFOX, and other technologies that work in an unlicensed spectrum; the other is cellular communication technologies supported by the telecommunications industry that work in licensed spectra, such as LTECat-m, EC -GSM and NB-IoT, etc.
LoRa, SIGFOX, and NB. 10T is a technology widely used by LPWAN. The comparison of the three is shown in Table 1. LoRa is a highly available technology with a high degree of freedom. Based on unlicensed frequency bands, the transmission distance in cities and suburbs can reach 8 kilometres and 25 kilometres, and the transmission rate can reach 0.3kbps-50kbps. Battery life the length is about ten years, and the network delay varies according to the length and transmission distance of the transmitted data packet, and the operating cost is low. Through the above technical comparison, among the existing LPWAN representative technologies, LoRa has the advantages of low operating cost, long transmission distance, and independent design based on unlicensed frequency bands, a high degree of freedom, and easy configuration of hardware parameters. Coupled with the higher data transmission rate, LoRa has better operational feasibility and prospects in the test performance analysis.

Principles of LoRa Communication Technology
LoRa adopts linear spread spectrum modulation technology, the signal penetration ability is weak, and its communication environment in the line of sight that is unobstructed, the open area will be farther than the city. Compared with other LPWAN technologies, LoRa has stronger practicability and farreaching application prospects in performance analysis [3].

Technical aspects.
Through spread spectrum technology, LoRa has the characteristics of long communication distance and low power consumption, which achieves a more prominent place than traditional short-range IoT communication technology. LoRa reduces the number of hops in data transmission, from multi-hop to single hop, reduces transmission delay, increases data transmission reliability, and reduces data transmission power consumption and complexity. LoRa adopts a starshaped network architecture. The terminal can only transmit data to the gateway, and there is no link between the terminal nodes. That is, a single gateway controls multiple terminal to transmit data in a single hop mode. In mesh architecture, terminal nodes can communicate with all topology nodes to form a local area network. Compared with mesh architecture, star architecture is the lowest latency and simplest network structure. The structure is shown in Figure 1.

Battery life.
The working state between the terminal and the gateway in the LoRa network can be different. In a synchronized network such as a cellular network, the terminal needs to be synchronized with the gateway without data transmission, thereby awakening. Synchronous work requires a lot of energy to maintain the device's regular operation, which is also an essential factor in reducing battery life. The functional status between the gateway and the terminal is not synchronized, which effectively increases the battery life used in the data transmission process.

Cost and marketing aspects.
The cost of LoRa communication module is low. At present, LoRa is piloted or deployed in many countries worldwide, such as the United States, France, and Germany. In our country, LoRa is being promoted in many areas, and the representative one is the Beijing-Hangzhou Grand Canal. LoRa base stations cover most of the watershed [4]. From the perspective of long-term development, some companies will consider factors such as corporate data information security and operating costs and independently deploy private Internet of Things to communicate outside of the operator's network, so LoRa will have broad application prospects in the future.

LoRa performance parameters
Spread spectrum communication technology is also called spread spectrum communication method, LoRa uses this communication method for data transmission. Spread spectrum technology was first applied in the military and space communications fields, and then it was applied on a large scale in the civilian field. Its characteristic is that the bandwidth required to transmit the data itself is more than the minimum bandwidth required to transmit it. Even if there is a lot of noise in the demodulation environment, the concealment of spread spectrum communication technology for data transmission is obviously more substantial than that of other wireless data transmission methods. The anti-interference ability of noise is more vital. In simple terms, the spread spectrum is to disperse the data transmission spectrum into a wider bandwidth so that the data occupies the entire bandwidth. In the field of information theory studied by Shannon, the channel capacity formula based on the relationship between the maximum information transmission rate, bandwidth, and signal-to-noise ratio is shown in equation (1), namely Shannon's formula: In the formula, B represents the bandwidth of the frequency band (Hz); S represents the useful signal power (dbm); N represents the noise power (dbm); C represents the maximum information transfer rate (bps); S/N represents the signal noise H: (dB). Transmission power (Power) indicates the power required by the gateway to send data and refers to the amount of energy within a given frequency band. There are two standards for transmitting power, namely power (P) and gain (dbm), and the conversion formula for the two is equation (2). LoRa transmission power can be set independently in the hardware configuration. In this article, the transmission power is measured by gain, and it is set to five values of 0dbm, 5dbm, 10dbm, 15dbm, and 20dbm.
In the formula, P stands for power (W); dbm stands for gain (dbm).

The overall architecture of LoRa IoT test system
According to the overall architecture of the Internet of Things design, the performance test system of LoRa is divided into three parts: perception layer, network layer, and application layer. The overall architecture topology is shown in Figure 2. The sensing layer is mainly arranged with terminals to send test data. By arranging the hardware in the test environment, the LoRa terminal periodically sends a fixed amount of data to the gateway according to different hardware configuration combinations and then uploads the data to the server through the network. The server will store the data in the database after receiving the data [5]. The application layer can call the server port through the browser interface to visually display the currently received data and implement operations such as configuring specific hardware parameters.

Power meter reading system based on LoRa Internet of Things
The control, monitoring, data processing, and other operations of the IoT system are implemented using embedded technology. Embedded systems play an essential role in understanding the nature of the Internet of Things. The Internet of Things can be called the networking of embedded products. The development of microprocessors provides a normalized intelligent core for computer information processing technology. Besides, the Internet of Things' intelligence can meet the needs of different users and then explore new application areas. The Internet of Things is a driving force that improves the core competitiveness of different industries and promotes economic development methods. It has comprehensive perception, reliable transmission, intelligent control, and digital integration [6].
The smart power metering system is a system that uses terminal sensors to improve the overall efficiency of the power grid. It mainly forms networking interactions between power users and power users and grid companies, increasing the convenience of contact and improving the quality of work and life, with high safety, high efficiency, and high-power quality. Smart power systems can realize high-speed, the two-way interconnection of data, realize information sharing between power users and grid companies, and promote convenient and free communication. The non-destructiveness of information collection, the smoothness of transmission, the orderliness of application, and the efficient use of information play a significant role in the intelligent decision-making level of the power grid system and improve effectiveness and safety of the power system. In the smart grid system, energy substitution and compatible utilization are its essences. Building energy consumption information that can perform the adaptive adjustment, real-time collection, and monitoring of customers can maximize electricity use, optimize its configuration, and improve the country. And the power grid company's management of electricity users.

Hardware design of power data measurement transmission system
The synchronous phasor measurement unit collects the voltage and current data of each key node of the power grid to dynamically monitor the power grid's active operating status in real-time [8]. With the continuous expansion of the power grid, the traditional synchronous phasor measurement unit system often needs to consume many secondary cables, and the economy and reliability need to be improved. The structure diagram of the traditional power data measurement transmission system is shown in Figure 3.  It can be seen from Figure 4 that the main improvements in the hardware of the synchronous phasor measurement unit system based on LoRa technology are: 1) The sampling unit, the collection of dynamic real-time data, converts the collected analogy quantity into a signal that can be identified by the wireless transmission module, send data through LoRa sending node. 2) Wireless transmission module, including LoRa receiving node and wireless transmission module body. The wireless transmission module wirelessly transmits the sampling data of the sampling unit through LoRa 3) The synchrophasor measurement unit terminal integrates the synchrophasor measurement unit substation and switch functions, receives the electrical information of the wireless transmission module, and sends it to the dispatch master station through the dispatch data network communication [7]. Since the usual significant transmission distance of LoRa is 15km, it can meet the data transmission and communication of synchronous sampling unit (LoRa sending node) and wireless transmission module (LoRa receiving node) in the substation. However, the distance between the PMU substation terminal and the WAMS master station is often long, and communication is still carried out through the dispatch data network.
3.1.1. Sampling unit design. The sampling unit chooses to use a high-precision ADS7809 chip to ensure the sampling accuracy, which contains a 16-bit successive approximation register, which can convert the measured phasor into a high-precision pulse and provide it to the LoRa node. The GPS/Beidou clock is used to synchronize the whole system's sampling to ensure that the scattered LoRa nodes are transmitted to the data acquisition unit as signals at the same time. The sampling unit design is shown in Figure 5. The ADS7809 chip used in Figure 5 has a capacitive analogy-to-digital converter with sample-and-hold, strong anti-interference ability, and can ensure reliability under extreme conditions.  As shown in Figure 6, the wireless transmission module uses a low-power single-chip STM32L031 to communicate with the SX1278LoRa chip through a serial interface to transmit data in a specific frequency band. STM32L031 is an ultra-low-power processor suitable for long-term battery power supply; SX1278LoRa chip uses forward error correction codec technology and spread spectrum modulation technology to improve link anti-interference performance and achieve ultra-long-distance low Power consumption data transmission. The LoRa sending node realizes the sending function through the sending control module, and the LoRa receiving node realizes the receiving function through the receiving control module [8].

Software design of power data measurement transmission system
The software design of the power data measurement and transmission system based on LoRa technology mainly includes system initialization, sampling data processing, and LoRa wireless communication. The software overall design flow chart is shown in Fig. 7. To ensure that the sampled data can be processed in time, the idea of time mark bit is introduced to improve the incident response speed. After starting the sampling data processing program, first, process the main loop event, and then query whether there is a sampling. Once data is sent in, an interrupt program will be generated by the hardware. The interrupt program's function is to collect and mark data and wait for the main program to process further. After the system is powered on and reset, the sampling data processing program sets the internal timing, counting, serial communication, and other functions of the device and initializes the memory, registers, I/O ports, etc.

System Test
Taking the error rate of the communication network between the LoRa sending node and the LoRa receiving node as the target, the actual communication distance is tested. The test location is selected as a substation, and the LoRa transmitting node power is set to 20dBm, and the frequency is 470MHz. Use debugging tools to test the traditional PMU system and the new PUM system under LoRa technology, send 150 data packets with a packet sending frequency of 60 times/min, and test at each transmission distance. The test results are shown in Table 2, and the simulation diagram is shown in 8. Shown.

Conclusion
This article describes the LoRa implementation of a DLMS-based energy meter for establishing communication and data extraction. The research in this paper shows that Lo. As a last-mile communication technology, how does Ra bring benefits to smart meter wireless access solutions? Power metering data can be stored in the cloud for data mining, providing real-time data sources for load prediction and abnormal power consumption. Smart meter parameters such as voltage, current frequency, power factor, and power consumption can be directly accessed through the Web page or directed to the terminal power user's mobile phone through a mobile application for decision-making, control, or real-time understanding of electricity usage information. The solution proposed in this