Rolling in Miniature: A Compact Electronic Die

Introducing a tiny, minimalist electronic die project that packs a punch! With just 7 LEDs, an ATtiny25V, a CR1616 coin cell battery, and some passive components, this device is incredibly compact, measuring only 18mm x 18mm in size, 4.9mm in thickness, and weighing a mere 2.1 grams.

https://youtube.com/watch?v=E05Uq4TWpRk

This tiny electronic die features a single button, the roll button, which triggers the die to cycle through numbers 1 to 6 when held down. When the button is released, the scrolling slows down until the final change, at which point it switches to a randomly generated number using the XORShift random number generator algorithm. The XORShift algorithm is lightning-fast, compact in code, and maintains excellent randomness, making it a perfect fit for this project. The final value flashes several times before the die powers off after a few seconds.

Battery Life

The dice is powered by a CR1616 coin cell with a capacity of around 50-60mAh.

Current draw:

StateCurrent @ 3V
Off<0.1uA
Active2.4mA (average)

Some battery life calculations:

Number of rolls24,000 @ 3 seconds per roll (a quick press of the roll button)
Total duration20 hours

Rolling the dice 20 times a day should result in a battery life of around 2.5 years.
These numbers are very approximate since the current draw will fall as the battery voltage falls and the LEDs will probably stop lighting up before the battery has completely drained.

Low Battery Warning

The battery voltage is also measured whenever the dice is woken up from a press of the roll button. When the voltage is below 2.4V the center LED will quickly flash a few times to notify the user of the low battery before going back to displaying the dice roll value.

Sources available at GitHub