SolarBridge: a Wemos Base bridge between GroWatt and Toon

Forum about Toon hardware, both versions 1 and 2 of Toon

Moderators: marcelr, TheHogNL, Toonz

oepi-loepi
Advanced Member
Advanced Member
Posts: 628
Joined: Sat Feb 09, 2019 7:18 pm

SolarBridge: a Wemos Base bridge between GroWatt and Toon

Post by oepi-loepi »

SolarBridge: a Wemos Base bridge between GroWatt and Toon

No hardware needed anymore.

viewtopic.php?f=99&t=13043


NEW VERSIONS!
Version 2.1, corrected for daily totals
Version 2.2, problem wih some logins solved
Version 2.2.1, minor issue improved. Time shortened when power is 0. (was 60 minutes, now 6 minutes. Will make system more stable when solar is fluctuating at low solar panels.

A very cheap to built software bridge which can be installed on a Wemos mini (Aliexpress ab. 2 euros) and a PC817 optocoupler (Aliexpress ab. 10 cents). In this case it is not needed to install a power meter into the fuse box. Also it is possible to easily connect the GroWatt converter to the Toon, even if the inverter is located far arway from the meter adapter.

It will check solarpower from the GroWatt API every 1 minute. It will convert the Solarpower to S0 pulses (divided over the minute) and it will serve a webpage.

1. Built it
2. Upload the software
3. Use the AutoConnectAP to install the wifi and the GroWatt credentals (same as used for the webpage or app)
4. Find the DHCP web adres or the static web adres and goto the web page
5. Connect the Wemos to the meteradapter

Image

Image

Image

Image

Image

Image

Image

Image



* SolarBridge by Oepi-Loepi
* All rights reserved
* Do not use for commercial purposes
*
* Solar Bridge for GroWatt solar converters
* This bridge will get the data from the GroWatt web interface (API) and create S0 pulses and led flashes
* Each pulse/flash will suggest 1 Watt
*
* On GPIO 4 a resistor (330 ohm and red LED are connected in series
* PIN D2 ---- Resistor 33Ohm) ---- (Long LED lead ---- LED ---- Short LED Lead) ----- GND
*
* On GPIO 5 a PC817 optocoupler is connected
* PIN D1 ---- PC817 (anode, pin 1, spot)
* GND ------- PC817 (cathode, pin 2)
*
* Pin 3 and 4 of the PC817 will be a potential free contact
*
* After uploading the sketch to the Wemos D1 mini, connect to the AutoConnectAP wifi.
* Goto 192.168.4.1 in a webbrowser and fill in all data including GroWatt credentials.
Attachments
SolarBridge_v2.2.1.rar
SolarBridge version 2.2.1
(6.78 KiB) Downloaded 478 times
Last edited by oepi-loepi on Thu Feb 04, 2021 12:07 am, edited 9 times in total.
TheHogNL
Forum Moderator
Forum Moderator
Posts: 2125
Joined: Sun Aug 20, 2017 8:53 pm

Re: SolarBridge: a Wemos Base bridge between GroWatt and Toon

Post by TheHogNL »

Hi,
Nice job!
One thing to notice is that a 1 minute interval will cause some weird negative values on the Toon during cloudy days where the Watt's changes often within the minute.
As the P1 provides each 10 seconds (or faster on newer models) data this will not match the 1 minute interval of the inverter. No problem if the watt is the same all the time (like now with no clouds) but on cloudy days it will not always be the same.

But nevertheless I like it. Maybe some others can adapt it to other portals. Some inverters even provide modbus or http data themselves so this can be used also.
Member of the Toon Software Collective
oepi-loepi
Advanced Member
Advanced Member
Posts: 628
Joined: Sat Feb 09, 2019 7:18 pm

Re: SolarBridge: a Wemos Base bridge between GroWatt and Toon

Post by oepi-loepi »

No it gets the data from the API each minute but it will calculate the time in between pulses and pulse with that interval until new data is found. It should work, also on cloudy days. But we will know after some time. Maybe i will make a version 2 then......

if (CurrentValue > 1) {
timebetweenpulses = 3600000/CurrentValue;
}
else{
timebetweenpulses = 0;
}

It should also work with all API based on session id's or token's like SMA and Omnik. I do not have login ceredentials nor do i use this platforms so i am unable to program or test...
marcelr
Global Moderator
Global Moderator
Posts: 1153
Joined: Thu May 10, 2012 10:58 pm
Location: Ehv

Re: SolarBridge: a Wemos Base bridge between GroWatt and Toon

Post by marcelr »

oepi-loepi wrote:...
* This bridge will get the data from the GroWatt web interface (API) and create S0 pulses and led flashes
* Each pulse/flash will suggest 1 Watt
...
I guess you mean 1 pulse/Wh, leading to 1000 pulses/kWh, correct?

Is it possible to increase this number? Right now I'm testing some solar stuff for toon, with 10000 pulses/kWh. At low power (< 100 W) this already gives pulse rates far below 1Hz. With your setup, it's even slower, possibly leading to inaccuracies (at 10k pulses/kWh the signal quality is already so-so).
Just a suggestion, otherwise: Nice job!
oepi-loepi
Advanced Member
Advanced Member
Posts: 628
Joined: Sat Feb 09, 2019 7:18 pm

Re: SolarBridge: a Wemos Base bridge between GroWatt and Toon

Post by oepi-loepi »

yes, it can be modified in the software before upload. If you replace the 3600000 into 36000000 and it will become 10000 pulses per kw or 10 pulses per watt.
TheHogNL
Forum Moderator
Forum Moderator
Posts: 2125
Joined: Sun Aug 20, 2017 8:53 pm

Re: SolarBridge: a Wemos Base bridge between GroWatt and Toon

Post by TheHogNL »

oepi-loepi wrote:No it gets the data from the API each minute but it will calculate the time in between pulses and pulse with that interval until new data is found. It should work, also on cloudy days. But we will know after some time. Maybe i will make a version 2 then......
I understand but it is impossible to calcultate the upfront generated Watts in realtime.
For example:
1) Sun is not behind cloud. Your production is 3000 Watt. Assume your house takes about 500 Watt and rest is feeded into the net (2500 Watt).
The API will show 3000 Watt and your solution provides 3000 Watt to the Toon in the correct amount of pulses. Also, the Toon receives from P1 a net-delivered value of 2500 Watt. The Toon now calculates 500Watt for the house to be used properly.
2) Suddenly a cloud appears before the sun. Your production drops to 750 Watt. Your house is still taking 500 Watt, so the feed in to the is 250 Watt.
Before the next minute the API is still showing 3000 Watt (your solution still only know about the last 3000 Watt and can't know the real Watt value before the next minute). The Toon receives from P1 a net-delivered value of 250 Watt. Now the Toon incorrectly assumes your a using (3000-250) 2750 Watt in the house (while it is 500 Watt) and will display that as the 'stroom verbruik'.
3) Now the minute is passed, sun is still behind the cloud. All values are good again (as the API will now show a production of 750 Watt). So the Toon 'stroom verbruik' display drops back again to the 500 Watt the house is realy using.
4) Then the sun comes back from the cloud. Again producing 3000 Watt. But the API still shows 750 Watt and the P1 production value is now (3000-500) = 2500 Watt. Now the Toon shows a value of (750-2500) MINUS 1750 power usage in your house.

So to have a correct zonoptoon values displayed on the Toon the solarpanel Watts produced should be updated at about the same frequency as the P1 smart meter.
Member of the Toon Software Collective
oepi-loepi
Advanced Member
Advanced Member
Posts: 628
Joined: Sat Feb 09, 2019 7:18 pm

Re: SolarBridge: a Wemos Base bridge between GroWatt and Toon

Post by oepi-loepi »

Yes, you are correct. Is has a delay of ab. 1 minute. For most users it will be accurate enough on the average. The totals are correct and the graphs show ok. The realtime graphs have a delay (sample time is 1 minute so the integrator works but with a sample time of 1 minute). It can easily be changed when in the program 60000 is changed to 10000. Then the data is extracted every 10 seconds. Same as from the P1 port. No problem, they are very small data packages.
marcelr
Global Moderator
Global Moderator
Posts: 1153
Joined: Thu May 10, 2012 10:58 pm
Location: Ehv

Re: SolarBridge: a Wemos Base bridge between GroWatt and Toon

Post by marcelr »

Hmmm ... zon op toon data are sampled at 10s intervals. These data are then filtered through a moving average filter over 5 minutes (30 sample points). This gives the data as stored in toon (and as displayed) a delay of 150 seconds. At low power, time intervals between pulses can go up to tens of seconds. A 1000 pulses/kWh setting means 3600J of energy for each pulse. With 1000W solar power this gives pulse frequencies of approximately 1/3 Hz, one every three seconds. That's not a lot. I still have to find out how these pulses are then averaged to give the power number as displayed in the tile "Zon nu",refresh rate once every 10 seconds, but I can already tell you that there's a lot of smoothing going on there as well.

P1 data are emitted at 10 s intervals as well (at least in the older DSMR specifications). There's a strong possibility that these data are averaged by the toon software in the same way, leading to an equal delay, and thus canceling out any issues in the displayed data.
TheHogNL
Forum Moderator
Forum Moderator
Posts: 2125
Joined: Sun Aug 20, 2017 8:53 pm

Re: SolarBridge: a Wemos Base bridge between GroWatt and Toon

Post by TheHogNL »

marcelr wrote:Hmmm ... zon op toon data are sampled at 10s intervals. These data are then filtered through a moving average filter over 5 minutes (30 sample points). This gives the data as stored in toon (and as displayed) a delay of 150 seconds. At low power, time intervals between pulses can go up to tens of seconds. A 1000 pulses/kWh setting means 3600J of energy for each pulse. With 1000W solar power this gives pulse frequencies of approximately 1/3 Hz, one every three seconds. That's not a lot. I still have to find out how these pulses are then averaged to give the power number as displayed in the tile "Zon nu",refresh rate once every 10 seconds, but I can already tell you that there's a lot of smoothing going on there as well.

P1 data are emitted at 10 s intervals as well (at least in the older DSMR specifications). There's a strong possibility that these data are averaged by the toon software in the same way, leading to an equal delay, and thus canceling out any issues in the displayed data.
That is the reason Eneco installed a Inepro pro1 with 10.000 imp/kwh earlier (and now the wireless qubino with even better resolution.)
Member of the Toon Software Collective
TheHogNL
Forum Moderator
Forum Moderator
Posts: 2125
Joined: Sun Aug 20, 2017 8:53 pm

Re: SolarBridge: a Wemos Base bridge between GroWatt and Toon

Post by TheHogNL »

oepi-loepi wrote:Yes, you are correct. Is has a delay of ab. 1 minute. For most users it will be accurate enough on the average. The totals are correct and the graphs show ok. The realtime graphs have a delay (sample time is 1 minute so the integrator works but with a sample time of 1 minute). It can easily be changed when in the program 60000 is changed to 10000. Then the data is extracted every 10 seconds. Same as from the P1 port. No problem, they are very small data packages.
I only hope Growatt allows that :) Does indeed the value update that fast on the website? Solaredge is only once in 5 minutes.
Member of the Toon Software Collective
oepi-loepi
Advanced Member
Advanced Member
Posts: 628
Joined: Sat Feb 09, 2019 7:18 pm

Re: SolarBridge: a Wemos Base bridge between GroWatt and Toon

Post by oepi-loepi »

I know GroWatt allows that because i programmed that before. I do not know the update time of Growatt API itself since we now have a quite stable weather these days so wasnt’t able to test. But for what i see in the mornings and evenings, the Toon filters seem to do their job and it all looks good in the Toon graphs. Resolution of 1 minute seems ok for most of us i think but if you need better, it is no problem to speed up a bit.
TheHogNL
Forum Moderator
Forum Moderator
Posts: 2125
Joined: Sun Aug 20, 2017 8:53 pm

Re: SolarBridge: a Wemos Base bridge between GroWatt and Toon

Post by TheHogNL »

oepi-loepi wrote:I know GroWatt allows that because i programmed that before. I do not know the update time of Growatt API itself since we now have a quite stable weather these days so wasnt’t able to test. But for what i see in the mornings and evenings, the Toon filters seem to do their job and it all looks good in the Toon graphs. Resolution of 1 minute seems ok for most of us i think but if you need better, it is no problem to speed up a bit.
Again, thanks for the great work. I think a lot of people would use this.
Member of the Toon Software Collective
oepi-loepi
Advanced Member
Advanced Member
Posts: 628
Joined: Sat Feb 09, 2019 7:18 pm

Re: SolarBridge: a Wemos Base bridge between GroWatt and Toon

Post by oepi-loepi »

Looking at the website and historical data it seems that the website is updated every 5 minutes. However looking at the JSON file from the API it looks like the data is refreshed more often.


To get the data from GroWatt more often, change this line (it is now 60 seconds or 60000 milliseconds):

unsigned long Getdatafrequency = 60000; //time between data transfers from GroWatt

To adjust the pulses per Watt change this line (it is now 1 pulse/Watt):

timebetweenpulses = 3600000/CurrentValue;

To make it 10 pulses per Watt change it to:

timebetweenpulses = 36000000/CurrentValue;
TheHogNL
Forum Moderator
Forum Moderator
Posts: 2125
Joined: Sun Aug 20, 2017 8:53 pm

Re: SolarBridge: a Wemos Base bridge between GroWatt and Toon

Post by TheHogNL »

Technically it is 1 imp per Wh (Watthour) (or 1000 imp/kWh).

That is why you divide (a multiple of) 3600 with the Watt value.

If it was pulse per Watt how could the Toon count the correct Watt? Like, counting 10 pulses, is that 10 Watt? And counting 3000 pulses is 3000Watt? But when do you stop counting pulses then :-)

So yes, it isn't the pulse itself what makes the Watt. Each pulse counts for a Watthour (or a multiple of). So each time BETWEEN the pulses (your timebetweenpulses value) is used to calculate the Watt itself.
The Toon does exactly the same calculation but then the other way around (CurrentWatt = 3600000 / timebetweenpulses)
Member of the Toon Software Collective
oepi-loepi
Advanced Member
Advanced Member
Posts: 628
Joined: Sat Feb 09, 2019 7:18 pm

Re: SolarBridge: a Wemos Base bridge between GroWatt and Toon

Post by oepi-loepi »

Yes, thanks for the info on the Wh. I think we are speaking about the same thing. The software from the ESP is getting the W from the API (web) and it calculates the time between pulses as if each pulse is 1 Wh generated solarpower.

So like if the current Powervalue = 1000 W then the pulse time will be 3600 seconds/1000 W = 3,6 seconds between the pulses. So it keeps pulsing with a 3,6 seconds interval until after 1 minute new data is received. Then it will calculate the interval again and it will update the pulse interval.

Toon will see these pulses and will calculate the power in reverse order using some damping filters.

Forgive if i am wrong with the watts and wattshour....
Last edited by oepi-loepi on Mon Apr 06, 2020 5:57 pm, edited 1 time in total.
Post Reply

Return to “Toon Hardware”