Electronic dice
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.

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:
- A roll shows 1 to 6
- The rolls vary
- 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
- Roll 30 times and count the sixes: about 5 is fair.
- Add a second display and roll two dice: you need 7 more pins, or a 74HC595 shift register.
- 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.