Arduino LED Dice + Speaker

by rachelhsiao0821 in Circuits > Arduino

377 Views, 1 Favorites, 0 Comments

Arduino LED Dice + Speaker

complete.jpg

This is where I got my idea from:

https://www.instructables.com/id/Arduino-Led-Dice/

What I changed:

  • The little push button to a larger one
  • Colors of LEDs
  • Delay time for LEDs
  • Adding a speaker
  • Order of D pins, because the original settings could not work

Intro

Arduino Project - LED dice
complete.jpg
side.jpg
LEDs.jpg
S__127336454.jpg

This project is called Arduino LED dice + speaker.

There are 7 LEDs with different colors, a button, and a speaker.

How it works:

When you press on the button, you would hear a sound from the speaker, and the LEDs would randomly choose a number from 1 to 6. After about a second, the LEDs would turn off and you could press the button again to choose another number. It is like the dice we use when playing board games.

The video above shows how it works, and the pictures display the look from different sides.

Materials

materials mine.jpg

Here are some materials needed for this project:

  • Arduino & Breadboard
  • 7x LEDs of any kind and colors
  • 7x 220 or 330 Resistor (brown)
  • 1x Push button
  • 1x Speaker
  • Some wires

Get Started!

S__127238170.jpg
FM2K0ZEG1BBD4NI.LARGE.jpg
S__121331988.jpg
123.jpg
S__127238166.jpg
S__127238167.jpg
S__127238168.jpg
  1. Place the LEDs on your breadboard in the shape of "H (as shown in the diagram)
  2. Connect the cathodes (-) of all the LEDs to ground (-) with the resistors
  3. Connect the 4 groups of LEDs (as shown in the diagram)
  4. Connect the groups of LEDs to D pin (as shown in the diagram)
  5. Put the button on the breadboard and connect it to ground (+) with 10k ohm resistor, another side to D pin
  6. Put the speaker on the breadboard and connect it to ground (-) and to D pin

The dice should follow the rules:

For no.1 of the dice: lights up the LED 4

For no.2 of the dice: lights up the group 1

For no.3 of the dice: lights up the groups 3 and 4

For no.4 of the dice: lights up the groups 1 and 3

For no.5 of the dice: lights up the groups 1, 3 and 4

For no.6 of the dice: lights up the groups 1, 2 and 3

Code

程式碼.JPG

Here is the code for this project:

(註明「改」地方的代表經過修改)

https://create.arduino.cc/editor/rachelhsiao0821/b...

Test It!

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

The last step is to try and test if your project works!

Here are some more pictures of my project: LED dice from 1 to 6.