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

Low power led indication like pwm using rtc timers

Hello,

My device based on ble uart app with nrf52832 operating with 2 AA batteries. It has 4 LEDs and 4 buttons. 4 LEDs are always on for indication but when a button is pressed, a LED associated with it will be highlighted(brighter than normal status), of course the other LED is still on (less bright) at this time. 

I came across an idea like 7 digit led time interval pulsing (division) like a movie frame to save energy using pwm, which means 4 LED consume  the power of one LED like below. But it looks the pwm uses higher power than I exprected as I see some post here and I end up with the timer way using app timer for low power.

Is there any sample code or idea how to implement it?

Parents
  • Hello,

    We don't have any official examples generating a PWM using the app_timer, unfortunately. 

    I would suggest you look into the app_pwm module used in SDK\examples\peripheral\pwm_library, and change out the timer being used with an RTC or the app_timer. This example uses PPI, which you should use. At least if you intend to use other peripherals, or the Bluetooth Low Energy stack, you would want the PWM to be able to handle other interrupts, which is why the PPI will do all the toggling of the gpios. Then you don't need to wait for the CPU, which may be busy with another interrupt, to be able to process the timer interrupt and toggle the pins.

    Although I agree that it would use less power in your diagram, I see no reason not to just set all pins to active from 0 to 10ms, and then inactive from 10 to 40ms. The reason for this is that then you can use one event (the timer reset) to set all pins high, and one event to turn them back off, instead of setting up a whole lot of PPI handles for each of the pins.

    BR,

    Edvin

  • Edvin, Thanks for your reply and I also agree with the idea to control at a time for all leds.

Reply Children
No Data
Related