Wifi-Solar-panel-optimizer-

Solar Pannel Optimizer with WIFI slave SSR

The Goal of this WEB site is to explain why and how I create a Solar Panel Optimzer with a WIFI slave SSR
First of all I have decided to install solar panel to compensate the energy needed for the simming tool pump.
 
The pump is a 1.1kW so I install 4 * 250W solar panel on a firewood storage shed roof.

solar panel web site

Due to mains regulation I realized that the excess energy must not be sent to grid. 

It will be the case in winter (no swimming pool), in spring or autum when the swimming pump is connected 

only 3 or 4 hours per day.

May be also in summer when the pump is connected 6 or 7 hours per day.

In winter the excess energy could be used to heat my workshop in the basement.

In the other seasons a second small pump with a waterfall and a swimming pool heater could used 

this excess energy.

Thereafter my home_eletric_wiring

nomimage

Many thanks to my colleague Xavier, Nabil, Regis, Benjamin

Please note that it was my first Hardware and Software project since my Ph.D. forty years ago...

Optimizer description

The issue was the existing electric wiring so I decided to create a Solar Panel Optimizer with a WIFI slave SSR. see my home electric wiring description.

A lot of opimizer exist, commercial one and DIY project. The commercial optimizer are quite expensive and not so efficent. After several weeks reading website and DIY optimizer description I decided to create my own project, and it was quite fun !

The solar Panel Optimizer is based on a processor ESP32-DEVKITC-32U which is compatible with arduino. The existing DIY project are based on arduino.

mk2pvrouter

ptwatt

forum photovoltaique

ESP32 module embed a dual core with a dual-core32-bit and a wifi link. One core will be used for power calculation, the second core for wi-fi link. The power calculation is mainly based on ptiwatt router.

Hardware description

A power supply to provide +8V and regulated +5V

nomimage

An optocoupler H11A1 to detect zero cross interruption,

nomimage

a small shift is compensated by software (dimthreshold). the falling edge is hidden by software (first_it_zero_cross)

nomimage

Voltage and current measurement using ADC with a shift of 3.3V/2

nomimage

A command for the SSR

nomimage

The full Schematic is available on GITHUB

nomimage

the first version of PCB was tested and needs some modifications, the updated version was not tested.

the two version of GERBER for manufactoring are available on GITHUB

PCB supplier: jlcpcb

BOM supplier: mainly aliexpress, and friends…

Software description

see comments on source code :-)    

github

One software for the Server and one software for the client

ESP32 processor needs a specific environmment on Arduino software see link to install ESP32 environmment

esp32 install

I use a board ESP32 Dev Module: ESP32 devkit

Some other libraries are needed. I don’t remember exactly which are mandatory and which have been installed for testing

nomimage

nomimage

nomimage

The softawre needs some calibration depending on components used.

measure U and I ADC 0Volt using software "testminmax_esp32" and modify values
Connect the ESP board WITHOUT the mains to a PC with an USB cable.
ADC value are available with a terminal (like hyperterminal 115200 bauds)
//

float ADC_V_0V = 467 ;
float ADC_I_0A = 467 ;
measure shift IT zero cross using software "dim final"  and modify value 
Connect an incandescent lamp to the SCR, at startup with DIM=0 lamp shines. DIM will slowly increase, suddenly the lamp turn off. Note the DIM value on the LCD.
By default dimthreshold=30
byte dimthreshold=30 ;	// dimthreshold; value to added at dim to compensate phase shift
Download final software (PowerRouter_v2.0 or client_v2.0)
measure mains voltage and modify value Vcalibration. Voltage and Current can be displayed on the OLED using the switch SW2

==> Vcalibration ```c++ float Vcalibration     = 0.90;   // to obtain the mains exact value  ```

measure mains current using and known power charge and modify value

==> Icalibration ```c++ float Icalibration     = 93;     // current in milliampères ```    The boars is ready to be used.

Wi-fi

an UDP link is used to reduce data transfert, only power value is transmitted with an Acknowledge by the client.

The power value is transmitted each 50msec (byte send_UDP_max); 

A Time To live is used to check the WiFi activity and restart Wifi link if needed.

a small M5STACK module can be used as a remote display.

Wifi parameter to be modified
const char *ssid = "BB9ESERVER";   // for example to be changed 
const char *password = "BB9ESERVER";  // for examplet  to be changed