Solar power monitoring through the Internet of Things

1
1003

Solar power monitoring through the Internet of Things is a cost-effective methodology based on IoT to remotely monitoring a solar plant for performance evaluation. With the passage of time, the output of the solar panels decreases due to the dust, humidity, etc. on the solar panels. So, it needs to be monitored 24/7 to get the optimum output by using real-time monitoring and cleaning of the panels using different sensors which will send data to a cloud base website and can be cleaned using the Blynk app.

Working and Explanation

IoT Based Approach for Monitoring Solar Power will facilitate preventive maintenance, fault detection of the plant in addition to real-time monitoring. Solar power plants need to be monitored for optimum power output. Our system constantly monitors the solar panel and transmits the power output to the IoT system over the internet.

Components used

  • Solar Panel
  • 9V Battery
  • Node MCU ESP8266
  • Voltage and Current Sensor:
  • Digital Humidity & Temperature Sensor
  • Arduino
  • Buck Converter
  • Relays
Solar power monitoring through the Internet of Things
IoT based solar power monitoring
Block Diagram

you may like to read “what skill electrical engineer have in 2021”

Solar photovoltaic remote monitoring system using IoT has two parts

  • Monitoring section
  • Tracking section

Monitoring Section

In the monitoring section, the NODE MCU (ESP8266) will connect automatically to the Wi-Fi OR Mobile’s Hotspot whose usernames and Passwords are “PTC” and “11223344” respectively. The NODE MCU is configured by a software called “Putty” which will give us the webpage address of the monitoring page. The page will refresh every 5 seconds. The input is provided from a 9V battery. By using Humidity, Temperature, Current, Voltage, and Luminosity sensors the data of those sensors will be collected and sent to an IoT-based website through Node MCU (ESP8266) Wi-Fi module which also has a built-in microcontroller. The website will gather the data and show the real-time outputs of these sensors every 5 seconds which will enable us to monitor and take necessary actions according to the situation.

Tracking Section

In the tracking system, two LDR are connected on both ends of the panel. If the resistance of one LDR is high, then it gives high to the Arduino and Arduino will rotate the panel through a wiper motor connected with the panel.  In this way, solar panels have maximum contact with the sun and produce maximum power. Angle sensor which is placed at the solar panel gives us the angle continuously, and when the solar panel rotates angle sensor gives the accurate angle. In this way, the sun angle with respect to the solar panel can be determined continuously.

Results:

The images below are the results of Internet of Things based Solar power monitoring system

Solar power monitoring through the Internet of Things
IoT based solar power monitoring
Monitoring section
Solar power monitoring through the Internet of Things
IoT based solar power monitoring
Tracking section

You may like to read IOT Based Fault detection in transmission line.

Coding (Design and implementation of an intelligent low-cost IoT based Solar power monitoring system)

Monitoring Section

#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <ESP8266mDNS.h>
//libs and variables realted to sensor data acquisition and calculations
#include <Wire.h>
#include <TSL2561.h>
#include <Adafruit_INA219.h>
Adafruit_INA219 ina219; //default INA219 address is 0x40 with no jumpers
TSL2561 tsl(TSL2561_ADDR_FLOAT); //TSL2561 default floating address is 0x39
uint32_t lux;
loat busvoltage = 0;
float current_mA = 0;
float power_mW = 0;
float steinhart; // it is temperature value, steinhart equation of modelling of NTC thermistor
#define THERMISTORPIN A0
#define NUMSAMPLES 10
#define SERIESRESISTOR 10000
#define THERMISTORNOMINAL 10000
#define TEMPERATURENOMINAL 25
int samples[NUMSAMPLES];
#define BCOEFFICIENT 3950
//End of libs and variables for sensors
const char *ssid = "PTC";
const char *password = "11223344";
//following unecessary variables
float voltage=0.0;
float current=0.0;
float temperature=0.0;
float power=0.0;
float irradiation=0.0;
ESP8266WebServer server(80);
const int led = 13;
void randomParaGen(){
  temperature = random(0,100);
  voltage = random(0,32000);
  current = random(-3000,+3000);
  power = voltage*current;
  irradiation = random(0,1000);
  }
void handleNotFound() {
  server.send(200, "text/plain", "Page Under Development For Graphs code 2");
  }
void handleRoot(){
  char temp[1700];
  //randomParaGen();
  measureNewReadings();
  int sec = millis() / 1000;
  int min = sec / 60;
  int hr = min / 60;
  snprintf(temp, 1700,
  "<!DOCTYPE HTML>\
  <html>\
 <HEAD>\
    <TITLE>Solar Data WebPage</TITLE>\
    <meta http-equiv='refresh' content='5'/>\
  <HEAD>\
<body style=\"background-color:rgb(240,240,240);\">\
  <CENTER>\
    <H1>Solar Data Station</H1>\
    <p>Uptime: %02d:%02d:%02d</p>\
  </CENTER>\
</br>\
<h4>The following are the real-time parameters of Solar Panel</h4>\
<p>->Temperature: <b style=\"color:DodgerBlue;\">%10.2f</b> Celcius</p>\
<p>->Current: <b style=\"color:Violet;\">%10.2f</b> mA</p>\
<p>->Voltage: <b style=\"color:Tomato;\">%10.2f</b> V</p>\
<p>->Power: <b style=\"color:Red;\">%10.2f</b> mW</p>\
<p>->Sun Irradiation <b style=\"color:MediumSeaGreen;\">%lu</b> Lux</P>\
</br>\
<p>Table view of parameters</p>\
<table style=\"width:50%\">\
<style>\
table, th, td {\
    border: 1px solid black;\
    border-collapse: collapse;\
}\
th, td {\
    padding: 5px;\
}\
th {\
    text-align: left;\
}\
</style>\
  <tr>\
    <th>Physical Parameter</th>\
    <th>Value</th> \
    <th>Unit</th>\
  </tr>\
  <tr>\
    <td>Temperature</td>\
    <td>%10.2f</td> \
    <td>Celcius</td>\
  </tr>\
  <tr>\
    <td>Current</td>\
    <td>%10.2f</td> \
    <td>mA</td>\
  </tr>\
  <tr>\
    <td>Voltage</td>\
    <td>%10.2f</td> \
    <td>V</td>\
  </tr>\
  <tr>\
tion</td>\
    <td>%lu</td> \
    <td>lux</td>\
  </tr>\
</table>\
Click <a href=\"192.168.1.6/graphs\"> <button>Here !</button></a> to show graphs\
</body>\
</html>",
    hr, min % 60, sec % 60,steinhart,current_mA, busvoltage,power_mW,lux,steinhart,current_mA, busvoltage,power_mW,lux
    );
    
  server.send(200,"text/html",temp);
  }
void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200); //Starting communication with pc serially
  
  configSensors(); //Initializing the sensors
  WiFi.mode(WIFI_STA); // defining the wifi mode which is station, mean it will connect to router
  WiFi.begin(ssid,password); //giving it credential of router to connect
  Serial.println(" ");
  while (WiFi.status()!=WL_CONNECTED){
    delay(500); // half second delay
    Serial.print("."); // printing dot while it connects to wifi access point
    }
  Serial.println(" ");
  Serial.print("Connected to ");   Serial.println(ssid);
  Serial.print("IP Address at ");   Serial.println(WiFi.localIP());
  if (MDNS.begin("esp8266")) {
    Serial.println("MDNS responder started");
  }
  server.on("/",handleRoot);
  server.on("/graphs", []() {
    server.send(200, "text/plain", "Page Under Development For Graphs code 1");
  });
  server.onNotFound(handleNotFound);
  server.begin();
  Serial.println("HTTP server Started");
  Serial.println("Temperature, Voltage, Current, Power, Irradiation");
  delay(2500);
}
void loop() {
  // put your main code here, to run repeatedly:
  server.handleClient();
  measureNewReadings();
  Serial.print(steinhart);
  Serial.print(" C, ");
  Serial.print(busvoltage);
  Serial.print(" V, ");
  Serial.print(current_mA);
  Serial.print(" mA, ");
  Serial.print(power_mW);
  Serial.print(" mW, ");
  Serial.print(lux);
  Serial.println(" lux");
  delay(1000);
}
void configSensors(){
    Serial.println("Starting the Setup sensor communication");
    configINA219();
    configTsl2561();
  }
void configINA219(){
  ina219.begin();
  
  Serial.print("Luminosity Sensor TSL2561 ready for readings");
  }
  
void configTsl2561(){
  if(tsl.begin()){
    Serial.println("Luminosity sensor found");
  }
  else{
    Serial.println("luminosity Sensor not found. Check wire connections and reset Controller");
    while(1);
  }
  tsl.setGain(TSL2561_GAIN_16X);      // set 16x gain (for dim situations)
  tsl.setTiming(TSL2561_INTEGRATIONTIME_13MS);  // shortest integration time (bright light)
  Serial.print("Luminosity Sensor TSL2561 ready for readings");
  }
void configTempSensor(){
  }
void measureNewReadings(){
  uint32_t lum = tsl.getFullLuminosity();
  uint16_t ir, full;
  ir = lum >> 16;
  full = lum & 0xFFFF;
  lux=tsl.calculateLux(full, ir);
  busvoltage = ina219.getBusVoltage_V();
  current_mA = ina219.getCurrent_mA();
  power_mW = ina219.getPower_mW();
  tempMeasurement();  
 }
void tempMeasurement(){
  uint8_t i;
  float average; 
  // take N samples in a row, with a slight delay
  for (i=0; i< NUMSAMPLES; i++) {
   samples[i] = analogRead(THERMISTORPIN);
   delay(10);
  } 
  // average all the samples out
  average = 0;
  for (i=0; i< NUMSAMPLES; i++) {
     average += samples[i];
  }
  average /= NUMSAMPLES;
    average = 1023 / average - 1;
  average = SERIESRESISTOR / average;
  steinhart = average / THERMISTORNOMINAL;     // (R/Ro)
  steinhart = log(steinhart);                  // ln(R/Ro)
  steinhart /= BCOEFFICIENT;                   // 1/B * ln(R/Ro)
  steinhart += 1.0 / (TEMPERATURENOMINAL + 273.15); // + (1/To)
  steinhart = 1.0 / steinhart;                 // Invert
  steinhart -= 273.15; 
  }

Tracking Section


#include<LiquidCrystal.h>  //include LCD library
#include<Wire.h>
LiquidCrystal lcd(A2,10,6,7,8,9); //define pins where LCD is connected
const int MPU_addr = 0x68;
int16_t AcX, AcY, AcZ, Tmp, GyX, GyY, GyZ;
int minVal = 265;
int maxVal = 402;
double x;
double y;
double z;
int LDR_Pin1 = A0; // what pin on the arduino is the LDR output connected to
 int LDR_Pin2 = A1;
 int LDR1;
 int LDR2; 
 unsigned int relay1 =2;
 unsigned int relay2 =3;
 unsigned int relay3 =4;
 unsigned int relay4 =5;
 void setup(){
  Serial.begin(9600);
  Wire.begin();
  Wire.beginTransmission(MPU_addr);
  Wire.write(0x6B);
  Wire.write(0);
  Wire.endTransmission(true);
    pinMode(relay1, OUTPUT);
    pinMode(relay2, OUTPUT);
    pinMode(relay3, OUTPUT);
    pinMode(relay4, OUTPUT);
    digitalWrite(relay1, HIGH);
    digitalWrite(relay2, HIGH);
    digitalWrite(relay3, HIGH);
    digitalWrite(relay4, HIGH);
  
  lcd.begin(16, 4);
  lcd.setCursor(0, 0);        //set rows and colums of 16*2 LCD
  lcd.print("       SOLAR ");   //print this text on LCD
  lcd.setCursor(0, 1);
  lcd.print("   TRACKING   ");
  delay(2000);
     lcd.clear();
  }
  
  void loop()
  {
   sun_tracking();
   angle();
  }
 void sun_tracking()
 {
    
 LDR1=(analogRead(LDR_Pin1));
 LDR2=(analogRead(LDR_Pin2));
  Serial.println(LDR1);
   Serial.println(LDR2);
   delay(1000);
      
  if(LDR1>650)
  {
    digitalWrite(relay2, HIGH);
    digitalWrite(relay3, HIGH);
    digitalWrite(relay1, LOW);
    digitalWrite(relay4, LOW);
    delay(70);
    digitalWrite(relay1, HIGH);
    digitalWrite(relay4, HIGH);
  }
    if(LDR1<649)
  {
    digitalWrite(relay2, HIGH);
    digitalWrite(relay3, HIGH);
    digitalWrite(relay1, HIGH);
    digitalWrite(relay4, HIGH);
  }
    if(LDR2>900)
  {
    digitalWrite(relay1, HIGH);
    digitalWrite(relay4, HIGH);
    digitalWrite(relay2, LOW);
    digitalWrite(relay3, LOW);
    delay(70);
    digitalWrite(relay2, HIGH);
    digitalWrite(relay3, HIGH);
  }
      if(LDR2<899)
  {
    digitalWrite(relay2, HIGH);
    digitalWrite(relay3, HIGH);
    digitalWrite(relay1, HIGH);
    digitalWrite(relay4, HIGH);
  }
  
  }
void angle()
{
       Wire.beginTransmission(MPU_addr);
  Wire.write(0x3B);
  Wire.endTransmission(false);
  Wire.requestFrom(MPU_addr, 14, true);
  AcX = Wire.read() << 8 | Wire.read();
  AcY = Wire.read() << 8 | Wire.read();
  AcZ = Wire.read() << 8 | Wire.read();
  int xAng = map(AcX, minVal, maxVal, -90, 90);
  int yAng = map(AcY, minVal, maxVal, 90, -90);
  int zAng = map(AcZ, minVal, maxVal, -90, 90);
  x = RAD_TO_DEG * (atan2(-yAng, -zAng) + PI);
  y = RAD_TO_DEG * (atan2(-xAng, -zAng) + PI);
  z = RAD_TO_DEG * (atan2(-yAng, -xAng) + PI);
  //     Serial.print("AngleX= ");
  //     Serial.println(x);
  Serial.print("AngleY= ");
  Serial.println(y);
  lcd.setCursor(0, 0);        //set rows and colums of 16*2 LCD
  lcd.print("Angle= ");
  lcd.print(y);
//  Serial.print("AngleZ= ");
//  Serial.println(z);
  Serial.println("-----------------------------------------");
  delay(400); 
     
}

1 COMMENT

LEAVE A REPLY

Please enter your comment!
Please enter your name here