Page 1 of 1

Blockly irrigation control problem

Posted: Wednesday 03 April 2019 13:08
by JohnyDeMarco
Dear All,

I have an irrigation system with 4 circles (spray, rota1, rota2, rota3), controlled by 24VAC valves. I managed to control them with a relay board and an RPi (GPIOs). I added virtual switches to domoticz to open / close the valves (by running simple GPIO commands).
switches.jpg
switches.jpg (61.84 KiB) Viewed 948 times
I can open one circle for X minutes without any problems but cannot put them together.
spray.jpg
spray.jpg (19.25 KiB) Viewed 948 times
My problem is that I am trying to create an "irrigation cycle" program with Blockly, without any success. The idea was to have virtual switch (irrigation cycle), which starts the process by opening / closing the circles and stepping the counter.
full.jpg
full.jpg (125.59 KiB) Viewed 948 times
What's wrong with this? Unfortunately I cannot figure it out, please help. Thanks in advance,

Johny

Re: Blockly irrigation control problem

Posted: Wednesday 03 April 2019 14:06
by kuifje
Johny,
you use a "if" "else" the wrong way.
When you click your mouse on the blue dot an else appears, that one you have to put under the if. You have to do this 4 times.
Now the first one doesn't know what the second one is doing or supposed to do.
Kuifje

Re: Blockly irrigation control problem

Posted: Wednesday 03 April 2019 14:26
by JohnyDeMarco
Hi kuifje,

thanks for your quick support! It is better now, however, just the first cycle executed (Spray started and worked for 1 minute and stopped), the counter did not change after 60 seconds, therefore the second cycle (Rota1) not started. The "Irrigation cycle" stuck as "ON", "Counter" remains "0".
elseif.jpg
elseif.jpg (123.43 KiB) Viewed 940 times
I am wondering that maybe the value of the counter is wrong, as the "0/1/2/3/4" are the names, the levels are "0/10/20/30/40".

counter.jpg
counter.jpg (129.67 KiB) Viewed 940 times
Thanks in advance,

Johny

Re: Blockly irrigation control problem

Posted: Wednesday 03 April 2019 15:57
by Gerwin
behind counter you are using the wrong block.
if you are using the level% block than is it working.
level%10 and level%20 level%30 Level%40

Gerwin

Re: Blockly irrigation control problem

Posted: Thursday 04 April 2019 14:10
by JohnyDeMarco
Thank you All for your valuable support, I've tried all of them, my garden looks like a lake now :) Anyways, I fixed it. Or I can say: "there I fixed it" :)
fixed.jpg
fixed.jpg (66.18 KiB) Viewed 907 times
Not the best solution, but it works. I'll try to use the more sophisticated versions as soon as I have time to play with them.

Thx, Johny