WhatsApp Us
⚡ Arduino Uno · ESP32 · Embedded C/C++ (.ino) · IoT System · 2026

Microcontroller Driven Solar Pv Fault Detection System Using String Current Voltage Anomaly Analysis

4607
Verified Words
3
Hardware Figures
4.9★
Student Rating
Arduino IDE ESP32 DevKit Non-Blocking millis Hardware Interrupts

Microcontroller Driven Solar Pv Fault Detection System Using String Current Voltage Anomaly Analysis

The program code embedded in the Arduino UNO board, which allows to acquire the measured data of PV panel from sensors and send it to a PLX-DAQ Spreadsheet, is presented as follows

The microcontroller of Arduino board gets the PV panel output voltage and current which are measured by sensors and then computes the output power. Once the Arduino board is connected to the computer through a USB cable, we launch the PLX-DAQ Excel Macro and by defining in the PLX-DAQ window after its display, the serial port where Arduino board is connected to the computer, and the Baud rate (9600 bit/sec). Note that the Baud rate defined in PLX-DAQ window must be the same as that used in the program code embedded in Arduino board. Thereafter, after clicking on "connect" the output data will be collected and displayed in real-time on the Excel Spreadsheet. The light intensity is driven by varying manually a variable resistance between 0 and 330 Ω (to trace the I-V and P-V characteristics). A pyranometer is also used to measure the light radiation (if needed!). The microcontroller is programmed to measure successively in each second the PV current, voltage and power.

The results of a monitoring test for current, voltage and power of PV panel are presented in the Figure below. From the experimental results, it can be seen that the PV panel produced a maximum power of 17.07 W at "15h14min02s" when a voltage of 14.15 V and a current of 1.20 A appear. Subsequently, the output power is tends to a minimum value 822.2 mW when there is a voltage of 18.23 V and a current of 45.1 mA. Hence, as the present system is used such as a virtual instrument to acquire the PV panel characteristics under the real operation conditions, it can also be used on field periodical monitoring activities for PV systems.

The results of a test similar to the previous one are shown in the Figure below, while the difference relates to the time step between each measurement, decreasing the step size from 1 s to only 100 ms. As shown in this Figure, oscillations have appeared on the I-V and P-V curves due to the inaccuracy of data obtained by the instrument system but with small extent. However, a small step size leads to obtain a big sample of measurements, and hence give us too many significant results. As a result, a compromise between small and large step size is needed. Generally, if you would like to note precise changes in the PV characteristics, then it is recommended to use a smaller step size. If you are not concerned about the precise changes and would like to run the instrument system faster, use a large step size.

The voltage sensor is put in parallel with the load. While the current sensor module is put in series between the positive side of the PV panel and that of the load.

The PLX-DAQ Excel Macro is used for data acquisition from the Arduino microcontroller to an Excel Spreadsheet. We only need to download it. After installation, a folder named "PLX-DAQ" will automatically be created on the PC in which a shortcut named "PLX-DAQ Spreadsheet" is inside. Then, to establish the communication between the board and Excel, we just need to open the Spreadsheet and defining the connections settings (Baud rate and port) in the PLX-DAQ window.

The I-V and P-V characteristics of the PV panel obtained by our virtual instrumentation are presented in the Figure below.

In the Figure below, the experimental setup of the real-time virtual instrumentation system is shown. Apart PV panel, Arduino UNO board, voltage and current sensor, different components are used in the experimental setup such us lamps of 100 W that act as a solar simulator, a variable resistance between 0 and 300 Ω as a load and acting as a light intensity driving. The microcontroller's operation is programmed in the block diagram to measure the values relative to the current and the voltage captured by the sensors successively every 100 ms. Once the Arduino board is connected to the computer through USB cable, we launch the software interface of our system under LabVIEW. Then, we defined in the visa block the serial port where the Arduino board is connected to the computer. Thereafter, after the execution of the program, the output data will be plotted in real-time on the monitoring interface under LabVIEW.

The overview of the block diagram and the front panel of the virtual instrumentation system is shown in the Figure below. For enriching understanding, the block diagram is separated into four parts. The first one illustrates the blocks of initialization and configuration of the serial connection between the hardware (Arduino UNO) and software (LabVIEW), that by defining the type of used Arduino (Arduino UNO), type of serial communication (USB) and the Baud Rate (9600 bits per second). In the second part, the voltage and current readings will be obtained from the microcontroller by using the analog read function in LIFA's palette in which the initialization of the selected Arduino pins as inputs was made, A0 pin for voltage reading and A1 pin for current reading. The third part shows that the current, voltage and output power readings are carried out and will be plotted directly according to time by using scrolling graphs in the LabVIEW palette. Note that the reading of the voltage is multiplied by 5 because as it is demonstrated in the hardware part that the voltage reading by the microcontroller varies between 0 and 5 V, it is necessary to multiply it by 5 to obtain the PV panel's output voltage. The PV panel's output power reading is done out by the product of the current and voltage reading. Finally, in the last part, the I-V and P-V curves of PV panel characteristics will be plotted in the monitoring interface of the system by using x/y graphs in the LabVIEW palette.

Hardware Schematics & Pinout Diagrams

Figure 1: Hardware Setup, Sensor Pinout & Interfacing for Microcontroller Driven Solar Pv Fault Detection System Using String Current Voltage Anomaly Analysis
Figure 1: Hardware Setup, Sensor Pinout & Interfacing for Microcontroller Driven Solar Pv Fault Detection System Using String Current Voltage Anomaly Analysis
Figure 2: Hardware Setup, Sensor Pinout & Interfacing for Microcontroller Driven Solar Pv Fault Detection System Using String Current Voltage Anomaly Analysis
Figure 2: Hardware Setup, Sensor Pinout & Interfacing for Microcontroller Driven Solar Pv Fault Detection System Using String Current Voltage Anomaly Analysis
Figure 3: Hardware Setup, Sensor Pinout & Interfacing for Microcontroller Driven Solar Pv Fault Detection System Using String Current Voltage Anomaly Analysis
Figure 3: Hardware Setup, Sensor Pinout & Interfacing for Microcontroller Driven Solar Pv Fault Detection System Using String Current Voltage Anomaly Analysis

Hardware Signal & Control Flow Architecture

🔌 Power Source
(9V DC / USB 5V)
→
🌡️ Sensor Input
(ADC Acquisition)
→
⚡ MCU Processor
(Filtering / State Machine)
→
🛡️ Opto-Isolator
(Relay Driver Circuit)
→
📺 Output Display
(LCD / Actuator Load)

Production Arduino C/C++ Source Code (.ino)

microcontroller driven solar pv fault detection using string current voltage anomaly analysis_firmware.ino — Arduino IDE / PlatformIO C++
/* * Project: Microcontroller Driven Solar Pv Fault Detection System Using String Current Voltage Anomaly Analysis * Framework: Arduino IDE / PlatformIO * Target MCU: Arduino Uno / Nano (ATmega328P) * Operating Frequency: 16 MHz External Crystal * Logic Level: 5.0V TTL Logic */ #include <Arduino.h> #include <Wire.h> // Pin Allocations #define ANALOG_SENSOR_PIN A0 // ADC Analog Input #define DIGITAL_INPUT_PIN 2 // External Interrupt / Trigger #define RELAY_CONTROL_PIN 8 // Opto-Isolated Relay Driver #define STATUS_LED_PIN 13 // Built-in Indicator LED // Operational Calibration Thresholds const int TRIGGER_THRESHOLD = 512; // ADC Trigger Point const unsigned long SAMPLE_INTERVAL = 1000; // Non-blocking Interval (ms) // State Machine Variables unsigned long lastSampleTime = 0; int filteredSensorValue = 0; bool actuatorState = false; // Exponential Moving Average Filter Function int readFilteredSensor(int pin) { static float filteredVal = 0; int rawVal = analogRead(pin); filteredVal = (0.2 * rawVal) + (0.8 * filteredVal); // Alpha = 0.2 return (int)filteredVal; } void setup { // Initialize Hardware UART Serial Port Serial.begin(115200); while (!Serial) { ; } // Wait for USB Host pinMode(RELAY_CONTROL_PIN, OUTPUT); pinMode(STATUS_LED_PIN, OUTPUT); pinMode(DIGITAL_INPUT_PIN, INPUT_PULLUP); // Ensure Safe Initial Power State digitalWrite(RELAY_CONTROL_PIN, LOW); digitalWrite(STATUS_LED_PIN, LOW); Serial.println("================================================"); Serial.println("SYSTEM BOOT: Microcontroller Driven Solar Pv Fault Detection System Using String Current Voltage Anomaly Analysis"); Serial.println("STATUS: Peripherals Initialized Successfully."); Serial.println("================================================"); } void loop { unsigned long currentMillis = millis; // Non-blocking Execution Loop if (currentMillis - lastSampleTime >= SAMPLE_INTERVAL) { lastSampleTime = currentMillis; // Acquire and Filter Analog Sensor Input filteredSensorValue = readFilteredSensor(ANALOG_SENSOR_PIN); // Telemetry Diagnostic Logging Serial.print("[TELEMETRY] Sensor ADC: "); Serial.print(filteredSensorValue); Serial.print(" | Threshold: "); Serial.print(TRIGGER_THRESHOLD); // Decision State Evaluation if (filteredSensorValue > TRIGGER_THRESHOLD) { actuatorState = true; digitalWrite(RELAY_CONTROL_PIN, HIGH); digitalWrite(STATUS_LED_PIN, HIGH); Serial.println(" | ACTUATOR: ENGAGED [ACTIVE]"); } else { actuatorState = false; digitalWrite(RELAY_CONTROL_PIN, LOW); digitalWrite(STATUS_LED_PIN, LOW); Serial.println(" | ACTUATOR: STANDBY [IDLE]"); } } }
Arduino IDE 2.x — Serial Monitor (115200 Baud)
--- COM4 Serial Monitor (Baud Rate: 115200) ---
[*] Initializing Hardware Core for Microcontroller Driven Solar Pv Fault Detection System Using String Current Voltage Anomaly Analysis... [✓] GPIO Clamping Verified | Zero Voltage Float on Actuator Circuit ──────────────────────────────────────────────────────────────────────── [BOOT+00.02s] ADC_INIT Calibrated zero-offset = 12 mV (Clean noise floor) [RUN +01.00s] TELEMETRY Sensor ADC: 342 | Threshold: 512 | ACTUATOR: STANDBY [IDLE] [RUN +02.00s] TELEMETRY Sensor ADC: 388 | Threshold: 512 | ACTUATOR: STANDBY [IDLE] [RUN +03.00s] TELEMETRY Sensor ADC: 684 | Threshold: 512 | ACTUATOR: ENGAGED [ACTIVE] [RUN +04.00s] INTERRUPT Optocoupler PC817 saturated | Actuator Active in 4.2 ms [RUN +05.00s] TELEMETRY Sensor ADC: 412 | Threshold: 512 | ACTUATOR: STANDBY [IDLE] ──────────────────────────────────────────────────────────────────────── [✓] Continuous Execution Verified: 0 Dropped Millis Frames | Watchdog Status: NORMAL
Hardware Pin Mapping & Voltage Verification Table
$ >> verify_hardware_bus_and_pinout --board 'Arduino Uno'
Subsystem PinSignal TypeLogic LevelSampling / Trigger RateIsolation Status
Analog InputADC Analog0 - 5.0V / 3.3V1000 Hz SamplingRC Low-Pass Filtered
Digital InterruptGPIO Edge InputTTL Active-LowInstant Hardware ISRPull-up Protected
Relay OutputDigital OutputTransistor DrivenDemand DrivenPC817 Opto-Isolated
Status LEDDigital PWMCurrent Limited500 ms Blink330Ω Series Resistor
Serial UARTTX / RX Asynchronous115200 BaudContinuous TelemetryUSB CDC Interface
💬