SolarBridge: a Wemos Base bridge between GroWatt and Toon

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

Moderators: marcelr, TheHogNL, Toonz

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 »

mvdbr4nd wrote:Hi,



So I migrated to Platform IO and managed to get everyhing compiled and running with the latests Core / ArduinoJSON6 and WifiManager also fixing the issues above. It also seems the Power goed to 0W in the night (which was a nice +) no idea why could be a core version which is now more recent.
Should be still showing 10W.

See https://github.com/mvdbr4nd/solarbridge ... e.cpp#L122
It is putting 360 seconds into the timebetweenpulses if current watt = 0.

360 seconds per pulse on a 1000imp/kwh (virtual) meter setting in the Toon results in 10watts.

As per comment in a few lines before you probably mean 3600 seconds (3600000 millis).

But I'll ask, why even give pulses if there is 0 watt? Just don't pulse and only start pulsing when there is generated watts again.
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 »

mvdbr4nd wrote:Hi,



So I migrated to Platform IO and managed to get everyhing compiled and running with the latests Core / ArduinoJSON6 and WifiManager also fixing the issues above. It also seems the Power goed to 0W in the night (which was a nice +) no idea why could be a core version which is now more recent.
Should be still showing 10W.

See https://github.com/mvdbr4nd/solarbridge ... e.cpp#L122
It is putting 360 seconds into the timebetweenpulses if current watt = 0.

360 seconds per pulse on a 1000imp/kwh (virtual) meter setting in the Toon results in 10watts.

As per comment in a few lines before you probably mean 3600 seconds (3600000 millis).

But I'll ask, why even give pulses if there is 0 watt? Just don't pulse and only start pulsing when there is generated watts again.
Member of the Toon Software Collective
mvdbr4nd
Starting Member
Starting Member
Posts: 12
Joined: Mon Jun 24, 2019 1:29 pm

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

Post by mvdbr4nd »

Yes i agree. Im trying soms changes for the pulses with the 0W output. It seems to work now (locally). I will check if that is a separate patch that I didnt push yet. Anyone have any idea why the 360 is there in the first place? Should we just not send pulses at all?
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 »

mvdbr4nd wrote:Yes i agree. Im trying soms changes for the pulses with the 0W output. It seems to work now (locally). I will check if that is a separate patch that I didnt push yet. Anyone have any idea why the 360 is there in the first place? Should we just not send pulses at all?
If you see this post viewtopic.php?f=95&t=12751&start=15#p94006 @oepi-loepi original plan was 0 seconds also but later changed it to 3 hours. Not sure how it got changed to 360 seconds in your code though.

If I have some spare time I'll review both solaredge and growatt code. My preference will be that they should be one code and user selectable.
I have done a lot of s0 pulse counting and simulating code myself (pythond and arduino) and I am already seeing some points where improvement can be made.

Eventually I would like to add some code to read s0 counters also and some logic to 'pair' multiple esp8266's running this code. One being the master, which pulses towards the Toon and getting the data from possible multiple sources (like growatt/solaredge api, but also other esp8266 with same code as slave reading S0 counters on kWh meters). Most of this code I already have. Only need to bring it all together.
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 »

Timebetweenpulses when currentvalue is zero should be a long time. And since we cannot divide by currentvalue because it is zero so the time is set the hard way 3 hrs. You can also choose to make it 10 hours or longer so it will pulse only once every 10 hrs or longer during the night.

if (CurrentValue > 1) {
timebetweenpulses = 3600000/CurrentValue;
}
else{
timebetweenpulses = 3*3600*1000;
}

then time will be 3 hours between the pulses when powervalue is 0.
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:Timebetweenpulses when currentvalue is zero should be a long time. And since we cannot divide by currentvalue because it is zero so the time is set the hard way 3 hrs. You can also choose to make it 10 hours or longer so it will pulse only once every 10 hrs or longer during the night.

if (CurrentValue > 1) {
timebetweenpulses = 3600000/CurrentValue;
}
else{
timebetweenpulses = 3*3600*1000;
}

then time will be 3 hours between the pulses when powervalue is 0.
But why not set timebetweenpulses to -1 for example and let the code check for -1 and do not do the pulse loop if that is the case?

1 pulse each 3 hours still makes about 3 Wh per night. And about 0.3 Watt realtime (on a 1000imp/kWh virtual meter). And only if the 3 hours is exceeded it seems that the code will accept new timeinbetweenpulses for the pulse loop.
Member of the Toon Software Collective
mvdbr4nd
Starting Member
Starting Member
Posts: 12
Joined: Mon Jun 24, 2019 1:29 pm

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

Post by mvdbr4nd »

Yes I see.. the div. by zero issue. Going for -1 for the period is an option but this period is currently an unsigned short. Why not go for an extra boolean that indicates that that is currently no power and skipping the pulse gen. when the boolean is true. (thats what im currently doing) its not a great solution but works.
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 think the timer cannot be set to -1 milliseconds but if you set it to a time longer than 14 hrs it will get the thirst morning sun and all will be less problem maybe. Otherwise it will need another boolean variable to be set if currentvalue is zero or use the currentvalue as booluean (<1) tho make a pulse or not.
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 think the timer cannot be set to -1 milliseconds but if you set it to a time longer than 14 hrs it will get the thirst morning sun and all will be less problem maybe. Otherwise it will need another boolean variable to be set if currentvalue is zero or use the currentvalue as booluean (<1) tho make a pulse or not.
I mean, you can use the -1 timer to be used as a boolean. Or is the variable unsigned currently? But a boolean for 'standby' mode would be ok 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 »

Yes, it is unsigned

unsigned long timebetweenpulses = 2000; //time between pulses calculated (initial)

A new boolean “valueismorethanone” can set the pulse trigger.

if (CurrentValue > 1) {
timebetweenpulses = 3600000/CurrentValue;
valueismorethanone = true;
}
else{
timebetweenpulses = 3*3600*1000;
valueismorethanone = false;
}

and in line 593 if (valueismorethanone){blinkled();}


Something like above will do
mvdbr4nd
Starting Member
Starting Member
Posts: 12
Joined: Mon Jun 24, 2019 1:29 pm

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

Post by mvdbr4nd »

running for a few days now. I did add a bool to indicate that no power is generated and just skip the blinkled() not the most elegant but works. Also changed the SolarEdge code with the same change.
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 »

Thanks for testing. I am glad skipping the led pulse works.

NEW APP WILL BE AVAILABLE SOON. This new app will be installed on toon and will extract all data from the iverter biy software. No hardware needed anymore.
Post Reply

Return to “Toon Hardware”