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.
  • 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
                    • B bsivley

                      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 Offline
                      petewillP Offline
                      petewill
                      Admin
                      wrote on last edited by
                      #254

                      @bsivley Are you using the libraries from the MySensors github page (https://github.com/mysensors/MySensorsArduinoExamples/tree/master/libraries)? I just compiled it without any errors. What version of the Arduino IDE are you using? What version of MySensors are you using?

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

                      Andrej_ABA 1 Reply Last reply
                      0
                      • petewillP petewill

                        @bsivley Are you using the libraries from the MySensors github page (https://github.com/mysensors/MySensorsArduinoExamples/tree/master/libraries)? I just compiled it without any errors. What version of the Arduino IDE are you using? What version of MySensors are you using?

                        Andrej_ABA Offline
                        Andrej_ABA Offline
                        Andrej_AB
                        wrote on last edited by
                        #255

                        @petewill Hi, Please can you advise what version Arduino IDE you are using for this sketch?

                        rechin304R 1 Reply Last reply
                        0
                        • Andrej_ABA Andrej_AB

                          @petewill Hi, Please can you advise what version Arduino IDE you are using for this sketch?

                          rechin304R Offline
                          rechin304R Offline
                          rechin304
                          wrote on last edited by
                          #256
                          This post is deleted!
                          1 Reply Last reply
                          0
                          • Andrej_ABA Offline
                            Andrej_ABA Offline
                            Andrej_AB
                            wrote on last edited by
                            #257

                            Hi, Maybe somebody can help me with this issue? Managed to upload code for irrigation controller with Arduino IDE 1.6.12 but can't pair with Vera controller.

                            petewillP 1 Reply Last reply
                            0
                            • Andrej_ABA Andrej_AB

                              Hi, Maybe somebody can help me with this issue? Managed to upload code for irrigation controller with Arduino IDE 1.6.12 but can't pair with Vera controller.

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

                              @Andrej_AB I'm using 1.6.12 but I haven't changed my node to 2.0 yet.
                              What is the issue you are having with pairing? Do you see the presentation messages on your gateway? Do you have other nodes successfully paired with your Vera?

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

                              Andrej_ABA 1 Reply Last reply
                              0
                              • petewillP petewill

                                @Andrej_AB I'm using 1.6.12 but I haven't changed my node to 2.0 yet.
                                What is the issue you are having with pairing? Do you see the presentation messages on your gateway? Do you have other nodes successfully paired with your Vera?

                                Andrej_ABA Offline
                                Andrej_ABA Offline
                                Andrej_AB
                                wrote on last edited by
                                #259

                                @petewill Hi, All my other nodes have successfully paired with Vera, but irrigation controller node can't pair with Vera, I have started inclusion mode on Vera, one minute passed 0 devices found.
                                Please see attached picture.
                                0_1480325874006_Vera inclusion.png

                                0_1480325904307_irrigation node.png

                                petewillP 1 Reply Last reply
                                0
                                • Andrej_ABA Andrej_AB

                                  @petewill Hi, All my other nodes have successfully paired with Vera, but irrigation controller node can't pair with Vera, I have started inclusion mode on Vera, one minute passed 0 devices found.
                                  Please see attached picture.
                                  0_1480325874006_Vera inclusion.png

                                  0_1480325904307_irrigation node.png

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

                                  @Andrej_AB It looks like it's communicating ok because it's getting the time. Have you ever had a mysenors node #5 in your Vera previously and deleted it? Could it be that the Vera thinks it's already there? What happens if you clear your eeprom on your irrigation controller then manually assign a different ID and then try to pair it again?

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

                                  Andrej_ABA 1 Reply Last reply
                                  0
                                  • petewillP petewill

                                    @Andrej_AB It looks like it's communicating ok because it's getting the time. Have you ever had a mysenors node #5 in your Vera previously and deleted it? Could it be that the Vera thinks it's already there? What happens if you clear your eeprom on your irrigation controller then manually assign a different ID and then try to pair it again?

                                    Andrej_ABA Offline
                                    Andrej_ABA Offline
                                    Andrej_AB
                                    wrote on last edited by
                                    #261

                                    @petewill said:

                                    @Andrej_AB It looks like it's communicating ok because it's getting the time. Have you ever had a mysenors node #5 in your Vera previously and deleted it? Could it be that the Vera thinks it's already there? What happens if you clear your eeprom on your irrigation controller then manually assign a different ID and then try to pair it again?

                                    Also thinking about it, eprom was cleaned and manually assigned new ID but still can't pair with Vera.
                                    Today I tried upload sketch from My sensors library 1.5.4 and node was successfully paired with Vera, then tried again last sketch and again can't pair.

                                    petewillP 1 Reply Last reply
                                    0
                                    • Andrej_ABA Andrej_AB

                                      @petewill said:

                                      @Andrej_AB It looks like it's communicating ok because it's getting the time. Have you ever had a mysenors node #5 in your Vera previously and deleted it? Could it be that the Vera thinks it's already there? What happens if you clear your eeprom on your irrigation controller then manually assign a different ID and then try to pair it again?

                                      Also thinking about it, eprom was cleaned and manually assigned new ID but still can't pair with Vera.
                                      Today I tried upload sketch from My sensors library 1.5.4 and node was successfully paired with Vera, then tried again last sketch and again can't pair.

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

                                      @Andrej_AB Can you post the full log from your sensor? The device is never getting presented in what you've posted so far. I don't have enough time to dig in to the code to know if this will help but can you try moving

                                      void presentation()  
                                      { 
                                        sendSketchInfo(SKETCH_NAME, SKETCH_VERSION);
                                        for (byte i = 0; i <= NUMBER_OF_VALVES; i++)
                                        {
                                          present(i, S_LIGHT);
                                        }
                                      }
                                      

                                      so it's above

                                      void setup()
                                      

                                      I still haven't updated my irrigation controller to 2.0 yet so I haven't tested any of the code.

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

                                      Andrej_ABA 1 Reply Last reply
                                      0
                                      • petewillP petewill

                                        @Andrej_AB Can you post the full log from your sensor? The device is never getting presented in what you've posted so far. I don't have enough time to dig in to the code to know if this will help but can you try moving

                                        void presentation()  
                                        { 
                                          sendSketchInfo(SKETCH_NAME, SKETCH_VERSION);
                                          for (byte i = 0; i <= NUMBER_OF_VALVES; i++)
                                          {
                                            present(i, S_LIGHT);
                                          }
                                        }
                                        

                                        so it's above

                                        void setup()
                                        

                                        I still haven't updated my irrigation controller to 2.0 yet so I haven't tested any of the code.

                                        Andrej_ABA Offline
                                        Andrej_ABA Offline
                                        Andrej_AB
                                        wrote on last edited by
                                        #263

                                        @petewill Finally managed to pair node with Vera controller, many thanks to @petewill for assistance with this issue.

                                        //
                                        #define NUMBER_OF_VALVES 6  // Change this to set your valve count up to 16.
                                        #define VALVE_RESET_TIME 7500UL   // Change this (in milliseconds) for the time you need your valves to hydraulically reset and change state
                                        #define RADIO_ID 7  // Set this to fix your Radio ID or use Auto```
                                        1 Reply Last reply
                                        0
                                        • impertusI Offline
                                          impertusI Offline
                                          impertus
                                          wrote on last edited by m26872
                                          #264

                                          hey @petewill

                                          finally i am done making the controller. but when i want to upload the code i get the error..

                                          
                                          C:\Users\crame\Desktop\Vanding\Vanding.ino: In function 'void setup()':
                                          
                                          Vanding:112: error: 'lcd' was not declared in this scope
                                          
                                             lcd.begin(16, 2); //(16 characters and 2 line display)
                                          
                                             ^
                                          
                                          C:\Users\crame\Desktop\Vanding\Vanding.ino: In function 'void loop()':
                                          
                                          Vanding:255: error: 'lcd' was not declared in this scope
                                          
                                                 lcd.clear();
                                          
                                                 ^
                                          
                                          C:\Users\crame\Desktop\Vanding\Vanding.ino: In function 'void displayMenu()':
                                          
                                          Vanding:388: error: 'lcd' was not declared in this scope
                                          
                                               lcd.clear();
                                          
                                               ^
                                          
                                          Vanding:399: error: 'lcd' was not declared in this scope
                                          
                                               lcd.print(F("."));
                                          
                                               ^
                                          
                                          C:\Users\crame\Desktop\Vanding\Vanding.ino: In function 'void updateDisplay()':
                                          
                                          Vanding:589: error: 'lcd' was not declared in this scope
                                          
                                                   lcd.setCursor(0, 0);
                                          
                                                   ^
                                          
                                          C:\Users\crame\Desktop\Vanding\Vanding.ino: In function 'void fastClear()':
                                          
                                          Vanding:750: error: 'lcd' was not declared in this scope
                                          
                                             lcd.setCursor(0, 0);
                                          
                                             ^
                                          
                                          C:\Users\crame\Desktop\Vanding\Vanding.ino: In function 'void updateClock()':
                                          
                                          Vanding:762: error: 'lcd' was not declared in this scope
                                          
                                               lcd.setCursor(15, 0);
                                          
                                               ^
                                          
                                          C:\Users\crame\Desktop\Vanding\Vanding.ino: In function 'void goGetValveTimes()':
                                          
                                          Vanding:791: error: 'lcd' was not declared in this scope
                                          
                                               lcd.setCursor(15, 0);
                                          
                                               ^
                                          
                                          exit status 1
                                          'lcd' was not declared in this scope
                                          

                                          do you have some help 4 me??

                                          dbemowskD 2 Replies Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          12

                                          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