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. Consumption & idle Loop

Consumption & idle Loop

Scheduled Pinned Locked Moved Development
14 Posts 5 Posters 1.6k Views 5 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.
  • mfalkviddM mfalkvidd

    @romeo01 with your current code, the node will never go to sleep. If you want it to go to sleep, you need to add a call to sleep().

    See https://www.mysensors.org/download/sensor_api_20#sleeping

    R Offline
    R Offline
    romeo01
    wrote on last edited by romeo01
    #3

    @mfalkvidd The problem is not here.
    In deep sleep mode, the consumption is arround 4, 5 Ua. That's perfect !

    When the node does not sleep, the NRF24 is always in RX mode.
    According to the datasheet, this one consumes +/- 12mA.

    The right question is: How to prevent the NRF24 to be in RX mode when nodes wakes up ??

    void loop{
    
    /*
     *
     *consumption here +/- 15mA
     *
     */
    
    sleep(100000) ;  // when performed , consumption +/- 4uA
    
    /*
     *
     *Immediately after wake up, consumption +/-15mA
      because NRF24 come back to RX mode.
     *
     */
    
    }
    

    I reminder, I'm looking for ultra low power node.
    My node needs only to test some input data and then send it to the Gateway.
    It never needs to RX anything from Gateway.

    I would like that NRF24 consumes only when the "send" command is performed

    send(MyMessage.set(anyData));
    

    How to put the NRF24 in sleep mode immediately after the "send command ?

    YveauxY 1 Reply Last reply
    0
    • R romeo01

      @mfalkvidd The problem is not here.
      In deep sleep mode, the consumption is arround 4, 5 Ua. That's perfect !

      When the node does not sleep, the NRF24 is always in RX mode.
      According to the datasheet, this one consumes +/- 12mA.

      The right question is: How to prevent the NRF24 to be in RX mode when nodes wakes up ??

      void loop{
      
      /*
       *
       *consumption here +/- 15mA
       *
       */
      
      sleep(100000) ;  // when performed , consumption +/- 4uA
      
      /*
       *
       *Immediately after wake up, consumption +/-15mA
        because NRF24 come back to RX mode.
       *
       */
      
      }
      

      I reminder, I'm looking for ultra low power node.
      My node needs only to test some input data and then send it to the Gateway.
      It never needs to RX anything from Gateway.

      I would like that NRF24 consumes only when the "send" command is performed

      send(MyMessage.set(anyData));
      

      How to put the NRF24 in sleep mode immediately after the "send command ?

      YveauxY Offline
      YveauxY Offline
      Yveaux
      Mod
      wrote on last edited by
      #4

      @romeo01 that's how MySensors works. A node is either asleep (radio powered down) or active (radio listening for incoming messages or transmitting).
      A low power node thus sleeps, wakes up and possibly sends some data and goes to sleep again.

      http://yveaux.blogspot.nl

      R 1 Reply Last reply
      1
      • YveauxY Yveaux

        @romeo01 that's how MySensors works. A node is either asleep (radio powered down) or active (radio listening for incoming messages or transmitting).
        A low power node thus sleeps, wakes up and possibly sends some data and goes to sleep again.

        R Offline
        R Offline
        romeo01
        wrote on last edited by
        #5

        @yveaux Tnx fer fast reply.

        Is there there any way to put the radio in standby (no TX, no RX) when node is active ?

        YveauxY 2 Replies Last reply
        0
        • R romeo01

          @yveaux Tnx fer fast reply.

          Is there there any way to put the radio in standby (no TX, no RX) when node is active ?

          YveauxY Offline
          YveauxY Offline
          Yveaux
          Mod
          wrote on last edited by
          #6

          @romeo01 you would have to hack the library I suppose

          http://yveaux.blogspot.nl

          1 Reply Last reply
          0
          • Nca78N Offline
            Nca78N Offline
            Nca78
            Hardware Contributor
            wrote on last edited by
            #7

            If you really need "long" processing with radio off you can try to use the methods from transport layer that are called from inside the sleep method of the library, but you would probably be better off with your own sleep method.

            void transportDisable(void)
             ... processing ...
            void transportReInitialise(void)
            
            1 Reply Last reply
            0
            • R romeo01

              @yveaux Tnx fer fast reply.

              Is there there any way to put the radio in standby (no TX, no RX) when node is active ?

              YveauxY Offline
              YveauxY Offline
              Yveaux
              Mod
              wrote on last edited by
              #8

              @romeo01 if you describe your application we can see if there are other options to achieve the same behavior

              http://yveaux.blogspot.nl

              1 Reply Last reply
              0
              • R Offline
                R Offline
                romeo01
                wrote on last edited by romeo01
                #9

                @Nca78
                Tnx fer your suggestion.

                @Yveaux
                Many low power node (running on batteries) don't need to be in RX mode.
                Like temp, door contact sensor, .....
                These simplest node only send datas.

                Is this idea could be related to a passive node ? with the RX disabled ?
                MY_PASSIVE_NODE

                YveauxY 1 Reply Last reply
                0
                • R romeo01

                  @Nca78
                  Tnx fer your suggestion.

                  @Yveaux
                  Many low power node (running on batteries) don't need to be in RX mode.
                  Like temp, door contact sensor, .....
                  These simplest node only send datas.

                  Is this idea could be related to a passive node ? with the RX disabled ?
                  MY_PASSIVE_NODE

                  YveauxY Offline
                  YveauxY Offline
                  Yveaux
                  Mod
                  wrote on last edited by
                  #10

                  @romeo01 said in Consumption & idle Loop:

                  Many low power node (running on batteries) don't need to be in RX mode.
                  Like temp, door contact sensor, .....
                  These simplest node only send datas.

                  I understand your point, but on the other hand a low power node will normally sleep >>99% of its time, then wake up (e.g. once per hour or by interrupt) quickly measure something and send the measurement data to the gateway.
                  The time a low power node is awake is normally extremely short compared to the sleeping time, and therefore the consumption of the node during wake time is largely irrelevant (if you don't push it ;-) ) w.r.t. its consumption wile sleeping.

                  E.g. sleeping consumption 4.5uA, wake consumption 15mA, wake time 10ms, wakes 1x per hour.
                  Consumption per hour: (3600-0.010) * 0.0045 + 0.010 * 15 = 16,199955 + 0,15 = 16,349955 mA/hour

                  E.g. sleeping consumption 4.5uA, wake consumption 1mA, wake time 10ms, wakes 1x per hour.
                  Consumption per hour: (3600-0.010) * 0.0045 + 0.010 * 1 = 16,199955 + 0,01 = 16,209955 mA/hour

                  As you can see the sleeping consumption (16,199955 mA) is the dominant factor in this equation, so switching the radio off while awake will hardly reduce the overall power consumption of your low power node.

                  http://yveaux.blogspot.nl

                  1 Reply Last reply
                  1
                  • R Offline
                    R Offline
                    romeo01
                    wrote on last edited by romeo01
                    #11

                    In my case, node is awake every 5 minutes for a couple of measure (no data sent).
                    An average from previous measure is only sent once by hour.
                    Sometimes, awake by interrups or for monitoring some sensors.
                    Most of time, no need to sent data.

                    In summary, in some case, a node can be awake and doesn't send anything.
                    NRF24 is still there in RX for pumping some power.

                    YveauxY 1 Reply Last reply
                    0
                    • rozpruwaczR Offline
                      rozpruwaczR Offline
                      rozpruwacz
                      wrote on last edited by
                      #12

                      @Yveaux just proved You that it does not matter if the node is consuming 15mA or 1mA during wake time. Power consumption during wake time may be an issue only if Your node wake time to sleeping time ratio is significant enough and it is not the case You described.

                      1 Reply Last reply
                      1
                      • R romeo01

                        In my case, node is awake every 5 minutes for a couple of measure (no data sent).
                        An average from previous measure is only sent once by hour.
                        Sometimes, awake by interrups or for monitoring some sensors.
                        Most of time, no need to sent data.

                        In summary, in some case, a node can be awake and doesn't send anything.
                        NRF24 is still there in RX for pumping some power.

                        YveauxY Offline
                        YveauxY Offline
                        Yveaux
                        Mod
                        wrote on last edited by
                        #13

                        @romeo01 I consulted with @tekka and for nRF24 the radio will be in idle/standby after wakeup, until loop() restarts. This behavior is not consistent over radios, but at least this it how it works for nRF24.

                        It means that as long as you don't exit the loop() function, the radio will stay in standby.

                        I suggest you create a for-loop in which you call the sleep() function, until you have to report the values, e.g.

                        void loop()
                        {
                            for (int i = 0; i < 12; ++i)
                            {
                                 // Measure value and average, then go to sleep
                                 // ...
                                 sleep(5*60*1000);
                                 // Woke from sleep, nRF24 is in standby
                            }
                            // Send averaged value every 1 hour
                            // ...
                           
                            // exit loop(), nRF24 Rx will be activated
                        }
                        
                        

                        http://yveaux.blogspot.nl

                        1 Reply Last reply
                        2
                        • R Offline
                          R Offline
                          romeo01
                          wrote on last edited by romeo01
                          #14

                          Hi Yveaux, many thanks for your effort to my case.

                          I didn't knew that after a wakeup, nrf24 is in stby before the next restart loop.
                          Indeed, I tried a new sketch and confirm this particularity.

                          So, a workaround should be to put a "sleep()" at start of the "loop"

                          void loop()
                          {
                          
                            // => At this point NRF is in RX mode
                          
                            sleep(xxx ms); // Put NRF24 in stby
                          
                           // ******
                           //
                           // All job here without NRF consumption !!
                           //
                           // *****
                          
                          } // End of loop
                          
                          

                          I will do something like that !!

                          Maybe, a new definition should be interresting, like MY_NRF24_RXMODE_DISABLED

                          I'm sure many nodes never need the RX mode.

                          PS: Hum.. !! I didn't tried if after the send command, NRF24 come back in RX mode or not.

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


                          24

                          Online

                          11.7k

                          Users

                          11.2k

                          Topics

                          113.1k

                          Posts


                          Copyright 2025 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