Advanced · Project 8
Electronic Dice
Hold ROLL and the dots spin in a blur; let go and they land on a random face, in the real dice pattern. A 555 clock, a CD4017 counter, diodes and four transistors.
Build this only with an adult present. Before you start, read our safety notice and disclaimer.
🧰 What you need
- 1×Full-size breadboardThe big brother of the half-size board: twice as long, with room for several chips.
- 1×4×AA battery holder with wire leadsHolds four AA batteries for 6 volts. Used for the 555 timer chip, which needs a bit more push.
- 4×AA batteryA regular household battery. Each one gives 1.5 volts.
- 1×NE555 timer chipOne of the most famous chips ever made: it makes blinks, beeps and timers from a resistor and capacitor.
- 1×CD4017 decade counterCounts clock pulses and turns on one of its ten outputs at a time, in order. Made for LED chasers.
- 4×2N3904 transistor (NPN)A tiny electronic switch: a small current into its middle leg (base) controls a bigger current.
- 6×1N4148 diodeA small, fast one-way valve for signals. The end with the black band is the cathode (−).
- 1×Push button (tactile switch)A little button with 4 legs. It connects its two sides only while you press it.
- 3×10 kΩ resistor — brown, black, orange, goldColors: brown, black, orange, gold.
- 3×150 Ω resistor — brown, green, brown, goldColors: brown, green, brown, gold.
- 1×220 Ω resistor — red, red, brown, goldOur go-to LED resistor. Colors: red, red, brown, gold.
- 1×1 µF capacitorA small can-shaped capacitor. The striped leg is −.
- 7×5 mm LED (any color) — all the same colorA tiny light that only lets current flow one way. The long leg is +.
- 40×Jumper wireA short wire with stiff ends that push into the breadboard.
✨ The finished project
↔ Big board! Scroll sideways to see all of it.
A real dice has six faces. Ours has seven LEDs laid out in the dice pattern, and a ROLL button. Hold it, and the face changes about 50 times a second: far too fast to see, so it’s a blur. Let go, and it stops wherever it happened to be. You can’t time your finger to a fiftieth of a second, so the result is random: nobody can predict it.
How it works
You’ve met all the main parts before:
- The 555 clock, as in the LED Chaser, but much faster. Its RESET pin is held low by a 10 kΩ pull-down, which stops it. ROLL connects RESET to +, so it only ticks while you hold the button.
- The CD4017 counter steps through its outputs Q0, Q1, Q2… one per tick. Like in the Traffic Light Controller, Q6 is wired to MR (reset), so it only ever uses six steps: one per face.
A dice face only needs four groups of LEDs, because the dots always light in the same groups:
| Group | Dots | Lit for |
|---|---|---|
| Centre | the middle dot | 1, 3, 5 |
| Diagonal A | top-left + bottom-right | 2, 3, 4, 5, 6 |
| Diagonal B | top-right + bottom-left | 4, 5, 6 |
| Middle pair | middle-left + middle-right | 6 |
Each counter step is one face. Which step shows which face doesn’t matter (it’s random anyway!), so we chose them to make the wiring as simple as possible: Q0 shows 2, Q1 shows 3, Q2 shows 5, Q3 shows 4, Q4 shows 6 and Q5 shows 1.
Diodes combine outputs. The centre dot must light for Q5, Q1 or Q2. Three diodes, one from each output, meet at one point. Whichever output is on pushes current through its diode; the diodes stop it flowing back into the outputs that are off.
A free shortcut: CO. Diagonal A is lit for every face except 1. The CD4017 has a pin called CO (“carry out”) that is on for Q0–Q4 and off for Q5–Q9. Since our face 1 is Q5, CO is exactly the signal we need, with no diodes at all.
Transistors do the heavy lifting. A CD4017 output can only push about 5 mA, not enough for two bright LEDs. So each group’s signal goes to the base of a transistor, with its collector on +. The transistor copies the signal (about 1.3 V lower) but can supply far more current. This way of using a transistor is called an emitter follower, because the emitter’s voltage follows the base. The LEDs hang off the emitter, through a resistor.
Build it
Rail bridges: red T+61 → B+61 (bottom red + rail, column 61), black T-62 → B-62 (bottom blue − rail, column 62).
The 555 clock: pin 1 in f5. Red a5 → T+5 (top red + rail, column 5); black j5 → B-5 (bottom blue − rail, column 5). 10 kΩ a6 → T+7 (top red + rail, column 7); 10 kΩ c6 → c2. Blue b7 → b2, e2 → f2, i6 → i2. 1 µF capacitor + a2, − T-2 (top blue − rail, column 2).
ROLL: 10 kΩ pull-down j8 (RESET) → B-9 (bottom blue − rail, column 9). White h8 → h10. Button across the gap in e10, f10, e12, f12. Red a12 → T+11 (top red + rail, column 11).
The CD4017: notch on the left, pin 1 in f16. Red a16 → T+16 (top red + rail, column 16); black g23 → B-23 (bottom blue − rail, column 23); black a19 (INH) → T-19 (top blue − rail, column 19).
Clock: yellow g7 (555 OUT) → g9, f9 → e9 over the gap, c9 → c18 (CLK).
Six steps (Q6 → MR): white i20 → i24, f24 → e24 over the gap, b24 → b17 (MR).
Centre diodes (bands toward column 14): i16 → i14, h17 → h14, g19 → g14.
Diagonal B diodes (bands toward column 26): j19 → j26, h22 → h26, and in the top half c22 → c26. Green e26 → f26 joins the two halves of that column.
Transistors (flat side facing you, E/B/C left to right): QA h32/h33/h34, QB c32/c33/c34, QC h37/h38/h39, QD c37/c38/c39. Collectors to +: red j34 → B+35 (bottom red + rail, column 35), b34 → T+35 (top red + rail, column 35), j39 → B+40 (bottom red + rail, column 40), b39 → T+40 (top red + rail, column 40).
Signals to the bases: orange j14 → j33 (centre), blue d20 (CO) → d33, green i26 → i38 (diagonal B), yellow a22 (Q4) → a38.
Emitter resistors: 220 Ω g32 → g28; 150 Ω d32 → d28; 150 Ω g37 → g42; 150 Ω d37 → d42.
The dice face. Corners plug straight into the − rails: top-left long leg a46, short leg T-45 (top blue − rail, column 45); top-right a56 / T-55 (top blue − rail, column 55); bottom-left j46 / B-45 (bottom blue − rail, column 45); bottom-right j56 / B-55 (bottom blue − rail, column 55). The middle row sits across the gap, long leg on top: e45/f45, e50/f50, e55/f55, each with a black wire to −: j45 → B-44 (bottom blue − rail, column 44), j50 → B-50 (bottom blue − rail, column 50), j55 → B-56 (bottom blue − rail, column 56).
Group wires: diagonal A (blue) c28 → b46 and b28 → i56; middle pair (yellow) c42 → c45 and b42 → b55; centre (orange) f28 → d50; diagonal B (green) f42 → c56 and h42 → h46.
Power: 4×AA red into T+1, black into T-3. Hold ROLL, let go, and read your dice! 🎲
The build check stepped the simulated counter through all six steps and checked every face lights exactly the right dots, then checked that letting go of ROLL freezes it.
Not working?
- A face has a dot missing? Find which group it belongs to (table above), then check that group’s transistor, resistor and wire. If a whole group never lights, check its transistor is the right way round.
- A dot never turns off? A diode is backwards: the band must face the transistor side.
- It rolls, but some faces never appear? Check the white Q6 → MR wires, and the diodes from that face’s output.
- Nothing happens when you hold ROLL? Check the button, the pull-down, and the 555’s wires.