Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. My Project
  3. Irrigation Controller (up to 16 valves with Shift Registers)

Irrigation Controller (up to 16 valves with Shift Registers)

Scheduled Pinned Locked Moved My Project
371 Posts 56 Posters 247.8k Views 52 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #110

    Hello Pete, thanks for your hard work on this. Superb!
    I want to build a irrigation controller like your project but can't figure out hows the wiring. On the wiki an image is shown but I can't see what the connections are in this "virtual proto board"
    Is there something clearer or like a pinout to pin list?
    I'm using an Arduino Nano, so things will be something different.
    Thank you very much.

    petewillP 1 Reply Last reply
    0
    • ? A Former User

      Hello Pete, thanks for your hard work on this. Superb!
      I want to build a irrigation controller like your project but can't figure out hows the wiring. On the wiki an image is shown but I can't see what the connections are in this "virtual proto board"
      Is there something clearer or like a pinout to pin list?
      I'm using an Arduino Nano, so things will be something different.
      Thank you very much.

      petewillP Offline
      petewillP Offline
      petewill
      Admin
      wrote on last edited by
      #111

      @Sergio Jim (@BulldogLowell) posted some more details above but here is my fritzing project as well. Hopefully you can zoom in where you need to see more.

      Fritzing Irrigation Controller Wiring.fzz

      My "How To" home automation video channel: https://www.youtube.com/channel/UCq_Evyh5PQALx4m4CQuxqkA

      1 Reply Last reply
      0
      • ? Offline
        ? Offline
        A Former User
        wrote on last edited by A Former User
        #112

        Mmm... I finally assembled the device. But I'm having problems with it. It doesn't activate/deactivates the relays. I'm getting the power for the relay board from the nano itself. Could that be the problem?
        Also, my domoticz doesn't receive the off signal from the controller. (doens't turn the light off) and sometimes throws some error telling that can't contact the node.
        BTW I tried to contac Bulldogloweel without success :sob:

        petewillP 1 Reply Last reply
        0
        • ? A Former User

          Mmm... I finally assembled the device. But I'm having problems with it. It doesn't activate/deactivates the relays. I'm getting the power for the relay board from the nano itself. Could that be the problem?
          Also, my domoticz doesn't receive the off signal from the controller. (doens't turn the light off) and sometimes throws some error telling that can't contact the node.
          BTW I tried to contac Bulldogloweel without success :sob:

          petewillP Offline
          petewillP Offline
          petewill
          Admin
          wrote on last edited by
          #113

          @Sergio said:

          Mmm... I finally assembled the device. But I'm having problems with it. It doesn't activate/deactivates the relays. I'm getting the power for the relay board from the nano itself. Could that be the problem?

          Yes, that is most likely the problem. Most of the relays I have used need more power than what the arduino can supply. Try feeding it more power (like from a phone charger).

          Also, my domoticz doesn't receive the off signal from the controller. (doens't turn the light off) and sometimes throws some error telling that can't contact the node.

          Check the serial monitor with debug enabled. Does this happen every time? It could be radio issues. Do you have a 4.7uf cap on the radio? Is it close enough to your gateway?

          My "How To" home automation video channel: https://www.youtube.com/channel/UCq_Evyh5PQALx4m4CQuxqkA

          1 Reply Last reply
          0
          • BulldogLowellB BulldogLowell

            @moffen666

            I don't have Domoticz but I suspect that the callback isn't functioning.

            try populating the array with the desired times for each sequence. replace this:

            int allZoneTime [NUMBER_OF_VALVES + 1];
            int valveSoloTime [NUMBER_OF_VALVES + 1];
            

            with something like this:

            int allZoneTime [NUMBER_OF_VALVES + 1] = {0, 10, 10, 10, 5,<... how many valves you have with zero in the first position>} ;
            int valveSoloTime [NUMBER_OF_VALVES + 1] = {0, 5, 5, 5, 5,<... how many valves you have with zero in the first position>};
            

            This will load in the times that the program uses as your 'default' values. Then, you can check with Domoticz experts on getting the V_VAR variables working.

            fusion_manF Offline
            fusion_manF Offline
            fusion_man
            wrote on last edited by
            #114

            @BulldogLowell

            I need to add a relay for a master valve. This will open when any zone valves open. I think it could be mapped to All On 0(1) but I am not sure how to accomplish this. I don't know the code for that or electrical connection. I also noticed we are about maxed out of data (99%) using ProMini. Any ideas?

            1 Reply Last reply
            0
            • BulldogLowellB Offline
              BulldogLowellB Offline
              BulldogLowell
              Contest Winner
              wrote on last edited by BulldogLowell
              #115

              If you are worried about Program Space you can turn off Serial debug to rid yourself of a bunch of overhead in the sketch. I am not using String class so there is PLENTY of RAM and I've been using this for a while with no stack corruption issues:

              #define DEBUG_ON   // comment out to surpress serial monitor output
              

              if you propose to turn ON the master valve when each valve is cycled on, then I believe all you need to do is add that valve to the bitmask (logical OR) each time you updateRelays().

              void updateRelays(int value)
              {
                if(value)
                {
                  value |= 0b0000000010000000;  // master is the eighth relay, there are 7 controlled in this example (active HIGH in this example)
                }
                digitalWrite(latchPin, LOW);
                shiftOut(dataPin, clockPin, MSBFIRST, highByte(value));
                shiftOut(dataPin, clockPin, MSBFIRST, lowByte(value));
                digitalWrite(latchPin, HIGH);
              }
              

              not tested

              fusion_manF 2 Replies Last reply
              0
              • BulldogLowellB BulldogLowell

                If you are worried about Program Space you can turn off Serial debug to rid yourself of a bunch of overhead in the sketch. I am not using String class so there is PLENTY of RAM and I've been using this for a while with no stack corruption issues:

                #define DEBUG_ON   // comment out to surpress serial monitor output
                

                if you propose to turn ON the master valve when each valve is cycled on, then I believe all you need to do is add that valve to the bitmask (logical OR) each time you updateRelays().

                void updateRelays(int value)
                {
                  if(value)
                  {
                    value |= 0b0000000010000000;  // master is the eighth relay, there are 7 controlled in this example (active HIGH in this example)
                  }
                  digitalWrite(latchPin, LOW);
                  shiftOut(dataPin, clockPin, MSBFIRST, highByte(value));
                  shiftOut(dataPin, clockPin, MSBFIRST, lowByte(value));
                  digitalWrite(latchPin, HIGH);
                }
                

                not tested

                fusion_manF Offline
                fusion_manF Offline
                fusion_man
                wrote on last edited by
                #116

                @BulldogLowell

                By commenting out the DEBUG, it went from 99% to 63% used memory.
                The modification to void updateRelays worked very nicely. I only wish the master control valve would remain ON during cycling through each valve (subjected to VALVE_RESET_TIME) as I am using it to control a chemical feed pump to prevent hydrogen proxide (30%) from entering my irrigation system.

                Awesome job and I am very pleased with your design.
                The only problem I had when building the controller was getting the LCD to communicate.
                I added this comment to my program under Instructions.

                • If your LCD is unresponsive, download sketch http://forum.arduino.cc/index.php?topic=128635.0 then check serial monitor for LCD address. Insert your address below.
                1 Reply Last reply
                1
                • BulldogLowellB BulldogLowell

                  If you are worried about Program Space you can turn off Serial debug to rid yourself of a bunch of overhead in the sketch. I am not using String class so there is PLENTY of RAM and I've been using this for a while with no stack corruption issues:

                  #define DEBUG_ON   // comment out to surpress serial monitor output
                  

                  if you propose to turn ON the master valve when each valve is cycled on, then I believe all you need to do is add that valve to the bitmask (logical OR) each time you updateRelays().

                  void updateRelays(int value)
                  {
                    if(value)
                    {
                      value |= 0b0000000010000000;  // master is the eighth relay, there are 7 controlled in this example (active HIGH in this example)
                    }
                    digitalWrite(latchPin, LOW);
                    shiftOut(dataPin, clockPin, MSBFIRST, highByte(value));
                    shiftOut(dataPin, clockPin, MSBFIRST, lowByte(value));
                    digitalWrite(latchPin, HIGH);
                  }
                  

                  not tested

                  fusion_manF Offline
                  fusion_manF Offline
                  fusion_man
                  wrote on last edited by
                  #117

                  @BulldogLowell

                  I ended up going a different approach. I modified the program so I could use Arduino digital pin6 as an output powering my master valve relay. I then added digitalWrite (masterValvePin, HIGH) where you have updateRelays(BITSHIFT_VALVE_NUMBER) to turn ON the valve. To turn off the valve I added a delay then digitalWrite (masterValvePin, LOW) to if (state == STAND_BY_ALL_OFF). This has tested perfectly for my situation.
                  The only thing missing from the Controller is the ability to add the RainBird rain sensor to the board. I think the way of achieving this is an input to my Vera controller.

                  BulldogLowellB 1 Reply Last reply
                  0
                  • fusion_manF fusion_man

                    @BulldogLowell

                    I ended up going a different approach. I modified the program so I could use Arduino digital pin6 as an output powering my master valve relay. I then added digitalWrite (masterValvePin, HIGH) where you have updateRelays(BITSHIFT_VALVE_NUMBER) to turn ON the valve. To turn off the valve I added a delay then digitalWrite (masterValvePin, LOW) to if (state == STAND_BY_ALL_OFF). This has tested perfectly for my situation.
                    The only thing missing from the Controller is the ability to add the RainBird rain sensor to the board. I think the way of achieving this is an input to my Vera controller.

                    BulldogLowellB Offline
                    BulldogLowellB Offline
                    BulldogLowell
                    Contest Winner
                    wrote on last edited by
                    #118

                    @fusion_man

                    maybe we can add a rain sensor this season. It is a good idea to include it.

                    fusion_manF 1 Reply Last reply
                    0
                    • BulldogLowellB BulldogLowell

                      @fusion_man

                      maybe we can add a rain sensor this season. It is a good idea to include it.

                      fusion_manF Offline
                      fusion_manF Offline
                      fusion_man
                      wrote on last edited by
                      #119

                      @BulldogLowell

                      I already did and it is up and running. I used A0 as the input for the rain sensor. I can see the rain sensor in Vera as a motion sensor. I didn't post the code as I didn't want to offend the designer. Being a newbie, I didn't know how to handle this update.

                      BulldogLowellB 1 Reply Last reply
                      0
                      • fusion_manF fusion_man

                        @BulldogLowell

                        I already did and it is up and running. I used A0 as the input for the rain sensor. I can see the rain sensor in Vera as a motion sensor. I didn't post the code as I didn't want to offend the designer. Being a newbie, I didn't know how to handle this update.

                        BulldogLowellB Offline
                        BulldogLowellB Offline
                        BulldogLowell
                        Contest Winner
                        wrote on last edited by
                        #120

                        @fusion_man

                        why not just post your code? I'm sure the guy who wrote the original code won't mind, if you include his original notes and credits.

                        1 Reply Last reply
                        0
                        • Mark JeffordM Offline
                          Mark JeffordM Offline
                          Mark Jefford
                          wrote on last edited by
                          #121

                          Quick question, semi also referenced on the openhab binding.

                          Looking to use this with Openhab, I have managed to get it to work with the serial gateway, however i don't see a way i can pass out any configuration of a valve time, i can however trigger valves with a runtime of 0 seconds.

                          Any ideas how i can amend this to either use a fixed runtime in the project (happy to run it in 1min increments trigged from openhab hydro sensor results)

                          BulldogLowellB 1 Reply Last reply
                          0
                          • Mark JeffordM Mark Jefford

                            Quick question, semi also referenced on the openhab binding.

                            Looking to use this with Openhab, I have managed to get it to work with the serial gateway, however i don't see a way i can pass out any configuration of a valve time, i can however trigger valves with a runtime of 0 seconds.

                            Any ideas how i can amend this to either use a fixed runtime in the project (happy to run it in 1min increments trigged from openhab hydro sensor results)

                            BulldogLowellB Offline
                            BulldogLowellB Offline
                            BulldogLowell
                            Contest Winner
                            wrote on last edited by
                            #122

                            @Mark-Jefford

                            In that case, I would just treat each zone as a separate relay/lamp and use Openhab to control the individual ON times... I think.

                            johnecyJ Mark JeffordM 2 Replies Last reply
                            0
                            • BulldogLowellB BulldogLowell

                              @Mark-Jefford

                              In that case, I would just treat each zone as a separate relay/lamp and use Openhab to control the individual ON times... I think.

                              johnecyJ Offline
                              johnecyJ Offline
                              johnecy
                              wrote on last edited by
                              #123

                              can I use pin D6 instead ok pin D8 to control the shift register. I am making the controller on the easy/newbie pc board and there is nothing connected to pin D8 on this board.

                              BulldogLowellB 1 Reply Last reply
                              0
                              • johnecyJ johnecy

                                can I use pin D6 instead ok pin D8 to control the shift register. I am making the controller on the easy/newbie pc board and there is nothing connected to pin D8 on this board.

                                BulldogLowellB Offline
                                BulldogLowellB Offline
                                BulldogLowell
                                Contest Winner
                                wrote on last edited by
                                #124

                                @johnecy

                                const int latchPin = 8;
                                

                                I think you should be OK to try that

                                johnecyJ 1 Reply Last reply
                                0
                                • BulldogLowellB BulldogLowell

                                  @johnecy

                                  const int latchPin = 8;
                                  

                                  I think you should be OK to try that

                                  johnecyJ Offline
                                  johnecyJ Offline
                                  johnecy
                                  wrote on last edited by
                                  #125

                                  @BulldogLowell thanks for the reply i will post pictures when i get it finished

                                  1 Reply Last reply
                                  1
                                  • BulldogLowellB BulldogLowell

                                    @Mark-Jefford

                                    In that case, I would just treat each zone as a separate relay/lamp and use Openhab to control the individual ON times... I think.

                                    Mark JeffordM Offline
                                    Mark JeffordM Offline
                                    Mark Jefford
                                    wrote on last edited by Mark Jefford
                                    #126

                                    @BulldogLowell

                                    Gave up with using openhab now using domoticz which is a lot nicer, forced it to hard coded run times by doing this:

                                    else if (message.type == V_VAR1)
                                    {
                                    int variable1 = 5; // atoi(message.data);// RUN_ALL_ZONES time
                                    DEBUG_PRINT(F("Recieved variable1 valve:"));
                                    DEBUG_PRINT(i);
                                    DEBUG_PRINT(F(" = "));
                                    DEBUG_PRINTLN(variable1);
                                    if (variable1 != allZoneTime[i])
                                    {
                                    allZoneTime[i] = variable1;

                                          zoneTimeUpdate = true;
                                        }
                                      }
                                      else if (message.type == V_VAR2)
                                      {
                                        int variable2 = 5; //atoi(message.data);// RUN_SINGLE_ZONE time
                                        DEBUG_PRINT(F("Recieved variable2 valve:"));
                                        DEBUG_PRINT(i);
                                        DEBUG_PRINT(F(" = "));
                                        DEBUG_PRINTLN(variable2);
                                        if (variable2 != valveSoloTime[i])
                                        {
                                          valveSoloTime[i] = variable2;
                                          zoneTimeUpdate = true;
                                        }```
                                    

                                    one thing to note the shift register 0b0000000010000000 does not seem to work, will work out a plan around this as i need to run a 12 pump off the relay bank to draw water from the water butt.

                                    BulldogLowellB 1 Reply Last reply
                                    0
                                    • Mark JeffordM Mark Jefford

                                      @BulldogLowell

                                      Gave up with using openhab now using domoticz which is a lot nicer, forced it to hard coded run times by doing this:

                                      else if (message.type == V_VAR1)
                                      {
                                      int variable1 = 5; // atoi(message.data);// RUN_ALL_ZONES time
                                      DEBUG_PRINT(F("Recieved variable1 valve:"));
                                      DEBUG_PRINT(i);
                                      DEBUG_PRINT(F(" = "));
                                      DEBUG_PRINTLN(variable1);
                                      if (variable1 != allZoneTime[i])
                                      {
                                      allZoneTime[i] = variable1;

                                            zoneTimeUpdate = true;
                                          }
                                        }
                                        else if (message.type == V_VAR2)
                                        {
                                          int variable2 = 5; //atoi(message.data);// RUN_SINGLE_ZONE time
                                          DEBUG_PRINT(F("Recieved variable2 valve:"));
                                          DEBUG_PRINT(i);
                                          DEBUG_PRINT(F(" = "));
                                          DEBUG_PRINTLN(variable2);
                                          if (variable2 != valveSoloTime[i])
                                          {
                                            valveSoloTime[i] = variable2;
                                            zoneTimeUpdate = true;
                                          }```
                                      

                                      one thing to note the shift register 0b0000000010000000 does not seem to work, will work out a plan around this as i need to run a 12 pump off the relay bank to draw water from the water butt.

                                      BulldogLowellB Offline
                                      BulldogLowellB Offline
                                      BulldogLowell
                                      Contest Winner
                                      wrote on last edited by
                                      #127

                                      @Mark-Jefford said:

                                      one thing to note the shift register 0b0000000010000000 does not seem to work, will work out a plan around this as i need to run a 12 pump off the relay bank to draw water from the water butt.

                                      Can you explain more? is there a bug?

                                      Mark JeffordM 1 Reply Last reply
                                      0
                                      • BulldogLowellB BulldogLowell

                                        @Mark-Jefford said:

                                        one thing to note the shift register 0b0000000010000000 does not seem to work, will work out a plan around this as i need to run a 12 pump off the relay bank to draw water from the water butt.

                                        Can you explain more? is there a bug?

                                        Mark JeffordM Offline
                                        Mark JeffordM Offline
                                        Mark Jefford
                                        wrote on last edited by
                                        #128

                                        @BulldogLowell
                                        Hi! :)

                                        Rather than using valve 8, i am using only a block of 4, but currently have a 2 channel for testing.

                                        My reading into shift registers showed 0b0000000010000000 is 2x 8 bit outputs, B0-B7

                                        tried configuing B0 and B7 to try and activate relay 1, was still seeing 5V on all pins apart from the output pin for the zone in use (EG zone 2 expecting Zone1 to alway be on)

                                        or am i doing this completely wrong? :)

                                        BulldogLowellB 1 Reply Last reply
                                        0
                                        • Mark JeffordM Mark Jefford

                                          @BulldogLowell
                                          Hi! :)

                                          Rather than using valve 8, i am using only a block of 4, but currently have a 2 channel for testing.

                                          My reading into shift registers showed 0b0000000010000000 is 2x 8 bit outputs, B0-B7

                                          tried configuing B0 and B7 to try and activate relay 1, was still seeing 5V on all pins apart from the output pin for the zone in use (EG zone 2 expecting Zone1 to alway be on)

                                          or am i doing this completely wrong? :)

                                          BulldogLowellB Offline
                                          BulldogLowellB Offline
                                          BulldogLowell
                                          Contest Winner
                                          wrote on last edited by
                                          #129

                                          @Mark-Jefford

                                          hmmm... are your relays ACTIVE HIGH (actuate wiht a 5V signal) or ACTIVE LOW (actuate when brought to ground) type?

                                          Mark JeffordM 1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          25

                                          Online

                                          11.7k

                                          Users

                                          11.2k

                                          Topics

                                          113.0k

                                          Posts


                                          Copyright 2019 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • MySensors
                                          • OpenHardware.io
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular