Electronic Dice

3.2K73

Intro: Electronic Dice

I conducted a lot of research when looking into a project for Advanced Computational Thinking and Coding. I wanted to make a final project that would be useful in my math classroom. I found a beginners project that I would use almost daily in my classroom. This project is an electronic dice.

The electronic dice I created included parts found in an arduino starter kit. The electronic dice consisted of six LED lights, an arduino uno, a breadboard, six 220 ohm resistors, one 2K ohm resistor, a button, and several wires.

The code created for my electronic dice included several components that I have learned about thus far in my Advanced Computational Thinking and Coding course. I first had to name each light’s pin value. This allowed me to use the name of light (the position it is in) later in my code. I also had to set up my random number function. This tells the code to pick a random number one through six. I also had to name what lights each number included when it is pressed in the void loop section. I am overall very happy with my finished project.

STEP 1: Step 1

Connect the GND pin on both sides of the breadboard to ground. Connect the closest positive strip to the 3.3 volt pin.

STEP 2: Step 2

Place six LED lights onto your breadboard in a dice-like fashion. Separate the anode and connode pin so they are on different numbered rows on the breadboard.

STEP 3: Step 3

Place your button onto the breadboard and connect one end of the button to ground with a 2K ohm resistor. Connect a wire from that same numbered row to the pin 2. Connect the opposite side of the button to the positive strip.

STEP 4: Step 4

Connect all cathode pins on the LED lights to ground using 220 ohm resistors. This can be done on either side of the breadboard.

STEP 5: Step 5

Connect all anode pins on the LED lights to the desired pins on the arduino uno. I have used pin three for my bottom left light, pin four for my middle left light, pin five for my upper left light, pin seven for my bottom right light, pin eight for my middle right light, and pin nine for my upper right light.

STEP 6: Step 6


Upload this code to arduino create and start using your electronic dice. The dice will at random choose a number between one and six and light up that many lights. This is the same thing that happens when you roll a regular dice.

3 Comments

Nice project

If you want to enhance it, try adding another LED in the middle and simulate the actual pattern in the die face (e.g. "one" in the middle, "two" diagonally on the outside corners, etc.)

You did not mention that, if you can see three faces of a die, you automatically know the values on each of the three hidden faces.

Cool. With electronic dice, there would never be the problem of the dice falling off the table or landing on edge.