ESP8266 WiFi MQTT gateway won't respond to parent request.



  • Hi everybody,

    Having a weird issue with my WiFi gateway. My nodes get FPAR:NO REPLY consistently when they start up. If i use another gateway, they work immediately.

    If I switch gateways to the WiFi after the nodes have a parent and are asleep, it works fine. I had it run like that the whole weekend with no issues so I doubt it's a radio problem.
    Unfortunately when I built the gateway, I didn't have an 8pin DIL socket so I had to solder the radio in place, making testing out with another very difficult.

    I've tried with vesion 2.3.1 as well as the dev branch from github.

    Background
    This Gateway has been working for over a year with a temperature sensor node on a ATMEGA168 Seeduino arduino board. Both were running MySensors 2.1.1.
    I decided to replace the arduino with a dedicated board I made with a ATMEGA328 running at 8Mhz using the MYSBootloader.
    After soldering up the board, I loaded the sketch with MySensors 2.3.1 and tested with an Ethernet Gateway on my Arduino Duemilanove.
    When it worked fine for a couple of days, I upgraded the Wifi gateway to 2.3.1 as well.

    Original node connected to the Wifi gateway and ran fo another few days while I made a case for the new node.

    When I switched the nodes, the new one would not connect. Power cycled both but no dice. Both are located in awkward positions so I removed them, flased each with the Clear EEPROM sketch and reloaded firmware but still no connection.
    Also tried with a 16Mhz board with MYSBootloader because I didn't solder headers to the 8Mhz board for serial and it became a pain to pull the chip out to flash.

    My setup:
    Wifi Gateway:
    ESP8266 12-E with a NRF24L2401+
    5v power supply with a HT7833 on the ESP8266 with a 100 nF Bypass across VCC and Gnd.
    AMS1117 on the NRF24L01+ with a 4.7uF Electrolytical Bypass Cap (Added a 100uF as well in testing while trying to debug)

    DS18B20 Temperature Node
    ATMEGA328 with MYSBootlader @ 8Mhz internal powered with a 5v Regulated Wall Wart power supply.
    AMS1117 regulator for the NRF24L01+ with 47uF Bypass Capacitor.

    Second test node
    ATMEGA328 with MYSBootlader @ 16Mhz crystal oscillator powered with a 5v Regulated power bank.
    AMS1117 regulator for the NRF24L01+ with 47uF Bypass Capacitor.

    WIFI Gateway Sketch

    // Enable debug prints to serial monitor
    #define MY_DEBUG
    //#define MY_DEBUG_VERBOSE_RF24  
    #define   MY_DEBUG_VERBOSE_GATEWAY
    
    // Use a bit lower baudrate for serial prints on ESP8266 than default in MyConfig.h
    #define MY_BAUD_RATE 9600
    
    //#define MY_RF24_CHANNEL 26
    //#define MY_RF24_DATARATE RF24_250KBPS
    //#define MY_RF24_DATARATE RF24_1MBPS
    
    // Enables and select radio type (if attached)
    #define MY_RADIO_RF24
    
    #define MY_GATEWAY_MQTT_CLIENT
    #define MY_GATEWAY_ESP8266
    
    // Set this node's subscribe and publish topic prefix
    #define MY_MQTT_PUBLISH_TOPIC_PREFIX "sensors-out"
    #define MY_MQTT_SUBSCRIBE_TOPIC_PREFIX "sensors-in"
    
    // Set MQTT client id
    #define MY_MQTT_CLIENT_ID "mysensors-esp"
    
    // Set WIFI SSID and password
    #define MY_WIFI_SSID "wifi_ssid"
    #define MY_WIFI_PASSWORD "wifi_password"
    
    // Set the hostname for the WiFi Client. This is the hostname
    // it will pass to the DHCP server if not static.
    #define MY_HOSTNAME "mqtt-sensor-gateway"
    
    // Enable MY_IP_ADDRESS here if you want a static ip address (no DHCP)
    #define MY_IP_ADDRESS 192,168,1,15
    
    // If using static ip you need to define Gateway and Subnet address as well
    #define MY_IP_GATEWAY_ADDRESS 192,168,1,1
    #define MY_IP_SUBNET_ADDRESS 255,255,255,0
    
    // MQTT broker ip address.
    #define MY_CONTROLLER_IP_ADDRESS 192, 168, 1, 2
    
    // The MQTT broker port to to open
    #define MY_PORT 1883
    
    // Set blinking period
    //#define MY_DEFAULT_LED_BLINK_PERIOD 100
    
    // Flash leds on rx/tx/err
    //Pin 2 is the PCB, on board LED
    //#define MY_DEFAULT_ERR_LED_PIN 5  // Error led pin
    //#define MY_DEFAULT_RX_LED_PIN  2  // Receive led pin
    //#define MY_DEFAULT_TX_LED_PIN  16  // 
    
    #include <ESP8266WiFi.h>
    #include <MySensors.h>
    
    #include <ArduinoOTA.h>
    
    void setup()
    {
    
      Serial.println("Ready");
      Serial.print("IP address: ");
      Serial.println(WiFi.localIP());
    
      
        // Setup locally attached sensors
      ArduinoOTA.onStart([]() {
        Serial.println("ArduinoOTA start");
      });
      ArduinoOTA.onEnd([]() {
        Serial.println("\nArduinoOTA end");
      });
      ArduinoOTA.onProgress([](unsigned int progress, unsigned int total) {
        Serial.printf("OTA Progress: %u%%\r", (progress / (total / 100)));
      });
      ArduinoOTA.onError([](ota_error_t error) {
        Serial.printf("Error[%u]: ", error);
        if (error == OTA_AUTH_ERROR) {
          Serial.println("Auth Failed");
        } else if (error == OTA_BEGIN_ERROR) {
          Serial.println("Begin Failed");
        } else if (error == OTA_CONNECT_ERROR) {
          Serial.println("Connect Failed");
        } else if (error == OTA_RECEIVE_ERROR) {
          Serial.println("Receive Failed");
        } else if (error == OTA_END_ERROR) {
          Serial.println("End Failed");
        }
      });
      ArduinoOTA.begin();
    }
    
    void presentation()
    {
    	// Present locally attached sensors here
      sendSketchInfo("ESP-MC Gateway", "1.2.3", 0);
    }
    
    void loop()
    {
    	// Send locally attech sensors data here
      wdt_disable();
        
      ArduinoOTA.handle();
    
    }
    

    Temperature Node Sketch

    // Enable debug prints to serial monitor
    //#define MY_DEBUG 
    
    //#define MY_RF24_CHANNEL 26
    //#define MY_RF24_DATARATE RF24_250KBPS
    //#define MY_RF24_DATARATE RF24_1MBPS
    
    #define MY_SKETCH_NAME "Temperature Sensor"
    #define MY_SKETCH_VERSION "2.3.2"
    
    #define MY_NODE_ID 10
    #define MY_PARENT_ID 0
    #define CHILD_ID_BATTERY 5
    
    // Enable and select radio type attached
    #define MY_RADIO_RF24
    
    //#define MY_DEFAULT_LED_BLINK_PERIOD 50
    //#define MY_WITH_LEDS_BLINKING_INVERSE
    
    // Set blinking period
    #define MY_DEFAULT_LED_BLINK_PERIOD 100
    
    // Flash leds on rx/tx/err
    // Uncomment to override default HW configurations
    #define MY_DEFAULT_ERR_LED_PIN 5  // Error led pin
    #define MY_DEFAULT_RX_LED_PIN  6  // Receive led pin
    #define MY_DEFAULT_TX_LED_PIN  4  // Transmit led pin
    
    #include <MySensors.h>  
    #include <DallasTemperature.h>
    #include <OneWire.h>
    
    #define COMPARE_TEMP 0 // Send temperature only if changed? 1 = Yes 0 = No
    
    #define ONE_WIRE_BUS 3 // Pin where dallase sensor is connected 
    #define MAX_ATTACHED_DS18B20 3
    unsigned long SLEEP_TIME = 60000; // Sleep time between reads (in milliseconds)
    OneWire oneWire(ONE_WIRE_BUS); // Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
    DallasTemperature sensors(&oneWire); // Pass the oneWire reference to Dallas Temperature. 
    float lastTemperature[MAX_ATTACHED_DS18B20];
    int numSensors=0;
    bool receivedConfig = false;
    bool metric = true;
    // Initialize temperature message
    MyMessage msg(0,V_TEMP);
    //MyMessage msgbatt(CHILD_ID_BATTERY, V_VOLTAGE);
    
    /////////////////////////////////////////////////
    
    int BATTERY_SENSE_PIN = A0;  // select the input pin for the battery sense point
    
    int oldBatteryPcnt = 0;
    
    /////////////////////////////////////////////////
    void before()
    {
      // Startup up the OneWire library
      sensors.begin();
    }
    
    void setup()  
    { 
      // requestTemperatures() will not block current thread
      sensors.setWaitForConversion(false);
    
      ///////////////////////////////////////////////
        // use the 1.1 V internal reference
    #if defined(__AVR_ATmega2560__)
      analogReference(INTERNAL1V1);
    #else
      analogReference(INTERNAL);
    #endif
    ////////////////////////////////////////////////
    }
    
    void presentation() {
      // Send the sketch version information to the gateway and Controller
      sendSketchInfo(MY_SKETCH_NAME, MY_SKETCH_VERSION);
    
      // Fetch the number of attached temperature sensors  
      numSensors = sensors.getDeviceCount();
    
      // Present all sensors to controller
      for (int i=0; i<numSensors && i<MAX_ATTACHED_DS18B20; i++) {   
         present(i, S_TEMP);
      }
    
      present(CHILD_ID_BATTERY, S_MULTIMETER);
    }
    
    int16_t millisToWaitForConversion(uint8_t bitResolution)
    {
      switch (bitResolution)
      {
          case 9:
          return 94;
          case 10:
          return 188;
          case 11:
          return 375;
          default:
          return 750;
      }
    }
    
    void loop()     
    {     
      // Fetch temperatures from Dallas sensors
      sensors.requestTemperatures();
    
      // query conversion time and sleep until conversion completed
      int16_t conversionTime = millisToWaitForConversion(sensors.getResolution());
      // sleep() call can be replaced by wait() call if node need to process incoming messages (or if node is repeater)
      sleep(conversionTime);
    
      // Read temperatures and send them to controller 
      for (int i=0; i<numSensors && i<MAX_ATTACHED_DS18B20; i++) {
    
        // Fetch and round temperature to one decimal
        float temperature = static_cast<float>(static_cast<int>((getControllerConfig().isMetric?sensors.getTempCByIndex(i):sensors.getTempFByIndex(i)) * 10.)) / 10.;
    
        // Only send data if temperature has changed and no error
        //Serial.print(temperature);
        #if COMPARE_TEMP == 1
        if (lastTemperature[i] != temperature && temperature != -127.00 && temperature != 85.00) {
        #else
        if (temperature != -127.00 && temperature != 85.00) {
        #endif
    
          // Send in the new temperature
          send(msg.setSensor(i).set(temperature,1));
          // Save new temperatures for next compare
          lastTemperature[i]=temperature;
        }
      }
    
    //////////////////////////////////////////////////////////////////////////
      // get the battery Voltage
      int sensorValue = analogRead(BATTERY_SENSE_PIN);
    #ifdef MY_DEBUG
      Serial.print("Sensor Reading: ");
      Serial.print(sensorValue);
      Serial.print(" --> modified to -->> ");
      Serial.print(sensorValue*5.5);
      Serial.println(" bits");
    #endif
      // sensorValue = sensorValue * 5.5;
      
      // 1M, 470K divider across battery and using internal ADC ref of 1.1V
      // Sense point is bypassed with 0.1 uF cap to reduce noise at that point
      // ((1e6+470e3)/470e3)*1.1 = Vmax = 3.44 Volts
      // 3.44/1023 = Volts per bit = 0.003363075
    
      int batteryPcnt = sensorValue / 10;
      // ((1M+220k)/220K)*1.1 = Vmax = 6.1 Volts
      // 6.1/1023 = Volts per bit =  0.005962854
      //  // ((220k+1M)/1M)*1.1 = Vmax = 6.1 Volts  // incorrect resistors
      //  // 1.342/1023 = Volts per bit =   0.001311827  // incorrect resistors
      // float batteryV  = sensorValue * 0.00498533724; // incorrect resistors
      float batteryV  = sensorValue * 0.00593824228;
      
    #ifdef MY_DEBUG
    
      Serial.print("Battery Voltage: ");
      Serial.print(batteryV);
      Serial.println(" V");
    
      Serial.print("Battery percent: ");
      Serial.print(batteryPcnt);
      Serial.println(" %");
    #endif
    
      if (oldBatteryPcnt != batteryPcnt) {
        // Power up radio after sleep
        sendBatteryLevel(batteryPcnt);
        oldBatteryPcnt = batteryPcnt;
    //    send(msgbatt.set(batteryV ,2));
      }
    //////////////////////////////////////////////////////////////////////////
      
      smartSleep(SLEEP_TIME);
    }
    

    16Mhz test Node sketch

    // Enable debug prints to serial monitor
    #define MY_DEBUG 
    
    //#define MY_RF24_CHANNEL 76
    //#define MY_RF24_DATARATE RF24_250KBPS
    //#define MY_RF24_DATARATE RF24_1MBPS
    
    #define MY_NODE_ID 200
    #define MY_PARENT_NODE_ID 0
    #define MY_PARENT_NODE_IS_STATIC
    #define CHILD_ID_BATTERY 25
    
    #define MY_SIGNAL_REPORT_ENABLED
    
    // Enable and select radio type attached
    #define MY_RADIO_RF24
    
    #include <MySensors.h>  
    #include <DallasTemperature.h>
    #include <OneWire.h>
    
    #define SKETCH_NAME "MC Pulse & Temp"
    #define SKETCH_VERSION "1.0.6"
    #define DIGITAL_INPUT_SENSOR 3  // The digital input you attached your light sensor.  (Only 2 and 3 generates interrupt!)
    #define PULSE_FACTOR 1000       // Number of blinks per of your meter
    #define SLEEP_MODE false        // Watt value can only be reported when sleep mode is false.
    #define MAX_WATT 10000          // Max watt value to report. This filters outliers.
    #define PULSE_CHILD_ID 4    
    
    #define COMPARE_TEMP 0 // Send temperature only if changed? 1 = Yes 0 = No
    
    #define ONE_WIRE_BUS 5 // Pin where dallas sensor is connected 
    #define MAX_ATTACHED_DS18B20 3
    unsigned long SLEEP_TIME = 50000; // Sleep time between reads (in milliseconds)
    OneWire oneWire(ONE_WIRE_BUS); // Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
    DallasTemperature sensors(&oneWire); // Pass the oneWire reference to Dallas Temperature. 
    float lastTemperature[MAX_ATTACHED_DS18B20];
    int numSensors=0;
    bool receivedConfig = false;
    bool metric = true;
    
    // Initialize temperature message
    MyMessage msg(0,V_TEMP);
    MyMessage msgbatt(CHILD_ID_BATTERY, V_VOLTAGE);
    
    /************************************************************/
    
    uint32_t SEND_FREQUENCY =
        20000; // Minimum time between send (in milliseconds). We don't want to spam the gateway.
    double ppwh = ((double)PULSE_FACTOR)/1000; // Pulses per watt hour
    bool pcReceived = false;
    volatile uint32_t pulseCount = 0;
    volatile uint32_t lastBlink = 0;
    volatile uint32_t watt = 0;
    uint32_t oldPulseCount = 0;
    uint32_t oldWatt = 0;
    double oldkWh;
    uint32_t lastSend;
    MyMessage wattMsg(PULSE_CHILD_ID,V_WATT);
    MyMessage kWhMsg(PULSE_CHILD_ID,V_KWH);
    MyMessage pcMsg(PULSE_CHILD_ID,V_VAR1);
    
    /////////////////////////////////////////////////
    // Enable REPORT_BATTERY_LEVEL to measure battery level and send changes to gateway
    #define REPORT_BATTERY_LEVEL
    
    
    #ifdef REPORT_BATTERY_LEVEL
    #include <Vcc.h>
    static uint8_t oldBatteryPcnt = 200;  // Initialize to 200 to assure first time value will be sent.
    const float VccMin        = 1.8;      // Minimum expected Vcc level, in Volts: Brownout at 1.8V    -> 0%
    const float VccMax        = 2.0*1.6;  // Maximum expected Vcc level, in Volts: 2xAA fresh Alkaline -> 100%
    const float VccCorrection = 1.0;      // Measured Vcc by multimeter divided by reported Vcc
    static Vcc vcc(VccCorrection); 
    #endif
    /////////////////////////////////////////////////
    
    void before()
    {
      // Startup up the OneWire library
      sensors.begin();
    }
    
    void setup()  
    { 
      // Fetch last known pulse count value from gw
      request(PULSE_CHILD_ID, V_VAR1);
    
      // Use the internal pullup to be able to hook up this sketch directly to an energy meter with S0 output
      // If no pullup is used, the reported usage will be too high because of the floating pin
      pinMode(DIGITAL_INPUT_SENSOR,INPUT_PULLUP);
    
      attachInterrupt(digitalPinToInterrupt(DIGITAL_INPUT_SENSOR), onPulse, RISING);
      lastSend=millis();
    
      // requestTemperatures() will not block current thread
      sensors.setWaitForConversion(false);
    
    }
    
    void presentation() {
      // Send the sketch version information to the gateway and Controller
      sendSketchInfo(SKETCH_NAME, SKETCH_VERSION);
      present(PULSE_CHILD_ID, S_POWER);
      
      // Fetch the number of attached temperature sensors  
      numSensors = sensors.getDeviceCount();
    
      // Present all temperature sensors to controller
      for (int i=0; i<numSensors && i<MAX_ATTACHED_DS18B20; i++) {   
         present(i, S_TEMP);
      }
      //present voltage sensor
      //present(CHILD_ID_BATTERY, S_MULTIMETER);
    }
    
    int16_t millisToWaitForConversion(uint8_t bitResolution)
    {
      switch (bitResolution)
      {
          case 9:
          return 94;
          case 10:
          return 188;
          case 11:
          return 375;
          default:
          return 750;
      }
    }
    
    void loop()     
    {     
    
    uint32_t now = millis();
      // Only send values at a maximum frequency or woken up from sleep
      bool sendTime = now - lastSend > SEND_FREQUENCY;
      if (pcReceived && (SLEEP_MODE || sendTime)) {
        // New watt value has been calculated
        if (!SLEEP_MODE && watt != oldWatt) {
          // Check that we don't get unreasonable large watt value.
          // could happen when long wraps or false interrupt triggered
          if (watt<((uint32_t)MAX_WATT)) {
            send(wattMsg.set(watt));  // Send watt value to gw
          }
          Serial.print("Watt:");
          Serial.println(watt);
          oldWatt = watt;
        }
    
        // Pulse count value has changed
        if (pulseCount != oldPulseCount) {
          send(pcMsg.set(pulseCount));  // Send pulse count value to gw
          double kWh = ((double)pulseCount/((double)PULSE_FACTOR));
          oldPulseCount = pulseCount;
          if (kWh != oldkWh) {
            send(kWhMsg.set(kWh, 4));  // Send kWh value to gw
            oldkWh = kWh;
          }
        }
        lastSend = now;
      } else if (sendTime && !pcReceived) {
        // No pulse count value received. Try requesting it again
        request(PULSE_CHILD_ID, V_VAR1);
        lastSend=now;
      }
    
      if (SLEEP_MODE) {
        sleep(SEND_FREQUENCY);
      }
    
      // Fetch temperatures from Dallas sensors
      sensors.requestTemperatures();
    
      // query conversion time and sleep until conversion completed
      int16_t conversionTime = millisToWaitForConversion(sensors.getResolution());
      // sleep() call can be replaced by wait() call if node need to process incoming messages (or if node is repeater)
      sleep(conversionTime);
    
      // Read temperatures and send them to controller 
      for (int i=0; i<numSensors && i<MAX_ATTACHED_DS18B20; i++) {
    
        // Fetch and round temperature to one decimal
        float temperature = static_cast<float>(static_cast<int>((getControllerConfig().isMetric?sensors.getTempCByIndex(i):sensors.getTempFByIndex(i)) * 10.)) / 10.;
    
        // Only send data if temperature has changed and no error
        #if COMPARE_TEMP == 1
        if (lastTemperature[i] != temperature && temperature != -127.00 && temperature != 85.00) {
        #else
          if (temperature != -127.00 && temperature != 85.00) {
          #endif
    
            // Send in the new temperature
            send(msg.setSensor(i).set(temperature,1));
            // Save new temperatures for next compare
            lastTemperature[i]=temperature;
          }
        }
    /***************************************************************************************************************************************/
     #ifdef REPORT_BATTERY_LEVEL
          const uint8_t batteryPcnt = static_cast<uint8_t>(0.5 + vcc.Read_Perc(VccMin, VccMax));
        
        #ifdef MY_DEBUG
          Serial.print(F("Vbat "));
          Serial.print(vcc.Read_Volts());
          Serial.print(F("\tPerc "));
          Serial.println(batteryPcnt);
        #endif
        
          // Battery readout should only go down. So report only when new value is smaller than previous one.
          if ( batteryPcnt < oldBatteryPcnt )
          {
              sendBatteryLevel(batteryPcnt);
              oldBatteryPcnt = batteryPcnt;
          }
        #endif
    /********************************************************************************************************************************/   
      
      //send(msgbatt.set(batteryV ,2));
          
      smartSleep(SLEEP_TIME);
      
    }
    
    
    void receive(const MyMessage &message)
    {
      if (message.type==V_VAR1) {
        pulseCount = oldPulseCount = message.getLong();
        Serial.print("Received last pulse count value from gw:");
        Serial.println(pulseCount);
        pcReceived = true;
      }
    }
    
    void onPulse()
    {
      if (!SLEEP_MODE) {
        uint32_t newBlink = micros();
        uint32_t interval = newBlink-lastBlink;
        if (interval<10000L) { // Sometimes we get interrupt on RISING
          return;
        }
        watt = (3600000000.0 /interval) / ppwh;
        lastBlink = newBlink;
      }
      pulseCount++;
    }
    

    Logs
    Wifi Gateway

    MCO:BGN:INIT GW,CP=RNNGE---,REL=255,VER=2.3.1
    109 TSF:LRT:OK
    125 TSM:INIT
    138 TSF:WUR:MS=0
    162 TSM:INIT:TSP OK
    183 TSM:INIT:GW MODE
    205 TSM:READY:ID=0,PAR=0,DIS=0
    237 MCO:REG:NOT NEEDED
    scandone
    350 TSM:READY:NWD REQ
    2626 TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=20,pt=0,l=0,sg=0,ft=0,st=OK:
    2700 GWT:TPC:CONNECTING...
    3228 GWT:TPC:CONNECTING...
    3756 GWT:TPC:CONNECTING...
    4284 GWT:TPC:CONNECTING...
    4812 GWT:TPC:CONNECTING...
    5340 GWT:TPC:CONNECTING...
    scandone
    state: 0 -> 2 (b0)
    state: 2 -> 3 (0)
    state: 3 -> 5 (10)
    add 0
    aid 2
    cnt 
    
    connected with wifi_ssid, channel 13
    dhcp client start...
    6965 GWT:TPC:CONNECTING...
    7493 GWT:TPC:CONNECTING...
    8021 GWT:TPC:CONNECTING...
    ip:192.168.1.15,mask:255.255.255.0,gw:192.168.1.1
    8549 GWT:TPC:CONNECTING...
    8577 GWT:TPC:IP=192.168.1.15
    8608 MCO:BGN:STP
    Ready
    IP address: 192.168.1.15
    8628 MCO:BGN:INIT OK,TSP=1
    8688 GWT:TPC:IP=192.168.1.15
    8719 GWT:RMQ:MQTT RECONNECT
    8761 GWT:RMQ:MQTT CONNECTED
    8791 GWT:TPS:TOPIC=sensors-out/0/255/0/0/18,MSG SENT
    8847 GWT:TPS:TOPIC=sensors-out/0/255/3/0/11,MSG SENT
    8903 GWT:TPS:TOPIC=sensors-out/0/255/3/0/12,MSG SENT
    pm open,type:2 0
    18609 TSF:MSG:READ,200-200-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
    18671 TSF:MSG:BC
    18689 TSF:MSG:FPAR REQ,ID=200
    18721 TSF:PNG:SEND,TO=0
    18746 TSF:CKU:OK
    18764 TSF:MSG:GWL OK
    21385 !TSF:MSG:SEND,0-0-200-200,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0
    22703 TSF:MSG:READ,200-200-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
    22766 TSF:MSG:BC
    22783 TSF:MSG:FPAR REQ,ID=200
    22815 TSF:CKU:OK,FCTRL
    22839 TSF:MSG:GWL OK
    25439 !TSF:MSG:SEND,0-0-200-200,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0
    52218 TSF:MSG:READ,200-200-255,s=255,c=3,t=7,pt=1,l=1,sg=0:119
    52284 TSF:MSG:BC
    52302 TSF:MSG:FPAR REQ,ID=200
    52333 TSF:PNG:SEND,TO=0
    52359 TSF:CKU:OK
    52376 TSF:MSG:GWL OK
    ...
    95174 !TSF:MSG:SEND,0-0-200-200,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0
    95947 TSF:MSG:READ,200-200-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
    96010 TSF:MSG:BC
    96028 TSF:MSG:FPAR REQ,ID=200
    96059 TSF:CKU:OK,FCTRL
    96083 TSF:MSG:GWL OK
    ...
    ...
    313918 !TSF:MSG:SEND,0-0-200-200,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0
    313997 TSF:MSG:READ,10-10-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
    314059 TSF:MSG:BC
    314078 TSF:MSG:FPAR REQ,ID=10
    314109 TSF:CKU:OK,FCTRL
    314134 TSF:MSG:GWL OK
    317217 !TSF:MSG:SEND,0-0-10-10,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0
    324923 TSF:MSG:READ,200-200-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
    324987 TSF:MSG:BC
    325006 TSF:MSG:FPAR REQ,ID=200
    325039 TSF:PNG:SEND,TO=0
    325065 TSF:CKU:OK
    325084 TSF:MSG:GWL OK
    ...
    368945 !TSF:MSG:SEND,0-0-200-200,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0
    369025 TSF:MSG:READ,200-200-255,s=255,c=3,t=7,pt=1,l=1,sg=0:0
    369090 TSF:MSG:BC
    369109 TSF:MSG:FPAR REQ,ID=200
    369141 TSF:CKU:OK,FCTRL
    369166 TSF:MSG:GWL OK
    371985 !TSF:MSG:SEND,0-0-200-200,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0
    372065 TSF:MSG:READ,10-10-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
    372127 TSF:MSG:BC
    372145 TSF:MSG:FPAR REQ,ID=10
    372177 TSF:CKU:OK,FCTRL
    372202 TSF:MSG:GWL OK
    

    Second Node

     __  __       ____
    |  \/  |_   _/ ___|  ___ _ __  ___  ___  _ __ ___
    | |\/| | | | \___ \ / _ \ `_ \/ __|/ _ \| `__/ __|
    | |  | | |_| |___| |  __/ | | \__ \  _  | |  \__ \
    |_|  |_|\__, |____/ \___|_| |_|___/\___/|_|  |___/
            |___/                      2.3.1
    
    16 MCO:BGN:INIT NODE,CP=RNNNA---,REL=255,VER=2.3.1
    26 MCO:BGN:BFR
    43 TSM:INIT
    44 TSF:WUR:MS=0
    51 TSM:INIT:TSP OK
    53 TSM:INIT:STATID=200
    55 TSF:SID:OK,ID=200
    57 TSM:FPAR
    93 TSF:MSG:SEND,200-200-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    2101 !TSM:FPAR:NO REPLY
    2103 TSM:FPAR
    2139 TSF:MSG:SEND,200-200-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    4147 !TSM:FPAR:NO REPLY
    4149 TSM:FPAR
    4185 TSF:MSG:SEND,200-200-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    6193 !TSM:FPAR:NO REPLY
    6195 TSM:FPAR
    6231 TSF:MSG:SEND,200-200-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    8239 !TSM:FPAR:FAIL
    8240 TSM:FAIL:CNT=1
    8242 TSM:FAIL:DIS
    8244 TSF:TDI:TSL
    18246 TSM:FAIL:RE-INIT
    18248 TSM:INIT
    18254 TSM:INIT:TSP OK
    18256 TSM:INIT:STATID=200
    18259 TSF:SID:OK,ID=200
    18262 TSM:FPAR
    18298 TSF:MSG:SEND,200-200-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    20307 !TSM:FPAR:NO REPLY
    20310 TSM:FPAR
    20346 TSF:MSG:SEND,200-200-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    22354 !TSM:FPAR:NO REPLY
    22356 TSM:FPAR
    22393 TSF:MSG:SEND,200-200-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    24401 !TSM:FPAR:NO REPLY
    24403 TSM:FPAR
    24440 TSF:MSG:SEND,200-200-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    26447 !TSM:FPAR:FAIL
    26448 TSM:FAIL:CNT=2
    26450 TSM:FAIL:DIS
    26452 TSF:TDI:TSL
    36456 TSM:FAIL:RE-INIT
    36458 TSM:INIT
    36464 TSM:INIT:TSP OK
    36466 TSM:INIT:STATID=200
    36469 TSF:SID:OK,ID=200
    36471 TSM:FPAR
    36508 TSF:MSG:SEND,200-200-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    38516 !TSM:FPAR:NO REPLY
    38518 TSM:FPAR
    38555 TSF:MSG:SEND,200-200-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    40562 !TSM:FPAR:NO REPLY
    40564 TSM:FPAR
    40601 TSF:MSG:SEND,200-200-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    42608 !TSM:FPAR:NO REPLY
    42610 TSM:FPAR
    42647 TSF:MSG:SEND,200-200-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    44654 !TSM:FPAR:FAIL
    44655 TSM:FAIL:CNT=3
    44657 TSM:FAIL:DIS
    44659 TSF:TDI:TSL
    54662 TSM:FAIL:RE-INIT
    54664 TSM:INIT
    54670 TSM:INIT:TSP OK
    54672 TSM:INIT:STATID=200
    54675 TSF:SID:OK,ID=200
    54677 TSM:FPAR
    54714 TSF:MSG:SEND,200-200-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    56721 !TSM:FPAR:NO REPLY
    56723 TSM:FPAR
    56760 TSF:MSG:SEND,200-200-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    58767 !TSM:FPAR:NO REPLY
    58769 TSM:FPAR
    58806 TSF:MSG:SEND,200-200-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    60813 !TSM:FPAR:NO REPLY
    60815 TSM:FPAR
    60852 TSF:MSG:SEND,200-200-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    62859 !TSM:FPAR:FAIL
    62860 TSM:FAIL:CNT=4
    62862 TSM:FAIL:DIS
    62864 TSF:TDI:TSL
    72867 TSM:FAIL:RE-INIT
    72869 TSM:INIT
    72876 TSM:INIT:TSP OK
    72878 TSM:INIT:STATID=200
    72881 TSF:SID:OK,ID=200
    72883 TSM:FPAR
    72920 TSF:MSG:SEND,200-200-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    74927 !TSM:FPAR:NO REPLY
    74929 TSM:FPAR
    74966 TSF:MSG:SEND,200-200-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    76973 !TSM:FPAR:NO REPLY
    76975 TSM:FPAR
    77011 TSF:MSG:SEND,200-200-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    79019 !TSM:FPAR:NO REPLY
    79021 TSM:FPAR
    79057 TSF:MSG:SEND,200-200-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    81065 !TSM:FPAR:FAIL
    81068 TSM:FAIL:CNT=5
    81069 TSM:FAIL:DIS
    81071 TSF:TDI:TSL
    91074 TSM:FAIL:RE-INIT
    91076 TSM:INIT
    91082 TSM:INIT:TSP OK
    91084 TSM:INIT:STATID=200
    91087 TSF:SID:OK,ID=200
    91089 TSM:FPAR
    91126 TSF:MSG:SEND,200-200-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    93134 !TSM:FPAR:NO REPLY
    93136 TSM:FPAR
    93173 TSF:MSG:SEND,200-200-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    95180 !TSM:FPAR:NO REPLY
    95182 TSM:FPAR
    95219 TSF:MSG:SEND,200-200-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    97226 !TSM:FPAR:NO REPLY
    97228 TSM:FPAR
    97265 TSF:MSG:SEND,200-200-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    99272 !TSM:FPAR:FAIL
    99273 TSM:FAIL:CNT=6
    99275 TSM:FAIL:DIS
    99277 TSF:TDI:TSL
    109280 TSM:FAIL:RE-INIT
    109282 TSM:INIT
    109288 TSM:INIT:TSP OK
    109291 TSM:INIT:STATID=200
    109293 TSF:SID:OK,ID=200
    109296 TSM:FPAR
    109333 TSF:MSG:SEND,200-200-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    111340 !TSM:FPAR:NO REPLY
    111342 TSM:FPAR
    111379 TSF:MSG:SEND,200-200-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    113387 !TSM:FPAR:NO REPLY
    113389 TSM:FPAR
    113426 TSF:MSG:SEND,200-200-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    115434 !TSM:FPAR:NO REPLY
    115436 TSM:FPAR
    115473 TSF:MSG:SEND,200-200-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    117481 !TSM:FPAR:FAIL
    117483 TSM:FAIL:CNT=7
    117485 TSM:FAIL:DIS
    117487 TSF:TDI:TSL
    177489 TSM:FAIL:RE-INIT
    177491 TSM:INIT
    177498 TSM:INIT:TSP OK
    177501 TSM:INIT:STATID=200
    177503 TSF:SID:OK,ID=200
    177506 TSM:FPAR
    177543 TSF:MSG:SEND,200-200-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    179550 !TSM:FPAR:NO REPLY
    179552 TSM:FPAR
    179589 TSF:MSG:SEND,200-200-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    181597 !TSM:FPAR:NO REPLY
    181599 TSM:FPAR
    181636 TSF:MSG:SEND,200-200-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    183644 !TSM:FPAR:NO REPLY
    183646 TSM:FPAR
    183683 TSF:MSG:SEND,200-200-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    185691 !TSM:FPAR:FAIL
    185693 TSM:FAIL:CNT=7
    185695 TSM:FAIL:DIS
    185697 TSF:TDI:TSL
    245699 TSM:FAIL:RE-INIT
    245701 TSM:INIT
    245707 TSM:INIT:TSP OK
    245710 TSM:INIT:STATID=200
    245712 TSF:SID:OK,ID=200
    245715 TSM:FPAR
    

    W5100 Ethernet Gateway
    For some reason the ethernet gateway does not start if I have a serial debug window open, so here is the MQTT log.

    sensors-out/0/255/0/0/18 2.3.1
    sensors-out/10/255/4/0/0 02002B004003DC920103
    sensors-out/10/255/4/0/0 02002B004003DC920103
    sensors-out/0/255/0/0/18 2.3.1
    sensors-out/10/255/0/0/17 2.3.1
    sensors-out/10/255/3/0/6 0
    sensors-in/10/255/3/0/6 M
    sensors-out/10/255/3/0/11 Temperature Sensor
    sensors-out/10/255/3/0/12 2.3.0
    sensors-out/10/0/0/0/6 (null)
    sensors-out/10/5/0/0/30 (null)
    sensors-out/10/0/1/0/0 21.6
    gelatitalia/freezer3/temperature 21.6
    sensors-out/10/255/3/0/0 83
    sensors-out/10/255/3/0/32 500
    sensors-out/200/255/0/0/17 2.3.1
    sensors-out/200/255/3/0/6 0
    sensors-in/200/255/3/0/6 M
    sensors-out/200/255/3/0/11 MC Pulse & Temp
    sensors-out/200/255/3/0/12 1.0.6
    sensors-out/200/4/0/0/13 (null)
    sensors-out/200/4/2/0/24 (null)
    sensors-out/200/255/3/0/0 100
    sensors-out/200/255/3/0/32 500
    

    WiFi gateway log after ethernet has assigned parent
    While both nodes were asleep, I disconnected the ethernet gateway and powered the ESP8266

    Jun 28 16:34:06 Ȥl���$$rZ�@>h��␡�53 MCO:BGN:INIT GW,CP=RNNGE---,REL=255,VER=2.3.1
    Jun 28 16:34:06 104 TSF:LRT:OK
    Jun 28 16:34:06 120 TSM:INIT
    Jun 28 16:34:06 134 TSF:WUR:MS=0
    Jun 28 16:34:06 157 TSM:INIT:TSP OK
    Jun 28 16:34:06 178 TSM:INIT:GW MODE
    Jun 28 16:34:06 200 TSM:READY:ID=0,PAR=0,DIS=0
    Jun 28 16:34:06 233 MCO:REG:NOT NEEDED
    Jun 28 16:34:06 ip:192.168.1.15,mask:255.255.255.0,gw:192.168.1.1
    Jun 28 16:34:06 scandone
    Jun 28 16:34:06 261 TSM:READY:NWD REQ
    Jun 28 16:34:08 2588 TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=20,pt=0,l=0,sg=0,ft=0,st=OK:
    Jun 28 16:34:08 scandone
    Jun 28 16:34:09 state: 0 -> 2 (b0)
    Jun 28 16:34:09 state: 2 -> 3 (0)
    Jun 28 16:34:09 state: 3 -> 5 (10)
    Jun 28 16:34:09 add 0
    Jun 28 16:34:09 aid 1
    Jun 28 16:34:09 cnt 
    Jun 28 16:34:09 
    Jun 28 16:34:09 connected with wifi_ssid, channel 13
    Jun 28 16:34:09 ip:192.168.1.15,mask:255.255.255.0,gw:192.168.1.1
    Jun 28 16:34:09 2838 GWT:TPC:CONNECTING...
    Jun 28 16:34:09 2866 GWT:TPC:IP=192.168.1.15
    Jun 28 16:34:09 2897 MCO:BGN:STP
    Jun 28 16:34:09 Ready
    Jun 28 16:34:09 IP address: 192.168.1.15
    Jun 28 16:34:09 2916 MCO:BGN:INIT OK,TSP=1
    Jun 28 16:34:09 2977 GWT:TPC:IP=192.168.1.15
    Jun 28 16:34:09 3008 GWT:RMQ:MQTT RECONNECT
    Jun 28 16:34:09 3609 GWT:RMQ:MQTT CONNECTED
    Jun 28 16:34:10 3639 GWT:TPS:TOPIC=sensors-out/0/255/0/0/18,MSG SENT
    Jun 28 16:34:10 3695 GWT:TPS:TOPIC=sensors-out/0/255/3/0/11,MSG SENT
    Jun 28 16:34:10 3751 GWT:TPS:TOPIC=sensors-out/0/255/3/0/12,MSG SENT
    Jun 28 16:34:18 pm open,type:2 0
    Jun 28 16:34:31 25601 TSF:MSG:READ,200-200-0,s=255,c=3,t=33,pt=5,l=4,sg=0:50000
    Jun 28 16:34:32 25668 GWT:TPS:TOPIC=sensors-out/200/255/3/0/33,MSG SENT
    Jun 28 16:34:32 25749 TSF:MSG:READ,200-200-0,s=255,c=3,t=32,pt=5,l=4,sg=0:500
    Jun 28 16:34:32 25814 GWT:TPS:TOPIC=sensors-out/200/255/3/0/32,MSG SENT
    Jun 28 16:35:01 55299 TSF:MSG:READ,10-10-0,s=255,c=3,t=33,pt=5,l=4,sg=0:60000
    Jun 28 16:35:01 55364 GWT:TPS:TOPIC=sensors-out/10/255/3/0/33,MSG SENT
    Jun 28 16:35:02 56152 TSF:MSG:READ,10-10-0,s=0,c=1,t=0,pt=7,l=5,sg=0:22.4
    Jun 28 16:35:02 56213 GWT:TPS:TOPIC=sensors-out/10/0/1/0/0,MSG SENT
    Jun 28 16:35:02 56268 TSF:MSG:READ,10-10-0,s=255,c=3,t=32,pt=5,l=4,sg=0:500
    Jun 28 16:35:02 56331 GWT:TPS:TOPIC=sensors-out/10/255/3/0/32,MSG SENT
    
    

  • Mod

    @mcchots nice troubleshooting, thanks for sharing so detailed information.

    The node sends find parent request, the gateway receives the find parent request and responds, but the node does not see the response.

    My first guess would be bad antenna placement on the gateway. Is there a lot of conducting material close to the nrf antenna? (Within a few centimeters)

    You could try modifying the antenna as described in https://youtu.be/NpMnauHeR7Y



  • @mfalkvidd Thanks. While trying to debug this, I've seen a number of posts where somebody asks for logs or more details from the OP. Thought I'd save some time.

    What I don't get is that it only fails to sent the FPAR response. Although maybe it's not sending any data at all, only receiving.
    Do gateways usually send any data or ack to a node or just receive and forward?

    I have noticed that it also does not seem to be receiving the bootloader firmware requests on node startup either.

    This is a picture of my gateway. Since replacing the radio is so difficult, I'll probably have to build a new one. Too bad i damaged my backup ESP while trying to debug this on a breadboard.

    0_1562053581041_IMG_1255.jpg


    Any recommendations on placement of the two modules?


  • Mod

    @mcchots the placement looks good, the nrf antenna is sticking out so interference by the perfboard should be small.

    The gateway

    • sends hardware ack on all messages it receives
    • responds to FPAR requests

    but except that it only receives and forwards messages node(s)->controller and controller->node(s).

    Looks like you've done everything according to the collective experience on what usually works, so unfortunately I don't have any ideas except swapping the nrf.



  • @mfalkvidd Turns out I didn't completely destroy my second ESP8266.
    Breadboarded a new gateway and it works fine. So I guess the radio is shot.

    Busy working up a much neater PCB with replaceable components to etch.
    Thanks for your help.


  • Mod

    Great work @mcchots, thanks for reporting back



Suggested Topics

51
Online

11.4k
Users

11.1k
Topics

112.7k
Posts