Electronic Dice for Kids

by vicky selva in Living > Toys & Games

1256 Views, 6 Favorites, 0 Comments

Electronic Dice for Kids

S & L.jpg

This instructable will show you how to create a dice using Arduino and few components. It's an easy and fun project for kids, suitable for beginners and those who want to start with Arduino; it also requires a minimal amount of components.

Components:

IMG_20180116_194647.jpg
IMG_20180116_194802.jpg
IMG_20180116_194907.jpg
IMG_20180116_195041.jpg

1)Arduino Uno X 1

2)LEDs X 7

3)1K resistors X 4

4)Switches X 4

5)PCB board X 1

6)Wires

TOOLS:

1)Soldering iron

2)Lead

3)Paste

Circuit Diagram:

F5LA4E0G1BB7YY2.MEDIUM.jpg
IMG_20180116_220021.jpg
IMG_20180116_210208.jpg

To create all the six faces of a dice, you need 7 LEDs, placed in the shape of an "H".As you can see from the diagram, they're not all linked to different pins of Arduino, but most are connected in pairs, to facilitate the use.

To create all the faces of the dice, you must follow these rules: For the number 1 of the dice: lights up the led 4For the number 2 of the dice: lights up the group 1For the number 3 of the dice: lights up the groups 3 and 4For the number 4 of the dice: lights up the groups 1 and 3For the number 5 of the dice: lights up the groups 1, 3 and 4For the number 6 of the dice: lights up the groups 1, 2 and 3

Program:

int pinLeds1 = 10;

int pinLeds2 = 9;

int pinLeds3 = 7;

int pinLed4 = 8;

int buttonPin = 6;

int buttonState;

long ran;

int time = 2000;

void setup ()

{

pinMode (pinLeds1, OUTPUT);

pinMode (pinLeds2, OUTPUT);

pinMode (pinLeds3, OUTPUT);

pinMode (pinLed4, OUTPUT);

pinMode (buttonPin, INPUT);

randomSeed(analogRead(0));

}

void loop()

{ buttonState = digitalRead(buttonPin);

if (buttonState == HIGH)

{ ran = random(1, 7);

if (ran == 1)

{ digitalWrite (pinLed4, HIGH);

delay (time);

}

if (ran == 2)

{

digitalWrite (pinLeds1, HIGH);

delay (time);

}

if (ran == 3)

{

digitalWrite (pinLeds3, HIGH);

digitalWrite (pinLed4, HIGH);

delay (time);

}

if (ran == 4)

{

digitalWrite (pinLeds1, HIGH);

digitalWrite (pinLeds3, HIGH);

delay (time);

}

if (ran == 5)

{

digitalWrite (pinLeds1, HIGH);

digitalWrite (pinLeds3, HIGH);

digitalWrite (pinLed4, HIGH);

delay (time);

}

if (ran == 6)

{ digitalWrite (pinLeds1, HIGH);

digitalWrite (pinLeds2, HIGH);

digitalWrite (pinLeds3, HIGH);

delay (time);

}

}

digitalWrite (pinLeds1, LOW);

digitalWrite (pinLeds2, LOW);

digitalWrite (pinLeds3, LOW);

digitalWrite (pinLed4, LOW);

}

Sequence:

1.jpg
2.jpg
3.jpg
4.jpg
5.png
6.jpg

Working:

dice