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 248.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.
  • BulldogLowellB BulldogLowell

    I put together an extension of the multi-Relay controller for use as a controller for your irrigation project if you have more zones than available pins on your Arduino.

    This sketch features the following:

    • Allows you to cycle through All zones or individual zone control.
    • Use the (n+1)th device to activate each zone in numeric sequence (zero to n) using
      Variable1 as the "ON" time in minutes in each of the vera devices created.
    • Use the individual zone controller to activate a single zone. This feature uses
      Variable2 as the "ON" time for each individual device/zone.
    • Connect according to pinout in the sketch and uses an 74HC595 (or equiv) Shift Register as to
      allow the MySensors standard radio configuration and still leave available digital pins
    • Compiles to ~12,000 Bytes, so will run on any Arduino
    • Turning on any zone will stop the current process and begin that particular process.
    • Turning off any zone will stop the current process and turn off all zones.
    • Sketch must collect your desired intervals so it takes several minutes to startup.
    • If you change your desired time intervals for your zones, simply restart your arduino
      and it will self update to reflect those changes.

    Example, I am using with 8 relays:

    This will create 9 devices. Zero through 7 are the individual relays. Eight is the Sequencer, so to speak (refer to attachment).

    Once you create this and add it using the gateway, go to each of zero through 7 and edit Variable1 and Variable2 for what time you want to use for the Sequencer or Zone respectively. Then save the settings. Then, restart your arduino; your arduino will extract these settings and save them to an array.

    When you turn on device 8 (aka the Sequencer) the relays will actuate in order from zero to seven, each one staying on for the period entered in the Variable1 field. There is a 5 second delay at the start of a new zone to allow for the valves to hydraulically reset.

    When you turn on any of devices zero through 7, it will run that zone only for the period of time entered in Variable2.

    Selecting any new zone (0-8) will stop the current process and start as per above.

    Hope you have a use for it. If you see any opportunity to improve, or find a bug, let me know.

    Jim
    modified. Attached wrong file, whoops!

    Sprinkler.ino

    wasamW Offline
    wasamW Offline
    wasam
    wrote on last edited by
    #234

    @BulldogLowell

    I love your programming skills, it is superb. Haven gone through your video, l was happy and l needed a modification to your setup. I want to use the arduino to power my irrigation with the following function.

    Arduino with soil moisture sensor check. once the soil is dry, arduino to switch on the electric 1horse power pumping machine and at the same time open the solenoid valve to irrigate at a specified timing.

    As per powering the pumping machine, arduino should check if there is public electricity supply before switching on the pump and if there is no public power supply then it should switch on the power generating set to power the pumping machine and solenoid valve.

    After the sensor has confirmed that the soil is wet and moist, then arduino stops the pumping machine and then closes the electric 220v solenoid valve.

    Second task.

    Overhead Mist Sprayer (uses a different AC 1horse power pump)

    A sensor to check when the sun temperature is 35 or 40 degrees or any programmed temperature and switch on the pumping machine to power the sprayer for a specified timing. Also arduino should should check if there is public electricity supply before switching on the pump and if there is no public power supply then it should switch on the power generating set to power the pumping machine.

    Also irrigation records of time and dates and other function will be added up in the setup.

    I like to know the hardwares l will need for this project, a guide and codes. I appreciate this .

    Thanks

    BulldogLowellB 1 Reply Last reply
    0
    • wasamW wasam

      @BulldogLowell

      I love your programming skills, it is superb. Haven gone through your video, l was happy and l needed a modification to your setup. I want to use the arduino to power my irrigation with the following function.

      Arduino with soil moisture sensor check. once the soil is dry, arduino to switch on the electric 1horse power pumping machine and at the same time open the solenoid valve to irrigate at a specified timing.

      As per powering the pumping machine, arduino should check if there is public electricity supply before switching on the pump and if there is no public power supply then it should switch on the power generating set to power the pumping machine and solenoid valve.

      After the sensor has confirmed that the soil is wet and moist, then arduino stops the pumping machine and then closes the electric 220v solenoid valve.

      Second task.

      Overhead Mist Sprayer (uses a different AC 1horse power pump)

      A sensor to check when the sun temperature is 35 or 40 degrees or any programmed temperature and switch on the pumping machine to power the sprayer for a specified timing. Also arduino should should check if there is public electricity supply before switching on the pump and if there is no public power supply then it should switch on the power generating set to power the pumping machine.

      Also irrigation records of time and dates and other function will be added up in the setup.

      I like to know the hardwares l will need for this project, a guide and codes. I appreciate this .

      Thanks

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

      @wasam

      There are several examples out there (either here or in the Arduino forum) of how to combine sketches for added functionality. Fortunately, you are starting with my code that is already non-blocking and uses little in the way of system resources so it should be straightforward from here.

      The community here (including me) can assist in giving you what you want.

      first thing is the hardware... assuming your using metric means you are 220VAC... you need a person familiar with mains switching to help you out there!

      1 Reply Last reply
      0
      • impertusI impertus

        Hi first Great projekt. All the things is Just ordred from eBay. But i Wonder what the yellow component is.

        And mayby a tuturial have to make a complete HA kontroller. And have to set i Up. Rigtig now i have a raspberry pi with calaos. But i Dont know have to the it Up with the system.

        Hope there is some help in here :)

        impertusI Offline
        impertusI Offline
        impertus
        wrote on last edited by
        #236

        @impertus said:

        Hi first Great projekt. All the things is Just ordred from eBay. But i Wonder what the yellow component is.

        And mayby a tuturial have to make a complete HA kontroller. And have to set i Up. Rigtig now i have a raspberry pi with calaos. But i Dont know have to the it Up with the system.

        Hope there is some help in here :)
        @BulldogLowell

        petewillP 1 Reply Last reply
        0
        • impertusI impertus

          @impertus said:

          Hi first Great projekt. All the things is Just ordred from eBay. But i Wonder what the yellow component is.

          And mayby a tuturial have to make a complete HA kontroller. And have to set i Up. Rigtig now i have a raspberry pi with calaos. But i Dont know have to the it Up with the system.

          Hope there is some help in here :)
          @BulldogLowell

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

          @impertus said:

          But i Wonder what the yellow component is.

          Where are you seeing the yellow component? Maybe it's the LED? Can you post a picture?

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

          impertusI 1 Reply Last reply
          0
          • petewillP petewill

            @impertus said:

            But i Wonder what the yellow component is.

            Where are you seeing the yellow component? Maybe it's the LED? Can you post a picture?

            impertusI Offline
            impertusI Offline
            impertus
            wrote on last edited by
            #238

            @petewill this One. 0_1476216631327_Screenshot_20161011-220800.png

            petewillP 1 Reply Last reply
            0
            • impertusI impertus

              @petewill this One. 0_1476216631327_Screenshot_20161011-220800.png

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

              @impertus Ah, ok. That is a .1uf capacitor.

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

              BulldogLowellB 1 Reply Last reply
              0
              • petewillP petewill

                @impertus Ah, ok. That is a .1uf capacitor.

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

                @petewill

                which can be easily substituted by a flux capacitor.

                :wink:

                impertusI 1 Reply Last reply
                0
                • BulldogLowellB BulldogLowell

                  @petewill

                  which can be easily substituted by a flux capacitor.

                  :wink:

                  impertusI Offline
                  impertusI Offline
                  impertus
                  wrote on last edited by
                  #241

                  @BulldogLowell Thx :)

                  Is this the rigth setup.

                  Irrigationcontroller <-----> Radio + ethernet (Gateaway) ------> Router + Wifi ------> RaspB with (Calaos HA controller)

                  Wifi -----> Calaos Mobile app

                  How does the HA controller detects the signal from the irrigation controller? some mystisk setup :) or plug an play..

                  What HA will you use (Opensouce)(With mobil function)

                  petewillP 1 Reply Last reply
                  0
                  • impertusI impertus

                    @BulldogLowell Thx :)

                    Is this the rigth setup.

                    Irrigationcontroller <-----> Radio + ethernet (Gateaway) ------> Router + Wifi ------> RaspB with (Calaos HA controller)

                    Wifi -----> Calaos Mobile app

                    How does the HA controller detects the signal from the irrigation controller? some mystisk setup :) or plug an play..

                    What HA will you use (Opensouce)(With mobil function)

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

                    @BulldogLowell Ha! Unfortunately I'm fresh out of those...

                    @impertus Both @BulldogLowell and I use Vera as our home automation controller (not open source). My setup looks like: Irrigation Controller <> Ethernet Gateway <> Vera <> Vera Mobile App (usually AutHomationHD). I haven't tested any other controllers with this device but reading up a little in this forum post it appears that some people have got it to work with Domoticz.

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

                    impertusI 1 Reply Last reply
                    1
                    • petewillP petewill

                      @BulldogLowell Ha! Unfortunately I'm fresh out of those...

                      @impertus Both @BulldogLowell and I use Vera as our home automation controller (not open source). My setup looks like: Irrigation Controller <> Ethernet Gateway <> Vera <> Vera Mobile App (usually AutHomationHD). I haven't tested any other controllers with this device but reading up a little in this forum post it appears that some people have got it to work with Domoticz.

                      impertusI Offline
                      impertusI Offline
                      impertus
                      wrote on last edited by
                      #243

                      @petewill yeahh i did a little bit of surfing on the forum. And felt over Domoticz. I see that also can run on RaspBerryPi. So think i will give that at try. It will be nice with a newbie guide how to setup my sensors to Domo. step by step..

                      now im waiting for the mailman with all my components :)

                      1 Reply Last reply
                      0
                      • HuczasH Offline
                        HuczasH Offline
                        Huczas
                        wrote on last edited by
                        #244

                        Hi, I've done recently this setup - it works greate with domoticz and Raspberry Pi 0.
                        After some tests I findout that when I plug in power - sometimes all, sometimes 3 or 4 relays are turning ON for 1second.
                        If that happend my 24V power adapter will be in trash. How to prevent that? Do I need to add something in code (I'm not a programmer)?

                        0_1477417969901_photo_2016-10-25_19-50-49.jpg

                        BulldogLowellB 1 Reply Last reply
                        0
                        • HuczasH Huczas

                          Hi, I've done recently this setup - it works greate with domoticz and Raspberry Pi 0.
                          After some tests I findout that when I plug in power - sometimes all, sometimes 3 or 4 relays are turning ON for 1second.
                          If that happend my 24V power adapter will be in trash. How to prevent that? Do I need to add something in code (I'm not a programmer)?

                          0_1477417969901_photo_2016-10-25_19-50-49.jpg

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

                          @Huczas

                          try adding a delay in various places in setup() start with 5 or even 10 seconds.

                          1 Reply Last reply
                          0
                          • HuczasH Offline
                            HuczasH Offline
                            Huczas
                            wrote on last edited by Huczas
                            #246

                            ok, I just get back from Hackerspace. Some people fix this issue:
                            SN74HC595 - 13 pin (OE from datascheet) - remove GND and then add pull up 1k resistor and wire it to Arduino pin 6

                            and software, added three lines in code:

                              const int outputEnablePin = 6;
                            
                              pinMode(outputEnablePin, OUTPUT);
                              digitalWrite (outputEnablePin, LOW);
                            
                            

                            put them after 190 line https://github.com/mysensors/MySensorsArduinoExamples/blob/master/examples/IrrigationController/IrrigationController.ino

                            should be like that:

                            <some code>
                             //Setup Shift Register...
                            const int latchPin = 8;
                            const int clockPin = 4;
                            const int dataPin  = 7;
                            const int outputEnablePin = 6;
                            //
                            byte clock[8] = {0x0, 0xe, 0x15, 0x17, 0x11, 0xe, 0x0}; // fetching time indicator
                            byte raindrop[8] = {0x4, 0x4, 0xA, 0xA, 0x11, 0xE, 0x0,}; // fetching Valve Data indicator
                            // Set the pins on the I2C chip used for LCD connections:
                            //                    addr, en,rw,rs,d4,d5,d6,d7,bl,blpol
                            LiquidCrystal_I2C lcd(0x3F, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);  // Set the LCD I2C address to 0x27
                            MySensor gw;
                            //
                            MyMessage msg1valve(CHILD_ID_SPRINKLER, V_LIGHT);
                            MyMessage var1valve(CHILD_ID_SPRINKLER, V_VAR1);
                            MyMessage var2valve(CHILD_ID_SPRINKLER, V_VAR2);
                            //
                            void setup()
                            {
                              SERIAL_START(115200);
                              DEBUG_PRINTLN(F("Initialising..."));
                              pinMode(latchPin, OUTPUT);
                              pinMode(clockPin, OUTPUT);
                              pinMode(dataPin, OUTPUT);
                              pinMode(ledPin, OUTPUT);
                              pinMode(waterButtonPin, INPUT_PULLUP);
                              //pinMode(waterButtonPin, INPUT);
                              attachInterrupt(1, PushButton, RISING); //May need to change for your Arduino model
                              digitalWrite (ledPin, HIGH);
                              DEBUG_PRINTLN(F("Turning All Valves Off..."));
                              updateRelays(ALL_VALVES_OFF);
                              pinMode(outputEnablePin, OUTPUT);
                              digitalWrite (outputEnablePin, LOW);
                            <some code>
                            

                            If somebody can update this project in github and that fritzling draw - would be super nice.

                            petewillP 1 Reply Last reply
                            0
                            • HuczasH Huczas

                              ok, I just get back from Hackerspace. Some people fix this issue:
                              SN74HC595 - 13 pin (OE from datascheet) - remove GND and then add pull up 1k resistor and wire it to Arduino pin 6

                              and software, added three lines in code:

                                const int outputEnablePin = 6;
                              
                                pinMode(outputEnablePin, OUTPUT);
                                digitalWrite (outputEnablePin, LOW);
                              
                              

                              put them after 190 line https://github.com/mysensors/MySensorsArduinoExamples/blob/master/examples/IrrigationController/IrrigationController.ino

                              should be like that:

                              <some code>
                               //Setup Shift Register...
                              const int latchPin = 8;
                              const int clockPin = 4;
                              const int dataPin  = 7;
                              const int outputEnablePin = 6;
                              //
                              byte clock[8] = {0x0, 0xe, 0x15, 0x17, 0x11, 0xe, 0x0}; // fetching time indicator
                              byte raindrop[8] = {0x4, 0x4, 0xA, 0xA, 0x11, 0xE, 0x0,}; // fetching Valve Data indicator
                              // Set the pins on the I2C chip used for LCD connections:
                              //                    addr, en,rw,rs,d4,d5,d6,d7,bl,blpol
                              LiquidCrystal_I2C lcd(0x3F, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);  // Set the LCD I2C address to 0x27
                              MySensor gw;
                              //
                              MyMessage msg1valve(CHILD_ID_SPRINKLER, V_LIGHT);
                              MyMessage var1valve(CHILD_ID_SPRINKLER, V_VAR1);
                              MyMessage var2valve(CHILD_ID_SPRINKLER, V_VAR2);
                              //
                              void setup()
                              {
                                SERIAL_START(115200);
                                DEBUG_PRINTLN(F("Initialising..."));
                                pinMode(latchPin, OUTPUT);
                                pinMode(clockPin, OUTPUT);
                                pinMode(dataPin, OUTPUT);
                                pinMode(ledPin, OUTPUT);
                                pinMode(waterButtonPin, INPUT_PULLUP);
                                //pinMode(waterButtonPin, INPUT);
                                attachInterrupt(1, PushButton, RISING); //May need to change for your Arduino model
                                digitalWrite (ledPin, HIGH);
                                DEBUG_PRINTLN(F("Turning All Valves Off..."));
                                updateRelays(ALL_VALVES_OFF);
                                pinMode(outputEnablePin, OUTPUT);
                                digitalWrite (outputEnablePin, LOW);
                              <some code>
                              

                              If somebody can update this project in github and that fritzling draw - would be super nice.

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

                              @Huczas Great, thanks! Have you tested these updates? Also, can you post a link the info on hackerspace?

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

                              HuczasH 1 Reply Last reply
                              0
                              • petewillP petewill

                                @Huczas Great, thanks! Have you tested these updates? Also, can you post a link the info on hackerspace?

                                HuczasH Offline
                                HuczasH Offline
                                Huczas
                                wrote on last edited by
                                #248

                                @petewill
                                Yes, I've tested this and it's working well!
                                Link to the hackerspace - HackerSpace Warsaw, they are on irc - where I talk with them, #hackerspace-pl at freenode servers.

                                petewillP 2 Replies Last reply
                                0
                                • HuczasH Huczas

                                  @petewill
                                  Yes, I've tested this and it's working well!
                                  Link to the hackerspace - HackerSpace Warsaw, they are on irc - where I talk with them, #hackerspace-pl at freenode servers.

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

                                  @Huczas Oh, ok. I thought it was a forum post. Thanks for the update. I will work to get this updated.

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

                                  1 Reply Last reply
                                  0
                                  • HuczasH Huczas

                                    @petewill
                                    Yes, I've tested this and it's working well!
                                    Link to the hackerspace - HackerSpace Warsaw, they are on irc - where I talk with them, #hackerspace-pl at freenode servers.

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

                                    @Huczas the code has been updated in the 2.0 GitHub branch. The wiring diagram has also been updated. Thanks for the fix!

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

                                    HuczasH 1 Reply Last reply
                                    1
                                    • petewillP petewill

                                      @Huczas the code has been updated in the 2.0 GitHub branch. The wiring diagram has also been updated. Thanks for the fix!

                                      HuczasH Offline
                                      HuczasH Offline
                                      Huczas
                                      wrote on last edited by
                                      #251

                                      @petewill as I sad before - pull up 1k resistor and wire it to Arduino pin 6 - I mean

                                      pull up - connect to power,
                                      so should be 1k resistor connected with power source(that make sence with pull up) and also with pin 6. Like below:
                                      0_1477751319151_Przechwytywanie.PNG

                                      petewillP 1 Reply Last reply
                                      0
                                      • HuczasH Huczas

                                        @petewill as I sad before - pull up 1k resistor and wire it to Arduino pin 6 - I mean

                                        pull up - connect to power,
                                        so should be 1k resistor connected with power source(that make sence with pull up) and also with pin 6. Like below:
                                        0_1477751319151_Przechwytywanie.PNG

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

                                        @Huczas Ah, missed that. I fixed it.

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

                                        1 Reply Last reply
                                        0
                                        • B Offline
                                          B Offline
                                          bsivley
                                          wrote on last edited by
                                          #253

                                          I just finished building this but when I go to upload the code to my arduino i get this error

                                          'byte clock [8]' redeclared as different kind of symbol

                                          what does this mean ?

                                          thanks

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


                                          7

                                          Online

                                          11.7k

                                          Users

                                          11.2k

                                          Topics

                                          113.1k

                                          Posts


                                          Copyright 2025 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