Home      Projects     Experiments     Circuits     Theory     BLOG     PIC Tutorials     Time for Science

31 December 2009
Author: Giorgos Lazaridis
Electronic Dice

The circuit assembled on a breadboard during the tests

This circuit is mostly for exercising and fun. I do not think that someone could ever exchange ye old plastic cubes with a cold electronic dice to play backgammon... But still, this is an interesting circuit.

The Circuit

The circuit is a 4017 decimal counter. 6 outputs are used to drive the transistor LEDs. The LEDs are connected in three pairs and a single LED. The clock pulses comes from the 555 timer. All the time, the 555 is out of voltage. The clock input is then pulled up using the R3 resistor. When the button is pressed, the 555 is connected to power and delivers pulses to the 4017. The dice is then 'rolled' until the button is released and the 555 stops sending pulses.

This circuit can operate with any voltage from 5 to 15 volts. The only thing that needs to be changes is the limiting resistor of the LEDs, R4 through R10. The value must be calculated according ti the voltage. This circuit is designed for 5 volts. You can use the Dr.Calculus LED resistor calculator to find the resistor needed for your application.

The LED array

What you may have already notice, is that the LEDs are not driven directly each one. Instead, they come in pairs, except one LED. This is done in purpose to reduce the diodes and the transistors used to drive them. I will try to explain what is going on.

First of all, the CO (Carry Out) output. This output remains HIGH from number 0 to number 4. This output is used to light the bottom left and top-right LEDs. So, when the output 0 of the 4017 is HIGH, the only LEDs that lights are those two, because output 0 drives NO LED. So, number 2 is indicated.

Onto the next number now. Output 1 of the 4017 drives the middle LED. Along with the bottom-left and top-right LEDs (from the CO output), number 3 is indicated.

The next output #2 is HIGH. This output drives the top-left and bottom right LEDs. Along with the two LEDs form OE output, the number 4 is indicated.

Following is output #3. This will drive the middle LED, as well as the top-left and bottom-right LEDs. Along with the 2 LEDs from the OE, number 5 is indicated.

Then, number #4 output is HIGH. this output will turn on the top-left and bottom-right LED, as well as the middle-left and middle-right LEDs. Along with the two LEDs from OE, number 6 is indicated.

For the following numbers, the OE output is turned off. So the bottom left and top-right LEDs are turned off. The output #5 will turn on the middle LED, and thus the number 1 is indicated.

Until now, all numbers 1 through 6 are indicated. On the next clock pulse, the output #6 will become High. But this output controls the RESET of the 4017. So, the chip will immediately reset and the count will re-start from output number 0.

This is how you should place the LEDs according to their numbers:

Bill Of Materials
 Resistors R1 Resistor 470 Ohm 1/4 Watt 5% Carbon Film R2 Resistor 470 Ohm 1/4 Watt 5% Carbon Film R3 Resistor 22 KOhm 1/4 Watt 5% Carbon Film R4-10 Resistor 220 Ohm 1/4 Watt 5% Carbon Film R11-14 Resistor 4.7 KOhm 1/4 Watt 5% Carbon Film Capacitors C1 10uF 16V Electrolytic Capacitor Diodes D1-6 1N4148 Switching Diode LED1-7 LED 3mm red Transistors T1-4 BC547 Switching and Applications NPN Epitaxial Transistor ICs IC1 74HC4017 IC2 555 Timer

Relative pages
• 555 timer basic circuits
• Basic transistor circuits
• 4000 series IC pinouts
• Dr.Calculus: 555 Astable multivibrator calculator
• Dr.Calculus: Standard resistor values calculator
• Dr.Calculus: LED resistor calculator

• Comments

 Name  Email (shall not be published)  Website Notify me of new posts via emailWrite your comments below:BEFORE you post a comment:You are welcome to comment for corrections and suggestions on this page. But if you have questions please use the forum instead to post it. Thank you.

 At 16 November 2015, 15:45:38 user Ram Jay wrote:   [reply @ Ram Jay]The output value of the dice would be a way to compare binary values?At 12 November 2014, 9:00:31 user Emmanuel wrote:   [reply @ Emmanuel]Can another circuit be constructed to take care of voicing out the number dislay?At 9 November 2014, 19:30:31 user Bob wrote:   [reply @ Bob]what resistor values for the time delay (R1 and R2 using a 220 or 100 microfarad capacitor) could I use for the dice when making the LED's faster? tyAt 7 May 2014, 7:38:17 user Giorgos Lazaridis wrote:   [reply @ Giorgos Lazaridis]@Leon Oh yes, its an 74HC4017At 4 May 2014, 11:20:31 user Leon wrote:   [reply @ Leon]I've tested your circuit on YENKA. The wires and components are similar to the circuit picture however the decade counter keeps exploding and also I have put the resistor values correctly. However, the decade counter keeps exploding. What can I do to fix it?At 2 January 2012, 17:50:02 user Kammenos wrote:   [reply @ Kammenos]@Kalung it seems that you have a wrong connection or something is dead...At 24 December 2011, 12:10:45 user Kalung wrote:   [reply @ Kalung]Hey. awesome curcuit, fun to make, and a fun project. I just got 1 problem, when i turn on the power LED 6 1 7 keep being turned on, and when i press start, LED 4 3 works, but LED 2 5 is off all the time. when im takeing an control it seems like LED 6 7 get power from R7 and R8. 1 thing i dont understand, first i forgot the power on the transistors, and it actully allmost worked, only 2 LED didnt work, becuase i forgot to connect them, after i connected them, and connected transistorene, it keep makeing problems for me, and this is were im standing rigt now. srry for my bad english, hope you can understand, what i wroteAt 15 July 2011, 19:22:06 user Kammenos wrote:   [reply @ Kammenos]@Amanda what happens when you remove the 555 from the circuit completely? Either the 555 is defective, or (most probably) you forgot to connect the R3 to VDD...At 15 July 2011, 13:18:59 user Amanda wrote:   [reply @ Amanda]i have tried making this circuit.but in my circuit all the 7 LEDs glow at all times irrespective of whether the push button is pressed or not...i have used 555p ic for timing,i guess there is some problem with the timer.i need help on this please.At 5 July 2011, 10:30:37 user Sotos wrote:   [reply @ Sotos]Ta LED pou anefera parakatw de syndeontai me tis antistaseis twn 4,7KOhm alla me aytes twn 220. Akomh, yparxei problhma ean anti gia 3 mm Led na xrhsimopoihsw 5 mm? Epishs, kata la8os anti gia 220 Ohm evala 100 Ohm. Peirazei?At 3 July 2011, 22:36:36 user Sotos wrote:   [reply @ Sotos]Sorry pou to xanagrafw alla nomiza pws mporousa na xrhsimopoihsw ellhnikous xarakthres. Egw to dokimasa to kuklwma, alla exw tis ekshs apories kai ta parakatw provlhmata. PRWTON, uparxei diafora metaksu switcing diodo kai kanonikhs? DEUTERON, to diko mou de leitourgei sta 5V alla sta 9V. TRITON, molis to sundew de sumvainei tipota, alla otan pataw to mpouton ta LED anavosvhnoun etsi opws 8a eprepe, parathrhsa omws oti duo ap' auta (ta opoia argotera sundeontai metaksu tous mesw twn antistasewn twn 4,7KW) menoun sunexws anamena. Mporei veveia na anavosvhnoun toso grhgora pou den to katalavainw! Oi sundeseis einai oles swstes (polakis elegmenes)kai tipota den einai kammeno. Mallon kati den paei kala ston tropo pou sundesa ta plhn kai ta sun. I N E E D H E L P !At 7 April 2011, 12:29:56 user Kammenos wrote:   [reply @ Kammenos]@Fung yes it is, because when the button is released, the 555 has no power, and the input would be floating.At 7 April 2011, 7:42:22 user Fung wrote:   [reply @ Fung]Is it really need to pull up on the connection between the clock output of the 555 timer and the clock input of 4017?At 24 March 2011, 8:08:34 user Kammenos wrote:   [reply @ Kammenos]@Fung, i've never tried such a circuit.At 24 March 2011, 7:55:51 user Fung wrote:   [reply @ Fung]Known that a LM358 with some parts provide a slow-down function (I have this). But how can I add a slow-down function without replacing the 555 timer or changing a lot of the circuit?At 16 March 2011, 18:10:01 user Kammenos wrote:   [reply @ Kammenos]elengr, diodes are used to avoid current flow back to an output from another output. Transistors are used to amplify current so they can drive the LEDs.At 16 March 2011, 17:34:51 user elengr wrote:   [reply @ elengr]Why transistors are used when switching diodes are already used? Don\'t you think it was unnecessary to use transistors?At 12 March 2011, 20:18:51 user Kammenos wrote:   [reply @ Kammenos]elendr, the diodes are used to prevent HIGH voltage from an output to go to another output that has LOW. For example, suppose that Q1 is HIGH to light the LED1, but Q5 is LOW. If D1 was missing from the circuit, then what happens is that Q1 that is HIGH is directly connected to Q5 that is LOW, and maximum current will flow, destroying instantly both outputs. As for the LEDs, most probably you got a wrong connection. If you want more help, join the forum and start a thread to post images from your circuitAt 12 March 2011, 13:41:48 user elengr wrote:   [reply @ elengr]Why switching diodes are used? Also led 4 and 5 are not working. What can possibly be the problem, please help me.At 26 November 2010, 6:12:06 user mkrc wrote:   [reply @ mkrc]Thank You very much Sir.At 14 September 2010, 10:16:08 user andler wrote:   [reply @ andler]i hope that you'll make a random electronic dice...much better for a project.... just a suggestion...At 30 June 2010, 15:54:14 user varsha wrote:   [reply @ varsha]Thank You very much Sir. the circuit is working :)At 28 June 2010, 18:51:43 user Kammenos wrote:   [reply @ Kammenos]Yes indeed there is one. I put this for my power supply sparks. I do not list it because the 5volts that the circuit is supplied, are supposed to be smooth and free of parasitic noise. This is a 1uF capacitor (i suppose). If you power by battery or a good power supply, can be totally omitted.At 28 June 2010, 18:40:05 user varsha wrote:   [reply @ varsha]there is a capacitor near the led in the video. it is not found in the circuit and the list of materialsAt 15 June 2010, 15:13:44 user shobi wrote:   [reply @ shobi]hmmmmmmmm,,,, goodAt 14 June 2010, 20:27:32 user Kammenos wrote:   [reply @ Kammenos]No, not really. But, imagine that someone tells the numbers from 1 to 6, about 5000 times per second... And when you say STOP (release the button), he tells you the number he is counting at this very moment... It is pretty much random in a way.At 14 June 2010, 16:43:54 user varsha wrote:   [reply @ varsha]could it not generate random numbers (as a nor normal dice)At 6 January 2010, 2:39:02 user Alin zhu wrote:   [reply @ Alin zhu]hehe,interesting.

 HOT in heaven!

 NEW in heaven! New Theory: AC electric motor working principle

 Contact     Forum     Projects     Experiments     Circuits     Theory     BLOG     PIC Tutorials     Time for Science     RSS    Site design: Giorgos Lazaridis © Copyright 2008 Please read the Terms of services and the Privacy policy