Navigation

    • Register
    • Login
    • OpenHardware.io
    • Categories
    • Recent
    • Tags
    • Popular
    1. Home
    2. smilvert
    • Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Best
    • Groups

    smilvert

    @smilvert

    8
    Reputation
    38
    Posts
    778
    Profile views
    1
    Followers
    0
    Following
    Joined Last Online

    smilvert Follow

    Best posts made by smilvert

    • RE: Best IDE to use for MySensors projects

      @ivankravets Thanks a lot!! 🙂

      Now I think that it works with the latest commit on github->dev-branch.
      I will try it to night and if I got time I will publish my node code/building structure as well.

      Here was my platformio.ini file that I tested with:

      [env:pro8MHzatmega328]
      platform = atmelavr
      framework = arduino
      board = pro8MHzatmega328
      build_flags = -I/(PATH_TO_MYSENSORS_GITHUB)/libraries/MySensors
      lib_ignore = MySensors
      
      
      posted in Development
      smilvert
      smilvert
    • RE: platformio and mysensors for atmega328p on breadboard?

      @n8henrie

      I have installed the mysensors lib from platformio (platformio lib install xx, or something like that)

      And my platformio.ini file look like this:

      [env:pro8MHzatmega328]
      platform = atmelavr
      framework = arduino
      board = pro8MHzatmega328
      

      I think you could remove the build_flags and the lib_ignore

      posted in Troubleshooting
      smilvert
      smilvert
    • RE: Why do "passive nodes" need to set their Node ID manually?

      @NeverDie

      I have started to test node-red (Which dont work yet...) so I have created a dummy sketch for parse the data to domoticz.

      // Enable debug prints
      #define MY_DEBUG
      #define MY_GATEWAY_SERIAL
      
      // Enable passive mode
      #define MY_PASSIVE_NODE
      #define MY_REPEATER_FEATURE
      
      // Passive mode requires static node ID
      #define MY_NODE_ID 0
      
      // Enable and select radio type attached
      // #define MY_RADIO_NRF24
      //#define MY_RF24_PA_LEVEL RF24_PA_HIGH
      
      //#define MY_RADIO_NRF5_ESB
      //#define MY_RADIO_RFM69
      //#define MY_RADIO_RFM95
      
      #include <MySensors.h>
      
      #define CHILD_ID_HUM 0
      #define CHILD_ID_TEMP 1
      #define CHILD_ID_BINARY 2
      
      // Initialize general message
      MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
      MyMessage msgHum(CHILD_ID_HUM, V_HUM);
      MyMessage msgBinary(CHILD_ID_BINARY, V_STATUS);
      int counter = 0;
      float temperature = 0;
      float humidity = 0;
      int binary = 0;
      void setup()
      {
      }
      
      void presentation()
      {
        // Send the sketch version information to the gateway and controller
        sendSketchInfo("Passive node", "1.0");
      
        // Register all sensors to gw (they will be created as child devices)
        present(CHILD_ID_TEMP, S_TEMP);
        present(CHILD_ID_HUM, S_HUM);
        present(CHILD_ID_BINARY, S_BINARY);
      }
      
      void loop()
      {
        // generate some random data
        counter ++;
        if (counter == 20 ){
          temperature = 0;
          humidity = 0;
          counter = 0;
        }
        else
        {
          temperature = 25.0 + random(0,30)/10.0;
          humidity = 55.0 + random(-20,20);
        }
      /*
        if (binary == 0){
          send(msgBinary.set(binary,2));
          binary = 1;
        }else {
          send(msgBinary.set(binary,2));
          binary = 0;
      
        }
      */
        send(msgTemp.set(temperature,2));
        send(msgHum.set(humidity,2));
        wait(1000);
      }
      
      posted in General Discussion
      smilvert
      smilvert
    • NRF52 -> Will not wake after sleep

      Hi

      Finally I have had time to solder my project, Temp_hum, and started to create the code for it. But I struggle with some bascis

      Code for the sensor:

      
      #define MY_NODE_ID 37
      
      // Enable debug prints
      #define MY_DEBUG
      
      // #define MY_DEBUG_VERBOSE_NRF5_ESB
      #define MY_BAUD_RATE 115200
      
      // Enable and select radio type attached
      //#define MY_RADIO_RF24
      //#define MY_RADIO_RFM69
      //#define MY_RS485
      #define MY_RADIO_NRF5_ESB
      
      #define CHILD_ID_HUM 0
      #define CHILD_ID_TEMP 1
      #define CHILD_ID_VOLT 2
      
      #define IS_NRF52
      // #define IS_NRF51
      
      #define SHORT_WAIT 100
      
      // Sleep time between sensor updates (in milliseconds)
      static const uint64_t UPDATE_INTERVAL = 6000;
      
      static bool metric = true;
      
      float batteryPcnt;
      float oldBatteryPcnt;
      
      #include <MySensors.h>
      #include <SI7021.h>
      
      static SI7021 sensor;
      
      void disableNfc()
      { //only applied to nRF52
      
      #ifdef IS_NRF52
        //Make pins 9 and 10 usable as GPIO pins.
        NRF_NFCT->TASKS_DISABLE = 1; //disable NFC
        NRF_NVMC->CONFIG = 1;        // Write enable the UICR
        NRF_UICR->NFCPINS = 0;       //Make pins 9 and 10 usable as GPIO pins.
        NRF_NVMC->CONFIG = 0;        // Put the UICR back into read-only mode.
      #endif
      }
      
      void turnOffRadio()
      {
        NRF_RADIO->TASKS_DISABLE = 1;
        while (!(NRF_RADIO->EVENTS_DISABLED))
        {
        } //until radio is confirmed disabled
      }
      
      void turnOffAdc()
      {
      #ifndef IS_NRF52
        if (NRF_SAADC->ENABLE)
        { //if enabled, then disable the SAADC
          NRF_SAADC->TASKS_STOP = 1;
          while (NRF_SAADC->EVENTS_STOPPED)
          {
          }                      //wait until stopping of SAADC is confirmed
          NRF_SAADC->ENABLE = 0; //disable the SAADC
          while (NRF_SAADC->ENABLE)
          {
          } //wait until the disable is confirmed
        }
      #endif
      }
      
      void turnOffUarte0()
      {
      #ifndef IS_NRF52
        NRF_UARTE0->TASKS_STOPRX = 1;
        NRF_UARTE0->TASKS_STOPTX = 1;
        NRF_UARTE0->TASKS_SUSPEND = 1;
        NRF_UARTE0->ENABLE = 0; //disable UART0
        while (NRF_UARTE0->ENABLE != 0)
        {
        }; //wait until UART0 is confirmed disabled.
      #endif
      
      #ifdef IS_NRF51
        NRF_UART0->TASKS_STOPRX = 1;
        NRF_UART0->TASKS_STOPTX = 1;
        NRF_UART0->TASKS_SUSPEND = 1;
        NRF_UART0->ENABLE = 0; //disable UART0
        while (NRF_UART0->ENABLE != 0)
        {
        }; //wait until UART0 is confirmed disabled.
      #endif
      }
      
      void turnOffHighFrequencyClock()
      {
        NRF_CLOCK->TASKS_HFCLKSTOP = 1;
        while ((NRF_CLOCK->HFCLKSTAT) & 0x0100)
        {
        } //wait as long as HF clock is still running.
      }
      
      void mySleepPrepare()
      { //turn-off energy drains prior to sleep
        turnOffHighFrequencyClock();
        turnOffRadio();
        //turnOffUarte0();
      }
      
      void presentation()
      {
        Serial.println("Presentation");
        // Send the sketch info to the gateway
        sendSketchInfo("TemperatureAndHumidity", "1.2");
      
        // Present sensors as children to gateway
        present(CHILD_ID_HUM, S_HUM, "Humidity");
        delay(SHORT_WAIT);
        present(CHILD_ID_TEMP, S_TEMP, "Temperature");
        delay(SHORT_WAIT);
        present(CHILD_ID_VOLT, S_MULTIMETER, "Battery");
      
        metric = getControllerConfig().isMetric;
        Serial.println("End presention");
      }
      
      void setup()
      {
        Serial.println("Setup");
        hwInit();
        
        disableNfc(); //remove unnecessary energy drains
        turnOffAdc(); //remove unnecessary energy drains
        while (not sensor.begin())
        {
          Serial.println(F("Sensor not detected!"));
          wait(5000);
        }
        Serial.println("End Setup");
      }
      
      void mySleep(uint32_t ms)
      {
        mySleepPrepare();  //Take steps to reduce drains on battery current prior to sleeping
        sleep(ms);
      }
      
      void loop()
      {
        // Read temperature & humidity from sensor.
        const float temperature = float(metric ? sensor.getCelsiusHundredths() : sensor.getFahrenheitHundredths()) / 100.0;
        const float humidity = float(sensor.getHumidityBasisPoints()) / 100.0;
      
      #ifdef MY_DEBUG
        Serial.print(F("Temp "));
        Serial.print(temperature);
        Serial.print(metric ? 'C' : 'F');
        Serial.print(F("\tHum "));
        Serial.println(humidity);
      #endif
      
        static MyMessage msgHum(CHILD_ID_HUM, V_HUM);
        static MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
        static MyMessage msgBattery(CHILD_ID_VOLT, V_VOLTAGE);
      
        send(msgTemp.set(temperature, 2));
      
        wait(SHORT_WAIT);
        send(msgHum.set(humidity, 2));
      
        float batteryVolt = getInternalVoltage();
        batteryPcnt =(batteryVolt / 3.3) * 100;
        if (batteryPcnt > 100)
        {
          batteryPcnt = 100;
        }
      #ifdef MY_DEBUG
        Serial.print(F("Vbat "));
        Serial.print(batteryVolt);
        Serial.print(F(" Battery percent "));
        Serial.println(batteryPcnt);
      #endif
      
        // Battery readout should only go down. So report only when new value is smaller than previous one.
        if (batteryPcnt < oldBatteryPcnt)
        {
      
          wait(SHORT_WAIT);
          send(msgBattery.set(batteryVolt, 3));
          wait(SHORT_WAIT);
          if (batteryPcnt < oldBatteryPcnt)
          {
            sendBatteryLevel(batteryPcnt);
            oldBatteryPcnt = batteryPcnt;
          }
      
          // Sleep until next update to save energy
          // 
          
        }
        //delay(5000);
        mySleep(UPDATE_INTERVAL);
      }
      
      float getInternalVoltage()
      {
        return ((float)hwCPUVoltage()) / 1000.0;
      }
      
      

      Have some problems.

      First and biggest: The sensor will not wake,

      2577 TSF:MSG:SEND,37-37-0-0,s=0,c=1,t=1,pt=7,l=5,sg=0,ft=0,st=OK:33.34
      Vbat 3.29 Battery percent 99.67
      2587 MCO:SLP:MS=6000,SMS=0,I1=255,M1=255,I2=255,M2=255
      2591 TSF:TDI:TPD
      8593 MCO:SLP:WUP=-1
      8595 TSF:TRI:TPU
      Temp 23.46C	Hum 33.85
      8626 TSF:MSG:SEND,37-37-0-0,s=1,c=1,t=0,pt=7,l=5,sg=0,ft=0,st=OK:23.46
      8733 TSF:MSG:SEND,37-37-0-0,s=0,c=1,t=1,pt=7,l=5,sg=0,ft=0,st=OK:33.85
      Vbat 3.29 Battery percent 99.67
      8743 MCO:SLP:MS=6000,SMS=0,I1=255,M1=255,I2=255,M2=255
      8748 TSF:TDI:TPD
      

      (Some times I got stuck at:

      5803 MCO:SLP:MS=6000,SMS=0,I1=255,M1=255,I2=255,M2=255
      5807 TSF:TDI:TPD
      11809 MCO:SLP:WUP=-1
      11811 TSF:TRI:TPU
      Temp 22.69C	Hum 31.08
      11842 TSF:MSG:SEND,37-37-0-0,s=1,c=1,t=0,pt=7,l=5,sg=0,ft=0,st=OK:22.69
      

      )

      Second when im trying to debug with

      #define MY_DEBUG_VERBOSE_NRF5_ESB
      

      the node will not pass presentation.

      153 NRF5:SND:END=1,ACK=1,RTRY=1,RSSI=-55,WAKE=5
      4158 TSF:MSG:SEND,37-37-0-0,s=255,c=0,t=17,pt=0,l=5,sg=0,ft=0,st=OK:2.3.2
      4164 NRF5:SND:TO=0,LEN=8,PID=1,NOACK=0
      4169 NRF5:SND:END=1,ACK=1,RTRY=1,RSSI=-55,WAKE=4
      4174 TSF:MSG:SEND,37-37-0-0,s=255,c=3,t=6,pt=1,l=1,sg=0,ft=0,st=OK:0
      4180 NRF5:RX:LEN=9,NOACK=0,PID=2,RSSI=-74,RX=0
      4184 TSF:MSG:READ,0-0-37,s=255,c=3,t=15,pt=6,l=2,sg=0:0100
      4190 NRF5:RX:LEN=8,NOACK=0,PID=1,RSSI=-53,RX=0
      4194 TSF:MSG:READ,0-0-37,s=255,c=3,t=6,pt=0,l=1,sg=0:M
      Presentation
      4200 NRF5:SND:TO=0,LEN=29,PID=2,NOACK=0
      4206 NRF5:SND:END=1,ACK=1,RTRY=1,RSSI=-55,WAKE=5
      4210 TSF:MSG:SEND,37-37-0-0,s=255,c=3,t=11,pt=0,l=22,sg=0,ft=0,st=OK:TemperatureAndHumidity
      4218 NRF5:SND:TO=0,LEN=10,PID=3,NOACK=0
      4223 NRF5:SND:END=1,ACK=1,RTRY=1,RSSI=-55,WAKE=4
      4228 TSF:MSG:SEND,37-37-0-0,s=255,c=3,t=12,pt=0,l=3,sg=0,ft=0,st=OK:1.2
      4234 NRF5:SND:TO=0,LEN=15,PID=0,NOACK=0
      4239 NRF5:SND:END=1,ACK=1,RTRY=1,RSSI=-55,WAKE=4
      4244 TSF:MSG:SEND,37-37-0-0,s=0,c=0,t=7,pt=0,l=8,sg=0,ft=0,st=OK:Humidity
      

      Someone that can help me?

      posted in Troubleshooting
      smilvert
      smilvert
    • RE: Why do "passive nodes" need to set their Node ID manually?

      @NeverDie

      Well I wanted to filter noise values and I also want to use influx/grafana as a complement to domoticz

      posted in General Discussion
      smilvert
      smilvert
    • RE: GWT:TPC:CONNECTING

      @DenisJ I have the same problem. Works with

      #define MY_GATEWAY_ESP32
      

      but with

      #define MY_GATEWAY_ESP32
      #define MY_GATEWAY_MQTT_CLIENT
      

      it dosen't. But when I changed the delay to 3000

      bool gatewayTransportConnect(void)
      {
      #if defined(MY_GATEWAY_ESP8266) || defined(MY_GATEWAY_ESP32)
      	if (WiFi.status() != WL_CONNECTED) {
      		GATEWAY_DEBUG(PSTR("GWT:TPC:CONNECTING...\n"));
      		delay(3000); // Was 1000
      		return false;
      	}
      	GATEWAY_DEBUG(PSTR("GWT:TPC:IP=%s\n"), WiFi.localIP().toString().c_str());
      

      in MyGatewayTransportMQTTClient.cpp then it started to work! 🙂

      posted in Troubleshooting
      smilvert
      smilvert
    • RE: GWT:TPC:CONNECTING

      No I have no idea. For me it seems to work.

      Currently I don't have any sensors conncted so its hard to see if it works.

      posted in Troubleshooting
      smilvert
      smilvert
    • RE: GWT:TPC:CONNECTING

      @electrik A ticket is raised quite long time ago, https://github.com/mysensors/MySensors/issues/1376

      posted in Troubleshooting
      smilvert
      smilvert

    Latest posts made by smilvert

    • RE: RFM95 RFM95:SWR:NACK

      @lood29 When I use TTGO LORA as a dummy sensor (Node 10 in the above log) it always works without any nacks.

      The NACK only appears when I connect my own sensor (Node 140 in the log above).

      So Scenario 1
      Dummy sensor (TTGO LORA) <-> MQTT gateway (TTGO LORA) -> Works

      Scenario 2
      My sensor <-> MQTT gateway (TTGO LORA) -> NACK in the Gateway.

      posted in Troubleshooting
      smilvert
      smilvert
    • RFM95 RFM95:SWR:NACK

      Hi

      Im trying to setup a temperature sensor that should be placed at my jetty, 350 meters from my house. So I have chosen RFM95 as my radio, an E-ink display to show the temperature but I have some struggle to this setup. Need some debug help.

      As the controller I have a TTGO LORA.

      I have two of the TTGO LORA, One gateway and one debug sensor, so I can verify that thoose are working with mysensors but when I add my custom sensor I receives a lot of !RFM95:SWR:NACK from the Gateway.

      Sensor code:

      //#define MY_PASSIVE_NODE
      //#define PIN_SERIAL_TX       (8) 
      // Enable debug prints
      #define MY_DEBUG
      #define MY_DEBUG_VERBOSE_RFM95
      
      //#define   MY_DEBUG_VERBOSE_NRF5_ESB
      #define MY_NODE_ID 140
      //#define MY_GATEWAY_SERIAL
      
      
      #define MY_RFM95_RST_PIN 15
      #define MY_RFM95_IRQ_PIN 16
      #define MY_RFM95_IRQ_NUM MY_RFM95_IRQ_PIN
      #define DEFAULT_RFM95_CS_PIN      (SS)
      
      #define MY_RFM95_FREQUENCY (RFM95_434MHZ)
      // #define MY_RFM95_ATC_MODE_DISABLED
      #define MY_RFM95_ATC_TARGET_RSSI_DBM (-70)  // target RSSI -70dBm
      #define MY_RFM95_MAX_POWER_LEVEL_DBM (10)   // max. TX power 10dBm = 10mW
      
      #define RFM95_RETRY_TIMEOUT_MS 3000ul
      #define MY_TRANSPORT_STATE_TIMEOUT_MS 6*1000ul
      
      // Enable and select radio type attached
      //#define MY_RADIO_NRF24
      //#define MY_RADIO_NRF5_ESB
      //#define MY_RADIO_RFM69
      #define MY_RADIO_RFM95
      
      
      #include <MySensors.h>
      
      #define ENABLE_GxEPD2_GFX 1
      
      #include <GxEPD2_BW.h>
      #include <GxEPD2_3C.h>
      
      #include "Fonts/FreeMonoBold9pt7b.h" 
      #include "Fonts/FreeSerif18pt7b.h" 
      #include "Fonts/FreeSans18pt7b.h" 
      #include "Fonts/FreeSansBold24pt7b.h" 
      
      
      GxEPD2_BW<GxEPD2_154, GxEPD2_154::HEIGHT> display(GxEPD2_154(/*CS=5*/ 22, /*DC=*/ 24, /*RST=*/ -1, /*BUSY=*/ 19));
      
      #include "GxEPD2_boards_added.h"
      #include "bitmaps/Bitmaps200x200.h" // 1.54" b/w
      
      
      #define CHILD_ID_TEMP           (0)  
      #define CHILD_ID_HUM            (1)
      
      // ID of the sensor child
      #define CHILD_ID_UPLINK_QUALITY (2)
      #define CHILD_ID_TX_LEVEL       (3)
      #define CHILD_ID_TX_PERCENT     (4)
      #define CHILD_ID_TX_RSSI        (5)
      #define CHILD_ID_RX_RSSI        (6)
      #define CHILD_ID_TX_SNR         (7)
      #define CHILD_ID_RX_SNR         (8)
      
      
      // Initialize general message
      MyMessage msgTxRSSI(CHILD_ID_TX_RSSI, V_DISTANCE);
      MyMessage msgRxRSSI(CHILD_ID_RX_RSSI, V_DISTANCE);
      MyMessage msgTxSNR(CHILD_ID_TX_SNR, V_DISTANCE);
      MyMessage msgRxSNR(CHILD_ID_RX_SNR, V_DISTANCE);
      MyMessage msgTxLevel(CHILD_ID_TX_LEVEL, V_DISTANCE);
      MyMessage msgTxPercent(CHILD_ID_TX_PERCENT, V_DISTANCE);
      MyMessage msgUplinkQuality(CHILD_ID_UPLINK_QUALITY, V_DISTANCE);
      
      #define ledPin LED_BUILTIN
      // Initialize general message
      MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
      MyMessage msgHum(CHILD_ID_HUM, V_HUM);
      
      float batteryVoltage = 0;
      float temperature = 0;
      int humidity = 0;
      int counter = 0;
      int switch_led = 1;
      
      void setup()
      {
        
        Serial.print("Display init");
        sleep(1000);
        hwPinMode(ledPin, OUTPUT_D0H1);
      
        NRF_CLOCK->INTENSET = B11; //enable interrupts for EVENTS_HFCLKSTARTED and  EVENTS_LFCLKSTARTED
        NRF_CLOCK->TASKS_HFCLKSTART = 1; //start the high frequency crystal oscillator clock
        while (!(NRF_CLOCK->EVENTS_HFCLKSTARTED)) {} //wait until high frequency crystal oscillator clock is up to speed and working
      
        pinMode(ledPin, OUTPUT);
        digitalWrite(ledPin, HIGH);
        display.init(115200);
        clearScreen();
      
      }
      
      void presentation()
      {
        // Send the sketch version information to the gateway and controller
        sendSketchInfo("Passive node", "1.1");
        // Register all sensors to gw (they will be created as child devices)
        present(CHILD_ID_TEMP, S_TEMP, "Temp");
        present(CHILD_ID_HUM, S_HUM, "Hum");
      
        present(CHILD_ID_UPLINK_QUALITY, S_DISTANCE, "UPLINK QUALITY RSSI");
        present(CHILD_ID_TX_LEVEL, S_DISTANCE, "TX LEVEL DBM");
        present(CHILD_ID_TX_PERCENT, S_DISTANCE, "TX LEVEL PERCENT");
        present(CHILD_ID_TX_RSSI, S_DISTANCE, "TX RSSI");
        present(CHILD_ID_RX_RSSI, S_DISTANCE, "RX RSSI");
        present(CHILD_ID_TX_SNR, S_DISTANCE, "TX SNR");
        present(CHILD_ID_RX_SNR, S_DISTANCE, "RX SNR");
      
      }
      
      void loop()
      {
      
        // generate some random data
        counter ++;
        if (counter == 10 ) {
          temperature = 0;
          humidity = 0;
          counter = 0;
        }
        else
        {
          temperature = 25.0 + random(0, 30) / 10.0;
          humidity = 55.0 + random(-20, 20);
        }
        int16_t uplink = transportGetSignalReport(SR_UPLINK_QUALITY);
        int16_t power_link = transportGetSignalReport(SR_TX_POWER_LEVEL);
        int16_t tx_power_percent = transportGetSignalReport(SR_TX_POWER_PERCENT);
        int16_t tx_rssi = transportGetSignalReport(SR_TX_RSSI);
        int16_t rx_rssi = transportGetSignalReport(SR_RX_RSSI);
        int16_t tx_snr = transportGetSignalReport(SR_TX_SNR);
        int16_t rx_snr = transportGetSignalReport(SR_RX_SNR);
      
        send(msgUplinkQuality.set(uplink));
        send(msgTxLevel.set(power_link));
        send(msgTxPercent.set(tx_power_percent));
        // retrieve RSSI / SNR reports from incoming ACK
        send(msgTxRSSI.set(tx_rssi));
        send(msgRxRSSI.set(rx_rssi));
        send(msgTxSNR.set(tx_snr));
        send(msgRxSNR.set(rx_snr));
        // wait a bit
      
        showDisplay(temperature, humidity, counter, uplink, power_link, tx_power_percent, tx_rssi, rx_rssi);
        send(msgTemp.set(temperature, 2));
        send(msgHum.set(humidity, 2));
        wait(5000);
      
        if (switch_led == 1)
        {
          digitalWrite(ledPin, HIGH);
          switch_led = 0;
        } else {
          digitalWrite(ledPin, LOW);
          switch_led = 1;
        }
      
      }
      
      const char temp[] = "Vattentemp:";
      const char hum[] = "Hum: ";
      const char counter_text[] = "Counter: ";
      const char hello[] = "Hello";
      const char clearText[] = "CLEAR";
      const char UPLINK_QUALITYtext[] = "Uplink_qa: ";
      const char TX_POWER_LEVELtext[] = "Tx power level: ";
      const char TX_RSSItext[] = "Tx rssi: ";
      const char RX_RSSItext[] = "RX rssi";
      const char TX_POWER_PERCENT_text[] = "Tx power:";
      
      
      void clearScreen()
      {
        display.setFullWindow();
        display.setTextColor(GxEPD_BLACK);
        display.fillScreen(GxEPD_WHITE);
        display.setCursor(0, 0);
        display.firstPage();
        do
        {
        }
        while (display.nextPage() );
      }
      
      void showDisplay(float temperature, int humidity, int counter,
                      int UPLINK_QUALITY, int TX_POWER_LEVEL, int TX_POWER_PERCENT,
                      int TX_RSSI, int RX_RSSI)
      {
        display.setRotation(1);
        display.setPartialWindow(0, 0, display.width(), display.height());
        display.setTextColor(GxEPD_BLACK);
        //display.setFullWindow();
        display.setCursor(0, 0);
        display.firstPage();
        // display.fillScreen(GxEPD_WHITE);
        uint16_t x = (display.width() ) ;
        uint16_t y = (display.height() ) ;
        display.setCursor(10, 50);
      
        do
        {
          display.setFont(&FreeSans18pt7b);
          display.println(temp);
          display.setFont(&FreeMonoBold9pt7b);
          display.println();
          display.println();
          display.setFont(&FreeSansBold24pt7b);
          display.print(temperature, 1);
          display.setFont(&FreeMonoBold9pt7b);
          display.println();
      
          display.print(counter_text);
          display.println(counter);
      
      
          display.print(TX_RSSItext);
          display.println(TX_RSSI);
      
          display.print(RX_RSSItext);
          display.println(RX_RSSI);
        }
        while (display.nextPage() );
        Serial.println("showDisplay done");
      }
      
      

      Gateway code:

      /*
       * 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-2019 Sensnology AB
       * Full contributor list: https://github.com/mysensors/MySensors/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.
       *
       *******************************
       *
       * REVISION HISTORY
       * Version 1.0 - tekka
       *
       * DESCRIPTION
       * The ESP32 gateway sends data received from sensors to the WiFi link.
       * The gateway also accepts input on ethernet interface, which is then sent out to the radio network.
       *
       * Make sure to fill in your ssid and WiFi password below.
       */
      
      // Enable debug prints to serial monitor
      #define MY_DEBUG
      #define MY_DEBUG_VERBOSE_RFM95
      #define MY_DEBUG_VERBOSE_TRANSPORT
      #define MY_DEBUG_VERBOSE_GATEWAY
      #define MY_DEBUG_VERBOSE_TRANSPORT_HAL
      
      #define MY_RADIO_RFM95
      
      #define RST     14   // GPIO14 -- SX1278's RESET
      #define DI0     26   // GPIO26 -- SX1278's IRQ(Interrupt Request)
      
      #define MY_RFM95_IRQ_PIN DI0
      #define MY_RFM95_IRQ_NUM MY_RFM95_IRQ_PIN
      #define MY_RFM95_CS_PIN SS
      
      #define MY_RFM95_FREQUENCY (RFM95_434MHZ)
      
      #define MY_GATEWAY_ESP32
      #define MY_GATEWAY_MQTT_CLIENT
      
      // Set this node's subscribe and publish topic prefix
      #define MY_MQTT_PUBLISH_TOPIC_PREFIX "mygateway1-out"
      #define MY_MQTT_SUBSCRIBE_TOPIC_PREFIX "mygateway1-in"
      
      // Set MQTT client id
      #define MY_MQTT_CLIENT_ID "mysensors-1"
      
      // Set WIFI SSID and password
      #define MY_WIFI_SSID "xxxxx"
      #define MY_WIFI_PASSWORD "xxxx"
      
      // Set the hostname for the WiFi Client. This is the hostname
      // passed to the DHCP server if not static.
      #define MY_HOSTNAME "ESP32_MQTT_GW"
      
      // MQTT broker ip address.
      #define MY_CONTROLLER_IP_ADDRESS 10, 0, 0, 3
      
      // The MQTT broker port to to open
      #define MY_PORT 1883
      
      #include <MySensors.h>
      
      void setup()
      {
      	Serial.println("Setup");
      }
      
      void presentation()
      {
      	// Present locally attached sensors here
      }
      
      void loop()
      {
      	// Send locally attech sensors data here
      }
      
      

      Debug log from sensor:

      23 MCO:BGN:INIT NODE,CP=RLNNN---,FQ=16,REL=255,VER=2.3.2
      29 TSM:INIT
      30 TSF:WUR:MS=0
      31 RFM95:INIT
      38 RFM95:INIT:PIN,CS=11,IQP=16,IQN=16,RST=15
      52 RFM95:PTX:LEVEL=13
      54 TSM:INIT:TSP OK
      55 TSM:INIT:STATID=140
      58 TSF:SID:OK,ID=140
      60 TSM:FPAR
      61 RFM95:SWR:SEND,TO=255,SEQ=0,RETRY=0
      7064 ?TSF:MSG:SEND,140-140-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=NACK:
      13071 !TSM:FPAR:NO REPLY
      13073 TSM:FPAR
      13074 RFM95:SWR:SEND,TO=255,SEQ=1,RETRY=0
      20078 ?TSF:MSG:SEND,140-140-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=1,st=NACK:
      26085 !TSM:FPAR:NO REPLY
      26087 TSM:FPAR
      26088 RFM95:SWR:SEND,TO=255,SEQ=2,RETRY=0
      33092 ?TSF:MSG:SEND,140-140-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=2,st=NACK:
      39099 !TSM:FPAR:NO REPLY
      39101 TSM:FPAR
      

      Debug from gateway:

      
      1982032 THA:DATA:AVAIL
      1982084 RFM95:SAC:SEND ACK,TO=10,SEQ=27,RSSI=-17,SNR=9
      1982132 THA:RCV:MSG=0A0A0022810D0500FFFFFF
      1982136 THA:RCV:MSG LEN=11
      1982138 TSF:MSG:READ,10-10-0,s=5,c=1,t=13,pt=4,l=4,sg=0:-256
      1982143 GWT:TPS:TOPIC=mygateway1-out/10/5/1/0/13,MSG SENT
      1982782 THA:DATA:AVAIL
      1982834 RFM95:SAC:SEND ACK,TO=10,SEQ=28,RSSI=-17,SNR=10
      1982882 THA:RCV:MSG=0A0A0022810D0609000000
      1982886 THA:RCV:MSG LEN=11
      1982888 TSF:MSG:READ,10-10-0,s=6,c=1,t=13,pt=4,l=4,sg=0:9
      1982893 GWT:TPS:TOPIC=mygateway1-out/10/6/1/0/13,MSG SENT
      1983582 THA:DATA:AVAIL
      1983634 RFM95:SAC:SEND ACK,TO=10,SEQ=29,RSSI=-18,SNR=9
      1983682 THA:RCV:MSG=0A0A002AE100086666CE4102
      1983686 THA:RCV:MSG LEN=12
      1983688 TSF:MSG:READ,10-10-0,s=8,c=1,t=0,pt=7,l=5,sg=0:25.80
      1983694 GWT:TPS:TOPIC=mygateway1-out/10/8/1/0/0,MSG SENT
      1984382 THA:DATA:AVAIL
      1984434 RFM95:SAC:SEND ACK,TO=10,SEQ=30,RSSI=-18,SNR=9
      1984482 THA:RCV:MSG=0A0A002AE101070000544202
      1984486 THA:RCV:MSG LEN=12
      1984488 TSF:MSG:READ,10-10-0,s=7,c=1,t=1,pt=7,l=5,sg=0:53.00
      1984494 GWT:TPS:TOPIC=mygateway1-out/10/7/1/0/1,MSG SENT
      1988912 THA:DATA:AVAIL
      1988914 THA:RCV:MSG=8C8CFF020307FF
      1988917 THA:RCV:MSG LEN=7
      1988919 TSF:MSG:READ,140-140-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
      1988924 TSF:MSG:BC
      1988926 TSF:MSG:FPAR REQ,ID=140
      1988929 TSF:PNG:SEND,TO=0
      1988931 TSF:CKU:OK
      1988933 TSF:MSG:GWL OK
      1989262 THA:SND:MSG=00008C0A2308FF00
      1989265 RFM95:SWR:SEND,TO=140,SEQ=65,RETRY=0
      1989817 !RFM95:SWR:NACK
      1989836 RFM95:SWR:SEND,TO=140,SEQ=66,RETRY=1
      1990388 !RFM95:SWR:NACK
      1990478 RFM95:SWR:SEND,TO=140,SEQ=66,RETRY=2
      1991030 !RFM95:SWR:NACK
      1991062 RFM95:SWR:SEND,TO=140,SEQ=66,RETRY=3
      1991614 !RFM95:SWR:NACK
      1991630 RFM95:SWR:SEND,TO=140,SEQ=66,RETRY=4
      1992182 !RFM95:SWR:NACK
      1992266 THA:SND:MSG LEN=8,RES=0
      1992268 !TSF:MSG:SEND,0-0-140-140,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0
      

      And here I can see that the gateway recieves data from sensor 140 but can't ack 😞

      Can someone please help me?

      posted in Troubleshooting
      smilvert
      smilvert
    • RE: GWT:TPC:CONNECTING

      @electrik A ticket is raised quite long time ago, https://github.com/mysensors/MySensors/issues/1376

      posted in Troubleshooting
      smilvert
      smilvert
    • RE: GWT:TPC:CONNECTING

      No I have no idea. For me it seems to work.

      Currently I don't have any sensors conncted so its hard to see if it works.

      posted in Troubleshooting
      smilvert
      smilvert
    • RE: GWT:TPC:CONNECTING

      @DenisJ I have the same problem. Works with

      #define MY_GATEWAY_ESP32
      

      but with

      #define MY_GATEWAY_ESP32
      #define MY_GATEWAY_MQTT_CLIENT
      

      it dosen't. But when I changed the delay to 3000

      bool gatewayTransportConnect(void)
      {
      #if defined(MY_GATEWAY_ESP8266) || defined(MY_GATEWAY_ESP32)
      	if (WiFi.status() != WL_CONNECTED) {
      		GATEWAY_DEBUG(PSTR("GWT:TPC:CONNECTING...\n"));
      		delay(3000); // Was 1000
      		return false;
      	}
      	GATEWAY_DEBUG(PSTR("GWT:TPC:IP=%s\n"), WiFi.localIP().toString().c_str());
      

      in MyGatewayTransportMQTTClient.cpp then it started to work! 🙂

      posted in Troubleshooting
      smilvert
      smilvert
    • RE: Heltec esp32 LoRa oled

      @mrussi I am also interested in using an esp32 with lora as the gateway. Did you make it work?

      I planning to buy, https://www.botnroll.com/en/esp/2979-esp32-wifi-bluetooth-lora-sx1278-433mhz-with-0-96-oled-display.html

      posted in Hardware
      smilvert
      smilvert
    • RE: NRF52 -> Will not wake after sleep

      I have been trying @nagelc code with a lot of debug prints and I think that my device is stuck after

      MyHwNRF5.cpp

      inline void hwSleep(void)
      {	CORE_DEBUG(PSTR("In hwSleep, 345\n"));
      	__WFE();
      	__SEV();
      	__WFE();
      	CORE_DEBUG(PSTR("In hwSleep, 351\n"));
      }
      
      int8_t hwSleep(uint32_t ms)
      {
      	hwSleepPrepare(ms);
      	while (nrf5_rtc_event_triggered == false) {
      		hwSleep();
      	}
      	CORE_DEBUG(PSTR("In hwSleep, 357\n"));
      	hwSleepEnd(ms);
      	return MY_WAKE_UP_BY_TIMER;
      }
      

      And I will not go to hwSleepEnd

      11274 MCO:SLP:MS=5000,SMS=0,I1=255,M1=255,I2=255,M2=255
      11280 TSF:TDI:TPD
      11281 After transport Disable
      11284 Before hwSleep
      11286 In hwSleepPrepare, 287
      11289 In hwSleepPrepare,300
      11291 In hwSleep, 345
      
      posted in Troubleshooting
      smilvert
      smilvert
    • RE: NRF52 -> Will not wake after sleep

      @nagelc Thanks will try

      posted in Troubleshooting
      smilvert
      smilvert
    • RE: NRF52 -> Will not wake after sleep

      @nagelc can you use
      MY_DEBUG_VERBOSE_NRF5_ESB

      Do I need to add a bigger capacitor between gnd and +3?

      posted in Troubleshooting
      smilvert
      smilvert
    • RE: NRF52 -> Will not wake after sleep

      I have a feeling that the

      Wait()
      

      Is the problem but haven't had time to investigate.

      posted in Troubleshooting
      smilvert
      smilvert