This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

power saving approach with LED data time

Hi,

I am using SDK 15.3 and NRF52840 Preview DK

I have a requirement where I have to glow one of 3 LEDs R-G-B (each connected to one gpio pin) for 1 second and turn it off for 29 seconds, which LED will lit up depends on a variable(eg. rgb) in my code, suppose if 

rgb == 1 -- RED

rgb == 2 -- GREEN

rgb == 4 -- BLUE

some of my approaches are

using a timer with 1 second timeout and then using a counter and flag for turning ON and OFF the LED

and the other is using two timers one to toggle led ON after 29 seconds and one timer to turn OFF led after 1 second.

which of the two approaches are better in terms of power consumption and are there any better approaches ?

Parents
  • I'm assuming you use app_timer. This uses RTC which is already running on the LFCLK and therefor low-power. While waiting for a timeout, the CPU will be in a low-power mode (i.e. system-on, low-power). When a timeout occurs, an interrupt will be generated that will start-up the CPU and perform the actions you specified in the event handler. So, when you do this every second, that takes more power than having a 29 seconds timer and then starting a 1 second timer at its timeout and then start the 29 seconds timer again at that timeout. For power consumption, it does not matter how many app_timers you have scheduled.

Reply
  • I'm assuming you use app_timer. This uses RTC which is already running on the LFCLK and therefor low-power. While waiting for a timeout, the CPU will be in a low-power mode (i.e. system-on, low-power). When a timeout occurs, an interrupt will be generated that will start-up the CPU and perform the actions you specified in the event handler. So, when you do this every second, that takes more power than having a 29 seconds timer and then starting a 1 second timer at its timeout and then start the 29 seconds timer again at that timeout. For power consumption, it does not matter how many app_timers you have scheduled.

Children
No Data
Related