Consumption & idle Loop



  • HI,

    I use a arduino pro mini 3.3v as a low power node (without power regulator and led) with a NRF24 and the lib v2.3.0-alpha

    In deep sleep mode, the consumption is arround 4, 5 Ua. That's perfect !

    Why the consumption is arround 15mA, with the sketch below. ??

    #define MY_RADIO_RF24                     // Enable and select radio type attached
    
    #define MY_RF24_PA_LEVEL RF24_PA_MAX
    
    #define MY_NODE_ID 250
    #define MY_PARENT_NODE_ID 0       
    #define MY_PARENT_NODE_IS_STATIC
    
    #define MY_BAUD_RATE 9600
                
    #include <MySensors.h>
    
    void setup() { }
    
    void presentation(){ 
    
          sendSketchInfo("Dummy Node", "1.0");
    
    }
    
    void loop() { }
    

    This sketch does nothing as you can see, the Loop{} is empty BUT consumes 15mA at full time.
    That's just for test purpose.

    When it's running, if I unplug the NRF24, the consumption go down to few mA ( 2, 3 mA)

    So, I could say that every time the node wake up, NRF24 pumps the power for nothing.

    Why such consumption for a NRF24 in RX (I suppose) ?

    Afterwards, I tried to use the IRQ feature with MY_RX_MESSAGE_BUFFER_FEATURE and
    MY_RF24_IRQ_PIN

    but same consumption, not less than 15mA with an empty Loop.

    In my case, I don't need to receive anything from the gateway after the registration. Can I stop the "receive mode" for a NRF24 ??
    I just need to send a couple of data and then go to sleep.
    The RX period is a waste of energy.

    Any idea ?? Thanks


  • Mod

    @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



  • @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 ?


  • Mod

    @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.



  • @yveaux Tnx fer fast reply.

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


  • Mod

    @romeo01 you would have to hack the library I suppose


  • Hardware Contributor

    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)
    

  • Mod

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



  • @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


  • Mod

    @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.



  • 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.



  • @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.


  • Mod

    @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
    }
    
    


  • 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.


Log in to reply
 

Suggested Topics

22
Online

11.2k
Users

11.1k
Topics

112.5k
Posts