Close

About keeping your badge running for a long time !

A project log for Dice badge

Put a bit of colorful randomness on your clothes !

pierre-loup-mPierre-Loup M. 02/23/2023 at 07:590 Comments

One of the challenge with wearable is you have to make the system last as long as possible on a battery. Most microcontrollers have different levels of awakeness (or sleepness, as you want), that fullfill different needs, with different current consumption.

The ATTiny 25/45/85, being a simple (and a bit old) microcontorller, has only three :

You can enable sleep by manipulating the registers to set the options you need. Some functions are also available by including "avr/sleep.h" in you program. The documentation is well made, and there are a lot of tutorials about that online.

On the badge, deep sleep (power-down) is implemented as soon as the leds are stopped. There are two cases :

On wake up, the timer for led dimming is started again, the interrupt on the button is removed, and its state is forced to 0, otherwise after waking up, the program would account for that press and send back the system to sleep. The watchdog timer is also stopped.

On mode 1 (Dice), the battery last very long, several month by awaking the badge for a dice throw every now and then.
On other modes, the leds are lit almost all the time, battery only holds for about three hours.

One thing that could be made to lengthen the battery life would be to limit the duty cycle of the leds to 50%. The decrease in intensity would be light to the eye, but that would half the current consumption.

Discussions