An ordinary die is easy to lose, so here is an electronic die-throwing circuit which can add a new twist to some old boring board games.
Throwing a die is a venerable way of generating a ‘random’ number between 1 and 6. The electronic die circuit generates random die patterns and must be considered as a simple application of logic circuits. The circuit uses members of the integrated circuit family known as CMOS (complementary metal-oxide semiconductor).

Circuit description
U1A and U1B form an oscillator which produces a square-wave output. The oscillator runs constantly, and its output is fed to U2 via a single NAND gate, U1C. Pin8 of U1C is held at 0V by R3 and C3. Whenever one input of a NAND gate is at logic level 0 (or 0 V), the output of the gate is always at logic level 1, irrespective of what is happening at its other input. So, despite the fact that the oscillator is running all the time, its square-wave output never reaches U2 until Pin8 of U1C is brought away from logic 0. This happens when S2 push-button is pressed. Pressing S2 momentarily, as is normally done, charges up C3 immediately to 9V, putting a logic 1 on Pin8 of U1. This way, the clock signal is allowed to go through U1C and reaches U2. As the switch is released, C3 begins to discharge through R3, gradually lowering the voltage on pin 8 of U1C. At the time when this voltage crosses 4.5 V (half the supply voltage), U1C treats this input as logic 0, which cuts off the clock signal from U2 again. Thus, when S2 is momentarily pressed, the clock signal is fed to U2 for a short interval of time, before being blocked again.

U2 is a CD4029 presettable up/down counter which counts in binary mode when its binary/decade input (pin 9) is at logical “1”. The counter counts up when the clock signal is fed to its clock input (pin 15) and its up/down input (pin 10) is at logical “1”. The counter is advanced one count at the positive-going edge of the clock if the carry in (pin 5) and preset enable (pin 1) inputs are at logical “0”. The carry out signal (pin7) is normally at logical “1” state and goes to logical “0” state when the counter reaches its maximum count in the “up” mode. A logical “1” preset enable signal allows information at the “jam” inputs (J1-J4) to preset the counter to any state asynchronously with the clock.
The outputs of the counter that concern us are from pins 14, 11 and 6. Pin 14 is the most significant bit and pin 6 is the least significant bit. And now, let’s see what happens here:
At the start of the counting process, the outputs of the counter have zero values, i.e. 000. As each cycle of the clock enters U2, it increments its internal counter and the values of that counter are shown by the states of pins 14, 11 and 6. After the first pulse, these three pins would have states corresponding to 001; after the second, 010; after the third, 011; after the fourth, 100; after the fifth, 101; after the sixth, 110. This sequence of 3-bit numbers represents a binary count from 1 to 6 in ‘normal’ parlance. These six states are used to illuminate the conventional pattern of dots on a die, using LEDs.
As the clock cycles are counted, the LEDs flicker as the die is ‘rolled’. Resistors R4 to R7 are used to limit the current through the LEDs. When the counter stops, it can be in any of the positions shown in Table 1.
Table 1 (Counter states)
State |
Pins 14 - 11- 6
| Die number |
1 |
0- 0 -1
|
1
|
2 |
0 -1- 0
|
2
|
3 |
0 -1- 1
|
3
|
4 |
1- 0- 0
|
4
|
5 |
1- 0- 1
|
5
|
6 |
1- 1- 0
|
6
|
Because of the way in which the dots are grouped on the faces of a die, the wiring of the LEDs is simpler than it might otherwise be. You can see from schematic that there are really only three sets of connections to the LEDs – one from each bit of the counter output. When pin 14 is at logic 1, four LEDs are lit, corresponding to the number four. For the number five, pins 14 and 6 will be at logic 1. For the number one, only pin 6 is at logic 1. For three, pins 11 and 6 are at logic 1, for six, pins 14 and 11 are at logic 1, and for two, only pin 11 is at logic 1. These conditions are summarised in Table 1.
One might ask, what about when outputs 14, 11 and 6 are in “000” or in “111” state. Well, we took care of that to never happen. That is because the counter is preset asynchronously at state “001” threw the “jam” inputs at every counting cycle. The counter is actually preset at the “1001” state, at the end of every counting cycle. It counts from 1001 to 1110. The next state after 1110 state would normally be the 1111 state. However, 1111 state is unstable due to the use of the U1D NAND gate. At state 1111 when the counter reaches its maximum count, the carry out signal goes at logical”0” and the output of U1D sets the preset enable pin to logical “1”, thus allowing information from the “jam” inputs (J1-J4) to preset the counter at state 1001. This way, state “000” never happens and state “111” triggers immediately state “001”.
Construction
For making construction easy, we have designed a small PCB. The only thing you have to do to make your electronic die, is to solder all the components on the provided PCB. It is essential to take some special care when handling the CMOS semiconductors.
CMOS semiconductors use very little current and can be completed destroyed if they come into contact with the magnitudes of static electricity that most of us carry about when we walk on carpets and wear rubber shoes. You will never know if this wanton destruction has happened – all you will discover is that your circuit doesn’t work and that you have tested everything. To avoid this problem, we recommend you to touch earthed metalwork of any equipment which is mains-earthed before you pick up the semiconductors. Touching some metallic water pipes, for example, will discharge your body from any electrostatic charge.
Resistors used in this project are all 0.25 watt, 10% tolerance, or better. The capacitors are all common electrolytic at 16V. The circuit is powered from an ordinary 9V battery. This type off battery is usually designated as NEDA 1604, IEC 6F22 and "Ever Ready" type PP3 (zinc-carbon) or MN1604 6LR61 (alkaline). The battery is connected to the PCB through a 9V-battery clip. S1 enables powering on and off the circuit, with the battery in place.
Download section
Electronic Die PCB Artwork and components placement guide