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 notifiy the user of the low battery before going back to displaying the dice roll value.

Sources available at GitHub

2 comments

4 pings

  1. Any room for a sensor where you can throw it like a real die and have it spit out a number?

    1. Hmm, there are shake switches around (basically a spring in a box), but they seem to be fairly large and bulky. The button could be swapped with an accelerometer and share the I2C lines with some of the LEDs with some hackery, but then battery life would be less than a year even if the dice is never used (an MMA8653 draws 6.5uA in its lowest power mode). Maybe someday I’ll come across a shake switch that’s small enough!

  1. […] Zak Kemble designed 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. […]

  2. […] Zak : […]

  3. […] A Tiny Electronic Dice based on ATtiny25V – [Link] […]

  4. […] Monopoly tournaments in your living room. If that’s the case, you’re in luck, because Zak Kemble designed an electronic dice you can build […]

Leave a Reply

Your email address will not be published.

Are you human? *