MONITOR di ENERGIA per PANNELLI FOTOVOLTAICI ENERGY MONITOR for PV PANELS
Il sistema permette il monitoraggio in tempo reale del bilancio energetico di una casa dotata di pannelli fotovoltaici e produce uno storico.
I dati raccolti in ogni istante sono visualizzabili sia attraverso uno schermo OLED collegato alla scheda Arduino che collegandosi alla pagina web del monitoraggio. Da quest'ultima e' possibile poi accedere ai dati dello storico che vengono organizzati in appositi grafici.
Informazioni sulla scheda Arduino e la sua programmazione tramite il relativo ambiente di sviluppo integrato (IDE) sono ampiamente disponibili su Internet e non rientrano nello scopo di questa pagina.

Per la realizzazione del progetto sono necessari:

-1 scheda Arduino UNO
-1 chip con Wi-Fi integrato ESP8266
-1 Schermo OLED I2C SSD1306 128x64
-1 Touch Sensor TTP223B
-4 Resistenze da 1kOhm(R8, R9, R10, R11*)
-1 Resistenza da 100kOhm(R7**)
-3 Resistenze da 4.7kOhm(R1, R2, R6**)
-3 Resistenze da 10kOhm(R3, R4, R5)
-1 Condensatore da 10uF (indifferentemente ceramico o elettrolitico)
-1 LED
-3 sensori di corrente SCT-013-XXX (dove XXX si riferisce alla corrente massima attesa su ciascun specifico ramo)
-1 Trasformatore AC-AC per il riferimento della tensione di rete

*Il valore di R11 deve essere scelto in modo da non bruciare il LED cui la resistenza e' messa in serie, ma puo' variare a seconda dell'intensita' luminosa che si desidera
**R6 ed R7 sono poste a formare un partitore di tensione che adatti la tensione in uscita dal trasformatore AC-AC agli intervalli misurabili dall'Arduino e sono percio' da scegliere in funzione di questa (come tra poco spiegheremo)

I collegamenti tra i componenti possono essere effettuati come in figura:






The system allows the real time monitoring of the energy balance in a house equipped with photovoltaic panels and creates a datalog archive .
Data are gathered real time and can be visualized both on an OLED display connected to the Arduino board and on a monitoring web page. The web page is also providing the user with graphs on the historical recordings.
Information about the Arduino board and the programming through the Integrated Development Environment (IDE) is largely available on the Internet and it's not part of the scope of this page.

Proposed system requires following HW:

-1 Arduino UNO board
-1 ESP8266 board with WIFI communication
-1 OLED I2C screen SSD1306 128x64
-1 Touch Sensor TTP223B
-4 1kOhm resistors (R8, R9, R10, R11*)
-1 100kOhm resistor (R7**)
-3 4.7kOhm resistors (R1, R2, R6**)
-3 10kOhm resistors (R3, R4, R5)
-1 10uF capacitor (either ceramic or electrolytic)
-1 LED
-3 CT sensors SCT-013-XXX (where XXX should refer to the maximum nominal current on each specific branch)
-1 AC-AC transformer to get the reference of the grid voltage

*The R11 rating should prevent any damage to the LED connected in series with it but can vary based on the desired LED light intensity.
**R6 and R7 ratings should be chosen in order to ensure that the voltage divider is bringing the AC-AC transformer output within a suitable range for the Arduino analog input (more explanation below).

Connections among components are as per following schematic:






Appunti sul circuitoNotes on the circuit


Il CT sensor SCT-013-XXX e' un sensore che restituisce una tensione istantanea direttamente proporzionale al valore istantaneo della corrente e, a corrente nominale (XXX), i picchi di tensione alla sua uscita sono di 1V e -1V. Potendo la scheda Arduino misurare tensioni comprese tra 0V e 5V rispetto al proprio GROUND, e' necessario collegare uno dei due pin di uscita del sensore ad una tensione fissa di 2.5V (rispetto al GROUND della scheda Arduino) in modo che la tensione tra il secondo pin del sensore e il GROUND abbia valori compresi tra 2.5V + 1V = 3.5V e 2.5V - 1V = 1.5V. Allo scopo di fornire questo MIDPOINT di tensione (2.5V) viene costruito il partitore di tensione formato dalle resistenze R1 ed R2, di uguale valore, poste a cavallo dei 5V e del GROUND di Arduino.
In maniera analoga, il trasformatore AC-AC fornisce un segnale proporzionale alla tensione di rete che, come quella in uscita dal sensore, oscilla tra valori positivi e negativi. Allo stesso modo quindi uno dei due pin dell'uscita del trasformatore AC-AC viene collegato al MIDPOINT.
La lettura del trasformatore comporta pero' un'ulteriore difficolta'. E' infatti' improbabile avere un trasformatore AC-AC avente un'uscita con picchi massimi di non piu' di 2,5V e minimi di non meno di -2,5V (valori che, traslati per il collegamento con il MIDPOINT, permetterebbero di rimanere nell'intervallo degli 0V-5V misurabile da Arduino). Si deve allora costruire un ulteriore partitore di tensione che permetta di ottenere una tensione picco-picco (NON RMS) entro quei valori appena esposti. Questo partitore e' quello formato dalle resistenze R6 ed R7, i cui valori sono quindi da scegliere in funzione del trasformatore che si ha a disposizione (i valori di R6 ed R7 indicati nella Bill Of Materials sono per un trasformatore con OUTPUT 25V RMS).




The SCT-013-XXX sensor provides a voltage signal proportional to the flowing current. At nominal current (XXX) voltage peaks are 1V and -1V. Since Arduino can measure voltages ranging from 0V to 5V, one of the sensors pins should be connected to a MIDPOINT with a reference voltage of 2.5V with respect to GROUND. In this way the second pin of the sensor will provide values ranging from 2.5V + 1V = 3.5V and 2.5V - 1V = 1.5V. The reference MIDPOINT (2.5V) is generated by R1 and R2 resistors connected across the 5V and the GROUND pins of Arduino.
In a similar way, the AC-AC transformer is providing a voltage signal proportional to the one on the power grid which is oscillating among negative and positive values, like in the current sensor case. Therefore, here as well, one of the AC-AC transformer pins should be connected to the MIDPOINT.
However the reading of the transformer signal implies one additional challenge. As matter of fact, the available AC-AC transformer is unlikely to provide a voltage signal not going beyond the maximum peak of 2.5V and the minimum one of -2.5V (values that once translated by the connection with the MIDPOINT would finally stay within the 0V-5V range compatible with Arduino). An additional voltage divider is therefore needed to get a peak to peak voltage signal (NOT RMS) staying within values mentioned above. This divider is formed by R6 and R7 resistors, whose ratings should be chosen in accordance with the available transformer. R6 and R7 ratings in the Bill of Materials above refer to a 25V RMS transformer.

Il sistemaThe system


La misura della tensione di rete, unitamente a quelle della corrente, della potenza (attiva ed apparente) e del cosφ nei vari rami, viene effettuata dalla scheda Arduino tramite il codice riportato qui di seguito ed attraverso la libreria "EmonLib.h". Maggiori informazioni sono reperibili sul sito OpenEnergyMonitor.



The measurement of the grid voltage together with current, power (active and apparent) and cosφ in the various branches, is done by Arduino with the code shown below based on the "EmonLib.h" library. More information can be found in the OpenEnergyMonitor website.


Energy_Monitor_Arduino_Sensor2serial_display.ino:


La condivisione dei dati via Internet avviene grazie al modulo con Wi-Fi integrato ESP8266, che funge da tramite tra il web client e la scheda Arduino.
Sharing of data on the Internet is done thanks to the ESP8266 WIFI module that connects the web client to Arduino.


Energy_Monitor_ESP8266_serial2webserver.ino:


Lo storico viene prodotto attraverso la periodica chiamata alla pagina powerenergylog.aspx da parte di un web monitoring tool come UptimeRobot o di un qualsiasi altro client attivato ad intervalli regolari. Questa pagina chiede i dati alla scheda Arduino e li salva in un file di testo sul web server. I dati inviati con questa chiamata sono, per ciascun sensore, il tempo trascorso dall'ultima chiamata avvenuta da parte del log e l'energia trasportata in questo lasso di tempo dal cavo che il sensore monitora. Arduino calcola l'energia facendo l'integrale della potenza nel tempo.
The history datalog is generated through a regular call to the powerenergylog.aspx web page done by a web monitoring tool like UptimeRobot or by any web client activated on a periodic basis. The page is requesting data to the Arduino board and saving them in a text file on the web server. For each of the current sensors, requested data are the time duration and the energy passed through the monitored cable since the last call. Arduino is calculating the energy by integrating the measured power over time.


powerenergylog.aspx:




I dati possono essere fruiti attraverso 3 pagine web: myenergymonitor.html, monitorpowergraphs.aspx e monitorenergygraphs.aspx.
Dalla prima e' possibile monitorare in tempo reale il valore di tensione di rete e potenza attiva, corrente e cosφ per ciascun sensore (Esempio).
Dalla seconda si puo' accedere ai dati di giorni passati e vedere i grafici dell'andamento della potenza e dell'energia nell'arco di una giornata (Esempio).
Dalla terza si e' in grado, sempre accedendo allo storico, di valutare l'andamento della produzione e dei consumi giornalieri in un periodo piu' o meno ampio di tempo (Esempio).



Qui sono riportati i loro codici.


Data can be visualized with 3 web pages: myenergymonitor.html, monitorpowergraphs.aspx and monitorenergygraphs.aspx.
The first one is monitoring real time values of grid voltage and active power, current and cosφ for each sensor (Example).
The second one gives you access to data on previous days and visualizes graphs on power and energy over the day (Example).
The third one reads the datalog and shows graphs about daily generated and consumed energy over a given time span (Example).



Here below are their respective codes:


myenergymonitor.html:


monitorpowergraphs.aspx:


monitorenergygraphs.aspx:


Nella stessa cartella di queste pagine deve essere inserito anche il file style.css, necessario per la loro corretta visualizzazione. The same folder should host the style.css file as well to ensure a proper visualization.

style.css:


In aggiunta, toccando il Touch Sensor, verranno mostrati sullo schermo OLED collegato all'Arduino i valori istantanei di potenza attiva per ciascun sensore (Esempio).

Tutti i file necessari per realizzare il progetto possono essere scaricati a questo link.


When touching the touch sensor, instantaneous values of active power from each sensor are shown on the OLED display connected to Arduino (Example).

All files needed to build this project can be downloaded at this link.



"Arduino", "ESP8266", "TTP223B", "UptimeRobot" ed altri marchi citati in queste pagine sono proprieta' dei rispettivi titolari.
Le immagini dei collegamenti e dello schema circuitale sono state create con "Fritzing".
"Arduino", "ESP8266", "TTP223B", "UptimeRobot" and other brands mentioned in these pages are trademarks of their respective owners.
Images of connections and schematics were created using "Fritzing".