"A few months ago, I installed a small off-grid solar systems. I'm always curious to see my performance solar photovoltaic systems, but the good news is I am using the charge controller has its own local display for monitoring. However, I seriously lack of remote monitoring function. So, I decided to make my own surveillance system must have both local and remote monitoring facilities.
Why do we need to monitor?
1. It provides clear information about the various parameters of solar energy, energy extraction, fault detection, historical analysis and the associated loss of solar energy power plants.
2. You can easily measure your solar electricity production, and the monthly savings.
3. You can keep track of all the important parameters in real-time solar photovoltaic system from the smartphone.
In this article, I'll show you I use ESP32 development board and ACS723 current sensor produced a simple solar monitoring system.
Specification:
1. Input voltage -0- 24V (can be extended to 50V)
2. Input current: 0 -15A
3. The solar panel rating -250W (12V) / 500W (24V)
Video display:
Be
Components list:
1. ESP32 -30 needle boards (Banggood / Aliexpress)
2. ACS723 sensor (LCSC)
3. OLED display (Amazon / Banggood)
4. Resistors (Amazon / Banggood)
The ceramic capacitor (Amazon / Banggood)
6. XL7015 buck converter module (Amazon)
7. A temperature sensor (Amazon / Banggood)
8. 3P- 3.5mm pitch screw terminals (LCSC)
9. 2P-9.52mm pitch screw terminal (LCSC)
10. The pin (Amazon / Banggood)
11. Jumper MF (Amazon)
12. PCB
13. Flux (Banggood)
14. Paste (Banggood)
Complementary tool:
1. The iron (Amazon / Banggood)
2. Junior (Amazon / Banggood)
3. Stripper (Amazon / Banggood)
4. 3D printer (Amazon / Banggood)
Step 1: How does it work?
Voltage and current of the solar cell panel are sensed by the sensor sensing the voltage and current. Here, the measurement using a voltage divider network solar panel voltage, a Hall effect current sensor using AC723 measurement of the solar cell panel current. Similarly, DS18B20 temperature sensor may sense ambient temperature.
Raw sensor data from all the sensors are processed by ESP32 plate, and perform any necessary mathematical operations to calculate the power, energy. Then sends the processed data to the OLED display for local monitoring, further sent to the cloud for remote monitoring. Remote monitoring by Blynk application installed on the smartphone completed.
Step 2: Voltage Measurement
Solar panel voltage sensing by a voltage divider network, the voltage divider network comprising two resistors R1 = 47k and R2 = 6.8k composition. R1 and R2 is connected to the output of the analog-pin GPIO pins 34 ESP32. Using the output of the voltage divider ceramic smoothing capacitor C1.
Voltage measurement
ESP32 analog input can be used to measure the DC voltage between 0 and 3.3V. I considered the solar panel can produce 24V (open circuit voltage). To read this voltage, we must gradually be done by using a voltage divider network.
A voltage divider circuit
Vout = R2 / (R1 + R2) x Vin
Vin = (R1 + R2) / R2 x Vout
AnalogRead () function to read and converted to a digital voltage between 0 to 4095
Calibration:
We will use one of its analog input analogRead Arduino () function reads the output value. The function output value between 0 to 4095, each increment of 3.3 / 4095
Vin = Vout * (R1 + R2) / R2; R1 = 47k and R2 = 6.8k
Vin = ADC count * (3.3 / 4095) * ((47 + 6.8) / 6.8) V
You can use the solar panel by selecting the appropriate higher-voltage resistors R1 and R2.
Step 3: measuring the current
For current measurements, I used the Hall-effect current sensors ACS 723 -20AUvariant. ACS723 current detection range of the sensor, according to other variants. ACS712 sensor reads the current value and converts it into a voltage value associated. Associating the two measured values is "sensitive." Output sensitivity can be obtained from the data table. According to the data sheet, the sensitivity of 200mV / A
calibration:
Analog read value = AnalogRead (Pin);
ADCVoltage = (3.3 / 4095) * read the analog value
Current in amperes = (ADCVoltage - offset voltage) / Sensitivity
According to the data table, the offset voltage of 0.1 * Vcc (0.5V), the sensitivity of 200mV / A
Note: ACS723 output by the step-down voltage divider network consisting of R4 and R5.
Step 4: measuring the temperature
I have been using an external probe DS18B20 measure the ambient temperature. It uses the single wire protocol to communicate with the microcontroller. Singlet device requires a pullup resistor at its signal line, so that the circuit board read correctly. Here, I use a 4.7K resistor (R6) as the pull-up resistor.
It can be hooked to the PCB by a 3-pin screw terminal.
To the DS18B20 temperature sensor interface, you need to install One Wire Library and Dallas Temperature library. You can read this article for more details on DS18B20 sensor.
Connected as follows:
Red -> Vcc
Yellow line -> data
Black line -> GND
All the above are clearly labeled on the PCB, to avoid confusion.
Step 5: OLED display is connected
To display solar panels parameters locally, I used 0.96-inch OLED display. Its resolution is 128 x 64, using the I2C bus communicate with ESP32. It uses two pins SCL (GPIO22) ESP32 in, SDA (GPIO21) communication.
I am using Adafruit_SSD1306 library to display parameters. First, you must download Adafruit_SSD1306. And then install it.
Should be connected as follows:
ESP32 -> OLED
3.3V ---> VCC
Ground -> Ground
GPIO21 ----> SDA
GPIO22 ----> SCL
Step 6: PCB Design
I have used EasyEDA online software to draw schematics and PCB design customized for the project. PCB design for mounting various modules, instead of using a large number of components. I have ordered my PCB from JLCPCB, and received it within 7 days.
You can click to download the attachment Gerber file (click to download).
Step 7: PCB Assembly
For welding, you will need a decent soldering iron, solder, jaws and multimeter. It is good practice for welding according to the height of the assembly. First welding means small height.
You can weld components by following these steps:
1. The foot assembly pushed into the pores thereof, and then turned over the back of the PCB.
2. The tip of the tip pad and secured at the junction of the leg assembly.
3. The solder joint into the solder around the lead to flow and cover the entire pad.
Once it flowing around the tip removed.
Step 8: Welding ACS723
Throughout the PCB, the height of the smaller component is a current sensor ACS723, this is the only SMT components used in this project.
First of all, the flux is applied on all eight pads, and then applied a small amount of solder pads at the corners. Using forceps diode chip placed and aligned. When the touch pad with a tip, the chip is fixed in place, so that the solder will melt together with the pin and pad.
To ensure that the point symbol ACS723 IC PCB and mate together. Point symbol representative number -1 pins.
Now, the solder applied to all the pads, can be completed. If the mess during welding, can be used to remove excess desoldering core solder.
Step 9: 3D printed housing
In order to make the product has a good trade dress, I use Autodesk Fusion 360 is designed housing for the project. PCB mounting hole size and all components are measured by vernier calipers, and the same factors considered in the design.
The housing is divided into two parts: a main body 2. Cover
The basic design of the body to retain the PCB. The cap covers the body opening and mounting the OLED display.
I use the printer Creality CR-10 and 1.75 mm PLA filament green printing member. It took me about six hours to print the body, took about two hours to print the cover.
My setup is:
Print speed: 60 mm / sec
Storey: 0.2mm (0.3 may be)
Packing density: 20%
Extruder temperature: 200 ° C
Bed temperature: 60 ° C
STL files downloaded from Thingiverse
Step 10: assembling the housing 3D printing
PCB may be mounted on the housing 4 3D printing stent. You can use the 4 x M3 screws directly fixed PCB, cooling plug may be mounted threaded to improve reliability. Here, I have used heat inserts on each bracket.
After the PCB is mounted to the body, we can move the OLED display is mounted. You can use hot glue or tape strength OLED displays mounted on the back of the top cover.
The jumper connector from the PCB to the OLED display OLED port. Pin plug on the PCB has clearly marked.
The temperature sensor cable insertion hole to the right of the chassis. The wire is then connected to the screw terminals.
Now, using 4 x M3 screws off the cap.
In order to make housing more attractive, I posted a roof Instructables label.
#define BLYNK_PRINT serial
#include
#define SCREEN_WIDTH 128 // OLED display width (in pixels)
#define SCREEN_HEIGHT 64 // OLED display height (in pixels)
#define INPUT_VOLTAGE_SENSE_PIN 34
#Define INPUT_CURRENT_SENSE_PIN 35
#Define TEMP_SENSE_PIN 4
# Define VOLTAGE_SCALE 7.911 // R1 + R2 / R2 // (47K + 6.8K) / 6.8K
# Define CURRENT_SCALE 1.5 // R4 + R5 / R5 // (1K + 2K) / 2K
Double mVperAmp = 200; // sensitivity of the sensor module 100A for use // // 100, 30A for the module 66
Double ACSoffset = 514; // ideally should be at (0.1 x Vcc) // measurement is 514mV
Unsigned long last_time = 0;
Unsigned long current_time = 0;
Floating power = 0; // wattage
Floating energy = 0; // watt hours of energy values
Floating-point temperature tempC = 0; // Celcius of temperature
// float tempF = 0; temperature (unit: F)
Floating Save = 0; // save costs
WiFiClient client;
// declare SSD1306 display connected to the I2C (SDA, SCL pin)
Adafruit_SSD1306 display (SCREEN_WIDTH, SCREEN_HEIGHT, & Wire, -1);
// DS18B20 connected to GPIO
const int oneWireBus = 2;
// set a OneWire instance to communicate with any device OneWire
OneWire oneWire (TEMP_SENSE_PIN);
Dallas temperature sensor (& oneWire);
// Variable for wifi server settings ========================= ================ === ===========
// your WiFi credentials.
// open network password is set to "."
char ssid [] = "XXXX"; // WiFi router ssid
char pass [] = "XXXX"; // WiFi router password
// copy received from the mail Blynk
char auth [] = "XXXX";
// Set function ===================== ========================= = ==========================
void setup () {
Serial.begin (115200);
Blynk.begin (auth, ssid, pass);
sensor.begin ();
If (! Display.begin (SSD1306_SWITCHCAPVCC, 0x3C)) {
Serial.println (F ( "SSD1306 allocation failure"));
for (;;);
}
display.clearDisplay ();
display.setTextColor (WHITE);
display.display ();
Delay (500);
}
// ======================== circulation ===================== = =========================
Futile cycle ()
{
// read voltage and current
Floating voltage = abs (return_voltage_value (INPUT_VOLTAGE_SENSE_PIN));
Floating current = abs (return_current_value (INPUT_CURRENT_SENSE_PIN));
// read the temperature from DS18B20
sensor.requestTemperatures (); // Get Temperature
tempC = sensor.getTempCByIndex (0);
// tempF = sensor.getTempFByIndex (0);
// compute power and energy
Power = Current * Voltage; // calculate the power in watts
last_time = current_time;
current_time = millis ();
Energy = energy + Power * (((current_time -last_time) /3600000.0); // to calculate the power in units of watt-hours // 1 hour x 60 seconds = 60 minutes x 1000 ms
Saving = 6.5 * (energy / 1000); // 6.5 // cost per kWh of examples only
// ================ serial display data on the monitor ======================== == ======================
/ * Serial.print ( "Voltage:");
Serial.println (voltage);
Serial.print ( "Current:");
Serial.println (current);
Serial.print ( "Power:");
Serial.println (power);
Serial.print ( "Energy:");
Serial.println (energy);
Serial.print ( "Temp:");
Serial.println (tempC);
Serial.println (voltage);
Delay (1000);
* /
// display data on ================ OLED display ========================== ======================
// display solar panel voltage
display.setTextSize (1);
display.clearDisplay ();
display.setCursor (10,10);
display.print (voltage, 1);
display.print ( "V");
// display the current solar panel
display.setCursor (70,10);
If (current> 0 && current <1)
{
display.print (current * 1000,0);
display.print ( "mA");
}
Else
{
display.print (current, 2);
display.print ( "A");
}
// display the power in watts of solar panels
display.setTextSize (2);
display.setCursor (10,25);
display.print (power);
display.print ( "W");
// display the energy generated by the solar cell panel
display.setCursor (10,45);
If (Energy> = 1000)
{
display.print (energy / 1000,3);
display.print ( "kWh");
}
Else
{
display.print (energy, 1);
display.print ( "Wh");
}
display.display ();
display.clearDisplay ();
================= ======================== // display the data in the application on Blynk == ======================
Blynk.run ();
Blynk.virtualWrite (0, voltage); // virtual pin 0
Blynk.virtualWrite (1, current); // virtual pin 1
Blynk.virtualWrite (2, power); // virtual pin 2
Blynk.virtualWrite (3, energy / 1000); // virtual pin 3
Blynk.virtualWrite (4, tempC); // virtual pin 4
Blynk.virtualWrite (5, Saving); // virtual pin 4
// delay (1000);
}
// ========================= solar panel voltage calculation function ================ == ==================
Double return_voltage_value (int pin_no)
{
Double tmp = 0;
Double ADCVoltage = 0;
double inputVoltage = 0;
Double mean = 0;
For (int i = 0; i <100; i ++)
{
tmp = tmp + AnalogRead (pin_no);
}
Average = tmp / 100;
ADCVoltage = ((mean 3.3 *) / (4095)) + 0.184; 0.184 // offset adjustment is performed by heating, and then try
inputVoltage = ADCVoltage * VOLTAGE_SCALE;
Return inputVoltage;
}
// ========================= calculation function ================ current solar panel = ==================
double return_current_value (int pin_no)
{
Double tmp = 0;
Double mean = 0;
Double ADCVoltage = 0;
Biamperometric = 0;
For (int z = 0; z <150; z ++)
{
tmp = tmp + AnalogRead (pin_no);
}
Average = tmp / 150;
ADCVoltage = ((mean * 3331) / 4095); // get mV
Amp = (((ADCVoltage * CURRENT_SCALE-ACSoffset) / mVperAmp); // 1.5 is a scaling of the voltage divider
Return amps;
}
Step 13: Field Test
Be
Now, our equipment is ready for on-site testing. Should be connected as follows:
1. The negative terminal of a load connected to the output terminal of the negative electrode terminal screw, and the positive terminal connected to the output terminal of the positive electrode. Here, I have connected the OUT terminal to my charging controller solar input terminal.
2. Connect the negative terminal of the solar panel to an input terminal of the negative electrode terminal screw, connecting the positive electrode to the positive input terminal.
Input and output terminals can be used screw diameter of 26-10AWG.
You can refer to the top wiring chart to get a better understanding.
Note: Make sure you connect to the correct polarity, otherwise you will see the magic smoke. This circuit has no reverse polarity protection.
Once all connections are completed, you will see the solar panel parameters on the OLED display. You can check from your smartphone by opening the blynk application.
At this point, our project is designed, you are welcome to practice interaction. "
Step 11: Software and libraries
To ESP32 board for use with Arduino library, you must be used with the Arduino IDE and ESP32 board. If you have not already done so, you can follow this tutorial Sparkfun, easily ESP32 development board to support install Arduino IDE.
Installation Library:
Before uploading the code, install the following libraries:
1. ESP32
2. Brink
3. Adafruit_SSD1306
4. a line
5. Dallas temperature
How to install the library?
You can read Sparkfun of this tutorial to install Arduino library.
Step 12: Application to interact with Blynk
Blynk is the most popular Internet of Things platform for connecting any hardware to the cloud, designed to control their applications and large-scale management of the deployed product. With Blynk library, you can be more than 400 kinds of hardware models (including ESP8266, ESP32, NodeMCU and Arduino) connected to Blynk Cloud.
step 1:
Download Application Blynk
1. For Android
2. For iPhone
Step 2:
To obtain an authentication token Blynk application and your hardware connection, you need authentication token.
1. Create a new account in Blynk application.
2. Press the QR icon on the top menu bar. By scanning the QR code shown above, create a copy of the project. Once successfully detected, the entire project will be immediately on your phone. I have made Sol Weather Station application. You are welcome to try!
To start using it:
1. Download Blynk application: http: //j.mp/blynk_Android or http://j.mp/blynk_Android
2. Touch QR code icon, then point the camera following code, please enjoy my app!
3. After you create a project, we will send the authentication token to you via e-mail.
4. Check your email inbox and find the "authentication tokens."
Step 3:
Wemos development board is ready Arduino IDE Arduino code that you want to upload to Wemos development board, you must follow Instructables
Step 4:
After attaching the library, Arduino paste the code given below.
Step 1 of the input authentication code, ssid and password for the router.
Then upload the code.
// ================================================ ===================================== //
// //
// solar panel energy monitor firmware V1.0 //
// //
// developed by the Debasish Dutta, last updated: 06.05.2021 //
// //
// ================================================ ===================================== //
#include
#include
#include
#include
#include "Wire.h"
#inclu
Our other product: