Navigation

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

    smilvert

    @smilvert

    5
    Reputation
    33
    Posts
    777
    Profile views
    0
    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

    Latest posts made by 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
    • 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
    • hwSPI NRF52

      Hi

      I want to understand how the hwSPI works for the NRF52 and a RFM95 module.

      I suppose that I can define more then one SPI interface in the file MyBoardNRF5.h so it looks like
      SodaqMoja/SodaqCore-samd (should be updated to the NRF52 pins)

      #ifdef ENABLE_SPI1
      #define SPI_INTERFACES_COUNT 2
      #else
      #define SPI_INTERFACES_COUNT 1
      #endif
      
      // SPI
      #define PIN_SPI_MISO         (42u)
      #define PIN_SPI_SS           (43u)
      #define PIN_SPI_MOSI         (44u)
      #define PIN_SPI_SCK          (45u)
      
      static const uint8_t MISO = PIN_SPI_MISO;
      static const uint8_t SS   = PIN_SPI_SS ;
      static const uint8_t SS_DFLASH  = PIN_SPI_SS ;
      static const uint8_t MOSI = PIN_SPI_MOSI ;
      static const uint8_t SCK  = PIN_SPI_SCK ;
      
      // SPI1
      #define PIN_SPI1_MISO        (53u)
      #define PIN_SPI1_SS          (54u)
      #define PIN_SPI1_MOSI        (55u)
      #define PIN_SPI1_SCK         (56u)
      
      static const uint8_t MISO1 = PIN_SPI1_MISO;
      static const uint8_t SS1   = PIN_SPI1_SS;
      static const uint8_t MOSI1 = PIN_SPI1_MOSI;
      static const uint8_t SCK1  = PIN_SPI1_SCK;
      

      But I don't get how I will init the second SPI bus and point it to the RFM95 module. Guessing it should be define RFM95_SPI SPI1 or something like that?

      #if !defined(RFM95_SPI)
      #define RFM95_SPI hwSPI //!< default SPI
      #endif
      
      posted in Development
      smilvert
      smilvert
    • RE: nRF5 action!

      @omemanti Well it seems to start working now... Hopefully it works 🙂 Havn't restart the gateway in 2 weeks now

      posted in My Project
      smilvert
      smilvert
    • RE: nRF5 action!

      I have recently installed an Ebyte E73 as my gateway with a DHT22. The problem is that I need to restart the gateway every 2 days and I can't figure out why. Can someone help me?

      /**
         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-2017 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.
      
       *******************************
      
         REVISION HISTORY
      
      
      */
      
      // Enable debug prints
      #define MY_DEBUG
      
      // Enable serial gateway
      #define MY_GATEWAY_SERIAL
      
      
      
      // Set blinking period
      #define MY_DEFAULT_LED_BLINK_PERIOD 300
      
      // Enable and select radio type attached
      //#define MY_RADIO_NRF24
      #define MY_RADIO_NRF5_ESB
      //#define MY_RADIO_RFM69
      //#define MY_RADIO_RFM95
      
      #include <SPI.h>
      #include <MySensors.h>
      #include "DHT.h"
      
      int switch_led = 1;
      #define ledPin 11
      // Set this to the pin you connected the DHT's data pin to
      #define DHT_DATA_PIN 02
      #define DHTTYPE DHT22   // DHT 22  (AM2302), AM2321
      
      
      // Set this offset if the sensor has a permanent small offset to the real temperatures.
      // In Celsius degrees (as measured by the device)
      #define SENSOR_TEMP_OFFSET 0
      
      // Sleep time between sensor updates (in milliseconds)
      // Must be >1000ms for DHT22 and >2000ms for DHT11
      static const uint64_t UPDATE_INTERVAL = 600000;
      
      // Force sending an update of the temperature after n sensor reads, so a controller showing the
      // timestamp of the last update doesn't show something like 3 hours in the unlikely case, that
      // the value didn't change since;
      // i.e. the sensor would force sending an update every UPDATE_INTERVAL*FORCE_UPDATE_N_READS [ms]
      static const uint8_t FORCE_UPDATE_N_READS = 10;
      
      #define CHILD_ID_HUM 1
      #define CHILD_ID_TEMP 0
      
      float lastTemp;
      float lastHum;
      uint8_t nNoUpdatesTemp;
      uint8_t nNoUpdatesHum;
      bool metric = true;
      
      MyMessage msgHum(CHILD_ID_HUM, V_HUM);
      MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
      DHT dht(DHT_DATA_PIN, DHTTYPE);
      
      void setup()
      {
          hwPinMode(LED_BUILTIN,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(PIN_LED1, OUTPUT);
          digitalWrite(PIN_LED1, HIGH);
      
          dht.begin(); // set data pin of DHT sensor
      }
      
      void presentation()
      {
          // Send the sketch version information to the gateway and controller
          sendSketchInfo("Serial Gateway nrf52", "1.0");
          wait(500);
          // Register all sensors to gw (they will be created as child devices)
          present(CHILD_ID_TEMP, S_TEMP);
          present(CHILD_ID_HUM, S_HUM);
      }
      
      void loop()
      {
      
          // Reading temperature or humidity takes about 250 milliseconds!
          // Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)
          float h = dht.readHumidity();
          // Read temperature as Celsius (the default)
          float t = dht.readTemperature();
          // Read temperature as Fahrenheit (isFahrenheit = true)
          float f = dht.readTemperature(true);
          Serial.print("Test print");
          // Check if any reads failed and exit early (to try again).
          if (isnan(h) || isnan(t) || isnan(f)) {
          //Serial.println("Failed to read from DHT sensor!");
          return;
          } else {
          send(msgHum.set(h, 1));
          send(msgTemp.set(t, 1));
      
          }
      
          wait(UPDATE_INTERVAL);
      }
      
      
      posted in My Project
      smilvert
      smilvert
    • RE: my first nrf5 ... NRF51/NRF52 which is better for MySensors ?

      I have been able to use platformio for my project quite recently and still have some problems that I haven't had time to solve yet.

      My platformio.ini for a NRF51832

      [env:nrf51_dk]
      platform = nordicnrf51
      framework = arduino
      board = rfduino
      upload_protocol = stlink
      board_build.f_cpu = 16000000L
      build_flags = -DNRF51 -DMYBOARDNRF5 -I{build.path}
      

      the only problem for my is that the flags

      -DMYBOARDNRF5 -I{build.path}
      

      dosen't work so the mynrf5board.h/c isn't read => I need to update the
      vim ~/.platformio/packages/framework-arduinonordicnrf5/variants/Generic/variant.h myself.

      posted in Hardware
      smilvert
      smilvert