Search form

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.

Required Components

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.

Code Explanation

Programming part of this project plays a very important role to display random digital dice number on seven segment display. Arduino does not contain any library for seven segment display. so we created whole code without using any library.

First of all we selects digital pin for seven segment display.

int pin[7]={6,5,4,3,2,1,0};

After it we create an array of 6 digits of dice namely 1, 2, 3, 4, 5 and 6.