With the rapid development of the electric vehicle industry, the number of EV charging stations has surged globally, making accurate energy metering and real-time monitoring essential for sustainable infrastructure. As of recent years, the proliferation of EV charging stations has highlighted the need for efficient, secure, and reliable systems to handle energy measurement and data transmission. Traditional methods often face challenges such as electromagnetic interference and security vulnerabilities in communication. In this work, we present a comprehensive design for an electric energy metering system based on LoRa communication technology, specifically tailored for EV charging stations. Our system integrates hardware and software components to enhance precision, reduce costs, and ensure data integrity, addressing key issues in existing solutions for EV charging stations.
The growing adoption of electric vehicles has led to an increased demand for EV charging stations, which serve as critical infrastructure for energy distribution. However, the limited space and standardized外形设计 of these stations necessitate compact and efficient metering systems. Many existing approaches rely on components like current transformers, which are prone to magnetic interference, and lack robust security measures for data transmission. To overcome these limitations, our system employs a dual-channel energy metering chip, combined with LoRa wireless communication, to provide a high-precision, low-power solution for EV charging stations. By focusing on real-time data processing and encrypted communication, we aim to improve the overall reliability and security of energy metering in EV charging stations.
In the following sections, we detail the hardware architecture, software design, and testing results of our system. We emphasize the integration of key components, such as the STM32F103 microcontroller and HLW8112 energy metering chip, to achieve accurate voltage, current, and power calculations. Additionally, we introduce an enhanced encryption algorithm that combines AES and RSA techniques to safeguard data transmitted between LoRa nodes and gateways. Through extensive testing, we demonstrate the system’s performance in terms of communication reliability and measurement accuracy, underscoring its applicability in real-world EV charging stations. This work not only addresses current challenges but also paves the way for future innovations in smart grid technologies for EV charging stations.
Hardware Design
The hardware design of our system revolves around a distributed network of LoRa nodes and a central LoRa gateway, optimized for deployment in EV charging stations. Each LoRa node comprises an energy metering module, a LoRa communication module, a microcontroller unit, and a power supply module. The gateway, on the other hand, integrates a microcontroller, LoRa module, and power supply, facilitating data aggregation and transmission to cloud servers via WiFi. This wireless architecture eliminates the complexities associated with wired connections, making it ideal for scalable EV charging station networks. The overall system structure ensures efficient data exchange and remote monitoring, enhancing the operational efficiency of EV charging stations.

The energy metering module in each LoRa node is critical for accurate data acquisition in EV charging stations. We utilize a sampling resistor made of manganese-copper alloy to collect current signals, minimizing magnetic interference. For voltage sampling, a series of resistors is employed to handle high-voltage scenarios, ensuring precision and safety. The HLW8112 dual-channel energy metering chip performs analog-to-digital conversion, integrating functions for voltage, current, and leakage detection. This chip simplifies the circuit design and improves reliability, which is vital for the constrained spaces in EV charging stations. The metering circuit includes protective elements, such as TVS diodes and RC filters, to suppress transient voltages and high-frequency noise, thereby maintaining signal integrity in EV charging stations.
To isolate the high-voltage energy metering module from the low-voltage microcontroller, we implement optocoupler isolation circuits. This design prevents potential damage to the microcontroller caused by power surges in EV charging stations. The optocoupler circuits ensure signal transmission while providing electrical separation, enhancing the overall safety and durability of the system. Additionally, the LoRa communication module, based on the A39C module, features impedance matching for stable antenna performance. This module operates in a low-power mode, making it suitable for continuous monitoring in EV charging stations. The combination of these hardware elements results in a robust and efficient system tailored for the demanding environments of EV charging stations.
The key parameters for the energy metering module are derived from the following equations, which calculate the root mean square (RMS) values for voltage, current, and active power. These formulas are essential for real-time energy calculation in EV charging stations:
$$ U_{rms} = \frac{V_{param}}{V_{reg}} \times K_v $$
$$ I_{rms} = \frac{I_{param}}{I_{reg}} \times K_i $$
$$ P_{rms} = \frac{P_{param}}{P_{reg}} \times K_v \times K_i $$
Here, $U_{rms}$ represents the RMS voltage, $I_{rms}$ denotes the RMS current, and $P_{rms}$ is the active power. The coefficients $K_v$ and $K_i$ are set to 1 based on the resistor configurations in the sampling circuit, ensuring straightforward calibration for EV charging stations. These equations form the basis for the microcontroller’s computations, enabling adaptive power management in EV charging stations.
Software Design
The software design focuses on data structure definition, program flow, and encryption algorithms to ensure efficient and secure operation in EV charging stations. We define a compact data packet structure for LoRa communication, which includes fields for address, channel, and energy parameters. This structure allows for reliable transmission between nodes and gateways in EV charging stations, accommodating the limited payload size of LoRa networks. The data packet is organized as follows: 2 bytes for the high address of the gateway, 2 bytes for the low address, 2 bytes for the channel, and 6 bytes for the data (split into 2 bytes each for voltage, current, and active power). This format ensures compatibility and efficiency in EV charging stations.
The LoRa node program begins with initialization upon power-up. When an EV charging station starts charging, the node responds to metering commands, collecting voltage and current data at regular intervals. The program calculates power and energy consumption using the aforementioned equations and performs diagnostic checks to monitor charging status. If abnormalities such as over-voltage or under-power conditions are detected, the system triggers a restart to ensure safety in EV charging stations. Data is modulated and transmitted via LoRa every second, providing real-time updates. The flowchart below illustrates the main program flow for LoRa nodes in EV charging stations, emphasizing continuous monitoring and adaptive response.
For the LoRa gateway, the software establishes a connection with cloud platforms using the ESP8266 WiFi module. After initialization, the gateway reads pre-stored address information from Flash memory to identify and communicate with specific LoRa nodes in EV charging stations. It then sets up an MQTT connection for bidirectional data exchange with the cloud. The gateway periodically receives data packets from nodes, parses the content, and forwards it to the cloud server. This process enables remote monitoring and management of EV charging stations, ensuring that operational data is accessible in real-time. The gateway’s program flow highlights its role as a relay, enhancing the scalability of EV charging station networks.
To address security concerns in data transmission for EV charging stations, we developed a hybrid encryption algorithm that combines AES and RSA techniques. AES is used for encrypting the actual data due to its high efficiency, while RSA secures the AES keys, providing an additional layer of protection. The traditional RSA algorithm involves modular exponentiation, as shown in the equations below, where $c$ is the ciphertext, $m$ is the plaintext, $n$ is the product of two primes $p$ and $q$, $E$ is the public exponent, and $D$ is the private exponent:
$$ c = m^E \mod n $$
$$ m = c^D \mod n $$
We optimize the decryption process by employing binary exponentiation and the Chinese Remainder Theorem (CRT). This reduces computational complexity, making it suitable for the resource-constrained environments of EV charging stations. The decryption is split into sub-calculations:
$$ m_1 = c^{D \mod (p-1)} \mod p $$
$$ m_2 = c^{D \mod (q-1)} \mod q $$
The final plaintext is recovered using the Modified Mixed-Radix Conversion (MMRC) method:
$$ m = m_2 + ((m_1 – m_2) \times q_{Inv} \mod p) \times q $$
This approach enhances security without compromising performance, ensuring that data from EV charging stations remains confidential and tamper-proof during transmission.
Testing and Evaluation
We conducted extensive tests to evaluate the encryption efficiency, communication reliability, and measurement accuracy of our system in the context of EV charging stations. Four encryption schemes were implemented on the STM32F103 microcontroller: XOR encryption, AES encryption, a classic AES-RSA hybrid, and our proposed AES-improved RSA hybrid. Each scheme was tested by encrypting and decrypting a 16-byte string, and the transmission times were recorded. The results, summarized in the table below, demonstrate that our hybrid algorithm offers a balance between speed and security, which is crucial for real-time operations in EV charging stations.
| Encryption Scheme | Transmission Time (s) | Data Integrity |
|---|---|---|
| XOR | 0.2998 | Yes |
| AES | 0.0595 | Yes |
| AES + RSA (Classic) | 0.1175 | Yes |
| AES + Improved RSA | 0.0972 | Yes |
Communication reliability was assessed by measuring the packet loss rate and signal strength (RSSI) at various distances between LoRa nodes and the gateway. Tests were performed in adverse weather conditions, such as heavy fog, to simulate real-world challenges for EV charging stations. The node transmitted data packets every second, and each distance was tested with 500 packets. The table below shows that the system maintains low packet loss up to 500 meters, making it suitable for widespread deployment in EV charging stations.
| Distance (m) | RSSI (Average) | Packet Loss Rate (%) |
|---|---|---|
| 100 | -93 | 0 |
| 300 | -72 | 0 |
| 500 | -66 | 2.4 |
| 700 | -48 | 6.1 |
For energy measurement accuracy, we compared our system with a commercially available metering socket in active EV charging stations. Multiple measurements of voltage, current, and active power were taken, and the errors were calculated. The results, presented in the table below, indicate high precision, with current measurement accuracy reaching 97.27%. This level of accuracy is essential for fair billing and efficient energy management in EV charging stations.
| Electrical Parameter | Our System | Reference Meter | Error |
|---|---|---|---|
| Voltage (V) | 221.84 | 224.70 | 2.86 |
| Current (mA) | 110 | 107 | 3 |
| Active Power (W) | 13.16 | 12.70 | 0.46 |
The testing phase confirms that our system meets the demands of modern EV charging stations, offering reliable communication, secure data transmission, and precise energy metering. These attributes make it a viable solution for enhancing the infrastructure of EV charging stations, supporting the global shift toward electric mobility.
Conclusion
In this work, we have designed and implemented a LoRa-based electric energy metering system that addresses the critical needs of EV charging stations. By integrating advanced hardware components like the HLW8112 chip and STM32F103 microcontroller, we achieved high accuracy in voltage, current, and power measurements. The use of LoRa communication enables wireless data transmission, reducing installation complexity and costs for EV charging stations. Our hybrid encryption algorithm, combining AES and improved RSA, ensures data security without significant overhead, making it ideal for the sensitive environments of EV charging stations.
Testing results demonstrate the system’s robustness, with low packet loss rates over long distances and high measurement precision. The encryption scheme outperforms traditional methods in terms of efficiency, further enhancing the system’s applicability in EV charging stations. As the adoption of electric vehicles continues to grow, such systems will play a pivotal role in managing energy resources effectively. Future work could focus on integrating machine learning for predictive maintenance and expanding the network capabilities for smart grid applications in EV charging stations. Overall, this system represents a significant step forward in the evolution of EV charging stations, promising reliability, security, and scalability.
