Electronic Dice!!!
![Dice!!!.png](/proxy/?url=https://content.instructables.com/FGH/LWQP/KBC84RMZ/FGHLWQPKBC84RMZ.png&filename=Dice!!!.png)
![Make Your Own Dice With Arduino!!!!/Dynamic Innovator](/proxy/?url=https://content.instructables.com/FHS/4E7I/KBC84RM6/FHS4E7IKBC84RM6.jpg&filename=Make Your Own Dice With Arduino!!!!/Dynamic Innovator)
![3lXtOE1Qq59j160iBoAK.jpg](/proxy/?url=https://content.instructables.com/F20/2QBU/KBC84T3M/F202QBUKBC84T3M.jpg&filename=3lXtOE1Qq59j160iBoAK.jpg)
![DICE!!! (1).png](/proxy/?url=https://content.instructables.com/FWD/D8QC/KBC84TA7/FWDD8QCKBC84TA7.png&filename=DICE!!! (1).png)
ABOUT THIS PROJECT
I made a dice throwing prototype: if you press the button, a random number between 1 and 6 is generated and the corresponding number of LEDs are lit up. This was a holiday project with my kids :)
Dice throwing prototype using Arduino UNO, a button switch and 6 LEDs.
Full tutorial on my channel visit my channel for full tutorial!!!
Parts & Materials Required!!!
![1.PNG](/proxy/?url=https://content.instructables.com/FLU/JL1L/KBC84RKR/FLUJL1LKBC84RKR.png&filename=1.PNG)
![2.PNG](/proxy/?url=https://content.instructables.com/FCV/88KV/KBC84RKU/FCV88KVKBC84RKU.png&filename=2.PNG)
![3.PNG](/proxy/?url=https://content.instructables.com/F5U/ERQ5/KBC84RKV/F5UERQ5KBC84RKV.png&filename=3.PNG)
![5.PNG](/proxy/?url=https://content.instructables.com/FQJ/5I8J/KBC84RKX/FQJ5I8JKBC84RKX.png&filename=5.PNG)
![6.PNG](/proxy/?url=https://content.instructables.com/FZI/XFL2/KBC84RKY/FZIXFL2KBC84RKY.png&filename=6.PNG)
![4.PNG](/proxy/?url=https://content.instructables.com/FAF/PCOV/KBC84RKW/FAFPCOVKBC84RKW.png&filename=4.PNG)
- Arduino uno
- 6x LED'S
- A breadbord or a prototyping board
- 6x 220 ohm Resistors
- 1x 1k ohm Resistors
- A push button
Circuit Diagram!!!
![Capture_2020_06_11_16_39_32_998.png](/proxy/?url=https://content.instructables.com/F2K/URZ4/KBC84RYV/F2KURZ4KBC84RYV.png&filename=Capture_2020_06_11_16_39_32_998.png)
I have made a circuit diagram for the connections of Arduino,led,push button and resistors.
see the circuit diagram for the connections.
Connections!!!
![8.PNG](/proxy/?url=https://content.instructables.com/FBO/M0VS/KBC84RL0/FBOM0VSKBC84RL0.png&filename=8.PNG)
![7.PNG](/proxy/?url=https://content.instructables.com/FUA/PIAR/KBC84RKZ/FUAPIARKBC84RKZ.png&filename=7.PNG)
![9.PNG](/proxy/?url=https://content.instructables.com/FH8/2ZYO/KBC84RL1/FH82ZYOKBC84RL1.png&filename=9.PNG)
Now connect led's negative terminal to the 220ohm resistors and positive terminal to the arduino's digital pins from 2 to 7.and connect the other led of the resistors to the Gnd(ground) pin.
For rest of the connections for push button see the circuit diagram!!
Additional Changes for the Led's!!!
![1p0.PNG](/proxy/?url=https://content.instructables.com/FLQ/22X8/KBC84RKS/FLQ22X8KBC84RKS.png&filename=1p0.PNG)
![11.PNG](/proxy/?url=https://content.instructables.com/FMP/374T/KBC84RL2/FMP374TKBC84RL2.png&filename=11.PNG)
I have added the BRIDGE like structure at the middle of the breadboard for the led's to rest infront of the wires and resistors JUST TO LOOK CLEAN.
U CAN ALSO SKIP THIS PART IF U DO NOT WANT TO DO THIS.
CODE!!
![12.PNG](/proxy/?url=https://content.instructables.com/F7M/61FM/KBC84RL7/F7M61FMKBC84RL7.png&filename=12.PNG)
![13.PNG](/proxy/?url=https://content.instructables.com/FZX/6UBP/KBC84RL8/FZX6UBPKBC84RL8.png&filename=13.PNG)
//Now hook up your pc with arduino and just download the below code and upload to your arduino.//Dynamic Innovator// set to 1 if we're debugging #define DEBUG 0 // 6 consecutive digital pins for the LEDs int first = 2; int second = 3; int third = 4; int fourth = 5; int fifth = 6; int sixth = 7; // pin for the button switch int button = 12; // value to check state of button switch int pressed = 0; void setup() { // set all LED pins to OUTPUT for (int i=first; i<=sixth; i++) { pinMode(i, OUTPUT); } // set buttin pin to INPUT pinMode(button, INPUT); // initialize random seed by noise from analog pin 0 (should be unconnected) randomSeed(analogRead(0)); // if we're debugging, connect to serial #ifdef DEBUG Serial.begin(9600); #endif } void buildUpTension() { // light LEDs from left to right and back to build up tension // while waiting for the dice to be thrown // left to right for (int i=first; i<=sixth; i++) { if (i!=first) { digitalWrite(i-1, LOW); } digitalWrite(i, HIGH); delay(100); } // right to left for (int i=sixth; i>=first; i--) { if (i!=sixth) { digitalWrite(i+1, LOW); } digitalWrite(i, HIGH); delay(100); } } void showNumber(int number) { digitalWrite(first, HIGH); if (number >= 2) { digitalWrite(second, HIGH); } if (number >= 3) { digitalWrite(third, HIGH); } if (number >= 4) { digitalWrite(fourth, HIGH); } if (number >= 5) { digitalWrite(fifth, HIGH); } if (number == 6) { digitalWrite(sixth, HIGH); } } int throwDice() { // get a random number in the range [1,6] int randNumber = random(1,7); #ifdef DEBUG Serial.println(randNumber); #endif return randNumber; } void setAllLEDs(int value) { for (int i=first; i<=sixth; i++) { digitalWrite(i, value); } } void loop() { // if button is pressed - throw the dice pressed = digitalRead(button); if (pressed == HIGH) { // remove previous number setAllLEDs(LOW); buildUpTension(); int thrownNumber = throwDice(); showNumber(thrownNumber); } }
Downloads
Electronic Dice Is Ready !!!
![14.PNG](/proxy/?url=https://content.instructables.com/FZO/7JL1/KBC84RLB/FZO7JL1KBC84RLB.png&filename=14.PNG)
![15.PNG](/proxy/?url=https://content.instructables.com/F4P/BENR/KBC84RLC/F4PBENRKBC84RLC.png&filename=15.PNG)
![16.PNG](/proxy/?url=https://content.instructables.com/FNM/CP9D/KBC84RLG/FNMCP9DKBC84RLG.png&filename=16.PNG)
![17.PNG](/proxy/?url=https://content.instructables.com/F14/HRR4/KBC84RLH/F14HRR4KBC84RLH.png&filename=17.PNG)
![Make Your Own Dice With Arduino!!!!/Dynamic Innovator](/proxy/?url=https://content.instructables.com/FNO/DRP2/KBC84T25/FNODRP2KBC84T25.jpg&filename=Make Your Own Dice With Arduino!!!!/Dynamic Innovator)