A simple digital dice circuit using a 555 timer and 4017 IC walkthrough — components, circuit connections, working principle, counting sequence, wiring steps, and an interactive digital dice you can explore in the browser.
Logic electronics · 555 + 4017
Nothing in this circuit generates a random number. A counter just runs through six states a few thousand times a second — and your thumb decides, with no real precision, where it stops.
Tap the die or SW1 to roll
Status: idle — waiting for a roll
Parts bin
Two chips, seven LEDs and a small pile of diodes. The diodes are what turn six counter states into six recognisable dice faces.
Operating principle
The circuit is entirely predictable. The person pressing the button is not.
The 555 runs at a few kilohertz and the 4017 advances one step per pulse, so the counter cycles through all six states thousands of times a second. Nobody can hold a button for a controlled number of microseconds — so the state it stops on is, in practice, unguessable. That's the whole trick.
Tying Q6 to the reset pin is what makes it a die rather than a ten-sided oddity. The instant the counter reaches Q6 it clears itself back to Q0, so only Q0 through Q5 ever stay lit long enough to matter — six equally likely states.
Seven LEDs can show all six faces because dice patterns are symmetrical. The pips are never driven individually; they're wired as four groups, and every face is just some combination of those groups turned on.
Centre — one LED, lit on the odd faces: 1, 3 and 5.
First diagonal — two corners, lit on everything except 1.
Second diagonal — the other two corners, lit on 4, 5 and 6.
Middle pair — the two side LEDs, lit only on 6.
Count the connections and you get twelve — one diode each, which is exactly the size of the matrix.
Assembly
Five steps — confirm the counter is stopping at six before you wire a single diode, or you'll be debugging two problems at once.
Wire the 555 as an astable: pin 8 to +9V, pin 1 to ground, R1 from +9V to pin 7, R2 from pin 7 to pin 6, pins 6 and 2 bridged, C1 from that junction to ground. With a 0.01 µF capacitor it runs at a few kilohertz — far too fast to watch, which is exactly the point.
Run SW1 from +9V to pin 4, and R7 from pin 4 to ground as a pull-down. Held down, the reset pin sits high and the clock runs. Released, it drops low and the 555 stops dead — so the counter freezes on whatever step it reached.
Seat the 4017: pin 16 to +9V, pins 8 and 13 to ground, and the 555's pin 3 to the clock on pin 14. Then wire Q6 straight back to reset on pin 15. The counter now only ever holds Q0 through Q5 — six states for six faces.
Arrange the LEDs as a die face: one centre, four corners, two middles. Wire them as four groups — the centre alone, each corner diagonal as a pair, and the two middle LEDs as a pair. Each group gets its own 220 Ω resistor down to ground.
Feed each group from the counter outputs that should light it, one diode per connection, cathodes toward the LEDs. Power up, hold SW1 — the pips should blur — and let go. A face should land and hold until the next roll.
If it misbehaves
Check the reset wire first, then the clock speed, then the matrix. In that order.