Home › Builds › Electronic dice

Electronic dice

Bench build · Embedded (Arduino) · Beginner · about 25 minutes

Rolls a die on a 7-segment display. Seven pins drive the seven segments of a common-cathode display, each through its own 220 Ω resistor (about 12 mA a segment; one shared resistor on the common would make a 1 brighter than an 8). A table of bit patterns turns a number into segments. Hold the button: the display spins; let go: random(1, 7) throws 1 to 6.

Electronic dice: the finished build running on the simulator's bench

Build it in the labGuided build, test sheet and fault finding, free in your browser.

Parts list

Test procedure

Each test has an expected value and a pass range, like a factory test sheet:

  1. A roll shows 1 to 6
  2. The rolls vary
  3. Every segment works

How it works

What it does: Rolls a die on a 7-segment display.

Build it (guided or ready-made), then run its test procedure below. Every test has an expected value and a pass range, just like a factory test sheet.

Things to try

  1. Roll 30 times and count the sixes: about 5 is fair.
  2. Add a second display and roll two dice: you need 7 more pins, or a 74HC595 shift register.
  3. Replace random() with a counter that runs while the button is held (n = (n % 6) + 1): human timing makes it random too.

Background

Electronic dice were a favourite first project in 1970s electronics magazines, with a 555 and a 4017.

More builds: embedded (arduino)