Introduction: DIY Solar Panel Monitoring System - V1.0
几个月后,我已经安装了一个小型离网太阳能系统。我总是非常好奇,看看我的太阳能光伏系统的表现,好消息是我正在使用的充电控制器有自己的本地显示器进行监控。但是,我非常缺少远程监控设施。因此,我决定制作自己的监控系统,必须具有本地和远程监控设施。
Why We Need Monitoring?
1.它提供了有关各种太阳能参数,提取的能量,故障检测,太阳能植物的历史分析以及相关能量损失的清晰信息。
2.您可以轻松衡量您的太阳能生产和节省您的每月电费。
3.您可以从智能手机实时跟踪太阳能光伏系统的所有重要参数。
In this Instructables, I will show you I have made a simple Solar Monitoring System by using an ESP32 development board and ACS723 current sensor.
Specification:
1.输入电压 - 0-24V(可延长至50V)
2.输入电流:0 -15a
3.太阳能电池板额定值 - 250W(12V)/ 500W(24V)
访问我的新创建的个人博客:https://www.opengreenenergy.com
Full Video Tutorial:
补给品
Step 1: How It Works?
The Solar panel voltage and current are sensed by voltage and current sensor respectively. Here, a voltage divider network is used to measure the solar panel voltage, and the AC723 hall effect current sensor is used to measure the solar panel current. Similarly, the ambient temperature is sensed by the DS18B20 temperature sensor.
来自所有传感器的原始传感器数据由ESP32板处理,并执行所有必要的数学以计算电源,能量。然后,已处理的数据将发送到OLED显示屏以获取本地监控,也向云进行远程监控。通过安装在智能手机上的Blynk应用程序完成远程监控。
Step 2: Measuring Voltage
太阳能电池板电压由分压器网络感测,包括两个电阻器R1 = 47K和R2 = 6.8K。R1和R2的输出连接到ESP32模拟引脚GPIO引脚34.通过使用陶瓷电容器C1平滑分压器的输出。
电压测量:
ESP32’s analog inputs can be used to measure DC voltage between 0 and 3.3V. The solar panel that I have considered can generate 24V ( Open Circuit Voltage). To read this voltage we have to step don the voltage which can be done by using a voltage divider network.
For a voltage divider circuit
Vout = R2/(R1+R2) x Vin
VIN =(R1 + R2)/ R2 x VOUT
The analogRead() function reads the voltage and converts it to a number between 0 and 4095
校准 :
我们将使用Arduino的一个模拟输入和其analogread()函数读取输出值。该函数输出0到4095之间的值,即为每个增量为3.3 / 4095
VIN = VOUT *(R1 + R2)/ R2;R1 = 47K和R2 = 6.8K
Vin= ADC count * ( 3.3/4095 ) * ( ( 47+6.8) / 6.8 ) Volt
You can use solar panel with higher voltage by selecting the appropriate resistors R1 and R2.
要选择分压器电阻值,可以在线使用计算器.
第3步:测量电流
For current measurement, I used a Hall Effect current sensor ACS 723 -20AUvariant. There are other variants of ACS723 Sensor based on the range of its current sensing. The ACS712 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 datasheet. As per the datasheet, the sensitivity is 200mV / A
校准:
模拟读取值= Analogread(PIN);
ADCVoltage = (3.3/4095)*analog read value
Current in amp = ( ADCVoltage – Offset Voltage ) / sensitivity
As per data sheets offset voltage is 0.1 * Vcc ( 0.5V ) and sensitivity is 200mV/A
Note:The output from the ACS723 is stepdown by a voltage divider network consists of R4 and R5.
Attachments
第4步:测量温度
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 ( R6 ) as a pull-up resistor.
它可以通过3pin螺钉端子连接到PCB。
要与DS18B20温度传感器接口,您需要安装一个电线库and the达拉斯温度库. You can read本文有关DS18B20传感器的更多详细信息。
连接如下:
红线 - > vcc
Yellow Wire -> DATA
黑色线——>接地
All the above are clearly labeled on the PCB for avoiding any confusion.
Step 5: 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 theAdafruit_SSD1306 library显示参数。首先,您必须下载adafruit_ssd1306。然后安装它。
连接应如下:
ESP32 -- >OLED.
3.3V ---> VCC
GND - > GND
GPIO21 ----> SDA
GPIO22----> SCL
第6步:PCB设计
I have drawn the schematic by usingEasyEDAonline 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. I have ordered my PCB fromjlcpcb.并在7天内收到它。
You can download the Gerber files attached below.
Attachments
第7步:PCB组件
对于焊接,您需要一个不错的烙铁,焊料,钳口和万用表。良好的做法是根据它们的高度焊接组件。首先焊接较小的高度组件。
You can follow the following steps to solder the components :
1.将部件腿通过它们的孔推动,并在背面转动PCB。
2.焊接的尖端iron to the junction of the pad and the leg of the component.
3.Feed 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.
第8步:焊接ACS723
In the entire PCB, the lesser height component is the current sensor ACS723 which is the only SMT component used in this project.
首先,在所有8个垫上涂抹焊剂,然后将少量焊料施加到拐角垫上。使用镊子放置并对齐二极管芯片。在用焊锡尖触摸焊盘时将芯片固定到位,使焊料熔化在一起熔化销和焊盘。
Be sure the dot symbol on the PCB and the ACS723 IC is matching together. The dot symbol represents pin number -1.
Now apply solder to all the pads, and you are done. If you mess up during the soldering, you can remove the extra solder by using a desoldering wick.
你可以阅读this tutorialif you are new to soldering SMD components by using a soldering iron.
第9步:3D印刷机箱
为了提供良好的商业产品外观,我已经使用Autodesk Fusion 360设计了该项目的机箱。所有组件和PCB安装孔的尺寸由Vernier Caliper测量,然后在设计期间考虑相同的尺寸188bet比分。
The enclosure has two parts: 1. Main Body 2. Top Lid The
主体基本上设计用于保持PCB板。顶部盖子是覆盖主体打开并安装OLED显示屏。
I used myCreality CR-10printer and 1.75 mm green 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.
我的设置是:
Print Speed : 60 mm/s
层高:0.2mm(0.3也很好)
Fill Density: 20%
挤出机温度:200℃
床温度:60°C
Download the STL files fromThingiverse
Step 10: Assemble the 3D Printed Enclosure
PCB可以安装在3D打印机箱中的4个支架上。您可以使用4 X M3螺钉直接固定PCB,或者您可以安装螺纹热插入件以获得更多可靠性。在这里,我在每个支架上使用了热插入物。
将PCB安装到主体后,我们可以移动以安装OLED显示屏。通过使用热胶或强胶带,可以将OLED显示器安装在顶部盖子的背面。
将跳线从OLED显示屏连接到PCB OLED端口。PCB上的标题销明显标记。
将温度传感器电缆插入机柜右侧给出的孔中。然后将电线连接到螺钉端子。
现在使用4 x m3螺丝关闭顶部盖子。
为了使机箱更有吸引力,我粘贴了顶部盖子上的令人助长的贴纸。
第11步:软件和库
To use the 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 bySparkfun..
安装库:
Before uploading the code install the following libraries :
1.ESP32
2.Blynk
4.一根电线
5.达拉斯温度
How to Install the Libraries?
您可以阅读本教程Sparkfun.to install the Arduino libraries.
Step 12: Interfacing With Blynk App
Blynk is the most popular Internet of Things platform for connecting any hardware to the cloud, designing apps to control them, and managing your deployed products at scale. With Blynk Library you can connect over 400 hardware models including ESP8266, ESP32, NodeMCU & Arduino to the Blynk Cloud.
Step-1:
Download the Blynk app
1. For安卓
2.对于苹果手机
Step-2:
获取auth令牌才能连接Blynk应用程序和硬件,您需要Auth令牌。
1.在Blynk应用程序中创建一个新帐户。
2.Press the QR icon on the top menu bar. Create a clone of this Project by scanning the QR code shown above. Once it detected successfully, the whole project will be on your phone immediately. I've made the Sol Weather Station app. You are welcome to try it out!
要开始使用它:
1.下载Blynk应用程序:http://j.mp/larblenk_android.或者http://j.mp/larblenk_android.
2.Touch the QR-code icon and point the camera to the code below, enjoy my app!
3.创建项目后,我们将寄给你Auth Token over email.
4.检查您的电子邮件收件箱并找到Auth令牌。
Step-3:
为Wemos Boardto上传arduino IDE为Wemos Board上传,您必须遵循这个赋予指标
第四步:
After installing the above libraries, paste the Arduino code given below.
Enter the auth code from step-1,ssid, and password of your router.
然后上传代码。
// ====================================================================================== // // // //太阳能电池板能量监控V1.0固件// // // // //由Debasish Dutta开发,最后更新:06.05.2021 // // // // ====================================================================================== // #include#include #include #include #include“wire.h“#include #define blynk_print序列#include #define screen_width 128 // OLED显示宽度,以像素#define screen_height 64 // OLED显示高度,在像素#define input_voltage_sense_pin 34#define input_current_sense_pin 35 #define temp_sense_pin 4 #define电压_cale 7.911 // r1 + r2 / r2 //(47k + 6.8k)/ 6.8k #define current_scale 1.5 // r4 + r5 / r5 //(1k + 2k)/ 2k双重mvperamp = 200;//传感器的SensityVit //使用100对于20A模块和66,适用于30A模块Double ACSOFFSET = 514;//理想情况下,它应该是(0.1 x VCC)//测量值为514mV unsigned long last_time = 0;unsigned long clust_time = 0; float power =0 ; // Power in Watt float energy =0 ; // Emergy in Watt-Hour float tempC=0; // temperaure in Celcius //float tempF = 0; temperature in F float saving=0; // cost saving WiFiClient client; // Declaration for an SSD1306 display connected to I2C (SDA, SCL pins) Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1); // GPIO where the DS18B20 is connected to const int oneWireBus = 2; // Setup a oneWire instance to communicate with any OneWire devices OneWire oneWire(TEMP_SENSE_PIN); DallasTemperature sensors(&oneWire); //========================= Variables for wifi server setup ============================= // Your WiFi credentials. // Set password to "" for open networks. char ssid[] = "XXXX"; // WiFi Router ssid char pass[] = "XXXX"; // WiFi Router password // copy it from the mail received from Blynk char auth[] = "XXXX"; //========================= Setup Function ================================================ void setup() { Serial.begin(115200); Blynk.begin(auth, ssid, pass); sensors.begin(); if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { Serial.println(F("SSD1306 allocation failed")); for (;;); } display.clearDisplay(); display.setTextColor(WHITE); display.display(); delay(500); } //========================= Loop Function ================================================ void loop() { // read voltage and current float voltage = abs( return_voltage_value(INPUT_VOLTAGE_SENSE_PIN)) ; float current = abs( return_current_value(INPUT_CURRENT_SENSE_PIN)) ; // read temperature from DS18B20 sensors.requestTemperatures(); // get temperatures tempC = sensors.getTempCByIndex(0); //tempF = sensors.getTempFByIndex(0); // Calculate power and energy power = current * voltage ; // calculate power in Watt last_time = current_time; current_time = millis(); energy = energy + power *(( current_time -last_time) /3600000.0) ; // calculate power in Watt-Hour // 1 Hour = 60mins x 60 Secs x 1000 Milli Secs saving = 6.5 * ( energy /1000 ); // 6.5 is cost per kWh // used just for example // ================= Display Data on Serial 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 Solar Panel Current 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 Solar Panel Power in Watt display.setTextSize(2); display.setCursor(10,25); display.print(power); display.print(" W"); // Display Energy Generated by the Solar 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 Data on Blynk App ================================================ 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); } //========================= Function to Calculate Solar Panel Voltage =================================== double return_voltage_value(int pin_no) { double tmp = 0; double ADCVoltage = 0; double inputVoltage = 0; double avg = 0; for (int i = 0; i < 100; i++) { tmp = tmp + analogRead(pin_no); } avg = tmp / 100; ADCVoltage = ((avg * 3.3) / (4095)) + 0.184 ; // 0.184 is offset adjust by heat and try inputVoltage = ADCVoltage * VOLTAGE_SCALE; return inputVoltage; } //========================= Function to Calculate Solar Panel Current =================================== double return_current_value(int pin_no) { double tmp = 0; double avg = 0; double ADCVoltage = 0; double Amps = 0; for (int z = 0; z < 150; z++) { tmp = tmp + analogRead(pin_no); } avg = tmp / 150; ADCVoltage = ((avg*3331) / 4095); // Gets you mV Amps = ((ADCVoltage * CURRENT_SCALE - ACSoffset ) / mVperAmp); // 1.5 is the scaling for voltage divider return Amps; }
Attachments
步骤13.: 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 charge controller solar input terminal.
2.Connect the Solar panel 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:确保你连接到正确的极性,否则你会看到魔法烟雾。电路没有反极性保护。
在所有连接之后,您将看到OLED显示屏上显示的太阳能电池板参数。您可以通过打开Blynk应用程序来查看智能手机。
未来目标:Implementation of MQTT and Home Assistant
Thanks for reading my Instructable.
If you like my project, don't forget to share it. Comments and feedback are always welcome.
16 Comments
4天前
出色的写作。做得好。对所有细节的级别印象非常深刻,以制定这项工作。
10 days ago
我有一个不同的电流传感IC的建议。有一个称为INA260的一款精湛的IC,可以测量高达15A和36V的电流。通过I2C读取数据,因此您不必读出任何模拟信号,也没有任何校准。所有校准都在制造业中完成。
电流传感通过内部分流来完成,但由于电阻器相当低,因此功率损失并不多。
You can either buy the IC separately or as a module. The shunt is a bit heat sensitive if you hand solder the SMD (I've destroy'd two IC's by overheating them). So the module is an easy way of just plug it into the PCB:
https://www.adafruit.com/product/4226.
Really nice project!!
14 days ago
伟大的设计和工艺!
15天前
Very impressive.
15天前
测量电压时如何管理ESP32 ADC的非线性?
15天前
HarikaOlmuşPaylaşımİinTeşekkürler
15天前
Nice project, but I would make a suggestion. It is not a great idea to have all the current from the panel(s) flow through your box as it becomes a single point of failure and can generate heat if your circuit board traces are not very thick or a connection should become loose or oxidized.
A much better solution is to use a non-invasive current sensor such asSCT-013-030/015 Non-invasive AC Current Sensor Split Core Current Transformer.This way your system only has low currents to deal with. These are easy to read with Arduino analog pins and a small network perhttps://learn.openenergymonitor.org/electricity-onitoring/ct-sensors/interface-with-arduino.
17 days ago
如果您有一个大型太阳系,10kva - 36面板,您将如何连接它?
19 days ago
Nice work.
Reply 18 days ago
谢谢你
19 days ago on步骤13.
well done!
Reply 18 days ago
谢谢你
18天前
I have a doubt, you set the Buck Converter XL7015 to 5v but the ESP 32 resis that 5v? and if is this true wich pin you use too. Thnx for the infromation and the proyect looks amazing
Reply 18 days ago
我施加了5V到ESP32 Dev板的VIN PIN。车载电压调节器将电压降至3.3V以进行操作ESP32芯片。
19 days ago
梦幻般的工作总是如:D
答复19天前
谢谢