To date we haven't considered power consumption n the badge. Our goal is for the badge to run for 80 hours on 3 AA batteries to that it survives DEF CON. All software and hardware work has been to address functionality and to build the best hardware we can. Now that the badge is becoming more and more real it was time to address power consumption.
Until this week, the badge has been running at full 72mhz even during delays for animation and waiting for user input. This created a relatively constant load of about 70mA. Based on the STM32F103 datasheet 40mA of that was simply going to the MCU. We are also powering the RFM69 and 4 WS2812B LEDs.
This week we implemented a low-power delay function into the badge that drops the clock frequency down to 6 mhz temporarily. This is the slowest we could reliably get the MCU while still maintaining the RFM69. It's only being used by the Matrix animation but the other delays will soon be switched.
Mode | Optimized? | Current |
Menu Idle | No | 69.5 mA |
Glow (100% white LED Brightness) | No | 114.7 mA |
Glow (40% white LED Brightness) | No | 81.7 mA |
Matrix Animation | Yes | 43.5 mA |
Not bad.
These results are far from scientific as we are not doing a great job at isolating variables. The values were measured as peaks on a multimeter and may have been when the RFM69 was handling packets in the background. The 100% White Glow test was by far the worst case we observed while measuring the badge. Values typically hovered around 69-70mA without the LEDs on.
What's interesting is that by varying the LED brightness from 100% to 40% we are able to save about 33 mA or 8.25 mA per LED (we're using 4 on this design). 40% looks great so it is now our default brightness.
Next steps are to optimize the remaining code, especially any code that blocks for user input, disable unused peripherals, and to try to put the MCU into a deeper sleep waiting for interrupts.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.
Thanks True! I appreciate the help a lot. I was eager to see what the new numbers looked like with the slower clock delay. Next step is to try your method and go lower. I thought about it last night a bit, it should work pretty well and not break the RFM69 since it's interrupt driven.
Are you sure? yes | no
I discussed this with you on IRC, but this is not the proper way to do this. You should be able to get power consumption even lower. Looking forward to what the numbers will be using a timer and sleeping the CPU.
Are you sure? yes | no