Design and Implementation of a Linux-Based Distributed Solar Inverter Data Monitoring System

In response to the global commitment toward carbon neutrality, the adoption of solar photovoltaic systems has accelerated significantly. Among the various components of a photovoltaic power plant, the solar inverter plays a critical role in converting direct current generated by solar panels into alternating current suitable for the grid or local loads. The reliability and efficiency of solar inverters directly affect the overall performance of the photovoltaic system. In distributed photovoltaic scenarios, solar inverters are often deployed across a wide area, making real-time monitoring both essential and challenging. Traditional wired monitoring systems suffer from complex cabling and limited scalability, while many wireless solutions exhibit insufficient transmission range. Furthermore, many existing monitoring products rely solely on cloud-based clustered storage, which risks data unavailability or loss if the server fails. To address these issues, I designed and implemented a Linux-based distributed solar inverter data monitoring system. This system adopts LoRa technology for long-range wireless communication, incorporates an on-site gateway with local data storage and visualization, and integrates a cloud server for remote access and long-term data archiving.

1. System Design Requirements and Architecture

The design requirements for this distributed solar inverter monitoring system are summarized in the table below. These requirements were derived from practical deployment scenarios, focusing on accuracy, scalability, reliability, and user experience.

Requirement Description
Accurate measurement Measure input/output voltages and currents of solar inverters with sufficient precision for status assessment.
Wireless transmission Support long-distance communication without complex wiring, suitable for distributed inverter placement.
Local data storage Provide on-site data persistence to avoid dependency on cloud server availability.
Visualization Display real-time data and trends on both local screens and remote web interfaces.
Scalability Allow easy addition of monitoring nodes and compatibility with various inverter communication interfaces.
Alarm functionality Trigger audible and visual alerts when inverter parameters exceed safety thresholds.

The overall architecture of the system is composed of three main layers: monitoring and RF nodes, on-site gateway, and cloud server. The monitoring node collects electrical parameters from solar inverters through dedicated metering circuits. The RF node establishes LoRa-based star topology communication with the gateway. The gateway processes, stores, displays, and uploads data to the cloud. A key design choice is the combination of local storage on the gateway with remote storage on the cloud server, which mitigates the risk of data loss due to server failure.

2. Key Technology Selection

I evaluated various technologies for wireless communication, data storage, and user interface frameworks. The table below compares the major wireless communication technologies considered.

Technology Range Data Rate Frequency Band Cost Application Scenario
LoRa Several kilometers Low (kbps) Sub-1GHz Medium Wide-area low-power networks
Bluetooth <100 m 1–3 Mbps 2.4GHz Low Short-range personal devices
ZigBee 10–100 m 250 kbps 2.4GHz Low Sensor networks
NB-IoT Several tens of km Low (tens of kbps) Cellular licensed bands Medium-high Wide-area IoT applications
NFC <1 m Low (hundreds of kbps) 13.56MHz Low Proximity communication

Given the need for reliable long-range communication in distributed photovoltaic fields, LoRa was selected due to its excellent range, low power consumption, and reasonable cost. For the connection between the gateway and the cloud, I chose Ethernet for scenarios with fiber access and a 4G module for remote or temporary installations. The TCP protocol was chosen over UDP to ensure reliable data delivery.

For data storage, SQLite was selected for the on-site gateway because it is lightweight, requires no separate server process, and fits well into embedded Linux environments. For the cloud server, MySQL was chosen because it provides robust relational database management, scalability, and widespread community support. The graphical user interface for the monitoring node was built using LVGL, a lightweight graphics library suited for MCU-based devices. The gateway interface was developed with Qt, which offers a rich set of widgets and excellent cross-platform compatibility.

3. Hardware Design

3.1 Monitoring Node Hardware

The monitoring node is responsible for acquiring electrical parameters from solar inverters and displaying them on a local LCD screen. The hardware block diagram includes the main controller (ESP32-WROOM-32U-N4), power supply circuits, human-machine interface circuits, RS232 communication, and data acquisition circuits using HLW8110 and BL0942 metering chips. The ESP32 was chosen for its dual-core processing capability, rich peripherals, and support for LVGL graphics. The power supply circuit accepts 12V DC input or 5V USB input. The 12V input is converted to 5V using the RY3825 buck converter. The output voltage calculation is given by:

$$V_{DC5V} = \frac{R_5+R_4}{R_5} \times V_{FB}$$

With \(R_5 = 16\,\mathrm{k\Omega}\) and \(V_{FB} \approx 0.768\,\mathrm{V}\), \(R_4\) was selected as \(91\,\mathrm{k\Omega}\) to produce approximately 5V. The 5V to 3.3V conversion uses the MT3420B with a feedback voltage of 0.588V:

$$V_{3V3} = \frac{R_{10}+R_{11}}{R_{11}} \times 0.588\,\mathrm{V}$$

Selecting \(R_{11}=110\,\mathrm{k\Omega}\) and \(R_{10}=510\,\mathrm{k\Omega}\) yields about 3.3V.

The data acquisition circuit for the AC output side of the solar inverter uses BL0942. Voltage division through a resistor ladder reduces the line voltage to the chip’s input range. The voltage at the sensor resistor is:

$$V_{R9} = \frac{R_9}{R_4+R_5+R_6+R_7+R_8+R_9} \times V_{IN}$$

For a maximum measurable voltage of 267V, the resistors were chosen as \(R_4\) to \(R_8 = 390\,\mathrm{k\Omega}\) and \(R_9 = 510\,\mathrm{\Omega}\). The current sensing path uses a shunt resistor of 1mΩ with a 16x gain setting, allowing a maximum current of 30A. Similar principles apply to the DC input side using HLW8110, where the voltage divider is designed for a maximum input voltage of 113V and a maximum current of 34A.

The user interface circuit includes a TFT LCD driven via SPI and a rotary encoder for navigation. The LCD backlight is controlled by a MOSFET circuit, enabling brightness adjustment through PWM.

3.2 RF Node Hardware

The RF node acts as a bridge between the solar inverter (or monitoring node) and the on-site gateway. It reads data from the inverter through RS232, RS485, or CAN interfaces, and transmits it over LoRa. The main controller is an STM32F103C8T6, selected for its rich peripheral set and low cost. The power supply is 5V external, converted to 3.3V using a linear regulator. The circuit includes a 8MHz crystal for high-speed operation and a 32.768kHz crystal for the real-time clock. The LoRa module used is the ATK-MW1268S, which integrates the SX1268 transceiver and supports a frequency range of 410–493MHz with up to 22dBm transmit power. The module can be configured for transparent transmission, directed transmission, or broadcast mode. In this design, I utilized directed transmission with polling to avoid data collisions and improve reliability.

3.3 On-Site Gateway Hardware

The on-site gateway is the central processing unit of the system. It must run Linux to support SQLite, Qt, and network services. I selected the NXP i.MX6ULL processor (MCIMX6Y2CVM05AB) based on the ARM Cortex-A7 core running at up to 792MHz. This MPU offers ample performance for the required tasks while maintaining low power consumption. The hardware architecture consists of a core board containing the MPU, DDR3L memory (NT5CC256M16EP-EK, 4Gb capacity), eMMC storage (KLM8G1GET, 8GB), and power management circuits. The core board uses a six-layer PCB with controlled impedance for high-speed signals. The table below shows the layer stack and impedance parameters used.

Layer Material Thickness (mm)
L1 (Top) Copper 1oz 0.0250
PP 3313 0.0944
L2 Copper 0.0152
Core FR4 0.0750
L3 Copper 0.0152
PP 3313 0.0918
L4 Copper 0.0152
Core FR4 0.0750
L5 Copper 0.0152
PP 3313 0.0944
L6 (Bottom) Copper 1oz 0.0250

The power supply for the gateway begins with a 12V DC adapter. The JW5060T buck converter generates 5V and 3.3V rails. The 5V rail is further converted to 3.3V for the core board, and the processor requires multiple voltage domains including 3.3V and 1.35V for DDR3L. The power-on sequence follows the i.MX6ULL specification: VDD_SNVS_IN must be powered first, followed by VDD_HIGH_IN, and finally VDD_SOC_IN. This sequence is implemented using an LDO, a load switch (MT9700), and a buck converter (MT3420B). The SOC core voltage is calculated as:

$$V_{out} = 0.6 \times \left(1+\frac{R_{32}}{R_{33}}\right)$$

With \(R_{33}=100\,\mathrm{k\Omega}\) and \(R_{32}=124\,\mathrm{k\Omega}\), the output is approximately 1.34V, which is used for the ARM core.

The gateway board also includes an Ethernet interface using the LAN8720A PHY chip with an RJ45 connector featuring a built-in transformer, a 7-inch TFT LCD with capacitive touch (FT5426 controller), a 4G module (ME3630) for cellular connectivity, and a buzzer alarm circuit. The LCD interface uses RGB888 signals, and the touch panel communicates via I2C.

4. Software Design

4.1 Monitoring and RF Node Software

The monitoring node software initializes the metering chips HLW8110 and BL0942, then periodically reads the registered values. The measurement cycle is triggered by a timer, and the raw data are converted into engineering units using the calibration constants and the known resistor divider and shunt values. The conversion formulas for voltage and current on the DC side are as follows:

$$V_{DC} = \frac{Code_{V} \times V_{ref}}{2^{24} \times PGA_{V}} \times \frac{R_{divider}}{R_{shunt}}$$

The exact scaling factors were determined experimentally to achieve the accuracy presented in the testing section. The monitoring node also implements an LVGL-based user interface, which includes a boot screen, a main menu, DC/AC parameter pages, and a settings page. This UI provides a modern and readable alternative to the traditional segment LCD found on many solar inverters.

The RF node software handles the LoRa communication protocol. The data frame format is shown in the table below.

Field Frame Header Frame Length Device Type Node Info Message Type Data Checksum
Size (bytes) 1 1 1 4 1 N 1

The polling-based directed transmission scheme ensures that only the addressed RF node replies to each gateway request, minimizing collisions. The gateway sends a request frame, the node responds with data, and the gateway sends back an acknowledgment. If no acknowledgment is received, the node retransmits up to three times before giving up.

4.2 On-Site Gateway Software

The gateway runs a customized Embedded Linux built with Buildroot. The U-Boot bootloader was ported and configured for the i.MX6ULL board. The Linux kernel 4.1.15 was modified and compiled from NXP’s official source. Device tree files were updated to register peripherals such as Ethernet, LCD, touch controller, and 4G modem. The touch screen driver was developed following the Linux input subsystem and I2C driver framework. The driver’s probe function initializes the GPIOs, resets the FT5426, configures the interrupt, registers an input device, and starts the interrupt handler for reporting touch events. The fragment of the driver flow is:

probe():
    get reset GPIO
    reset FT5426
    get interrupt GPIO
    request_irq
    initialize FT5426 registers
    allocate and register input device

The application software on the gateway is structured around a thread pool to manage multiple concurrent tasks: LoRa communication, data parsing, database storage, network transmission, and user interface updates. The thread pool maintains a fixed number of worker threads and a task queue, improving efficiency and reducing overhead compared to creating and destroying threads on demand. The data processing flow for incoming LoRa frames is shown in the following diagram:

Start
  -> Receive frame
  -> Check header and length
  -> CRC check
  -> Send ACK/NACK
  -> Parse parameters
  -> Evaluate safety thresholds
  -> If abnormal: activate buzzer and store immediately
  -> If normal: store at predefined interval
  -> Upload to cloud server
End

The safety evaluation for a solar inverter is based on the output voltage and frequency values. For a single-phase inverter, the acceptable output voltage range is 220V ±10%, and the frequency range is 49–51Hz according to GB/T 19064-2003. When the RF node connects directly to the inverter, the warning and fault codes provided by the inverter’s communication interface are also considered.

4.3 Database Design on Gateway

SQLite is used for local storage on the gateway. The database file is named inverter.db. The main table inverter contains the following fields:

Field Type Description
node_id int Node ID
input_v varchar Input voltage
input_c varchar Input current
output_v varchar Output voltage
output_c varchar Output current
frq varchar Output frequency
energy varchar Daily energy
warning varchar Warning code
fault varchar Fault code
Time datetime Timestamp

Data insertion is performed using SQL statements with prepared statements to avoid SQL injection and improve performance. The database is periodically cleaned to prevent unbounded growth, retaining data for a configurable number of days.

4.4 Network Communication

For communication between the gateway and the cloud server, TCP is used due to its reliability. The gateway acts as a client, and the cloud server listens on a specific port. The communication flow follows the standard socket programming model: server creates socket, binds, listens, accepts; client creates socket, connects, sends data; server receives, processes, and closes connection. The server is designed to handle multiple clients concurrently using a multi-threaded approach. Each time a new client connects, a new thread is spawned to handle that client’s data stream. A linked list stores active socket descriptors, protected by a mutex.

4.5 User Interface on Gateway

The gateway’s user interface was developed using Qt 5 with the Qt Designer tool. The main window contains a title label, a stack widget for different pages, and navigation controls. The pages display real-time solar inverter data, node status, and trend graphs. The trend graphs are updated by reading data from the local database at regular intervals. The interface also includes a circular gauge showing the output voltage of each solar inverter, with colors indicating normal or abnormal ranges. A screenshot of the Qt application is shown in the test section.

4.6 Cloud Server Software

The cloud server runs MySQL to store all the reported data. I created four data tables: user_info, inverter_info, inverter_data, and inverter_rt_data. The user table stores account information, the inverter_info table stores node system parameters, the inverter_data table stores historical records, and the inverter_rt_data table stores the latest reading for each node. The web application was built using Node.js and the Express framework. The EJS template engine was used to generate dynamic HTML pages. Users can log in through a web interface, view node lists, and inspect real-time or historical data. The data are displayed in tabular format, and a dropdown allows selecting a specific node for historical queries.

5. System Testing

5.1 Monitoring and RF Node Tests

The monitoring and RF node hardware was subjected to voltage and ripple tests. The results are summarized in the table below.

Power Rail Designed Voltage (V) Measured Voltage (V) Ripple (mV)
DC_5V (monitoring node) 5.00 4.99 29.4
VCC_3V3 (monitoring node) 3.30 3.21 22.5
VCC_3V3 (RF node) 3.30 3.19 15.6

All measured voltages were within ±10% of the designed values, and the ripple was below 5%, indicating stable power supplies.

Electrical parameter measurements were performed using a variable DC power supply and a load. The tables below compare the measured values from the monitoring node with the actual values from the instruments.

DC Voltage Measurement Results
Actual (V) Measured (V) Error (V)
0.00 0.03 0.03
0.75 0.70 0.05
5.00 5.15 0.15
15.00 15.12 0.12
25.00 25.03 0.03
35.00 34.90 0.10
45.00 45.07 0.07
55.00 55.03 0.03
DC Current Measurement Results
Actual (A) Measured (A) Error (A)
0.000 0.0001 0.0001
0.001 0.0012 0.0002
0.010 0.0104 0.0004
0.100 0.0983 0.0017
3.000 2.9618 0.0382
4.900 4.8643 0.0357
AC Voltage Measurement Results
Actual (V) Measured (V) Error (V)
220.0 220.10 0.10
220.1 220.29 0.19
220.3 220.37 0.07
219.9 220.15 0.25
220.0 220.11 0.11
219.8 220.07 0.27

These results demonstrate that the solar inverter monitoring node provides sufficient accuracy for status monitoring, with errors well below 1% for voltage and current in the test ranges.

The communication functionality was verified by sending requests from the gateway and observing the responses on the RF node’s serial debug output. The request frame and acknowledgment frame matched the defined format, confirming correct data exchange between the RF node and the gateway.

Communication performance was evaluated in terms of RSSI and packet loss. Two LoRa modules were configured for transparent transmission on channel 23 with a frequency of 433MHz, 22dBm transmit power, and 3dBi antennas. The RSSI was measured at various distances with and without obstacles. The results are shown in the table below.

Distance (m) RSSI (dBm) No Obstacle RSSI (dBm) With Obstacle
100 -20 -22
200 -33 -36
400 -41 -45
600 -56 -58
800 -68 -89
1000 -74 -95

At 400 meters, a packet loss test was conducted with three nodes. The gateway polled each node every 5 seconds. The results were:

Node Node 1 Node 2 Node 3
Packets sent 500 498 499
Packet loss rate 0% 0.04% 0.02%
Garbled rate 0% 0% 0%

The average packet loss rate was 0.02%, and no garbled data were observed, confirming the reliability of the LoRa-based polling protocol.

The user interface on the monitoring node was tested by connecting the node to a solar inverter with a 48V DC input and no load on the AC output. The LCD screens displayed the boot animation, main menu, AC parameters, and DC parameters correctly, demonstrating that the LVGL interface effectively replaces the traditional segment LCD.

5.2 Gateway Tests

The gateway hardware was tested for voltage and ripple on its various power rails. The results are summarized below.

Power Rail Designed Voltage (V) Measured Voltage (V) Ripple (mV)
DCDC_5V (baseboard) 5 4.97 70.0
VCC_3V3 (baseboard) 3.3 3.34 62.2
SYS_3V3 (core) 3.3 3.34 60.5
DCDC_3V3 (core) 3.3 3.20 52.0
VDD_ARM_SOC_IN (core) 1.35 1.36 58.8
DRAM_1V35 (core) 1.35 1.34 51.0

All rails were within acceptable limits, and the power-on sequence was verified using a dual-channel oscilloscope. The sequence of SYS_3V3, DCDC_3V3, and VDD_ARM_SOC_IN followed the required order, ensuring safe boot-up of the processor.

The bootloader and kernel were successfully loaded via TFTP and NFS. The Ethernet interface was tested using the ping command against a public IP address, with no packet loss. The 4G module also connected successfully via PPP and passed ping tests. The LCD and touch screen were validated using the tslib test program, showing accurate touch response.

For the functional test of the gateway, an RF node was connected directly to the solar inverter’s RS232 port. The solar inverter was supplied with 48V DC input and no AC load. The gateway received the LoRa data frame and printed it on the serial terminal in hexadecimal format. An example frame is shown below:

AA 17 01 00000001 00 01E0 000C 0898 0000 01F4 0000 00 00 07

Where 0xAA is the header, 0x17 is the frame length (23 bytes), 0x01 indicates RF node device, the next four bytes represent node ID = 1, 0x00 is the message type (data report), 0x01E0 converts to 48.0V input voltage, 0x000C converts to 1.2A input current, 0x0898 converts to 220.0V output voltage, 0x0000 converts to 0.0A output current, 0x01F4 converts to 50.0Hz frequency, 0x0000 indicates zero energy, and 0x00, 0x00 indicate no warning or fault. The last byte 0x07 is the CRC.

The gateway stored the parsed data into its SQLite database. Exporting the database and inspecting it with Navicat confirmed that the records matched the incoming frame data.

The Qt user interface ran correctly, displaying real-time data for each solar inverter node. The data browsing page showed the curve graphs generated from the database readings, confirming the visualization functionality.

5.3 Cloud Server Tests

The MySQL database on the cloud server was verified using Navicat. All four data tables were present, and the data reported by the gateway were successfully stored with a 5-second update interval. The web application was tested by accessing the server’s IP address and port. The login page accepted valid credentials, the node display page showed the inverter system parameters and online status, and the real-time data page updated correctly. The historical data page allowed selecting a node ID and displaying its past records. The test results demonstrated that the cloud server functions properly and provides remote monitoring capabilities for the distributed solar inverter system.

6. Conclusion

In this work, I designed and implemented a comprehensive Linux-based distributed solar inverter data monitoring system. The system consists of monitoring nodes, RF nodes, an on-site gateway, and a cloud server. The monitoring node accurately measures the input and output electrical parameters of solar inverters and provides a modern LCD interface. The RF node supports multiple industrial communication interfaces and uses LoRa for long-range wireless transmission, overcoming the cabling and range limitations of traditional solutions. The on-site gateway, based on the i.MX6ULL processor, runs an embedded Linux system that enables local data storage using SQLite, real-time visualization through a Qt interface, and reliable upload to the cloud via Ethernet or 4G. The cloud server provides centralized data archiving and a web-based interface for remote monitoring. Extensive testing verified that the system meets the design goals: solar inverter parameters are acquired with sufficient accuracy, wireless communication is stable at distances up to 400 meters, local data storage ensures resilience against server failures, and the cloud server provides timely and consistent data updates. The proposed system offers significant practical value for the monitoring and maintenance of distributed photovoltaic power plants, contributing to the safe and efficient operation of solar energy systems.

Although the current system performs well, there is room for improvement. The gateway hardware could be optimized by using lower-cost domestic processors and miniaturizing the board layout. The cloud platform could be extended to support remote control commands for solar inverters, enabling more active management. Furthermore, the web interface could be enhanced with dynamic charts and data visualization tools to provide a more intuitive user experience. These future developments will build upon the stable foundation established in this thesis.

Scroll to Top