ESP8266 Based Solar Power Plant Monitoring System (1MW Power Plant)
4261 4
Techno Automation Ashish Patel

ESP8266 Based Solar Power Plant Monitoring System (1MW Power Plant)

This project is perfect combination of my hobby and my profession. I am electronics hobbyist and...

Description:-

This project is perfect combination of my hobby and my profession. I am electronics hobbyist and professional automation engineer at Adani Port(Dahej). I used to make Arduino and raspberry pi based projects for home automation and for fun & learning new technology. We have installed 1MW on-grid roof top solar power plant at my company. Plant is installed at three different location having 4 km distance each. After installation of plant we have started daily monitoring of Plant to calculate daily generation. We started facing problems mentioned below o Our team struggling to monitor all inverters as those are installed at various location. o During tripping of grid side power breaker whole system stop generating energy and we are not getting any information about it until next reading taken. o We have to travel a lot to take readings. o Team needs to climb on roof for checking weather cleaning is required or not which is unsafe. o We didn’t get information of single or multiple inverter tripping which creates loss of energy. o Monitoring system suggested by OEM is also possible to implement as it’s based on internet only and we are not interested to post our data on cloud server. After facing lots of problem I decided to use My Hobbyist skills to solve this problem  I came up with ESP8266 based data logger system which provides wireless connectivity which suite our plant location.  In this project I have learned about Modbus protocol decoding, electronic designing, Programming, Wi-Fi, Fibre and Ethernet Network designing & dashboard designing etc.  System which I have implemented is not only data logger but its whole solution including data archiving, Data visualising, Historical data monitoring, alarm generating and cloud monitoring.  We have run this system since couple of month and this system solves all problems we faced.  Main benefit of this project is we get live notification in case any inverter is not working.  We decide when and where we have too clean panels for maximum utilization of plant using historical data.

Project Used Hardware

Solar Plant Hardware

Solar Plant Hardware

ESP12F, 485-TTL , 3.3V REGULATOR, AIRLIVE WIFI GATEWAY, D-LINK FO-TCP MEDIA CONVERTER, D-LINK ETHERNET SWITCH, DESKTOP PC

Project Used Software

ARDUINO IDE, OPENHAB, MOSQUITTO, INFLUXDB, GRAFANA, KEPWARE

Project Hardware Software Selection

Solar Plant Hardware

Hardware Selection:- ESP12F:- Used as wifi gateway which reads data from inverter using modbus protocol and converts data in to json string and send data to server using mqtt protocol. 485-TTL Converter:- ESP12f work on TTL logic level but Goodwe make inverter provides data with RS485 standard. to convert data from 485 to TTL i have used this device. Desktop PC with Ubuntu : - I have chosen Openhab as server which runs on Linux. I have used old desktop pc and install Ubuntu on it. This PC runs all necessary software required for data gathering, archiving & for User interface for live as well historical data monitoring. Airlive make WIFI Router:- This routers are act as AP on which all ESP12f module connects. This AP also connected with Ethernet switch for server side connectivity. D-Link make Ethernet-Fiber converter:- This device converts Ethernet to Fiber. I have used fiber network for server connectivity as distance from plant to control room is about 4 km. and fiber cables are already available at all location previously. D-Link Ethernet Switch: - used to connect Openhab server to ESP12f for data gathering and also provide connectivity with WINCC (SCADA) and all other client PC. Software Selection:- Arduino IDE:- Used for to program ESP12f Module. Mosquitto Broker:- This software is MQTT broker & installed on Ubuntu PC. ESP12f and Openhab connect and share data using MQTT broker only. Openhab3.1:- This is main server installed on Ubuntu PC it provides interactive web based user interfaces. it reads data from ESP12 module using MQTT protocol. Parse json string and store each data in to respective items (Tags). Openhab host web server, user can monitor live data as well historical data by opening webpage. Openhab provide connectivity with influxdb for data archiving. Influxdb:- Influx DB installed on Ubuntu PC. it is used as archiving server. Openhab connects with influxdb and store all data in to influxdb. Grafana:- Grafana is installed on Ubuntu PC. Grafana is used to monitor historical data from archive server which is influxdb in my case. Grafana connects with influx db and we can develop dashboards for data monitoring. It also provides live data monitoring as well notification generation. Kepware:- Kepware is used to share data with WinCC Scada. WinCC is already used in our plant for centralised monitoring. WinCC is Industrial application known as SCADA. WinCC is used to control our plant. i have interface Solar monitoring system with WinCC as proof of concept only. Arduino ModbusRTU library: - This library is used to for to read data from modbus clients. ESP12f act as modbus master. Arduino Json Library:- This library used to convert all data in to single json string which is further send to server using mqtt protocol. Arduino Pubsub Library:-This library used to establish connection between ESP12f and MQTT broker. Arduino ESPAsyncWebServer :- This library used to create diagnostic webpage for ESP12F. ESP act as webserver and host diagnostics webpage showing wifi and mqtt connectivity and display local IP. Arduino OTA :- This library used to provide OTA Over to Air feature to ESP12F. I used this ibrary to provide over to air firmware update feature. Arduino ESP8266WiFi :- This library provides Wifi functionality to ESP12F.

Circuit Diagram

Solar plant Circuit diagram

Circuit designed using easyeda. as less componants are used i make final pcb using perf board.

 

Code

#include "ESPAsyncWebServer.h"
#include <WiFiUdp.h>
#include <ModbusRTU.h>
#include <SoftwareSerial.h>
#include <ArduinoJson.h>
#include <ESP8266WiFi.h>
#include <PubSubClient.h>
#include <ESP8266mDNS.h>
#include <WiFiUdp.h>
#include <ArduinoOTA.h>

uint16_t Mread[20];
uint16_t Mread1[1];
int Call_Stp = 1;
int Slave_ID = 1;

ModbusRTU mb;
WiFiClient Goodwe_MT;
PubSubClient client(Goodwe_MT);
#define MQTT_MAX_PACKET_SIZE 512

#include "Settings.h"
#include "IntToFloat.h"
#include "Data_Structure.h"
#include "Webpage.h"
#include "WebserverSetup.h"
#include "MoveData.h"
#include "Modbus_callback.h"
#include "JsonPack.h"
#include "Modbus_Slave_Query.h"
#include "MQTT.h"
#include "WIFISet.h"
#include "OTA.h"

SoftwareSerial S(Rx, Tx);

void setup() {
  Serial.begin(115200);
  Serial.println();
  pinMode(LED, OUTPUT);
  digitalWrite(LED, HIGH);
  S.begin(9600, SWSERIAL_8N1);
  Slave_ID = Start_ID;
  mb.begin(&S, DE_RE);
  mb.master();
  if (MQTT_Enable) {
    setup_wifi();
    asynkweb_setup();
    client.setServer(mqtt_server, 1883);
    client.setCallback(callback);
    String MQTT_Topic_s = MQTT_Topic;
    MQTT_Topic_s = MQTT_Topic_s + "-%ld";
    MQTT_Topic_s.toCharArray(MQTT_Topic, (MQTT_Topic_s.length() + 1));
    Serial.println((MQTT_Topic_s.length() + 1));
  }
  otasetup();
}
void loop() {
  ArduinoOTA.handle();
  if (millis() - LastScan > Interval) {
    MBslaveQuery(Slave_ID);
    ArduinoOTA.handle();
  }
  if (MQTT_Enable) {
    if (!client.connected()) {
      long now = millis();
      if (now - lastReconnectAttempt > MQTT_Re_Connect_Interval) {
        lastReconnectAttempt = now;
        if (reconnect()) {
          lastReconnectAttempt = 0;
        }
      }
    }
    else client.loop();
  }
  mb.task();
  yield();
}