BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

Simple 4 relay irrigation scheduler

#79

I can add time_no for scheduler_turn_off function such as

scheduler_turn_off(byte scheduler_num , byte time_no )

0 Likes

#80

If you look carefully you will see that the scheduler_turn_off is called out of the time_no loop.
the information for which time_no was used to turn on is not saved. You could add an array to save time_no.
it will look something like :

                /////////////////////////////////////
                 // activation
                 ////////////////////////////////////
                  scheduler_turn_on(scheduler_cnt,timer_cnt);
                  **saved_time_cnt[scheduler_cnt] = timer_cnt;**
          }
        
      }
    }

   ///////////////////////////////////
   // De activation (per scheduler)
   //////////////////////////////////
   if ((now_abs_sec >= active_end_time_sec[scheduler_cnt])|
       (now_abs_sec >= max_end_time_sec[scheduler_cnt])   ){
                scheduler_turn_off(scheduler_cnt , saved_time_cnt[scheduler_cnt] );
   }  
 }
1 Like

#81

@hagay I set timer start 1:05 emd 1:06 but start time 1:05 timer Start and finish at the same time. i see from debug. I removed slider and fix it.

  // MAX DURATION SLIDER INPUT                                                      //
  ////////////////////////////////////////////////////////////////////////////////////
  else if (pin >= VP_MAX_DUR_SCHD0) {                                       //V24..V27
     if (pin < VP_MAX_DUR_SCHD0+SCHEDULER_CNT){ 
      if(param.asInt()>2)
         max_duration_sec[pin-VP_MAX_DUR_SCHD0] = 86400;
      else
         max_duration_sec[pin-VP_MAX_DUR_SCHD0] = 864000; // set to 10 days is equivalent to not setting max duration
     }
  }
  ///////////////////////////////////////////////////////////////////////////////////
  // SCHEDULER IMMEDIATE TASK ACTIVATION BUTTON INPUT                              //
  ///////////////////////////////////////////////////////////////////////////////////
  else if (pin >= VP_IMMD_ACTV_SCHD0) {                                     //V20..V23
    if ( pin <(VP_IMMD_ACTV_SCHD0+SCHEDULER_CNT) ) {
      if (param.asInt()==0)
        scheduler_turn_off(pin-VP_IMMD_ACTV_SCHD0, 0);
      else     
        (pin-VP_IMMD_ACTV_SCHD0,TIME_CNT); // immediate turn on using duration from slider
    }
  }
  ///////////////////////////////////////////////////////////////////////////////////
  // DEFAULT ACTIVE DURATION SLIDER INPUT                                          //
  ///////////////////////////////////////////////////////////////////////////////////
  else if (pin >= VP_ACTV_DUR_SCHD0) {                                       //V16..V19
    // default duration is written in extra "timer"
    if (pin <VP_ACTV_DUR_SCHD0+SCHEDULER_CNT) active_duration_sec[pin-VP_ACTV_DUR_SCHD0][TIME_CNT] = 86400;
  }
0 Likes

#82

@hagay I’ve been studying your code trying to understand its operation. Am I correct that pressing System Sleep will prevent any events from turning on until system sleep button is pressed again? Schedule timers are still running but can’t turn anything on.
However system disable shuts down schedule timers but has limited duration based on shutdown duration?

0 Likes

#83

Yes the sleep mode will temporally turn off all tasks keeping them (and schedule events) live in the background. For example if I use this to control my garden irrigation I may want to temporally prevent the sprinklers while I am out, but once I go in again I want everything to return to it’s prev state.

System disable will shut down everything (turn off every active device and all schedulers) and after end of “disable time” it will only activate devices when reaching start time (not due to old schedules). For example if I connect this to my boiler and am going out to the weekend. Then I will disable the system for the next few days.

The duration of both (if not manually deactivated) is defined by the Disable Days slider.

I see the sleep mode as a more short term then the disable mode. Therefore for my sprinklers I will set the disable days to 0 (Or I can remove it from my app) so that if I forget to activate the system again it will still operate the next day.
Of course you may have your own use case where you can see differently.

0 Likes

split this topic #84

A post was merged into an existing topic: How to make Blynk.sync ALL after the power loss?

0 Likes

#87

Hi Arizona, I like your code but I would like to modify your App.

I want control “Zone 1” output with 2 differents start time.

0- Zone 1 T1 (Pin V0) > I use only a start time (Allow start/stop input > NO) : OK (Work fine)
1- I want use a “Zone 1 Duration (MIN)” (Pin V16) for end setting of the Zone 1 : OK (Work fine)

2- I want use a “MAX DURATION” (Pin V24) for end setting of the Zone 1 for a second Zone 1 T2 (Pin V1)

3- These 2 end settings are independents for each 4 Zones.

I’m not able to change your code to get what I want to have mentioned.

Help me. Thank you

Note : I use this hardware

image

0 Likes

#88

Arizona.

I am running your code and GUI on my NodeMCU. Thks a lot for your good work. I want to add a Rain Delay of maximum 7 days. On GUI I already did under Virtual Pin V33.

  1. is your code ready to do that?
  2. if I select for example 2 days delay. Is it necessary to click on OFF button V50?

Thks

0 Likes

#89

Approved 101,

The code I posted does not have rain delay. hagay”s code has what you need but you have to integrate his code into yours. Hagay is an advanced programmer.

I tried to integrate his rain delay into my code but I could not figure it out. I just slide the system to offf manually when it rains.

0 Likes

#90

Thks for your reply. I already show the code in Hagay’s code the reference to Sleep function. I am tripping to adapt but it is not easy for me. For the time being I will use as you are doing. I am able to run it, I will share.

0 Likes

#91

Hi,
nice project and work very well.
maybe 1 button is missed… i think is userfull to have 1 more button for manual irrigation, like manual automation., and it do start Relay 1, 2, 3,… in sequence. so start 1, after timeout start relay 2, ecc…
This is my first experience with blink, do you think it is possible?

1 Like

#92

Hi to all. I already make my irrigation system work. The problem is the solenoid I have. My former systems was by battery then they are not NC (normally closed), with one electricity signal they open the valve and with another one they close. Now I have a problem because when I activate the system with my app it open the valve and start to irrigate but when I click off it doesn’t stop irrigating. I have 2 options, to buy 4 new valves 9V NC or to do it by software if possible. Any suggestion?

0 Likes

#93

you can change the button to reverse the status (yours will be same like the picture down change 0 to 1 and 1 to 0), on for Low and off for High from the application
without rewriting any code

image

0 Likes

#94

This is my button, I think it is a problem of hardware. My solenoid is running by pulses, this means that each time you send an small signal of 9v the solenoid change from close to open, then to close, etc. I need solenoid NC 9v.

0 Likes

#95

you could solve this by code only , the button will send the pulse every time to change the solenoid ON/OFF and save the value into variable (integer) and map this value to LED widget (Virtual pin) for example

mostly you have a 9V source there in your old system , use your relay to just pulse this 9V DC as explained above (more easier)

or trigger the 9V source using 3.3V from ESP8266 will need lever shifter

here is the links guiding you to do so (i didn’t tried this before but it should work)
link1
link 2

no need to buy new hardware in my opinion

0 Likes

#96

only an idea
you can control it with BLYNK using MQTT

0 Likes

#97

Thks for your support. This morning I did some test with the solenoid. If I connect it to a 9V battery, red cable to + and black cable to - the solenoid open it. Then if I connect the red cable to - and the black cable to + then solenoid close. It is not necessary to keep supplying electricity all the time the system is irrigating, just one second is enough to change the status of the solenoid.

This is most difficult to solve via software because it’s necessary to change the polarity of the cables.

I should find solenoid NC (usually closed) and then when supplying 9V it will open and when relay will close electricity supplying then it will close again, or I need to find some device between relay and the solenoid which will change the polarity each time it receive energy, I mean … receive energy positive/negative, receive again energy negative/positive, but I think cannot be done.

0 Likes

#98

that is very interesting device that you have i never faced such one , but still can be manipulated using DPDT relays to reverse polarity such module will help

more infor about the DPDT here Link

0 Likes

#99

Thks for your support. I saw this DPDT, if I have 4 relays I need to buy 4 of these DPDT? Where I should put them?

0 Likes

#100

this cheap water tight enclosure should be a good selection for any outdoor thing

0 Likes