Dice Shield for Arduino

Dice Shield

Dice Shield
A truly random electronic dice and random number generator, in the form of a shield for Arduino UNO or Mega.

Features

How it Works
The heart of the dice shield is the zener avalanche random generator circuit.

The ATmega microprocessor complimentary PWM feature is used to pump a voltage multiplier (diodes D8 thru D11 and capacitors C11 thru C14) at 32 KHz. This produces about 15 volts, which goes to a reversed biased junction (Q2) which produces the zener effect. The high voltage is necessary to get the zener effect into the avalanche region. Transistor Q1 amplifies the signal. The signal is biased to 1/2 of supply voltage, and then fed into an Arduino digital input pin.

Signal at TP1
Signal Trace

The signal consists of shot noise plus avalanche noise. The big jagged downhill slopes are the avalanche events. To generate a random bit the software counts the number of edges that are seen in a period of time and truncates the count to 1 bit. To generate a dice roll, 3 random bits are generated, which equates to a roll of 1 to 8. Since dice only have 6 faces, if the roll is 7 or 8 it is discarded and we try again.

Several example dice programs are available for download. These programs show how to use the random generator and display results.

Example Dice Programs

Basic DiceSimple example program
Press Roll to roll
The shake sensor is not used
Fancy DiceDice with fancy animation
Double DiceShows two dice rolls
Multi DicePress Roll repeatedly to roll 1 to 6 dice

Example Dice Programs Download

Design Documents

Bill of Materialdice_shield_bom.pdf
Component Placement Guidedice_shield_placement.jpg
Schematic Diagramdice_shield_schematic.pdf
PCB Gerbersdice_shield_gerbers.zip
Source Codedice_shield_code.zip

Specifications

Compatible BoardsArduino UNO, Arduino Mega 2560
Dimensions2.7" x 2.1"

Build Pictures

Front
Front
Back
Back

on Arduino UNO
on Arduino UNO

on Arduino Mega
on Arduino Mega