A Tiny Electronic Dice

Here’s a simple, tiny electronic dice project using 7 LEDs, an ATtiny25V, a CR1616 coin cell and a few passives. Measuring just 18mm x 18mm and 4.9mm thick while weighing 2.1g.

Rolling The Dice

There’s only one button, the roll button, which when held down will cause the dice to roll through numbers 1 to 6. After releasing the button the rolling will slow down until the last change where it will instead use a randomly generated number sourced from an XORShift random number generator algorithm (nabbed from here). XORShift algorithms are great for their speed and small code size while still maintaining excellent randomness. The final value flashes a few times, then after a further few seconds the dice turns off.

Battery Life

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

Current draw:

State Current @ 3V
Off <0.1uA
Active 2.4mA (average)

Some battery life calculations:

Number of rolls 24,000 @ 3 seconds per roll (a quick press of the roll button)
Total duration 20 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


Loading comments...
  1. « Prev
  2. Next »

Leave a Reply

Sorry, new comments have been disabled since I rarely have time to moderate and reply these days :(