Design and Implementation of a Long Range Wireless Data Acquisition System for Photovoltaic Installation based on LoRa Technology

-In this paper, a low power consumption long range wireless data acquisition system for PV installations, consisting of a set of sensors connected wirelessly with one or several monitoring/control systems was designed and implemented. The wireless communication between devices is based on LoRa technology. LoRa is a spread spectrum modulation technique derived from Chirp Spread Spectrum (CSS) technology. It offers a long-range low power wireless platform, suitable for professional wireless sensor network applications. The integration of this technology in PV installations provides an extensive, low cost, power-efficient, and easy to maintain, system. Design, high-layer communication protocol, and hardware implementation of sensors are discussed. The sensor set consists of a voltage/current sensor, a sun irradiance sensor, a panel position sensor based on an accelerometer/magnetometer for sun tracking installations, a temperature and humidity sensor, and a mobile monitoring system.

INTRODUCTION A monitoring/control system of photovoltaic (PV) arrays requires a comprehensive data acquisition system in order to measure the different parameters required for a proper conduction of production. It consists of a set of measurement sensors which detect and measure physical properties such as temperature, voltage, current and position [1]. The measured signals pass through an acquisition card which has the role of conditioning, digitalizing, processing, and displaying these signals. These measurements are necessary for healthy and effective monitoring and control of the system. With the revolution of communication technologies, and the continuous evolution of wireless technology, wireless has nowadays become one of the most dominated communication technologies, opening a range of capabilities to other domains [2]. Over the last decade, low-power long range technologies have received a lot of attention. They have enabled new types of services while simplifying network structures, deployment, management and maintenance [3]. A Wireless Sensor Network (WSN) offers a lot of advantages over classic wired networks: • It is cost effective. The cost of implementing a wireless network is relatively less expensive than that of a wired network.
• It is easy to install and easy to maintain. The implementation of a wireless network is faster, easier, and requires less equipment.
• It offers mobility and flexibility.
• It can be deployed on a large scale [3].
• It can be monitored or accessed from a remote location.
• It usually has software topology (star, tree, ring, mesh), while wired networks have hardware topology.
• It is characterized by low power consumption, which is one of the most important factors in a PV installation [4,5].
This article proposes a low power wireless data acquisition system for PV installations based on LoRa technology. LoRa (Long Range) is a spread spectrum modulation technique derived from CSS technology [6]. LoRa technology is a long range, low power wireless platform. It enables smart applications that solve challenges such as energy management [7]. It is a physical layer implementation and is agnostic to higher-layer implementations. This allows LoRa to coexist and interoperate with existing network architectures [8]. For the purpose of this article, a set of sensors integrated with LoRa technology has been involved.
II. SENSOR ARCHITECTURE The proposed acquisition system consists of set of transmitters integrated with LoRa transceivers and connected wirelessly with one or several monitoring/control systems. The general architecture is presented in Figure 1. As shown in Figure 1, the microcontroller unit serves for processing and conditioning of sensor measurement, configuration and setting the LoRa module, receiving data requests through the LoRa module, and sending processed data. The LoRa module serves for receiving data requests from other devices, transmitting MCU's processed data and waking-up the MCU from the power saving mode when requests are received.

III. WORKING PRINCIPLE
LoRa is a physical layer implementation. The high layer communication protocol of the system is discussed in this section. The sensor working flowchart is shown in Figure 2. The transmitter starts with initialization and configuration. The first thing to do is setting the LoRa module's address and wireless channel. Then it initializes the sensor configurations and ports. After this step, the sensor enters power saving mode. A data request received by the LoRa module wakes up the MCU which starts directly to process sensor measurements and then sends them to the LoRa module's buffer. After that, the sensor returns to waiting mode (power saving). This allows maximum power saving.
The data request signal is a data packet which contains the sensor's address, sensor's channel, receiver's address and receiver's channel. The measurement data packet sent by the transmitter contains the address and the channel of the receiver and the processed measurement data. A monitoring/control system could have a LoRa wireless module to communicate with sensors, or it could be connected to a gateway which converts the LoRa protocol to other network protocols such as Ethernet (local network) or internet (global network). IV. HARDWARE DESIGN A set of wireless sensors needed in PV installations were designed. In the MCU side, the sensors were designed on the base of the Ultra-Low Power (ULP) consumption STM32L031C6 MCU from ST Microelectronics. This MCU is based on the ARM Cortex-M0+ CPU architecture. It provides a maximum clock speed of 32MHz, 12 bit Analog to Digital Converter (ADC), I2C and UART communication, etc. [9]. These specifications are sufficient for battery powered sensor applications. Some key specifications of the MCU are illustrated in Table I. Also, LoRa E32-433T20D wireless transceiver modules were involved in the design. These modules are wireless serial port (UART)-based on the SX1278 chip from SEMTECH. They have multiple transmission modes and work in the 410MHz-441MHz LoRa spread spectrum technology [10]. These modules provide an output pin to wake-up the MCU from sleep mode when wireless data are available (Aux pin), two pins to set the working mode (M0 and M1) in addition to the UART interface pins and power supply pins. The module's specifications are shown in Table II. Parameter setting of the module was done through the UART interface. To configure the module, it has to be set in parameter setting mode (M0 and M1 are set to high level), and then a configuration message is sent to the module through the UART interface. The configuration message consists of a sixbyte data package: • HEAD: 0×C0 or 0×C2 [10].
• ADDH: high address byte of the module.
• ADDL: low address byte of the module.
• SPED: to configure UART parity bit and baud rate and air data rate.
• OPTION: to configure other options like transmission mode, transmission power, wake-up time, etc.
Address, working channel, parameter setting, and working mode are done automatically by the MCU during the initialization and configuration phase discussed in the previous section. The general sensor schematic of the combination of MCU and LoRa module, including the power supply section and the programming interface is presented in Figure 3. This schematic is then customized for each sensor type as required for proper working.

A. Voltage/Current Sensor
Voltage and current are the most important measurements in a PV installation. To ensure good power control and monitoring, accurate current and voltage sensing is necessary. For example, these measurements can be used to extract the maximum power available [11]. For this purpose, a voltage/current senor integrated with a LoRa transceiver is designed. For voltage measurement, the classical voltage divider method is used to adapt the voltage with the ADC of the MCU. The measured analog signal is then multiplied with the voltage dividing ratio in order to get the measured voltage value: ܸ ൌ ܸ .
where ܸ is the ADC input voltage, ܸ is the ADC reference voltage, ‫ܥܦܣ‬ ௦ is the ADC resolution, and ܴ ଵ and ܴ ଶ are the resistors of the voltage divider. To minimize the extent to which the process of measuring affects the voltage being measured, a voltage follower is placed to achieve high input impedance. This ensures that the reading is not altered by subsequent components in the measurement circuit. A simplified voltage measurement circuit is shown in Figure 4. The schematic of the voltage sense circuit is shown in Figure 5. V_SENS is connected to the pin 19 of the MCU (PB1). The most common and accurate approach to current sensing is the resistive approach. A small value precision shunt resistor is placed into the current path with a differential amplifier to measure the voltage drop across it. The measured voltage drop is proportional to the current flowing through the resistor. To maximize accuracy, specialized current sensing amplifiers are involved. They have a unique input stage that enables a significantly high common mode voltage. In addition, they integrate high precision and low drift gain which maximize measurement accuracy. For this purpose, the integrated current shunt and power monitor INA219 [12] is used. The INA219 communicate with the MCU through the I2C interface. The current sense circuit is shown in Figure 6. In   The designed PCB for voltage and current sensing is presented in Figure 7. As shown in Figure 7, the sensor can be supplied directly from the source to be measured by shorting the jumper "JP1" or it can be supplied by an external source ("J3").

B. Irradiation Sensor
The amount of radiant flux incident on a known surface area is called irradiance. Irradiance is the radiometric measurements of the solar spectrum that is observed as power per unit area (W/m 2 ). Solar irradiance monitoring in solar energy production systems is important in order to know how much power a solar project could potentially harvest from the sun. Whereas the photometric spectrum is measured in lux(lumen/m 2 ), the ratio "0.0079 W/m 2 per lux" can be used to find approximate sun irradiance using photometric sensors [13]. In this context, the BH1750 lux sensor is used as an irradiance sensor. Fig. 7.
Voltage and current LoRa sensor PCB design.

C. Panel Position Sensor
In case of sun tracking PV installations, the measurement of the azimuth and elevation angles of solar panels is important. These measurements can be used by the positioning control system for position feedback and for monitoring. For this purpose, a combination of a 3-axis magnetometer and an accelerometer are used. This module communicates with the MCU through the I2C interface. The magnetometer in the module can be used as a digital compass to measure the azimuth. The heading of the digital compass is calculated by: where ߙ is the heading of the compass, ܺ and ܻ are respectively the X-axis and Y-axis of the magnetometer, and ߜ represents the magnetic declination angle.
The heading is then shifted toward south and scaled to measure azimuth (degrees in east and degrees in west).
The 3-axis accelerometer can be used to calculate the elevation angle of panels. Elevation angle ߠ can be calculated by (3): where ܺ , ܻ and ܼ are respectively the X-axis, Y-axis and Zaxis of the accelerometer. Elevation angle is also scaled to be 0 when the panel is in vertical position. When the panels move upward, ߠ will be greater than 0 and vice versa when the panel move downward. The PCB for the panel position LoRa sensor based on the accelerometer-magnetometer module is shown in Figure 8.

D. Ambient Temperature and Humidity Sensor
The ambient temperature and humidity LoRa sensor is based on the capacitive digital temperature and humidity sensor AM2301 (DHT21). The sensor works with one wire protocol. The PCB for the temperature and humidity LoRa sensor based on the AM2301 sensor is shown in Figure 9.
V. IMPLEMENTATION Due to the non-availability of the STM32L031 MCU's at the time this article was written, the implementation was done using STM32F103 boards which have almost the same pinout and architecture as the STM32L031, and a couple of Arduino Uno and Arduino Nano boards. Because of the limited number of E32-433T20D modules, irradiance and panel position sensors were combined in the same board. In order to test the system, a mobile monitoring device was also implemented. To make programming easier, a library was built that contains a set of functions for configuration and initialization of the LoRa modules. The library contains a table of configurations for a list of devices. The configuration list is illustrated in Table III. According to the datasheet of the LoRa modules [4], the first two bytes present the addresses of the device. The third byte ("1A") means: • UART rate = 9600bps.
In accordance to the sensor flowchart given in Figure 2, the LoRa modules are configured automatically after the device is powered on or reset. That also makes the modules replaceable and interchangeable between the devices.

A. Voltage/Current Sensor
For voltage and current sensing, the implementation consists of an Arduino Nano board, a voltage divider breakout board for voltage sensing with an op-amp used as a voltage follower connected to analog input pin "A6", and the INA219 breakout board for current sensing connected to the I2C interface of the Arduino. The LoRa module is connected to the Arduino in the following manner: • M0 is connected to digital pin 8.
• M1 is connected to digital pin 7.
• Rx is connected to Arduino's Tx pin.
• Tx is connected to Arduino's Rx pin.
• Aux is connected to digital pin 7.
The implementation of the voltage and current sensor is illustrated in Figure 10. The Arduino Nano has a 10-bit ADC and works at 5V supply. The ADC reference voltage is 5V. The resistors of the voltage divider ܴ ଵ and ܴ ଶ have respectively values of 30 and 7.5kΩ. The voltage is calculated by (1). Current measurement is given to the MCU by the INA219 current sensor through the I2C interface.

B. Irradiance/Position Sensor
For the irradiance and position sensor, an Arduino Uno board is used. In addition to the Arduino, the implementation consists of a BH1750 lux sensor for irradiance measurement and the GY-80 IMU module which contains the HMC5883L 3axis magnetometer and the ADXL345 3-axis accelerometer for azimuth and elevation measurement. The LoRa module is connected to the Arduino UNO in the following manner: • M0 is connected to digital pin 11.
• M1 is connected to digital pin 12.
• Rx is connected to Arduino's Tx pin.
• Tx is connected to Arduino's Rx pin.
• Aux is connected to digital pin 13.
The implementation is shown in Figure 11. It can be seen that both the BH1750 and the GY-80 modules are connected to the Arduino through the I2C interface and the LoRa module is connected to the UART interface of the Arduino. The calculations of the panel's azimuth and elevation are done by (2) and (3). The extracted data are then scaled for the proposed application. The magnetic declination angle in (2) is set according to our location of 1.6° East. In the initialization phase, the MCU calibrates both magnetometer and accelerometer in order to remove the offset error.

C. Temperature/Humidity Sensor
For temperature and humidity sensor, a STM32F103 board is used with the AM2301 temperature and humidity digital sensor and the LoRa module. The STM32F013 has almost the same pinout diagram with the STM32L031 MCU. The data wire of the AM2301 is connected to pin PB0. The LoRa module is connected to the board in the following manner: • M0 is connected to the pin PB15.
• M1 is connected to the pin PA8.
• Rx is connected to the pin PA9.
• Tx is connected to the pin PA10.
• Aux is connected to the pin PA11.
The implementation of temperature and humidity sensor is shown in Figure 12.

D. Monitoring System
In order to test the functionality and the range of the proposed acquisition system, a mobile monitoring system has been implemented. It consists of an STM32F103 MCU board integrated with a LoRa module and a character LCD. The implementation is presented in Figure 13. The monitoring device communicates with the LoRa sensors using a wireless token ring topology. It loops through the installed sensors by sending data requests. For each sensor, it sends a data request and waits for a response for a predetermined time. If the waiting time ends without getting the sensor data (timeout), the monitoring device resends a second request. If there's no response for the second time, the monitoring system bypasses the sensor to the next sensor in the ring loop. Figure 14 shows the working algorithm flowchart of the monitoring device. The timeout is set for this application at 1s and it can be redefined.
The received data are displayed on the LCD screen as shown in Figure 15.  VI. RESULTS An example of the obtained results in the display mobile monitoring system, after the installation of the system, is shown in Figure 15. The system reaches up to 1200 meters in open space area and up to 400 meters in a building area with 3dBi antennas. We have noticed a delay in elevation angle evolution and an offset of about 10 degrees in azimuth angle. In order to furthermore test the performance of the system, a LoRa data logged measurement module was installed to a PC through a USB to serial converter. The installed LoRa module was configured with the same address as the mobile monitoring device. When a sensor transmits the requested measurements to the monitoring device, the data will be also received by the PCinstalled LoRa module. The received data are acquired by the AccessPort serial debugging software, as shown in Figure 16.   The system has been tested with a fixed panel position (azimuth = 10°E, elevation= 45°) and a fixed 39Ω load for a full day, from sunrise to sunset for approximately 15 hours(5:15 AM to 20:45 PM). The obtained voltage and current measurements are shown Figure 17. The power curve is illustrated in Figure 18. The acquired irradiance data are shown in Figure 19. Temperature and humidity are shown in Figure  20. Panel position measurements (azimuth and elevation) are illustrated in Figures 21 and Figure 22 respectively.      Figures 19 and 20, the output power of the panel is proportional to the irradiance. It increases when irradiance increases until ~11:00 AM. At this point the panel reaches its maximum power output which stops increasing until ~ 15:00. From this point, the panel's output power decreases along with irradiance until sunset. As shown in Figures 21 and  22, a small offset of 0.5 degrees due to installation uncertainty is noticed. Besides that, azimuth and elevation measurements seem to be relatively stable. The absolute deviation of both azimuth and elevation measurements is illustrated in Figure 23.

As shown in
This work tends to integrate wireless technologies with PV supervising and control systems due to their advantages in comparison with old wired systems. Despite the existence of other wireless technologies like GSM, Zigbee, Bluetooth, and Wi-Fi, LPWANs represent the trend of the future of IoT and industrial applications [14]. These are designed for long range communication with low power consumption and low costs [15]. Among existing LPWANs, LoRa and SigFox are the most popular LPWAN technologies deployed nowadays [15][16][17]. Though LoRa has some limitations, such as latency and low data throughput compared to Wi-Fi and GSM, it provides a promising solution for industrial uses [18]. Furthermore, the CSS type modulation used in LoRa can send six-times more data-packets than Sigfox [19]. Also, it shows good performances under the impact of different weather conditions [20] which make it ideal for PV installations. VII. CONCLUSION In this paper, a long-range wireless data acquisition system for PV installations based on LoRa technology has been designed and implemented. General sensor architecture working principle and hardware design have been detailed. A LoRa voltage/current sensor, an irradiance sensor based on a lux sensor, a panel position sensor based on a magnetometer and an accelerometer, and a LoRa temperature and humidity sensor have been designed and implemented. A mobile LoRa monitoring device has been implemented in order to test the proposed system.
The aim of the project is the integration of new technologies regarding the surveillance and control of PV systems. A long range and low power wireless data acquisition system opens a range of capabilities for new applications in renewable energy domain.
Future works will focus in improvements of the stability of position sensor (involve gyroscope in azimuth and elevation measurement) and the implementation and integration of advanced control and supervising systems based on new approaches such as Machine Learning algorithms.