The project posted here is of simple music player system based on Arduino uno board and SD card module. As we all know that Arduino can deals with digital signal or square signal only, if we wish to work with sine wave we have to use further processing circuit. Previously we had posted Tune Player using Arduino for demonstration of using PWM pin of arduino.
Audio signal is sine wave thus we have used PWM pin and OP-amp for audio output. In order to generate pure audio signal (sine wave) we have o use some extra component because the output of arduino is PWM rather than sine wave.
Circuit Description of Arduino Based Music Player
The circuit of Arduino Based Music Player is shown in figure 1, designed using Arduino Uno Board. Few other essential components are SD card, SD card module, Op-Amp IC (LM386) and few other electronics components like resistors, capacitors etc. in order to work flawlessly. The heart of the project Arduino Based Music Player is arduino uno board which read and process audio file from SD card and produce audio signal through PWM pin (pin 9) by turning on and off board frequently. Here in this project we had only used digital pins.
Audio file is first converted to .wav file format because arduino cannot process MP3 file directly. In order to play MP3 file, we have to use MP3 shield. For storing audio file (.wave audio file) we had used SD card. SD card cannot be directly interfaced with Arduino Uno Board thus we had uses SD card module. The four pin of SD card module CS, MOSI, MISO and SCK of SD card is connected to digital pin 4, 11, 12 and 13 of arduino uno board respectively as shown in circuit diagram.
The audio output is taken from digital pin 9 of arduino uno board and is very weak thus it is not audible. As a result, we have to amplify the output signal. For amplification we had used LM386 which is low voltage, battery powered power amplifier designed for application where low power is main concern. Another advantage of using LM386 is it does not require any ground reference voltage and output is biased to ½ of supply voltage. The amplifier circuit designed here is for 200 gains. For portability and easy use, we had powered this IC with 5V from arduino. These supply voltage is responsible for increase and decrease of volume i.e. if you wish to increase volume you have to increase supply voltage and if you wish to decrease volume then you have to decrease supply voltage. Output is taken from digital pin 9 of arduino and is given to non-inverting input (pin 3) through resistor R1 where inviting terminal (pin 2) is connected to ground.
The output of IC2 is collected from the pin 5 and then passed towards the loudspeaker via polarize electrolytic capacitor; C3. The pitch of frequency response in the audio system can be increased by replacing capacitor C3 with high value capacitor.
Learn more about Low Power Audio Amplifier using LM386 here.
Two switches SW1 and SW2 is connected to digital pin D2 and D3 of arduino uno board. Switch SW1 is used to change the track of the song and SW2 is used to play/pause the music.
NOTE: For better output sound 8-ohm speaker is preferred.
Working of the circuit Arduino Based Music Player
- Convert the audio file in .wav format and save in SD card.
- Place the SD card in SD card module and assemble the entire circuit as shown in circuit diagram.
- When power supply is connected music start to play. Use switch SW1 to change the track and SW2 to play/ pause the track
Software: The software code of arduino based music player is written in arduino programming language am is complied using arduino IDE. You can directly download the code and use it in your system without modifying the code.
PARTS LIST OF ARDUINO BASED MUSIC PLAYER
|Resistors (all ¼-watt, ± 5% Carbon)|
|R1 = 1 KΩ
R2 = 10 KΩ
|C1, C3 = 1 µF/16V (Electrolytic Capacitors)
C2, C4 = 10 µF/16V (Electrolytic Capacitors)
|ARD1 = Arduino Uno Board
IC2 = LM386 (Low Power Audio Amplifier)
|LS1 = 8Ω loudspeaker
SW1, SW2 = Push to on switch
SD card Module