In this tutorial, you will learn how to build a colorful LED Arduino dice, which can be “rolled” by simply pressing a button. I will explain how to build the Arduino, and how to code it. It is a fairly simple tutorial for those that are at the beginner level.
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Materials
Step 1: The first step when constructing this Arduino is to get all of your materials together. Organization is key if you want to build an efficient dice.
Materials: These are the components that you will need for this project:
- Seven different colored LEDs
- Arduino UNO
- One 10k resistor
- Seven 220k or 330k resistors
- Thirteen wires (aka connector cables)
- Arduino Software
- USB cord
In case you are a beginner and may not know what these components are, or what their purpose is, below is a manual guide on each constituent.
LED- An LED or a Light Emitting Diode, is practically just a small flashing light.
Breadboard- The Breadboard is where you make your experimental model of a prototype of an electrical circuit. Arduino UNO- An Arduino is a physical programmable circuit board.
Button- A button is used to be pressed in order to operate another device
10k/22k Resistor- A resistor is a device that resists the passage of an electric current
Wires- Metal that is drawn out to form thin flexible rods or threads
Arduino Software- The Arduino software is downloadable on your laptop and is where you will write your code USB Cord- You use a USB cord to connect the Arduino to your laptop, and so that you can upload the code to your laptop
Laptop- Pretty self-explanatory, but you need a laptop to actually get this dice to work because you will be using it to code the instructions to the dice.
Step 2: Attaching Your LED's
Attach your LEDs to your breadboard. It is important that you attach your LEDs first, rather than in any other order because you will be building off of where they are positioned. You can put the LEDs anywhere on the breadboard as you like, however they have to be in the same order. Below is a chart for the order they should be in. In addition to the chart, there is a picture that shows how to differentiate between the positive/negative legs of the LED.
Step 3: Attaching Your Resistors
After you attach your LEDs, you should fasten on the 220k resistors to their corresponding LEDs. On the left side of the breadboard, you should have them connected to the positives, and on the right side of the breadboard, they should be connected to the negatives.
Step 4: Connecting Your Button
Now that your breadboard has the LEDs and their 220k resistors, you should add the components needed for the button. You can put the button anywhere you like on the breadboard, just not so close to the LEDs that it interferes with all the wires. The button should have legs in both sides of the Arduino. The next step to getting your button to work is to attach a 10k resistor in the same row as the button, and the negative side of the breadboard (left-hand side).
The final step in putting together the dice is to attach wires from the Arduino Uno to the breadboard. To start off with, pin #3 is going to be connected to the button. (I know it reads #2 on the diagram but I’ve switched it up one pin). The pins are the slots on the Arduino Uno numbered from 0-13, and a good rule of thumb is to always work in between those numbers, not on them. Then, pin 4-10 will be connected to the LEDs.
Step 5: Attaching the Rest of the Wires
Now that you have attached the wires to the LEDs and the button, the rest of the wires will be connecting the actual Arduino to make the breadboard work. Two wires are going to connect both sides of the Arduino to the GND (Ground) pins, and one wire will connect it to 5V (five volts). Lastly, a wire going from the positive on the breadboard to the button concludes the construction of the Arduino.
Step 6: Coding
Now that you have successfully built the Arduino, the next step is to code it on the Arduino software. In summary, this software lets you tell the Arduino what you want to do or what you want to happen in the form of code.
There is definitely a coding element in this tutorial, and below is the provided code (link) for this dice and overall explanation of what it does. Something to keep in mind is that the pins should match up with the numbers in the code, for example, if you have the wire connecting to your dice in pin #3 it should say the same in the code. Firstly, the first bunch are the numbers that are being inserted are the pins that they will each respectively be attached to. Meaning instead of saying, “4” you could just say bottomLeft anywhere in the rest of the code. The next bunch is telling the LEDs to OUTPUT and the button to INPUT. Next comes the loop, which is where the Arduino is coded to “roll” a random number. This happens because you insert randNumber.
Step 7: Additional Step for Professionalism
The wires on the breadboard can slightly obscure the LEDs, so for professionalism, you could cut a cardboard or thick paper piece to fasten over the LEDs, and covering the wires and resistors. This is completely optional, and up to your taste.
Step 8: Conclusion/Final Product
In conclusion, you should have a fully functional Arduino dice, just by the click of a button. I Included in this tutorial the schematics, pictures, and short functionality video to help you along with this, so you should be able to successfully build it. As I’ve mentioned before, some adjustments that you could make could be; add a cardboard cover for professionalism, which makes your project look much neater and presentable.