Starting Electronics needs your help! Please make a donation to help cover our hosting and other costs. Click the donate button to send a donation of any amount.
Created on: 6 August 2012
This circuit simulates a dice being thrown. Pressing the button "throws" the dice. One of six LEDs will light up after the throw.
The LEDs have values from left to right of one to six. If the second LED lights up, the value thrown is 2, if the fifth LED lights up, the value thrown is 5, etc.
Can't see the video? View on YouTube →
As a minimum, finish tutorial 5 (555 LED Flasher).
In addition to a breadboard, wire links, 9V battery and battery clip, you will need:
|1||10k resistor||R7||1/4W 5% or better||Resistors|
|6||2k2 resistors||R1 to R6|
|1||10n capacitor||C1||Non-polorized capacitor||Capacitor|
|1||4047||U1||4047 IC e.g. CD4047 (14 pin IC)||Semiconductor|
|1||4017||U2||4017 IC e.g. HCF4017 (16 pin IC)|
|6||5mm Red LEDs||D1 to D6||Or other colour LEDs|
|1||Push button switch||SW1||Switch|
Books that may interest you:
Click the circuit diagram for a bigger image. New in this tutorial is the two 4000 series logic ICs, the 4047 and 4017. The outlines with pin numbering of these two ICs are shown below the circuit diagram.
Sometimes the schematic symbol of an IC will not show the power and ground pins of the IC, as is the case in this circuit. This makes the schematic diagram simpler, especially when a number of ICs are used. The power and ground pin numbers are usually shown in a text box as you can see in this circuit.
First note that the two 4000 series logic ICs (4047 and 4017) are sensitive to static electricity. The static electricity from your body or other sources can destroy or partly destroy the IC.
Strictly speaking, an anti-static bench mat and wrist strap should be used when handling and working with these ICs. Not every hobbyist will have this equipment or want to spend the money on it. There are some precautions that can be taken:
Click any of the breadboard pictures for a bigger image.
In the photos, the breadboard top horizontal rail is used for the positive battery and circuit connections. The horizontal rail just below it is used for the negative (or GND) connection.
The bottom horizontal rail is used for negative connections and the one above it is used for positive connections. This is made possible by the two wires (red and black) on the left of the photo.
The orange jumpers also connect the the left and right horizontal rails of each set.
In this photo, all power connections have been made from the ICs to the horizontal rails. All IC pins that are shown to be connected to +9V and GND (negative or 0V) in the circuit diagram have been made on the breadboard. A push button switch has also been inserted into the breadboard.
The connection between pin 5 and 15 of U2 has been made. The connection from pin 13 of U1 to pin 14 of U2 has been made. Six LEDs have been inserted with the anodes (longer LED lead) to the left. Each cathode of each LED is connected to GND with a 2k2 resistor.
The position of the LEDs and resistors have been swapped around on this breadboard circuit. I.e. in the circuit diagram, the resistors connect to U2 and then to the LEDs. In the breadboard image, the LEDs are connected to U2 and then to the resistors. This makes no difference to the way the circuit operates.
The circuit has now been completed by connecting the LED anodes to U2. C1 and R7 have been connected to U1 and wired to the push button switch.
You can help the Starting Electronics website by making a donation:
Any donation is much appreciated and used to pay the running costs of this website. Click the button below to make a donation.
After connecting the battery, one of the LEDs will switch on. To throw the dice, close the switch and then open it. The number of the LED, counting from the left, that is on will be the number that was "thrown" on the dice.