Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Development
  3. Anything needed to do before sending Message after a long sleep ?

Anything needed to do before sending Message after a long sleep ?

Scheduled Pinned Locked Moved Development
8 Posts 3 Posters 86 Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    hlehoux
    wrote on last edited by
    #1

    Hello, this might be a question from beginner only, but i'm wondering if i needed to do something specific after a long sleep of my node before being able to send a message.

    I have from time to time send error when my node wakes up to send a message after a long period of sleep.

    So my question is wether i have to execute anything special to get my node ready to send() a message after waking up from this long sleep() ?

    Many thank for the advice

    Here is a log when it works perfectly:

    22:06:44.169 -> 6807 MCO:SLP:MS=14400000,SMS=0,I1=0,M1=1,I2=255,M2=255
    22:06:44.169 -> 6813 TSF:TDI:TSL
    22:06:48.121 -> 6815 MCO:SLP:WUP=0
    22:06:48.121 -> 6817 TSF:TRI:TSB
    22:06:48.121 -> Loop
    22:06:48.121 -> analogRead: 18/933
    22:06:48.121 -> digitalRead:1
    22:06:48.121 -> Interrupt received for switch:1
    22:06:48.121 -> 6828 MCO:SLP:MS=150,SMS=0,I1=0,M1=1,I2=255,M2=255
    22:06:48.155 -> 6836 TSF:TDI:TSL
    22:06:48.255 -> 6838 MCO:SLP:WUP=0
    22:06:48.289 -> 6840 TSF:TRI:TSB
    22:06:48.289 -> Loop
    22:06:48.289 -> analogRead: 18/219
    22:06:48.289 -> digitalRead:0
    22:06:48.289 -> Interrupt received for switch:-1
    22:06:48.461 -> Code=1
    22:06:48.461 -> 6871 TSF:MSG:SEND,9-9-8-0,s=1,c=1,t=47,pt=0,l=1,sg=0,ft=0,st=OK:1
    22:06:48.498 -> 6881 TSF:MSG:SEND,9-9-8-8,s=1,c=1,t=2,pt=0,l=1,sg=0,ft=0,st=OK:1
    22:06:48.498 -> 6889 TSF:RTE:N2N OK
    

    and Here an example of failure (30 minutes later)

    22:06:48.498 -> 6891 MCO:SLP:MS=14400000,SMS=0,I1=0,M1=1,I2=255,M2=255
    22:06:48.498 -> 6897 TSF:TDI:TSL
    22:35:31.596 -> 12425 MCO:SLP:WUP=0
    22:35:31.596 -> 12427 TSF:TRI:TSB
    22:35:31.596 -> Loop
    22:35:31.596 -> analogRead: 18/861
    22:35:31.596 -> digitalRead:1
    22:35:31.596 -> Interrupt received for switch:3
    22:35:31.596 -> 12435 MCO:SLP:MS=150,SMS=0,I1=0,M1=1,I2=255,M2=255
    22:35:31.596 -> 12443 TSF:TDI:TSL
    22:35:31.797 -> 12447 MCO:SLP:WUP=-1
    22:35:31.797 -> 12449 TSF:TRI:TSB
    22:35:31.797 -> Loop
    22:35:31.797 -> Code=3
    22:35:31.797 -> 12457 !TSF:MSG:SEND,9-9-8-0,s=1,c=1,t=47,pt=0,l=1,sg=0,ft=2,st=NACK:3
    22:35:31.797 -> 12468 !TSF:MSG:SEND,9-9-8-8,s=1,c=1,t=2,pt=0,l=1,sg=0,ft=3,st=NACK:3
    22:35:31.797 -> 12476 !TSF:RTE:N2N FAIL
    22:35:31.797 -> 12482 !TSF:MSG:SEND,9-9-8-8,s=1,c=1,t=2,pt=0,l=1,sg=0,ft=3,st=NACK:3
    

    Here is the code i use to wait:

    int8_t MySDJ::sleep(const uint32_t _long) {
        return ::sleep(digitalPinToInterrupt(GetdigitalPin()), CHANGE, wait_next() ? 150 : _long , false);
    }
    

    and my loop():

      if (tripped==0) {   
        the_switch= sdj.get();
        DPR("Interrupt received for switch:"); DPRLN(the_switch);
      } else if (tripped==MY_WAKE_UP_BY_TIMER) {
        if (sdj.wait_next()) {
          // timeout, We should send this code to someone
          Serial.print("Code="); Serial.println(sdj.getCode());
    
          send(msg.set( sdj.getCode() )); // send to controller
          send(MsgRelayGlobal.set( sdj.getCode() )); // send message to node relay actuator
          
          sdj.resetCode();
        } else {
        // on ne mesure la batterie que si pas d'action pendant le délai
        bm.MeasureBattery();
        }
      }
      
      // Sleep until something happens with the sensor or timeout
      tripped= sdj.sleep(WAIT_LOOP);
    
    
    mfalkviddM 1 Reply Last reply
    0
    • H hlehoux

      Hello, this might be a question from beginner only, but i'm wondering if i needed to do something specific after a long sleep of my node before being able to send a message.

      I have from time to time send error when my node wakes up to send a message after a long period of sleep.

      So my question is wether i have to execute anything special to get my node ready to send() a message after waking up from this long sleep() ?

      Many thank for the advice

      Here is a log when it works perfectly:

      22:06:44.169 -> 6807 MCO:SLP:MS=14400000,SMS=0,I1=0,M1=1,I2=255,M2=255
      22:06:44.169 -> 6813 TSF:TDI:TSL
      22:06:48.121 -> 6815 MCO:SLP:WUP=0
      22:06:48.121 -> 6817 TSF:TRI:TSB
      22:06:48.121 -> Loop
      22:06:48.121 -> analogRead: 18/933
      22:06:48.121 -> digitalRead:1
      22:06:48.121 -> Interrupt received for switch:1
      22:06:48.121 -> 6828 MCO:SLP:MS=150,SMS=0,I1=0,M1=1,I2=255,M2=255
      22:06:48.155 -> 6836 TSF:TDI:TSL
      22:06:48.255 -> 6838 MCO:SLP:WUP=0
      22:06:48.289 -> 6840 TSF:TRI:TSB
      22:06:48.289 -> Loop
      22:06:48.289 -> analogRead: 18/219
      22:06:48.289 -> digitalRead:0
      22:06:48.289 -> Interrupt received for switch:-1
      22:06:48.461 -> Code=1
      22:06:48.461 -> 6871 TSF:MSG:SEND,9-9-8-0,s=1,c=1,t=47,pt=0,l=1,sg=0,ft=0,st=OK:1
      22:06:48.498 -> 6881 TSF:MSG:SEND,9-9-8-8,s=1,c=1,t=2,pt=0,l=1,sg=0,ft=0,st=OK:1
      22:06:48.498 -> 6889 TSF:RTE:N2N OK
      

      and Here an example of failure (30 minutes later)

      22:06:48.498 -> 6891 MCO:SLP:MS=14400000,SMS=0,I1=0,M1=1,I2=255,M2=255
      22:06:48.498 -> 6897 TSF:TDI:TSL
      22:35:31.596 -> 12425 MCO:SLP:WUP=0
      22:35:31.596 -> 12427 TSF:TRI:TSB
      22:35:31.596 -> Loop
      22:35:31.596 -> analogRead: 18/861
      22:35:31.596 -> digitalRead:1
      22:35:31.596 -> Interrupt received for switch:3
      22:35:31.596 -> 12435 MCO:SLP:MS=150,SMS=0,I1=0,M1=1,I2=255,M2=255
      22:35:31.596 -> 12443 TSF:TDI:TSL
      22:35:31.797 -> 12447 MCO:SLP:WUP=-1
      22:35:31.797 -> 12449 TSF:TRI:TSB
      22:35:31.797 -> Loop
      22:35:31.797 -> Code=3
      22:35:31.797 -> 12457 !TSF:MSG:SEND,9-9-8-0,s=1,c=1,t=47,pt=0,l=1,sg=0,ft=2,st=NACK:3
      22:35:31.797 -> 12468 !TSF:MSG:SEND,9-9-8-8,s=1,c=1,t=2,pt=0,l=1,sg=0,ft=3,st=NACK:3
      22:35:31.797 -> 12476 !TSF:RTE:N2N FAIL
      22:35:31.797 -> 12482 !TSF:MSG:SEND,9-9-8-8,s=1,c=1,t=2,pt=0,l=1,sg=0,ft=3,st=NACK:3
      

      Here is the code i use to wait:

      int8_t MySDJ::sleep(const uint32_t _long) {
          return ::sleep(digitalPinToInterrupt(GetdigitalPin()), CHANGE, wait_next() ? 150 : _long , false);
      }
      

      and my loop():

        if (tripped==0) {   
          the_switch= sdj.get();
          DPR("Interrupt received for switch:"); DPRLN(the_switch);
        } else if (tripped==MY_WAKE_UP_BY_TIMER) {
          if (sdj.wait_next()) {
            // timeout, We should send this code to someone
            Serial.print("Code="); Serial.println(sdj.getCode());
      
            send(msg.set( sdj.getCode() )); // send to controller
            send(MsgRelayGlobal.set( sdj.getCode() )); // send message to node relay actuator
            
            sdj.resetCode();
          } else {
          // on ne mesure la batterie que si pas d'action pendant le délai
          bm.MeasureBattery();
          }
        }
        
        // Sleep until something happens with the sensor or timeout
        tripped= sdj.sleep(WAIT_LOOP);
      
      
      mfalkviddM Offline
      mfalkviddM Offline
      mfalkvidd
      Mod
      wrote on last edited by
      #2

      There should not be a need to do anything special after sleeping. The most common cause of communication problems is insufficiently stable power supply. It might be that the power consumed by the arduino when the arduino wakes up is just enough to trigger power problems. Do you have capacitors close to the radio? How is the node powered?

      H 1 Reply Last reply
      0
      • mfalkviddM mfalkvidd

        There should not be a need to do anything special after sleeping. The most common cause of communication problems is insufficiently stable power supply. It might be that the power consumed by the arduino when the arduino wakes up is just enough to trigger power problems. Do you have capacitors close to the radio? How is the node powered?

        H Offline
        H Offline
        hlehoux
        wrote on last edited by
        #3

        @mfalkvidd thank you for your help.

        The node is a EasyNewbie-PCB-for-MySensors thanks to @sundberg84 in battery mode

        IMG_0710.jpg

        Maybe i have a noise problem: i did not set the "BAT" jumper because my battery might be a bit to powerfull (3.7-4V) a little above what the radio may be able to receive.

        sundberg84S 1 Reply Last reply
        1
        • H Offline
          H Offline
          hlehoux
          wrote on last edited by
          #4

          I will run it with extended debug mode for a few hours to get more insights

          1 Reply Last reply
          0
          • H hlehoux

            @mfalkvidd thank you for your help.

            The node is a EasyNewbie-PCB-for-MySensors thanks to @sundberg84 in battery mode

            IMG_0710.jpg

            Maybe i have a noise problem: i did not set the "BAT" jumper because my battery might be a bit to powerfull (3.7-4V) a little above what the radio may be able to receive.

            sundberg84S Offline
            sundberg84S Offline
            sundberg84
            Hardware Contributor
            wrote on last edited by
            #5

            @hlehoux - it looks like you use a booster?
            Why are you using this with 3,7 - 4V battery?

            9972e6ac-cdf1-4fe0-9ba3-aa0bff3d5c04-image.png

            In most cases, issues like this are related to booster performance.
            If you need the booster, can you try to change it out?

            Controller: Proxmox VM - Home Assistant
            MySensors GW: Arduino Uno - W5100 Ethernet, Gw Shield Nrf24l01+ 2,4Ghz
            MySensors GW: Arduino Uno - Gw Shield RFM69, 433mhz
            RFLink GW - Arduino Mega + RFLink Shield, 433mhz

            H 1 Reply Last reply
            1
            • sundberg84S sundberg84

              @hlehoux - it looks like you use a booster?
              Why are you using this with 3,7 - 4V battery?

              9972e6ac-cdf1-4fe0-9ba3-aa0bff3d5c04-image.png

              In most cases, issues like this are related to booster performance.
              If you need the booster, can you try to change it out?

              H Offline
              H Offline
              hlehoux
              wrote on last edited by
              #6

              @sundberg84 Thank you for your advice.

              Yes, i guess this battery has a too high voltage. But the advantage is that the battery is small.
              If i understand correctly, since i did not set the BAT jumper, the radio is not fed directly from the battery ; i measure 3.3V at the radio .
              If i would set the BAT jumper , the radio would be directly fed by the battery, so with 3,85V which could kill the radio.

              I don't have space for 2xAA , I understand finding a small 3.3V battery would be clever :-) so i'm gonna search for that.
              I will test during a full night with one hour sleep to check if i really occurs often or not.

              Do you suggest i should remove the booster ? I have very little experience regarding how long my node will workwith this battery.

              Ah Ah, electronics is a strange world for us simple software programmers.

              Thank you again for EasyPCB

              sundberg84S 1 Reply Last reply
              0
              • H hlehoux

                @sundberg84 Thank you for your advice.

                Yes, i guess this battery has a too high voltage. But the advantage is that the battery is small.
                If i understand correctly, since i did not set the BAT jumper, the radio is not fed directly from the battery ; i measure 3.3V at the radio .
                If i would set the BAT jumper , the radio would be directly fed by the battery, so with 3,85V which could kill the radio.

                I don't have space for 2xAA , I understand finding a small 3.3V battery would be clever :-) so i'm gonna search for that.
                I will test during a full night with one hour sleep to check if i really occurs often or not.

                Do you suggest i should remove the booster ? I have very little experience regarding how long my node will workwith this battery.

                Ah Ah, electronics is a strange world for us simple software programmers.

                Thank you again for EasyPCB

                sundberg84S Offline
                sundberg84S Offline
                sundberg84
                Hardware Contributor
                wrote on last edited by
                #7

                @hlehoux the purpose of the booster is to boost the voltage up to 3.3v for the Pro Mini. If you have a battery with voltage range 3,7 - 4V this isnt needed and may just cause the issues you are having.

                Instead you need to lower the voltage to 3.3v depending on the pro mini version you use.
                In the EasyPCB examples there are some guides you can look at.

                Controller: Proxmox VM - Home Assistant
                MySensors GW: Arduino Uno - W5100 Ethernet, Gw Shield Nrf24l01+ 2,4Ghz
                MySensors GW: Arduino Uno - Gw Shield RFM69, 433mhz
                RFLink GW - Arduino Mega + RFLink Shield, 433mhz

                H 1 Reply Last reply
                0
                • sundberg84S sundberg84

                  @hlehoux the purpose of the booster is to boost the voltage up to 3.3v for the Pro Mini. If you have a battery with voltage range 3,7 - 4V this isnt needed and may just cause the issues you are having.

                  Instead you need to lower the voltage to 3.3v depending on the pro mini version you use.
                  In the EasyPCB examples there are some guides you can look at.

                  H Offline
                  H Offline
                  hlehoux
                  wrote on last edited by
                  #8

                  Thank you @sundberg84 !
                  Well the node's been working for a whole day without loosing any message, and it reports its battery so everything seems fine.

                  By the way, i have my first RFm69 node based on easyPCB now working :-) (a sonar to measure fuel tank) connected to the gateway of @Gerator : works great

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


                  20

                  Online

                  11.7k

                  Users

                  11.2k

                  Topics

                  113.0k

                  Posts


                  Copyright 2019 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • MySensors
                  • OpenHardware.io
                  • Categories
                  • Recent
                  • Tags
                  • Popular