• Categories
    • Recent
    • Tags
    • Popular
    • Register
    • Login

    Node ACK issue

    Scheduled Pinned Locked Moved General Discussion
    17 Posts 3 Posters 2.6k Views 2 Watching
    Loading More Posts
    • 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.
    • D Offline
      Daniele
      last edited by

      I did another experiment: I defined a dummy sensor, and every time I receive a new message, I push the value I received on this dummy sensor.
      In this case, even with the ack turned off, after 5 or 6 status changes the node goes offline.
      Seems like the continuous exchange of messages hangs something after a while.

      PS: I only have an ethernet GW, sincce the position where I have my Raspberry with Mycontroller is not easily reachable with wireless connection.

      jkandasaJ 1 Reply Last reply Reply Quote 0
      • jkandasaJ Offline
        jkandasa @Daniele
        last edited by

        @daniele Dummy sensor attached with dummy node? If yes, it is expected behavior(as dummy node does not response for node alive check).

        I do not have ethernet GW at this time. I will try to set up locally.

        Do you have only one node or more than one? If more than one, same behavior across all the nodes?
        Next time when it goes offline, can you reboot your GW alone and check everything comes normal?

        1 Reply Last reply Reply Quote 0
        • D Offline
          Daniele
          last edited by

          @jkandasa dummy sensor on the same real node, disabling ack on the GW (please look at commented lines in the code):

          // Enable debug prints to serial monitor
          #define MY_DEBUG
          
          // Enable and select radio type attached
          #define MY_RADIO_NRF24
          #define MY_RF24_PA_LEVEL   RF24_PA_MIN
          #define MY_RF24_DATARATE   RF24_250KBPS
          #define MY_RF24_CHANNEL 125
          
          #define MY_NODE_ID 1
          
          #define CHILD_ID_RELAY 2
          //#define CHILD_ID_RELAY_C 3
          
          #define relayPin 5
          #define ledPin 6
          #define ventolePin 7
          
          #define RELAY_ON 1  // GPIO value to write to turn on attached relay
          #define RELAY_OFF 0 // GPIO value to write to turn off attached relay
          
          #include <MySensors.h>
          
          //MyMessage msgRELAY(CHILD_ID_RELAY_C, V_STATUS);
          
          
          unsigned int relay;
          unsigned int new_msg = 0;
          
          
          
          void before()
          {
            pinMode(ledPin, OUTPUT);
            pinMode(relayPin, OUTPUT);
            pinMode(ventolePin, OUTPUT);
          
            // Set relay to last known state (using eeprom storage)
            relay = loadState(CHILD_ID_RELAY)?RELAY_ON:RELAY_OFF;
            digitalWrite(ledPin, relay);
            digitalWrite(relayPin, relay);
            digitalWrite(ventolePin, relay);
          }
          
          
          void setup() {
          }
          
          
          
          void presentation()
          {
            sendSketchInfo("P0 - PIR Caldaia", "1.2");
            present(CHILD_ID_RELAY, S_BINARY, "P0 Consenso Caldaia");
            //present(CHILD_ID_RELAY_C, S_BINARY, "P0 Consenso Check");
          }
          
          
          
          void loop() {
          
            if (new_msg == 1){
              
              digitalWrite(ledPin, relay);
              digitalWrite(relayPin, relay);
              digitalWrite(ventolePin, relay);
          
              saveState(CHILD_ID_RELAY, relay);
              //send(msgRELAY.set(relay));
              new_msg = 0;
          
              #ifdef MY_DEBUG
              Serial.print("Relay: ");
              Serial.println(relay);
              #endif
              
            }
          
            wait(500);
          
          }
          
          
          
          
          void receive(const MyMessage &message)
          {
            #ifdef MY_DEBUG
            Serial.println("*** Receiving ***");
            #endif
          
            
            if (message.type == V_STATUS && message.sensor == CHILD_ID_RELAY) {
          
              relay = message.getBool()?RELAY_ON:RELAY_OFF;
              new_msg = 1;
          
            }
          
          }
          

          I have more than one node, but just another is an actuator, and is connected to a different ethernet GW (and it seems to be much more stable, even if not 100%).

          I'll try to reboot the GW and let you know the result.

          jkandasaJ T 2 Replies Last reply Reply Quote 0
          • jkandasaJ Offline
            jkandasa @Daniele
            last edited by

            @daniele Thank you for the update. After implemented ack feature, I never tested ethernet gateway. I will do it when I get time. Kindly update your findings. It might help us to narrow down the issue.

            1 Reply Last reply Reply Quote 0
            • D Offline
              Daniele
              last edited by

              Apparently nothing changes if I reboot the ethernet GW, the node remains disconnected.

              jkandasaJ 1 Reply Last reply Reply Quote 0
              • jkandasaJ Offline
                jkandasa @Daniele
                last edited by

                @daniele looks like the problem on node side.

                1 Reply Last reply Reply Quote 0
                • D Offline
                  Daniele
                  last edited by

                  I fully agree with you, but I cannot understand what can be causing the issue.
                  On the software side, do you suggest any change on the node code?
                  Could it be an hardware issue?
                  I tried changing both the arduino and the NRF24, but without any luck.
                  I tried switching from the 3.3V pin to the 5V pin with a voltage regulator, but still the same issue.

                  jkandasaJ 1 Reply Last reply Reply Quote 0
                  • jkandasaJ Offline
                    jkandasa @Daniele
                    last edited by

                    @daniele Can you try with a different version of MySensors library? What the current version of MySensor library?

                    1 Reply Last reply Reply Quote 0
                    • D Offline
                      Daniele
                      last edited by

                      I'm using version 2.2.0, which is the last one.

                      jkandasaJ 1 Reply Last reply Reply Quote 0
                      • jkandasaJ Offline
                        jkandasa @Daniele
                        last edited by

                        @daniele ok, When I get time, I will try to reproduce this locally.

                        1 Reply Last reply Reply Quote 0
                        • T Offline
                          Tag MOD @Daniele
                          last edited by Tag

                          @daniele said in Node ACK issue:

                          pinMode(ledPin, OUTPUT);
                          pinMode(relayPin, OUTPUT);
                          pinMode(ventolePin, OUTPUT);

                          // Set relay to last known state (using eeprom storage)
                          relay = loadState(CHILD_ID_RELAY)?RELAY_ON:RELAY_OFF;

                          Hi!,

                          Might not be an issue, however from a code perspective you should set the stuff below in the setup loop:

                           pinMode(ledPin, OUTPUT);
                            pinMode(relayPin, OUTPUT);
                            pinMode(ventolePin, OUTPUT);
                          
                            // Set relay to last known state (using eeprom storage)
                            relay = loadState(CHILD_ID_RELAY)?RELAY_ON:RELAY_OFF;
                          

                          Before() is called prior to setup... not sure if this really is an issue, but just try it...

                          What might help is the example from the mysensors site. It contains an example to control relays:
                          https://www.mysensors.org/build/relay

                          It does basically the same you want... can you try the example?

                          1 Reply Last reply Reply Quote 0
                          • D Offline
                            Daniele
                            last edited by

                            That's exactly the example I started with, then I changed it trying to avoid this issue (basically I only change the value of a variable during the receive() function to reduce the time needed to process a new message).

                            I also tried using the setup() instead of the before(), but the effect is the same.

                            1 Reply Last reply Reply Quote 0
                            • D Offline
                              Daniele
                              last edited by

                              @jkandasa , the ack issue is probably related to some hardware interference, not to your code.

                              Yesterday as a last test I turned off a wireless thermostat I have close to arduino (working on 433 Mhz, so really far from the 2.4 GHz I use with NRF24), and the disconnections suddenly disappeared!

                              I'm sorry I bothered you.
                              Thank you very much for your support!
                              Daniele

                              jkandasaJ 1 Reply Last reply Reply Quote 0
                              • jkandasaJ Offline
                                jkandasa @Daniele
                                last edited by

                                @daniele no worries. I am happy that you find the root cause of the issue 🙂

                                1 Reply Last reply Reply Quote 0
                                • First post
                                  Last post

                                0

                                Online

                                589

                                Users

                                529

                                Topics

                                3.4k

                                Posts
                                Copyright © 2015-2025 MyController.org | Contributors | Localization