Digital Dice using Arduino
We all are familiar with dice and often played LUDO or SANP SIDI (Snake & Ladders) game by using dice. Dice is a squire type solid box which contains 6 different numbers on all of its sides. We throw dice on a surface to get a random number while playing the games. In this project we have tried to replicate it with a digital dice using arduino uno board. In place of throwing the dice, here we need to press a button to get a random number between 0 to 6.
- Arduino UNO
- Seven segment display (Common Anode)
- Push buttons
- Connecting wires
- Bread board
- 1 k resistor
- Power supply
Circuit Diagram and Explanation
As shown in the above digital dice circuit, arduino is used for controlling whole the process. Two push buttons are used in the circuit – one to start the dice and other for resetting the dice. Arduino reads these two buttons and perform the operation. A seven segment display is used to display the dice result.
Arduino is continuously executing rand() function and stored its value in to a temporary variable. When dice button is get pressed stored value calculated and display on seven segment by using appropriate method (see programming part of article).
Here in this dice circuit, a common anode seven segment display is used for displaying dice numbers, which is directly connected to arduino digital pin numbers 6, 5, 4, 3, 2, 1, 0. And common anode pin of seven segment is connected with +5 volt 220 Ohm resistor. Two push button are also connected namely dice button and reset button which are connected to digital pin 14 (A0) and 15 (A1) with respect to ground.