Author Topic: Lwmesh Power saving  (Read 1407 times)

0 Members and 1 Guest are viewing this topic.

Offline PeiliTopic starter

  • Regular Contributor
  • *
  • Posts: 108
  • Country: in
Lwmesh Power saving
« on: September 03, 2019, 10:04:50 am »
Hi,
    I am using the Lwmesh stack for avr-atmega256rfr2 MCU. I downloaded the Lwmesh and modify the code to send data as broadcast. My application is the End Device broadcast the data .. I'm using Watch dog Timer interrupt other than Hal_Sleep() function.. So my application is , End Device send data and go for sleep and when an interrupt come then wake up and send data using Watch Dog Timer of 2 sec.But the problem we are facing is we are not able to save battery(Since the devices are battery powered).I have measured the current consumption.It takes 20milli ampere  while sleeping and 15 milli ampere when it wakes up.I am using avr-atmega256rfr2 MCU . Here i'm attaching my code for End device(WSNDemo) and Hal_sleep. Please advice us to save battery life.. How to reduce the power consumption of the End Device?
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11905
  • Country: us
    • Personal site
Re: Lwmesh Power saving
« Reply #1 on: September 03, 2019, 06:07:11 pm »
This is not really related to LwMesh. You need to debug sleep modes separately first. This may be related to something else on your board, for example.
Alex
 

Offline PeiliTopic starter

  • Regular Contributor
  • *
  • Posts: 108
  • Country: in
Re: Lwmesh Power saving
« Reply #2 on: September 04, 2019, 04:26:53 am »
This is not really related to LwMesh. You need to debug sleep modes separately first. This may be related to something else on your board, for example.
What are the examples ? Is my code correct? Sometimes it works perfectly. How to debug the sleep modes? Please advise..
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11905
  • Country: us
    • Personal site
Re: Lwmesh Power saving
« Reply #3 on: September 04, 2019, 04:30:33 am »
Create a static application that just sleeps. Does it achieve the expected consumption? That's the start. After you are sure that your sleep stuff works on its own, add it to the network code.

If "sometimes" it works, figure out what is different about times when it doesn't.

I don't know if code is correct. I have not worked with AVRs in many years, and I don't care to remember how it all works.
Alex
 

Offline PeiliTopic starter

  • Regular Contributor
  • *
  • Posts: 108
  • Country: in
Re: Lwmesh Power saving
« Reply #4 on: September 17, 2019, 11:03:22 am »
Is broadcast frames consume more power? Now my current consumption is 4ms at ON time and 16UA at sleep.. i want to down the consumption in micro seconds.. How to reduce it?
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11905
  • Country: us
    • Personal site
Re: Lwmesh Power saving
« Reply #5 on: September 17, 2019, 01:54:31 pm »
What is "consumption in micro seconds"?

No, broadcast frames do not consume more power compared to unicast frames. But the most power is consumed by the active receiver.
Alex
 

Offline PeiliTopic starter

  • Regular Contributor
  • *
  • Posts: 108
  • Country: in
Re: Lwmesh Power saving
« Reply #6 on: September 18, 2019, 04:27:06 am »
What is "consumption in micro seconds"?
I want to reduce the power consumption in micro seconds now it's in Milli seconds.. Few months ago i got the ON time of my End Device as 135UA.. That is the expected power consumption.. But now it's 4ms... But there is no change in the code and don't know why it consume more power.. :-\
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11905
  • Country: us
    • Personal site
Re: Lwmesh Power saving
« Reply #7 on: September 18, 2019, 04:33:17 am »
I have no idea what you are talking about. How can you compare 135 microamps to 4 milliseconds? They have different units.
Alex
 

Offline PeiliTopic starter

  • Regular Contributor
  • *
  • Posts: 108
  • Country: in
Re: Lwmesh Power saving
« Reply #8 on: September 18, 2019, 04:37:54 am »
Sorry, current consumption is now close to 135UA.. i want to reduce the 4millisecond ON time to microseconds..
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11905
  • Country: us
    • Personal site
Re: Lwmesh Power saving
« Reply #9 on: September 18, 2019, 04:38:42 am »
Ok, so measure what takes that time in your application. How would I know that?
Alex
 

Offline PeiliTopic starter

  • Regular Contributor
  • *
  • Posts: 108
  • Country: in
Re: Lwmesh Power saving
« Reply #10 on: September 18, 2019, 04:50:10 am »
My application uses Watch Dog Timer interrupt other than Halsleep function.. My scenario is End Device wakeup and send it's App_Addr to nearest Router and go for sleep. WDT is 2seconds.. only that much i need. no need for routing.. Just Wakeup ,Send and Sleep.... But for that scenario the device take 4milliseconds ON time.. My End Device is a Battery powered device(atmega256rfr2). I can't afford this type of power consumption... What are the factors affecting the power Consumption and how can i reduce it by code wise? I'm really stuck into it :-\
Here i'm attaching my Wsndemo for EndDevice the configuration file and sleep function
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11905
  • Country: us
    • Personal site
Re: Lwmesh Power saving
« Reply #11 on: September 18, 2019, 05:01:38 am »
How did you measure that 4 ms time? It takes some time to send a frame and receive an ACK. I don't know if 4 ms is justified or not in this case. You need to measure different part of the process and see what takes the longest time and eliminate that.
Alex
 

Offline PeiliTopic starter

  • Regular Contributor
  • *
  • Posts: 108
  • Country: in
Re: Lwmesh Power saving
« Reply #12 on: September 18, 2019, 05:14:14 am »
How did you measure that 4 ms time? It takes some time to send a frame and receive an ACK. I don't know if 4 ms is justified or not in this case. You need to measure different part of the process and see what takes the longest time and eliminate that.
Measured it by switching one Pin in my board in sleep
Code: [Select]
 case APP_STATE_SLEEP:
{
PORTD&=~(1<<PD6);//sleep
HAL_Sleep(APP_SENDING_INTERVAL);
appState = APP_STATE_WAKEUP;
} break;

case APP_STATE_WAKEUP:
{

  NWK_WakeupReq();
PORTD|=(1<<PD6);//sleep
                appState = APP_STATE_SEND;
} break;



here PD6 is the pin I'm switching and measuring...
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11905
  • Country: us
    • Personal site
Re: Lwmesh Power saving
« Reply #13 on: September 18, 2019, 05:20:50 am »
Ok, now do the same for all steps of the sending process and see what takes all this time. I don't know what could be taking that long.
Alex
 

Offline PeiliTopic starter

  • Regular Contributor
  • *
  • Posts: 108
  • Country: in
Re: Lwmesh Power saving
« Reply #14 on: September 18, 2019, 05:41:04 am »
Ok i will check and update you sir
 

Offline PeiliTopic starter

  • Regular Contributor
  • *
  • Posts: 108
  • Country: in
Re: Lwmesh Power saving
« Reply #15 on: September 19, 2019, 11:06:55 am »
Ok, now do the same for all steps of the sending process and see what takes all this time. I don't know what could be taking that long.
Sir, i done the same step for all the process and the results are:
  • appSendData() takes 200microseconds
  • appInit() takes small amount
But in my sleep condition,
Code: [Select]
 case APP_STATE_PREPARE_TO_SLEEP:
{
               PORTD&=~(1<<PD6);
if(!NWK_Busy()){

NWK_SleepReq();
appState = APP_STATE_SLEEP;
}

} break;

case APP_STATE_SLEEP:
{
PORTD|=(1<<PD6);
HAL_Sleep(APP_SENDING_INTERVAL);
appState = APP_STATE_WAKEUP;
} break;


takes 4 milliseconds.. The condition  if(!NWK_Busy()) function is taking that much power consumption.. So the ON time of the device is about 4 milliseconds..
I checked the code and realize that a lock bit(nwkIb.lock) is checked during the condition and find that the lock bit is decrement when nwkDataReqConfirm() is called..
Is ma thoughts are correct? And how can i reduce that time?
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11905
  • Country: us
    • Personal site
Re: Lwmesh Power saving
« Reply #16 on: September 19, 2019, 03:34:52 pm »
Well, yes, this was to be expected. You need to do the same for the internals of the stack. Basically trace the path of the frame through the stack and see what steps of the sending process take this time.

I would specifically start with PHY_DataReq() and PHY_DataConf() pair and extend outwards.
« Last Edit: September 19, 2019, 04:52:59 pm by ataradov »
Alex
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf