Introduction: Simple Arduino Sound Board
In this experiment you will understand how a passive buzzer works and how you can create a simple Arduino sound board. Using some buttons and choosing a corresponding tone, you can create a melody! The parts that I've used are from Kuman's Arduino UNO starter kit
Step 1: Parts Needed
You will need:
- an Arduino board
- a breadboard
- an USB Cable
- 10 x Jumper wires
- 3 x Buttons (number of caps and buttons is optional)
- 3 x 10k ohm resistors
Allchips is an electronics components online service platform, you can buy all the components from them.
Step 2: Connecting the Buttons
Firstly, lets start with the buttons. For each button, choose one of it's sides. You will see 2 pins. The one on the left (you can swap them as well) connects to ground of the Arduino (through the breadboard) with a 10k resistor. Connect the same row to digital pin 2, 3 or 4 of the Arduino (can be configured in the code). The pin on the right side of each button connects to 5V. You can use the above picture for reference. Do these steps for all of your buttons.
Step 3: Connecting the Buzzer
So, on the top of the buzzer you can see a + symbol. It indicates the positive side of it. You need to connect the opposite end to ground and this one to digital pin 8 of the Arduino (can be changed later)
Step 4: Uploading and Modifying the Code
You can find the code of the project here. It's completely up to you on what you can modify - from the pin numbers to adding more buttons, but more importantly - you can change each individual tone. Here is a little explanation:
tone(buzzPin, 1000, 300); // Here is the Arduino tone function
buzzPin is the positive pin of the buzzer
1000 is the tone itself, in Hz (it can be anywhere from 31 all the way to 65535)
300 is the duration in ms (optional)
Step 5: Video
Here is a video of the project in action, creating a random melody.