OpenSprinkler Forums OpenSprinkler Unified Firmware long timer setting for Pool pump

This topic contains 8 replies, has 0 voices, and was last updated by  Ray 6 years, 2 months ago.

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #22357

    pbo
    Member

    Hello Ray,
    I just upgraded my Opensprinkler V1.1 with 1.6 software to version 1.8.3.
    Works fine and the User Interface is a great improvement.
    I am using it with a few sprinklers and wanted it to use also to program a pool pump timer.
    In version V1.6 I could not use long timer settings because the unit will crash/ hang.
    Now I was trying a timer setting with a duration of 10 hours ( duration set to 600 minutes) but it seems you cannot program more than 540 minutes otherwise you get negative minutes back as setting. I tried different settings.
    Another problem is when power is interupted (which happens frequently here in Spain) during the program start/stop times.The program will not run again, because the start time has been passed. This can be bypassed more or less by setting a shorter Duration and Interval to run more frequent but than the timer will run also after the end time for the duration left.
    I thought to be clever to set Interval and Duration to 1 minute both so the program will continue after a power interupt, but then it will run 1 minute, stop 1 minute, run 1 minute and so on. Setting Duration to 0 minutes, 58 seconds gives a 1 sec interuption every minute.
    Ray do you have a solution ?
    Peter

    #23350

    Ray
    Keymaster

    The 540 minutes limit is mainly because the duration time is stored in a signed integer. So the maximum duration is 32767 seconds (roughly 546 minutes). This should be easy to change to twice as much, by using unsigned integer. I will put it on the todo list for the next update.

    Regarding the solution to frequent power loss. The way you described seems to be the best. I just did a test on my controller: setting 1 minute duration with 1 minute interval seems to do what it’s supposed to (except there is a 1-second delay). I cannot reproduce the problem you described as ‘run 1 minute, stop 1 minute’. The 1-second delay can be avoided by deleting the + 1 in the following line:
    unsigned long accumulate_time = curr_time + 1;
    at function ‘void schedule_all_stations’ in interval_program.pde

    #23351

    pbo
    Member

    Thanks for the reply Ray.
    If you put the controller in non sequential mode you can reproduce my problem with the timer settings I used.
    The results when in sequential mode is simular to your results. So its seems there is a difference how the timer behaves in non sequential mode.
    I would like to avoid the 1-second delay as you discribed so the output has a smooth continues output but I see no way at the moment to compile the program with Linux with avr-gcc version 4.5.3. on my Windows computer. Would it be possible to obtain a pre- compiled version in hex with this change?
    Peter

    #23352

    Ray
    Keymaster

    You can install VirtualBox and run a virtual Linux system in Windows, as described here:
    http://rayshobby.net/?page_id=732#compile
    I recommend Ubuntu 12.04 or Linux Mint 13, which comes with avr-gcc 4.5.3.

    #23353

    pbo
    Member

    It took a while to get Virtual box and Arduino IDE v0023 running on my windows computer.
    Unfortunately the serial com port in the IDE stays grayed out despite all suggestions found on the internet.
    I found a work around by compiling with Verify and locate the *.hex file in the tmp directory of the system files directory and upload this *.hex file with avrdude on the way you described how to upload.
    Finally I was able to change the line “unsigned long accumulate_time = curr_time + 1”;
    at function ‘void schedule_all_stations’ in interval_program.pde with your suggestion to delete the +1.
    Unfortunately it did not help.
    With a program setting of 0hrs 1 mins sequence and running for 1 min 0 secs in sequential mode the program runs in on mode with a 1sec interruption each minute.
    The log however says “ran for 1m0s every minute”.
    A similar result in non sequential mode but then with a setting of 0hrs 1 mins sequence and for 0 mins, 59 secs. ( before the modification this was with 0 mins, 58 sec.)
    With a setting of 0hrs ,1 mins sequence and running for 1 min, 0 secs the program runs in a sequence of 1 minute on than 1 minute off.
    I tried to figure out how you manage the start/stop times in your code but could not quite understand the way you handle this .
    Ray, could you check once more if your suggestion was right or that you obtain similar results as I did.
    Peter

    #23354

    Ray
    Keymaster

    Regarding the serial port: please follow the re-programming instructions — you only need to select board and then click on Upload, there is no step to select a serial port. This is because OpenSprinkler does not have a USB-serial chip (which the standard Arduino has).

    I will take a look at the timing issue as soon as I can. Meanwhile, have you considered adding a UPS backup power supply? That may be the simplest solution to the power interruption problem.

    #23355

    Ray
    Keymaster

    OK, I think I found a potential solution to the issue. First of all, the 1 second delay is because the program only checks and performs bookkeeping of running time once every second. This is to give sufficient time share to the Ethernet controller in order to improve response time to web requests. Therefore, after a schedule is finished, the program goes back to the beginning of the loop (where it checks web requests), and does not perform scheduling until a new second comes. So the quick fix is that after a schedule is finished, let the program re-do schedule checking before going back to the beginning of the loop, and this should solve the problem.

    Specifically, you need to add the following two lines in inverval_program.pde:
    1. Before the comment // ====== Schedule program data ====== and after svc.rainsensor_status();, add a label, such as:
    svc.rainsensor_status();
    CHECK_PROGRAM_SCHEDULE:
    // ====== Schedule program data ======

    2. Locate code “mas = svc.options[OPTION_MASTER_STATION].value;” around line 307, and add the following line after that:
    goto CHECK_PROGRAM_SCHEDULE;

    Basically this directs the program to go back to schedule check after a previous program is finished, and it should eliminate the 1 second delay.

    Note that this only works when sequential option is turned on. If you want to run the controller in parallel mode, there is an additional change you should make. Also, keep in mind that this has not been tested thoroughly, it’s a rather ad hoc solution. Give it a try and see if it works.

    #23356

    pbo
    Member

    The adhock solution in combination with the first suggestion to  change unsigned long accumulate_time = curr_time + 1; into  unsigned long accumulate_time = curr_time; seems to work in sequential mode. Thats great!! Thanks a lot for giving me a solution.
    Where and what should i add or change in the code to obtain a simulair result in parallel mode?

    #23357

    Joshua
    Member

    Ray,

    I am having the same issue. I need to be able to run a schedule continually in parallel mode. I like the idea of running for 1 minute every minute in case there is a power outage or something. What is the additional changes that need to be made so this will work in parallel mode?

    Thanks,

    -Joshua

    #23358

    Ray
    Keymaster

    If you have to run in parallel mode (sequential is off), you can modify the following line:
    in interval_program.pde, around line 191, change
    if (curr_minute != last_minute) {
    to
    if (seq==0 || curr_minute != last_minute) {

    this forces the algorithm to check program match at all times, instead of once every minute. Again, this change is very experimental, so use it at your own discretion.

Viewing 10 posts - 1 through 10 (of 10 total)

You must be logged in to reply to this topic.

OpenSprinkler Forums OpenSprinkler Unified Firmware long timer setting for Pool pump