Starting Electronics Needs Your Help!
It is that time of the year when we need to pay for web hosting and buy new components and equipment for new tutorials. You can help by making a donation. Contribute to this website by clicking the Donate button. The total will be updated once daily. (You may need to clear your browser cache to see the updates.)
Target Amount: $2000
Amount Raised: $118
Created on: 6 August 2012
In this tutorial you will build a dice that is shaken by holding the button in and thrown by releasing the button. The shake, throw and number thrown are animated and displayed on a seven segment display.
A 74HC595 IC is used to interface the 7-segment display to the Arduino, using only 3 Arduino digital pins.
Can't see the video? View on YouTube →
|1||10k resistor (brown - black - orange)||R9||1/4W 5% or better||Resistors|
|8||470 Ω resistors (yellow - violet - brown)||R1 to R8|
|1||100n capacitor||C1||Non-polorized capacitor||Capacitor|
|1||74HC595||U1||74HC595 IC (16 pin DIP)||Semiconductors|
|1||Common cathode 7-segment display||S1||Common cathode 7-segment display, e.g. DMR14C from SunLED, or similar|
|1||Push button switch||SW1||Can also use a wire link to simulate a switch||Switch|
The circuit diagram is shown below. The seven segment display could have been directly interfaced to the Arduino, but by using the 74HC595, only 3 Arduino pins are used.
Find more information about interfacing the 74HC595 IC to the Arduino in the Serial to Parallel Shifting-Out with a 74HC595 article from the Arduino website. The circuit diagram uses the same Arduino pins as this article and the switch is wired the same as the Arduino Button example.
The completed breadboard circuit is shown here. Click the picture for a bigger image.
The suggested sequence for building the circuit is:
Download the Arduino_Dice sketch and load it to the Arduino.
Press and hold the push button to shake the dice. Release the button to throw the dice. After the dice settles, the number that was thrown will be displayed.