Introduction: Arduino MP3
On this Instructables, I will show you how I made a very rudimentary mp3 player. In short, there are melodies stored in the memory that will play based on which buttons are pressed.
Step 1: The Components
1x 220 ohms
1x 560 ohms
1x 4.7k ohms
1x 1k ohms
1x 10k ohms
1x 1M ohms
Step 2: Setup
The placement of the buttons and resistors feed into an analog input, and it's called resistor ladder.
The first button is connected with just wire, the 2nd with a 220 ohm resistor, the 3rd with a 10K ohm resistor, and the 4th with a 1M ohm resistor.
At the end, the circuit should be completed with a 1K ohm resistor. Meanwhile, another wire should connect to analog in A0 to read the resistance.
In the center, a wire from digital pin 8 must be connected to the buzzer and the resistor. The output from pin 8 is the tune the buzzer will play and when the LED will turn on or off.
Lastly, the buzzer should be completed with a 4.7k ohm to lower the volume as well as make the sound more clear.
Step 3: The Code
For the code, it has two parts to it. The coding for the songs, and the coding for which song to play when a button is pressed.
The songs are and coded by:
Star Wars Imperial March
Harry Potter Theme Song
by Borderliner / www.instructables.com/id/Arduino-Harry-Potter-Theme-Song
By electricmango / https://electricmango.github.io
I've made slight modification with the codes to make them work with my board.
Step 4: Improvements
There are many things I could improve in the future. These include, adding a potentiometer between the connection of pin 8 to the buzzer. With the potentiometer, I will be able to control the volume of the buzzer. Also, I should compress the notes into either separate libraries or all into one. Adding something like a 555 timer and connect several LEDS would make it flashier. Lastly, I could add an SCR and a button that stops any song midway when pressed.
Anyways, thanks for reading my Instructable.
We have a be nice policy.
Please be positive and constructive.