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. Relay output activates when power off/on

Relay output activates when power off/on

Scheduled Pinned Locked Moved Development
8 Posts 3 Posters 1.2k Views 3 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.
  • JoupilJ Offline
    JoupilJ Offline
    Joupil
    wrote on last edited by
    #1

    Hi,
    I've just discovered NodeManager. Wow! So simple for coding great stuffs and mixing functions!
    Unfortunately I'm stuck resolving the issue below.
    The last node I created was built to open 3 doors (I've hacked an old Somfy remote controller) Each door is open/closed using a relay. I've used SensorLatchingRelay1Pin three times. It works like a charm.
    The problem is that when unplugging the node then replug it the relays are all activating. In case off power failure all doors will open at last!
    Is there something to know to solve that major issue?
    Thanks in advance,
    NodeManager Padawan.

    dbemowskD 1 Reply Last reply
    0
    • gohanG Offline
      gohanG Offline
      gohan
      Mod
      wrote on last edited by
      #2

      Do your relais activate when pin goes low?

      1 Reply Last reply
      0
      • JoupilJ Joupil

        Hi,
        I've just discovered NodeManager. Wow! So simple for coding great stuffs and mixing functions!
        Unfortunately I'm stuck resolving the issue below.
        The last node I created was built to open 3 doors (I've hacked an old Somfy remote controller) Each door is open/closed using a relay. I've used SensorLatchingRelay1Pin three times. It works like a charm.
        The problem is that when unplugging the node then replug it the relays are all activating. In case off power failure all doors will open at last!
        Is there something to know to solve that major issue?
        Thanks in advance,
        NodeManager Padawan.

        dbemowskD Offline
        dbemowskD Offline
        dbemowsk
        wrote on last edited by
        #3

        @joupil Look in your setup() routine where you define the relay pins as outputs with:

        pinmode(relay, OUTPUT)
        

        and immediately after that, add this:

        dititalWrite(relay, HIGH);  //Or use LOW instead of HIGH depending on your relays
        

        to tell them to start in the off position. If you are using latching relays, depending on the type, you may need something else.

        Vera Plus running UI7 with MySensors, Sonoffs and 1-Wire devices
        Visit my website for more Bits, Bytes and Ramblings from me: http://dan.bemowski.info/

        1 Reply Last reply
        0
        • JoupilJ Offline
          JoupilJ Offline
          Joupil
          wrote on last edited by
          #4

          Thanks for all.

          NodeManager presents this method:

          // what to do during setup
          void SensorDigitalOutput::onSetup() {
          // setup the pin
          pinMode(_pin, OUTPUT);
          // setup the off pin if needed
          if (_pin_off > 0) pinMode(_pin_off, OUTPUT);
          // report immediately
          _report_timer->unset();
          // turn the relay off by default
          setStatus(OFF);
          }

          Shall I write :
          // setup the pin
          pinMode(_pin, OUTPUT);
          dititalWrite(_pin, HIGH);

          or turn the relay On by default?

          Thank you

          dbemowskD 1 Reply Last reply
          0
          • JoupilJ Joupil

            Thanks for all.

            NodeManager presents this method:

            // what to do during setup
            void SensorDigitalOutput::onSetup() {
            // setup the pin
            pinMode(_pin, OUTPUT);
            // setup the off pin if needed
            if (_pin_off > 0) pinMode(_pin_off, OUTPUT);
            // report immediately
            _report_timer->unset();
            // turn the relay off by default
            setStatus(OFF);
            }

            Shall I write :
            // setup the pin
            pinMode(_pin, OUTPUT);
            dititalWrite(_pin, HIGH);

            or turn the relay On by default?

            Thank you

            dbemowskD Offline
            dbemowskD Offline
            dbemowsk
            wrote on last edited by
            #5

            @joupil I guess the first thing is to know if you are actually using a latching relay or a standard relay module. If it is a standard relay module, then you need to check whether it is an active high or active low module. I believe that was the reason for @gohan's question. If your goal is to have the relay off when the node starts up, then there should be somewhere in NodeManager that would allow you to define what type of relay module you have, whether it is active high, or active low. It looks like this line calls a routine to set the relay to off by default during setup:

            // turn the relay off by default
            setStatus(OFF);
            

            So the problem may be that you have your relay module defined wrong in NodeManger. I haven't used NodeManager myself yet, so I don't know how it works, but that would be my guess.

            Vera Plus running UI7 with MySensors, Sonoffs and 1-Wire devices
            Visit my website for more Bits, Bytes and Ramblings from me: http://dan.bemowski.info/

            1 Reply Last reply
            0
            • gohanG Offline
              gohanG Offline
              gohan
              Mod
              wrote on last edited by
              #6

              In fact I was asking because it is a common problem when using active low relay boards

              1 Reply Last reply
              0
              • JoupilJ Offline
                JoupilJ Offline
                Joupil
                wrote on last edited by
                #7

                Hello,
                Unfortunatly none of these methods worked for me.

                • "setStatus(OFF);" was already set in NodeManager
                • I tried to set it "ON": the result was the same
                • I changed this setup to "dititalWrite(_pin, HIGH);" then the debugger displays "digitalWrite not declared" (well, I don't know what to do, I'm not an experienced coder)

                For all: the relays turn on when pins go high.

                To me the original setup is correct but with no effect at startup. (Setup is in the file NodeManagerLibrary.ino)

                I wrote a simple program 2 years ago and wanted to switch to NodeManager. But this issue is annoying. In this old program the method was following:
                // Fetch relay status
                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)
                present(sensor, S_BINARY);
                // Then set relay pins in output mode
                pinMode(pin, OUTPUT);
                // Set relay to 0
                digitalWrite(pin, RELAY_OFF);}

                This worked fine with no relay switch at startup.

                Still stuck...

                Thank you in advance for your help.

                Joupil

                1 Reply Last reply
                0
                • JoupilJ Offline
                  JoupilJ Offline
                  Joupil
                  wrote on last edited by
                  #8

                  Hi,
                  I solved this issue by simply commenting
                  //setStatus(OFF);
                  in NodeManagerLibrary.ino

                  Thanks for all

                  Joupil

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


                  20

                  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