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. Development
  3. Problem with multiple relays and delays

Problem with multiple relays and delays

Scheduled Pinned Locked Moved Development
16 Posts 6 Posters 5.5k Views 6 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.
  • Z Offline
    Z Offline
    zrom69
    wrote on last edited by
    #7

    hi friends which works for 3 motorized shutters and how Arduino thank you

    parachutesjP 1 Reply Last reply
    0
    • Z zrom69

      hi friends which works for 3 motorized shutters and how Arduino thank you

      parachutesjP Offline
      parachutesjP Offline
      parachutesj
      wrote on last edited by
      #8

      @zrom69 is this a question or statement?

      1 Reply Last reply
      0
      • Z Offline
        Z Offline
        zrom69
        wrote on last edited by
        #9

        I'm sorry for my English, I'm French
        I try to control node 3 and motorized shutters which card must be used aduino thank you
        :smiley:

        parachutesjP 1 Reply Last reply
        0
        • Z zrom69

          I'm sorry for my English, I'm French
          I try to control node 3 and motorized shutters which card must be used aduino thank you
          :smiley:

          parachutesjP Offline
          parachutesjP Offline
          parachutesj
          wrote on last edited by
          #10

          @zrom69 no worries.
          I am using arduino Nano but others will work too. The Nano is small enough and easy to program (it has USB). The Pro Mini is also a good option, but needs extra programer (it has only serial connectors).
          I am using those and all work very well:
          http://www.banggood.com/5Pcs-ATmega328P-Nano-V3-Controller-Board-For-Arduino-Improved-Version-p-951797.html
          In addition you need the relays - you either could build that yourself or use ready to use ones:
          http://www.banggood.com/5V-4-Channel-Relay-Module-For-Arduino-PIC-ARM-DSP-AVR-MSP430-Blue-p-87987.html

          If you want to control shutters, you usually need 1 relay per direction. so for your 3 shutters it would be 6 relays. I am not sure if there are products out there, you could take one with 8 relays if you do have the space or make them yourself.

          The code I posted above is "ready" for 3 shutters (up/down each) and manual control buttons on an Arduino Nano.
          you need to connect the relays on digital pins 3/4 & 5/6 & 7/8 and the manual inputs on analog A0/A1, A2/A3, A4/A5 (note: pin 14 makes out of Analog A0, a digital D14)
          Besides this, connect the radio and power and you should be ready to go.

          1 Reply Last reply
          0
          • Z Offline
            Z Offline
            zrom69
            wrote on last edited by
            #11

            Hi friends
            thank you for your help I have try the code on Arduino pro mini touts the relay they work or even monument must change something in the code Arduino
            I am newbie in Arduino
            there is detection of door opening
            thanks for the help

            1 Reply Last reply
            0
            • ihtgtwtdI Offline
              ihtgtwtdI Offline
              ihtgtwtd
              wrote on last edited by
              #12

              hi @parachutesj hi @all
              i tried the sketch posted above. it works but my relay board is active low and the relays are on when they should be off. #define RELAY_ON 0 and #define RELAY_OFF 1 do not change the behavior. the relays stay on. do you have an idea what is happening? thx

              parachutesjP 1 Reply Last reply
              0
              • ihtgtwtdI ihtgtwtd

                hi @parachutesj hi @all
                i tried the sketch posted above. it works but my relay board is active low and the relays are on when they should be off. #define RELAY_ON 0 and #define RELAY_OFF 1 do not change the behavior. the relays stay on. do you have an idea what is happening? thx

                parachutesjP Offline
                parachutesjP Offline
                parachutesj
                wrote on last edited by
                #13

                @ihtgtwtd
                change in the code in the routines shutters UP/DOWN/STOP

                the parts

                digitalWrite(RELAYxxx, HIGH);
                

                HIGH to LOW and vice versa

                SJ

                ihtgtwtdI 1 Reply Last reply
                0
                • parachutesjP parachutesj

                  @ihtgtwtd
                  change in the code in the routines shutters UP/DOWN/STOP

                  the parts

                  digitalWrite(RELAYxxx, HIGH);
                  

                  HIGH to LOW and vice versa

                  SJ

                  ihtgtwtdI Offline
                  ihtgtwtdI Offline
                  ihtgtwtd
                  wrote on last edited by
                  #14

                  thanks for the quick reply. I did what you suggested and the switches work the right way but when I reset the arduino all relay contacts turn on and stay on until I give a command. this is a major problem, it will destroy the shutter motor. i think there is no defined case when the arduino powers on.

                  parachutesjP 1 Reply Last reply
                  0
                  • ihtgtwtdI ihtgtwtd

                    thanks for the quick reply. I did what you suggested and the switches work the right way but when I reset the arduino all relay contacts turn on and stay on until I give a command. this is a major problem, it will destroy the shutter motor. i think there is no defined case when the arduino powers on.

                    parachutesjP Offline
                    parachutesjP Offline
                    parachutesj
                    wrote on last edited by
                    #15

                    @ihtgtwtd
                    put this into the setup routine within the "for"

                    digitalWrite (pin, HIGH);
                    

                    e.g. like this:

                     for (int sensor = 1, pin = RELAY_1; sensor <= NUMBER_OF_RELAYS; sensor++, pin++) {
                        // Register all sensors to gw (they will be created as child devices)
                        gw.present(sensor, S_COVER);
                        // Then set relay pins in output mode
                        pinMode(pin, OUTPUT);
                        digitalWrite (pin, HIGH);
                    
                      }
                    
                    ihtgtwtdI 1 Reply Last reply
                    0
                    • parachutesjP parachutesj

                      @ihtgtwtd
                      put this into the setup routine within the "for"

                      digitalWrite (pin, HIGH);
                      

                      e.g. like this:

                       for (int sensor = 1, pin = RELAY_1; sensor <= NUMBER_OF_RELAYS; sensor++, pin++) {
                          // Register all sensors to gw (they will be created as child devices)
                          gw.present(sensor, S_COVER);
                          // Then set relay pins in output mode
                          pinMode(pin, OUTPUT);
                          digitalWrite (pin, HIGH);
                      
                        }
                      
                      ihtgtwtdI Offline
                      ihtgtwtdI Offline
                      ihtgtwtd
                      wrote on last edited by
                      #16

                      @parachutesj
                      thank you very much. looks good now.

                      1 Reply Last reply
                      1

                      Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                      Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                      With your input, this post could be even better 💗

                      Register Login
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      19

                      Online

                      12.1k

                      Users

                      11.2k

                      Topics

                      113.4k

                      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