A truly random electronic dice and random number generator, in the form of a shield for Arduino UNO or Mega.
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
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 Dice||Simple example program|
Press Roll to roll
The shake sensor is not used
|Fancy Dice||Dice with fancy animation|
|Double Dice||Shows two dice rolls|
|Multi Dice||Press Roll repeatedly to roll 1 to 6 dice|
|Bill of Material||dice_shield_bom.pdf|
|Component Placement Guide||dice_shield_placement.jpg|
|Compatible Boards||Arduino UNO, Arduino Mega 2560|
|Dimensions||2.7" x 2.1"|