Relay output activates when power off/on



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


  • Mod

    Do your relais activate when pin goes low?



  • @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.



  • 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



  • @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.


  • Mod

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



  • 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



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

    Thanks for all

    Joupil


Log in to reply
 

Suggested Topics

  • 1
  • 198
  • 1
  • 2
  • 2
  • 2

0
Online

11.2k
Users

11.1k
Topics

112.5k
Posts