This arduino sketch makes use of the Entropy library as a source of truly random numbers to simulate various dice (4, 6, 8, 10, 12, and 20-sided) as well as several other useful forms of random numbers. In total the device has eleven separate modes. These modes (in the order they default to when turned on) are:
- DICE - This mode simulates two standard six-sided dice.
- COIN - This mode simulates the flip of a coin
- 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 basic circuit (larger version available if you click on the image) used by the sketch (available at the bottom of this page) is fairly simple and only requires a few components.
The above circuit shows an Arduino Uno
, but any other Arduino
chip) with at least the same resources as the Uno can be used. In the
version I built I used an Adafruit Atmega32u4 breakout board
that I had lying around. If you want the most compact version of the
build possible for installation in a small case, you could use that
board, a Teensy
, or one of the Pro Mini
boards. A 3.3V, 8MHz board
raises the possibility of being powered by a pair of AAA batteries.