Open Green Energy

Open Source DIY Projects on Green energy

DIY Solar Panel Monitoring System – V2.0

DIY Solar Panel Monitoring System – V2.0

 

Solar Panel Monitoring

 

As solar photovoltaic (PV) systems become increasingly popular as a clean and renewable source of energy, it’s crucial to ensure that these systems are performing efficiently and effectively. A solar Panel Monitoring System helps to identify potential issues, optimize energy production, and extend the lifespan of your investment. In this blog post, we’ll introduce you to a simple yet powerful DIY solar PV monitoring system that enables you to track essential performance parameters, such as voltage, current, temperature, power, and energy.

The DIY monitoring system is built around the XIAO ESP32 MCU, a versatile and cost-effective microcontroller that forms the core of the system. To measure the electrical parameters, we’ll use the ACS758 current sensor for accurate current readings and a voltage divider circuit for voltage measurements. Additionally, we’ll incorporate the DS18B20 temperature sensor to monitor the temperature of the solar panels or other system components. Optionally, you can also add an OLED display to visualize the data in real-time.

This project not only offers a cost-effective solution for monitoring your solar PV system but also provides a fantastic learning experience for those interested in electronics, solar energy, and programming. By building your own monitoring system, you gain a deeper understanding of your solar PV system’s workings, and you can customize it to suit your specific needs.

In the following sections, we’ll provide a list of the required components, detailed instructions on setting up the circuit, and the Arduino code to get your DIY solar PV monitoring system up and running. So, let’s dive into the world of solar PV monitoring and make the most out of the clean energy harnessed by your solar panels.

You may check out my previous post on DIY Solar Panel Monitoring System – V1.0


Why do We Need a Solar Panel Monitoring System?

1. It gives clear information about various solar parameters, extracted energy, fault detection, historical analysis of the solar plant, and associated energy loss.

2. You can easily measure your solar production and the saving on your monthly electricity bill.

3. You can track all the important parameters of the solar PV system in real-time from your smartphone.

In this post, I will show you I have made a simple Solar Monitoring System by using an ESP32 development board and ACS723 current sensor.

Specification:

1. Voltage Range: 0- 50V

2. Current Range: 0 -50A

3. Temperature Range:  -55°C to +125°C

 

Bill Of Material ( BOM )

 

 

Components Used:

SL No.
Components
Quantity
Buying Link
1
XIAO ESP32C3
1
2
ADS1115 Module
1
3
ACS758 Module
1
4
XL7015 Buck Converter
1
5
OLED Display
1
6
Resistor ( 100K , 10K, 4.7K, 2K , 1K )
1
7
0.1 uF Capacitor
1
8
Screw Terminal 2P – 9.52mm
2
9
Screw Terminal 3P- 3.5mm
1

 

Tools Used:

SL No
Tools
Buying Link
1
Soldering Iron
2
Nipper
3
Wire Stripper
4
3D Printer

 

How It works?

 

 

XIAO ESP32 MCU: The microcontroller serves as the central processing unit, gathering data from sensors, performing calculations, and controlling the OLED display.

ACS758 Current Sensor: The ACS758 measures the current flowing through the solar panel by converting the magnetic field generated by the current into a proportional output voltage. The XIAO ESP32 MCU reads this voltage and converts it into the actual current value.

Voltage Divider: The voltage divider, composed of two resistors in series, is connected to the solar panel’s positive terminal and GND. The junction between the two resistors provides a scaled-down voltage, which the XIAO ESP32 MCU reads and converts back to the actual voltage value. This method allows the circuit to measure voltages higher than the MCU’s maximum analog input voltage.

DS18B20 Temperature Sensor: This digital temperature sensor measures the temperature of the solar panel or other system components. It communicates with the XIAO ESP32 MCU using the OneWire protocol, providing accurate temperature readings that can help identify performance issues related to temperature variations.

OLED Display: The OLED display is used to visualize the collected data in real time. It communicates with the XIAO ESP32 MCU using the I2C protocol, allowing you to easily display voltage, current, temperature, power, and energy readings.

 

Schematic Diagram

 

 

Setting Up the Circuit

 

  1. XIAO ESP32 MCU: This versatile microcontroller will serve as the brain of our monitoring system, processing and analyzing the data from our sensors, and connecting to Blynk.
  2. ACS 758 Current Sensor: Connect the Vcc and GND pins of the ACS 758 to the 5V and GND pins on the XIAO ESP32, respectively. Connect the output (OUT) pin of the ACS 758 to an analog input pin (e.g., A0) on the XIAO ESP32.
  3. Voltage Divider: Set up a voltage divider using two resistors in series. For measuring up to 50V, you can use a 450kΩ resistor and a 50kΩ resistor. Connect one end of the series to the solar panel’s positive terminal and the other end to GND. Then, connect the junction of the two resistors to an analog input pin (e.g., A1) on the XIAO ESP32.
  4. DS18B20 Temperature Sensor: Connect the Vcc, GND, and data pins to the 3.3V, GND, and a digital input pin (e.g., D2) on the XIAO ESP32, respectively. Remember to add a 4.7K Ohm resistor between the Vcc and data pins for proper functioning.
  5. OLED Display (optional): Connect the Vcc, GND, SCL, and SDA pins of the OLED display to the corresponding pins on the XIAO ESP32. If you’re using a display that supports I2C communication, it typically involves connecting the Vcc to 3.3V, GND to GND, SCL to the SCL pin (e.g., D22), and SDA to the SDA pin (e.g., D21) on the XIAO ESP32.

 

Measuring Voltage

The solar panel voltage is sensed by a voltage divider network consisting of two resistors R1=100k and R2=10k. The output from the voltage divider is connected to ADC1115  pin A0. The output from the voltage divider is smoothed out by using a ceramic capacitor C1.

Voltage Measurement :

For a voltage divider circuit

Vout = R2/(R1+R2) x Vin

Vin = (R1+R2)/R2 x Vout

The ads.readADC_SingleEnded(0)  function reads the raw analog data

Calculation :

We’re going to read the output value with one of the analog inputs of Arduino and its analogRead() function. That function outputs a value between 0 and 4095 that is 3.3/4095 for each increment

Vin = Raw Voltage *(R1+R2)/R2 ; R1=100k and R2=10k

You can use solar panels with higher voltage by selecting the appropriate resistors R1 and R2.

To select the voltage divider resistance values, you can use this online calculator.

 

Measuring Current

 

 

For the current measurement, I used a Hall Effect current sensor ACS 758 -50B. The output from the current sensor is connected to a voltage divider network consisting of resistors R3 and R4. There are other variants of the ACS758 Sensor based on the range of its current sensing. The ACS758 sensor reads the current value and converts it into a relevant voltage value, The value that links the two measurements is Sensitivity. The output sensitivity can be obtained from the ACS758-Datasheet. As per the datasheet, the sensitivity is 40mV / A

 

Calculation:

analog read value = analogRead(Pin);

ADCVoltage = ads.readADC_SingleEnded(1);

Then multiply the default gain of ADC1115 ( (0.1875/1000) and then multiply the voltage divider factor ( R3+R4)/R3

Current in amp = ( ADCVoltage – Offset Voltage ) / sensitivity

As per data sheets offset voltage is  Vcc/2  ( 2.5V ) and sensitivity is 40 mV/A

Measuring Temperature

I have used an external DS18B20 probe for measuring the ambient temperature. It uses a one-wire protocol to communicate with the microcontroller. One-wire devices need a pull-up resistor connected to their signal line to be properly read by your board. Here, I have used a 4.7K resistor ( R5 ) as a pull-up resistor.

It can be hooked up to the PCB through the 3-pin screw terminal.

To interface with the DS18B20 temperature sensor, you need to install the One Wire library and the Dallas Temperature library. You can read this article for more details on the DS18B20 sensor.

The connection is as follows:

Red Wire -> Vcc

Yellow Wire -> DATA

Black Wire -> GND

All the above are clearly labeled on the PCB for avoiding any confusion.

Interfacing OLED Display

To display the solar panel parameters locally, I have used a 0.96″ OLED display. It has a 128 x 64 resolution and uses an I2C bus to communicate with the ESP32. Two pins SCL (GPIO22), SDA (GPIO21) in ESP32 are used for communication.

I am using the Adafruit_SSD1306 library to display the parameters.

The connections should be as follows:

ESP32 – ->OLED

3.3V —>VCC

GND –>GND

GPIO21—-> SDA

GPIO22—-> SCL

You can also connect an I2C LCD Display in place of the OLED display. However, you have to modify the code accordingly.

 

PCB Design

I have drawn the schematic by using EasyEDA online software and then designed a custom PCB for this project. The PCB is designed for mounting the different modules instead of using a lot of components.

You can download the Gerber files from PCBWay

You may also try Seeed Studio Fusion Aglie Manufacturing Service from 0.1 –

 

PCB Assembly

 

 

For Soldering, you will need a decent Soldering Iron, Solder, Nipper, and a multimeter. It is good practice to solder the components according to their height. Solder the lesser height components first.

You can follow the following steps to solder the components :

1. Push the component legs through their holes, and turn the PCB on its back.

2. Hold the tip of the soldering iron to the junction of the pad and the leg of the component.

3. Feed the solder into the joint so that it flows all around the lead and covers the pad.

Once it has flowed all around, move the tip away.

 

3D printed Enclosure

 

 

To give a nice commercial product look, I have designed an enclosure for this project by using Autodesk Fusion 360. The dimensions of all the components and PCB mounting holes are measured by a vernier caliper then the same were considered during the design.

The enclosure has two parts: 1. Main Body 2. Top Lid The

The main body is basically designed to keep the PCB board. The top lid is to cover up the main body opening and mounting the OLED display.

I used my Ender 3S1 Pro printer and 1.75 mm silver and pink PLA filament to print the parts. It took me about 6 hours to print the main body and around 2 hours to print the top lid.

My settings are:

Print Speed: 60 mm/s

Layer height: 0.2mm ( 0.3 also works well)

Fill Density: 20%

Extruder Temperature: 205 deg C

Bed Temp: 60 deg C

Download the STL files from Thingiverse

Software and Libraries

To use the XIAO ESP32 board with the Arduino library, you’ll have to use the Arduino IDE with ESP32 board support. If you haven’t already done that yet, you can easily install ESP32 Board support to your Arduino IDE by following this tutorial by Sparkfun.

Install the Libraries:

Before uploading the code install the following libraries :

1. Adafruit_ADS1X15

2. Blynk

3. Adafruit_SSD1306

4. One Wire

5. Dallas Temperature

6. Blynk Library

 

Interfacing With Blynk 2.0 App

 

In the earlier version, I used the old Blynk app which is now obsolete. In this project, we will use the new Blynk 2.0 app to monitor all the parameters remotely. First, you need to create a Blynk project and set up a dashboard in the mobile or web application. Here’s how you can set up the dashboard:

Web Dashboard: 

Visit blynk.cloud and create a Blynk account on the Blynk website. Or you can simply sign in using the registered Email ID.

Click on +New Template.

 

 

Now you have to give a name to your Hardware ( Solar PV Monitoring V2). Choose the Hardware type as ESP32 and the connection type as WiFi. You can also write a shot of the description in the description box. Then click on Done. Now the template is created successfully.

 

 

 

 

The next step is to add a new data stream. For this project, I have used 6 data streams for voltage, current, power, energy, temperature, and savings. And assigned virtual pins from V0 to V5 for all the variables.

You have to also give the unit of measurement and minimum, maximum value for it. In our case, the voltage is assigned to virtual pin V0, the data type is Double, the unit is Volt, the minimum is 0 and the maximum is solar panel maximum voltage. You can also select the specific color of your choice.

 

 

Similarly, create for all 6 variables.

 

 

Now we have to add a new device here.

 

Select the device from a template that you created earlier.

 

 

 

After giving a name to the device, click on Create. A device authentication token ( 3 lines in a black box at the top right corner)  will be generated now. Copy this token as this will be used in our code.

 

Now go to the Web Dashboard.

 

In the Web Dashboard, drag and drop 4 widgets Gauge, two labels, and one chart on the dashboard. Then click on the gear icon to set the parameters as shown below. Then save it and repeat the same process for setting up all 7 widgets.

 

Now you have successfully set up your Blynk Dashboard.

 

 

 

Mobile Dashboard: 

 

 

 

Arduino Code

Before uploading the code be sure, you have installed all the libraries from the links given before. Then copy the below code and upload it to the XIAO ESP32 board.

 

Field Testing

 

 

Now our device is ready for real field testing. The connection shall be as follows:

1. Connect the negative terminal of the load to the negative terminal of the output screw terminal and then the positive terminal to the output positive terminal. Here I have connected the out terminal to my inverter solar input terminal.

2. Connect the Solar panel’s negative terminal to the negative terminal of the Input screw terminal and positive to the input positive terminal.

The Input and Output screw terminals can be used for wire sizes from 26 – 10AWG.

Note: Be sure you are connecting to the right polarity, otherwise you will see the magic smoke. The circuit doesn’t have reverse polarity protection.

After all the connections, you will see your solar panel parameters displayed on the OLED display. You can check it from your smartphone by opening the Blynk App.

Related Posts

Fig-12.2: Wire Gauge Systems Fig-12.4: Cable Sizing Example       Fig-12.5: DC Cable Size Chart   Fig-13.1: Battery and

Read More