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. Troubleshooting
  3. node stalled

node stalled

Scheduled Pinned Locked Moved Troubleshooting
11 Posts 2 Posters 2.1k Views 2 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.
  • jjkJ Offline
    jjkJ Offline
    jjk
    wrote on last edited by
    #1

    Hi there,
    I've been encountering a strange issue with one my nodes and can't seem to figure out how to fix it. The node is built with an arduino nano, nrf24, and a HC-SR04 distance sensor. Things worked out o.k. for a while, then I updated the sketch so the sensor would only send a measurement every 5 minutes. Now, every time I restart the node and check via serial monitor, I only get a few lines, then the whole thing stalls.

    3 TSM:INIT
    4 TSF:WUR:MS=1
    11 TSM:INIT:TSP OK
    12 TSM:INIT:STATID=151
    15 TSF:SID:OK,ID=15

    I've tried to clear the eeprom, and uploaded the sketch again, but that won't change a thing. My sketch is included below.

    Any idea is welcome at this point...

    Thanks,
    JJK

    // Enable debug prints
    #define MY_DEBUG
    #define MY_DEBUG_VERBOSE
    #define MY_TRANSPORT_WAIT_READY_MS 1
    
    // define node specific configuration
    #define MY_NODE_ID 151
    #define MY_PARENT_NODE_ID 21
    //#define MY_PARENT_NODE_IS_STATIC
    
    // Enable and select radio type attached
    #define MY_RADIO_NRF24
    //#define MY_RADIO_RFM69
    
    #include <SPI.h>
    #include <MySensors.h>  
    #include <NewPing.h>
    
    #define CHILD_ID 1
    #define TRIGGER_PIN  6  // Arduino pin tied to trigger pin on the ultrasonic sensor.
    #define ECHO_PIN     5  // Arduino pin tied to echo pin on the ultrasonic sensor.
    #define MAX_DISTANCE 200 // Maximum distance we want to ping for (in centimeters). Maximum sensor distance is rated at 400-500cm.
    unsigned long SLEEP_TIME = 300000; // Sleep time between reads (in milliseconds)
    
    NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE); // NewPing setup of pins and maximum distance.
    MyMessage msg(CHILD_ID, V_DISTANCE);
    int lastDist;
    bool metric = true;
    
    void setup()  
    { 
      metric = getControllerConfig().isMetric;
    }
    
    void presentation() {
      // Send the sketch version information to the gateway and Controller
      sendSketchInfo("Distance Sensor", "1.0");
    
      // Register all sensors to gw (they will be created as child devices)
      present(CHILD_ID, S_DISTANCE);
    }
    
    void loop()      
    {     
      int dist = metric?sonar.ping_cm():sonar.ping_in();
      Serial.print("Ping: ");
      Serial.print(dist); // Convert ping time to distance in cm and print result (0 = outside set distance range)
      Serial.println(metric?" cm":" in");
    
      if (dist != lastDist) {
          send(msg.set(dist));
          lastDist = dist;
      }
    
      wait(5000);
      smartSleep(SLEEP_TIME);
    
    gohanG 1 Reply Last reply
    0
    • jjkJ jjk

      Hi there,
      I've been encountering a strange issue with one my nodes and can't seem to figure out how to fix it. The node is built with an arduino nano, nrf24, and a HC-SR04 distance sensor. Things worked out o.k. for a while, then I updated the sketch so the sensor would only send a measurement every 5 minutes. Now, every time I restart the node and check via serial monitor, I only get a few lines, then the whole thing stalls.

      3 TSM:INIT
      4 TSF:WUR:MS=1
      11 TSM:INIT:TSP OK
      12 TSM:INIT:STATID=151
      15 TSF:SID:OK,ID=15

      I've tried to clear the eeprom, and uploaded the sketch again, but that won't change a thing. My sketch is included below.

      Any idea is welcome at this point...

      Thanks,
      JJK

      // Enable debug prints
      #define MY_DEBUG
      #define MY_DEBUG_VERBOSE
      #define MY_TRANSPORT_WAIT_READY_MS 1
      
      // define node specific configuration
      #define MY_NODE_ID 151
      #define MY_PARENT_NODE_ID 21
      //#define MY_PARENT_NODE_IS_STATIC
      
      // Enable and select radio type attached
      #define MY_RADIO_NRF24
      //#define MY_RADIO_RFM69
      
      #include <SPI.h>
      #include <MySensors.h>  
      #include <NewPing.h>
      
      #define CHILD_ID 1
      #define TRIGGER_PIN  6  // Arduino pin tied to trigger pin on the ultrasonic sensor.
      #define ECHO_PIN     5  // Arduino pin tied to echo pin on the ultrasonic sensor.
      #define MAX_DISTANCE 200 // Maximum distance we want to ping for (in centimeters). Maximum sensor distance is rated at 400-500cm.
      unsigned long SLEEP_TIME = 300000; // Sleep time between reads (in milliseconds)
      
      NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE); // NewPing setup of pins and maximum distance.
      MyMessage msg(CHILD_ID, V_DISTANCE);
      int lastDist;
      bool metric = true;
      
      void setup()  
      { 
        metric = getControllerConfig().isMetric;
      }
      
      void presentation() {
        // Send the sketch version information to the gateway and Controller
        sendSketchInfo("Distance Sensor", "1.0");
      
        // Register all sensors to gw (they will be created as child devices)
        present(CHILD_ID, S_DISTANCE);
      }
      
      void loop()      
      {     
        int dist = metric?sonar.ping_cm():sonar.ping_in();
        Serial.print("Ping: ");
        Serial.print(dist); // Convert ping time to distance in cm and print result (0 = outside set distance range)
        Serial.println(metric?" cm":" in");
      
        if (dist != lastDist) {
            send(msg.set(dist));
            lastDist = dist;
        }
      
        wait(5000);
        smartSleep(SLEEP_TIME);
      
      gohanG Offline
      gohanG Offline
      gohan
      Mod
      wrote on last edited by
      #2

      @jjk is there a specific reason to use MY_PARENT_NODE_ID? Do you have also a log on gateway or gateway doesn't receive anything? Have you checked the repeater that it seems you are using?

      jjkJ 1 Reply Last reply
      0
      • gohanG gohan

        @jjk is there a specific reason to use MY_PARENT_NODE_ID? Do you have also a log on gateway or gateway doesn't receive anything? Have you checked the repeater that it seems you are using?

        jjkJ Offline
        jjkJ Offline
        jjk
        wrote on last edited by
        #3

        @gohan: the reason I'm using MY_PARENT_NODE_ID is to ensure connection to the repeater. The sensor in question is outside in the yard and I won't get it to connect to the gateway otherwise.

        Yes, I have checked, both the repeater node and the gateway and both are talking to each other (gw and repeater), but neither is getting any signals from the node in question. Strangely enough, this setup had worked before I updated the sketch in this particular node...

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

          Have you updated boards definitions and Arduino ide?

          jjkJ 1 Reply Last reply
          0
          • gohanG gohan

            Have you updated boards definitions and Arduino ide?

            jjkJ Offline
            jjkJ Offline
            jjk
            wrote on last edited by
            #5

            @gohan yeah, it's all up to date - plus other node work as desired even after updating today...

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

              Did you try to swap radios on the nodes? Or swap the Arduinos? Or power supplies? Just try to move things around and see if the problem follows something you moved

              jjkJ 1 Reply Last reply
              0
              • gohanG gohan

                Did you try to swap radios on the nodes? Or swap the Arduinos? Or power supplies? Just try to move things around and see if the problem follows something you moved

                jjkJ Offline
                jjkJ Offline
                jjk
                wrote on last edited by
                #7

                @gohan no, I have not et swapped hardware... That's on my to-do for the next days, but I was hoping that the problem is a known one with a more or less easy fix. If i's a bad piece of hardware, I guess I will have to got through the swapping exercise... It's just strange that the issue showed up after updating the sketch?!

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

                  Try downgrading the board definitions like to 1.6.11 or mysensors to 2.1.0

                  jjkJ 1 Reply Last reply
                  0
                  • gohanG gohan

                    Try downgrading the board definitions like to 1.6.11 or mysensors to 2.1.0

                    jjkJ Offline
                    jjkJ Offline
                    jjk
                    wrote on last edited by
                    #9

                    @gohan, hm not sure I get what you're suggesting...?! I had not changed anything before updating the sketch, so should that really make a difference? The ide and libraries are the same I have used a day or two ago to install the initial sketch - the one that worked?!

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

                      Oh ok, I thought more time has passed. Never mind then. Maybe could be a faulty electronics: it can happen that faulty components break after few hours or days

                      1 Reply Last reply
                      0
                      • jjkJ Offline
                        jjkJ Offline
                        jjk
                        wrote on last edited by
                        #11

                        o.k., quick update... contrary to what I reported yesterday, it now looks like my gateway is getting sensor readings from the node in question at irregular intervals. strangely enough, when I connect my Mac and launch the serial monitor, the sensor printout still stops after just the few lines above. Has anybody ever experienced something like this before?

                        Still need to do the hardware swapping to see if this is related to a malfunction of any of the components.

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


                        9

                        Online

                        11.7k

                        Users

                        11.2k

                        Topics

                        113.0k

                        Posts


                        Copyright 2019 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