Electronic Dice / Portable Random number generator

When I put together the Entropy library, I started prototyping a simple electronic dice project to demonstrate the library. I originally started with a simple array of seven led’s arranged as the dots on a six sided die; however, I realized how little of the resources that used from the Arduino, and came across the 8x8 LED matrices from Adafruit and realized that these would be perfect for graphically representing a die. As I developed the program, I decided to add other types of dice (the old D&D 4,8,10,12, and 20 sided dice). I have been tinkering with this prototype on and off for over a year and I have added a total of ten modes to the device.

  • DICE - Simulate two six sided dice
  • DICE 4 - This mode simulates two dungeons and dragons style four sided dice
  • DICE 8 - This mode simulates two dungeons and dragons style eight sided dice
  • DICE 10 - This mode simulates two dungeons and dragons style ten sided dice. The tenth side is displayed as a 0. This means that this mode can be used to directly generate a random number in the range 00 - 99.
  • DIE 12 - This mode simulates a single dungeons and dragons style twelve sided die.
  • DIE 20 - This mode simulates a single dungeons and dragons style twenty sided die.
  • CARD - In this mode the device will simulates a randomly shuffled deck of 52 standard playing cards (no joker). allowing the drawing one card from the deck with no repeats. After all 52 cards have been draws, the deck will be reshuffled and you can start over.
  • HEX - This mode randomly produces a single hexadecimal number in the range of 0x00 - 0xFF
  • BIN - This mode produces sixteen random 8-bit binary random numbers displayed on the two 8x8 matrices. Since the entropy generator used only generates 8 bytes per second, and has a queue of up to 64 bytes, this mode can empty the queue and take a second or two to display after ‘rolling’ the dice.
  • PASSWORD - This mode slowly scrolls a eight character (0-9, a-z, A-Z. -, and +) password across the two displays.

The Arduino sketch, a circuit diagram, parts list, and a video demonstrating all ten modes are available from; LED Matrix Dice - A study of entropy

Excellent project!

I have a complaint: The images on your site are blocked. You need to loosen the security.

And two suggestions...

  1. (Optionally) Output the result to Serial. I can imagine the device being connected to a computer to generate passwords (or maybe even dice rolls).
  2. Add a coin flip option.


Sorry, I didn't notice the problem. It is fixed now. Thank you!

I will take care of this. It is funny, I actually removed the code that did this since I was only using it for testing purposes!

Duh, I can't believe that this one didn't even occur to me!

Thanks to Coding Badly’s suggestions I have updated the project’s page as well as the video. The sketch will now send the same information that is displayed on the Matrices to the Serial port console. It also now has a coin flip mode.


Interesting am considering building a similar device mostly for initiative tracking in savage worlds - would also allow the use of dice simulator and full deck of cards including jokers though.

Very nice project !!!

Unfortunately the images on your site are blocked again :frowning:

Unfortunately the images on your site are blocked again :frowning:

Works for me.

Unfortunately not for me :’(

Very nice Idea.
I am currently working on something similar, not for the D&D game, but for Earthdawn instead.
Also I don't have the dot-matrix you have but bought a 20x4 LCD Module which I would use for output.

I implemented a mechanism called "exploding dice": If you roll the highest number possible on a die, you can reroll - as long as you roll again the highest number.
Additionally there are different Steps for the Skills witch translates in different dice-sets to roll. It begins with
Step 1: D4-2
Step 10: D10 + D6
and so on...