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

    Unable to retrieve data from any node

    Scheduled Pinned Locked Moved Troubleshooting
    9 Posts 3 Posters 697 Views 1 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.
    • S Offline
      SamuelMills
      last edited by

      Hello,
      I am running mycontroller on an RPI3 with a serial gateway. My gateway includes a DTH11 sensor. My second node contains a DTH11 and BMP 280. My nodes communicate via NRF24L01+. When I view the gateway node via the serial monitor in the Arduino IDE (or putty), I can see values from both nodes, and all sensors. I also get a green Rx light on my gateway with every expected Tx of my second node. When I launch mycontroller "sudo ./start.sh" and log in with a web browser, my gateway and first node show green on the topology graphic. I do not receive any values from the DTH11, and there is no indication of my second node. After about 10 minutes, my first node appears dead to the controller. I have deleted and re-installed my gateway to no avail. I have also completed the troubleshooting under the thread "Frustrated Newbie" and after reconnecting my gateway, the auto detect found the first node, and one sensor, but not the second node or all sensors. Please help me correct this issue.

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

        @SamuelMills Where did you monitor your gateway node via serial port? on the same RPI3 or on your computer?

        How your serial gateway connected with RPI3? with an internal serial port pin or via USB-TTL connector?

        If you plan to use RPI native serial port, you should enable serial port for the user. By default, it will be used for RPI console access. You may follow this tutorial to disable console output on RPI serial port.

        1 Reply Last reply Reply Quote 0
        • S Offline
          SamuelMills
          last edited by

          @jkandasa. Thank you for taking the time to help. I am using the USB-TTL connection to my gateway.

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

            @SamuelMills Then it should not be a problem with the serial port. can you post your gateway sketch and gateway configuration screenshot? Do you see any error on MyController log file?

            1 Reply Last reply Reply Quote 0
            • S Offline
              SamuelMills
              last edited by

              @jkandasa,
              Sorry it took so long to get back to you. Here is my configuration screenshot:
              2019-01-27-124435_1366x768_scrot.png 2019-01-27-124933_1366x768_scrot.png 2019-01-27-125617_1366x768_scrot.png

              And here is my gateway sketch:

              /**
              * The MySensors Arduino library handles the wireless radio link and protocol
              * between your home built sensors/actuators and HA controller of choice.
              * The sensors forms a self healing radio network with optional repeaters. Each
              * repeater and gateway builds a routing tables in EEPROM which keeps track of the
              * network topology allowing messages to be routed to nodes.
              *
              * Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
              * Copyright (C) 2013-2015 Sensnology AB
              * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
              *
              * Documentation: http://www.mysensors.org
              * Support Forum: http://forum.mysensors.org
              *
              * This program is free software; you can redistribute it and/or
              * modify it under the terms of the GNU General Public License
              * version 2 as published by the Free Software Foundation.
              *
              *******************************
              *
              * DESCRIPTION
              * The ArduinoGateway prints data received from sensors on the serial link.
              * The gateway accepts input on seral which will be sent out on radio network.
              *
              * The GW code is designed for Arduino Nano 328p / 16MHz
              *
              * Wire connections (OPTIONAL):
              * - Inclusion button should be connected between digital pin 3 and GND
              * - RX/TX/ERR leds need to be connected between +5V (anode) and digital pin 6/5/4 with resistor 270-330R in a series
              *
              * LEDs (OPTIONAL):
              * - To use the feature, uncomment any of the MY_DEFAULT_xx_LED_PINs
              * - RX (green) - blink fast on radio message recieved. In inclusion mode will blink fast only on presentation recieved
              * - TX (yellow) - blink fast on radio message transmitted. In inclusion mode will blink slowly
              * - ERR (red) - fast blink on error during transmission error or recieve crc error
              *
              * Samuel Mills uptated this version for his personal use.
              */
              
              // Enable debug prints to serial monitor
              #define MY_DEBUG
              
              
              // Enable and select radio type attached
              #define MY_RADIO_NRF24
              //#define MY_RADIO_RFM69
              
              // Set LOW transmit power level as default, if you have an amplified NRF-module and
              // power your radio separately with a good regulator you can turn up PA level.
              #define MY_RF24_PA_LEVEL RF24_PA_LOW
              
              // Enable serial gateway
              #define MY_GATEWAY_SERIAL
              
              // Define a lower baud rate for Arduino's running on 8 MHz (Arduino Pro Mini 3.3V & SenseBender)
              #if F_CPU == 8000000L
              #define MY_BAUD_RATE 38400
              #endif
              
              // Enable inclusion mode
              #define MY_INCLUSION_MODE_FEATURE
              // Enable Inclusion mode button on gateway
              #define MY_INCLUSION_BUTTON_FEATURE
              
              // Inverses behavior of inclusion button (if using external pullup)
              //#define MY_INCLUSION_BUTTON_EXTERNAL_PULLUP
              
              // Set inclusion mode duration (in seconds)
              #define MY_INCLUSION_MODE_DURATION 60
              // Digital pin used for inclusion mode button
              #define MY_INCLUSION_MODE_BUTTON_PIN  7
              
              // Set blinking period
              #define MY_DEFAULT_LED_BLINK_PERIOD 1000
              
              // Inverses the behavior of leds
              #define MY_WITH_LEDS_BLINKING_INVERSE
              
              // Flash leds on rx/tx/err
              // Uncomment to override default HW configurations
              #define MY_DEFAULT_ERR_LED_PIN 4  // Error led pin
              #define MY_DEFAULT_RX_LED_PIN  6  // Receive led pin
              #define MY_DEFAULT_TX_LED_PIN  5  // the PCB, on board LED
              
              #include <MySensors.h>
              #include <DHT.h>
              const int DHTPin = 3;
              static const uint64_t Update_Interval = 60000;
              #define CHILD_ID_HUM 0
              #define CHILD_ID_TEMP 1
              #define SENSOR_TEMP_OFFSET 0
              float lastTemp;
              float lastHum;
              uint8_t nNoUpdatesTemp;
              uint8_t nNoUpdatesHum;
              bool metric = true;
              static const uint8_t FORCE_UPDATE_N_READS = 30;
              static const uint64_t UPDATE_INTERVAL = 60000;
              MyMessage msgHum(CHILD_ID_HUM, V_HUM);
              MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
              DHT dht(3, DHT11);
              
              void setup()
              {
                pinMode(3, INPUT_PULLUP);
                pinMode(7, INPUT_PULLUP);
                sleep(500);
              	// Setup locally attached sensors
              }
              
              void presentation()
              {
              	present(CHILD_ID_HUM, S_HUM);
                present(CHILD_ID_TEMP, S_TEMP);
                metric = getConfig().isMetric;
              	
              	// Present locally attached sensors
              }
              
              void loop()
              {
              	 // Force reading sensor, so it works also after sleep()
                dht.readTemperature();
                dht.readHumidity();
              
                // Get temperature from DHT library
                float temperature = dht.readTemperature();
                if (isnan(temperature)) {
                  Serial.println("Failed reading temperature from DHT!");
                } else if (temperature != lastTemp || nNoUpdatesTemp == FORCE_UPDATE_N_READS) {
                  // Only send temperature if it changed since the last measurement or if we didn't send an update for n times
                  lastTemp = temperature;
                 if (!metric) {
                    temperature = dht.readTemperature(true);
                  }
                 
                  // Reset no updates counter
                  nNoUpdatesTemp = 0;
                  temperature += SENSOR_TEMP_OFFSET;
                  send(msgTemp.set(temperature, 1));
              
                  #ifdef MY_DEBUG
                  Serial.print("T: ");
                  Serial.println(temperature);
                  #endif
                } else {
                  // Increase no update counter if the temperature stayed the same
                  nNoUpdatesTemp++;
                }
              
                // Get humidity from DHT library
                float humidity = dht.readHumidity();
                if (isnan(humidity)) {
                  Serial.println("Failed reading humidity from DHT");
                } else if (humidity != lastHum || nNoUpdatesHum == FORCE_UPDATE_N_READS) {
                  // Only send humidity if it changed since the last measurement or if we didn't send an update for n times
                  lastHum = humidity;
                  // Reset no updates counter
                  nNoUpdatesHum = 0;
                  send(msgHum.set(humidity, 1));
              
                  #ifdef MY_DEBUG
                  Serial.print("H: ");
                  Serial.println(humidity);
                  #endif
                } else {
                  // Increase no update counter if the humidity stayed the same
                  nNoUpdatesHum++;
                }
              
                // Sleep for a while to save energy
                sleep(UPDATE_INTERVAL);
              	// Send locally attached sensor data here
              }```
              1 Reply Last reply Reply Quote 0
              • S Offline
                SamuelMills
                last edited by jkandasa

                @jkandasa,
                I also looked at my logs, and mostly they say this:

                statusSince=1515091216204, txDelay=0), driver=AUTO, portName=/dev/ttyUSB0, baudRate=115200, retryFrequency=60, runningDriver=JSERIALCOMM)], Unable to reconnected! Will do next try after 60 second(s)
                2018-01-05 05:13:09,374 INFO [Thread-32] [org.mycontroller.standalone.gateway.serialport.SerialPortMonitoringThread:112] Serial GatewayTable[GatewaySerial(super=Gateway(id=2, enabled=true, name=Home, type=SERIAL, networkType=MY_SENSORS, timestamp=1515091215685, state=DOWN, statusMessage=ERROR: Unable to open!, statusSince=1515091216204, txDelay=0), driver=AUTO, portName=/dev/ttyUSB0, baudRate=115200, retryFrequency=60, runningDriver=JSERIALCOMM)] not connected, Reconnect initiated...
                2018-01-05 05:13:09,886 ERROR [Thread-32] [org.mycontroller.standalone.gateway.serialport.SerialPortjSerialCommImpl:74] Unable to open serial port:[/dev/ttyUSB0]
                2018-01-05 05:13:09,894 INFO [Thread-32] [org.mycontroller.standalone.gateway.serialport.SerialPortMonitoringThread:93] Serial GatewayTable[GatewaySerial(super=Gateway(id=2, enabled=true, name=Home, type=SERIAL, networkType=MY_SENSORS, timestamp=1515091215685, state=DOWN, statusMessage=ERROR: Unable to open!, statusSince=1515091216204, txDelay=0), driver=AUTO, portName=/dev/ttyUSB0, baudRate=115200, retryFrequency=60, runningDriver=JSERIALCOMM)], Unable to reconnected! Will do next try after 60 second(s)
                
                skywatchS jkandasaJ 2 Replies Last reply Reply Quote 0
                • skywatchS Offline
                  skywatch @SamuelMills
                  last edited by skywatch

                  @SamuelMills A gateway should NEVER sleep.

                  Try again without the sleep function. Actually, try again without anything but a 'clean' gateway sketch and then add bits one at a time until you find the issue or it all works as you expect.

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

                    @SamuelMills

                    in your log says,

                    Unable to open serial port:[/dev/ttyUSB0]
                    

                    Which mean, serial port /dev/ttyUSB0 busy with some other application or your gateway node serial port might be different. Check available serial ports by running,

                    ls -lh /dev/ttyUSB*
                    

                    NOTE: Do not unplug your gateway from RPI3 when gateway enabled in MyController. If you want to unplug your USB-TTL from RPI3, disable the gateway in MyController GUI and unplug, later once you plug and enable the gateway.

                    As @skywatch said Gateway node should not be in sleep mode! And keep clean sketch until you get complete success with MyController<-->Gateway communication.

                    1 Reply Last reply Reply Quote 0
                    • S Offline
                      SamuelMills
                      last edited by

                      Thanks for all the help. I have not been able to rework the code yet, but I will take that as a working thesis and consider this problem closed. I really appreciate your help and patience as I work my way through this.

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

                      0

                      Online

                      587

                      Users

                      529

                      Topics

                      3.4k

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