Beruflich Dokumente
Kultur Dokumente
In this post we are going to construct an Mp3 player using arduino and DFPlayer. The
proposed article has two Mp3 player designs, one with push button control and another
one with IR remote control. We will also take a look at DFPlayer (Mp3 player module)
By Girish Radhakrishnan
We all love music, we would like to hear it while at gym, reading, moments before
Constructing a music player at home few decades back was a near impossible for an
components.
Replicating a song to another cassette was a nightmare too. But now, thanks to
advancement in electronics an Mp3 player can be made from scratch with your pocket
money.
The heart of the project is DFPlayer which is a small Mp3 player module which can
Illustration of DFPlayer:
It has in-build amplifier which can drive 3 watt loudspeakers in stereo or mono. It has
24-bit digital to analog converter (DAC) which is pretty good for such low cost and
compact module.
It can support up to 32GB micro SD card. It supports up to 100 folders, each folder can
It has 6 different levels of equalizer; and 30 levels of volume adjust control. It can
By now you would have familiar with DFPlayer and its specification. You can purchase
to control the songs. The user can input their choice via push buttons.
The arduino’s built-in pull-up resistor has been activated in the program, so that we no
Try to use good quality speakers; the DFPlayer can deliver very good quality sound.
If you find any distortion in the sound at higher volume levels, power the DFPlayer
DFPlayer.
If you want stereo sound setup, connect the one of the speaker to SPK1 of DFPlayer and
//---------Developed by R.Girish------//
#include <SoftwareSerial.h>
pinMode(btnPause, INPUT);
pinMode(btnNext, INPUT);
pinMode(btnPrevious, INPUT);
pinMode(volumeUP, INPUT);
pinMode(volumeDOWN, INPUT);
digitalWrite(btnPause, HIGH);
digitalWrite(btnNext, HIGH);
digitalWrite(btnPrevious, HIGH);
digitalWrite(volumeUP, HIGH);
digitalWrite(volumeDOWN, HIGH);
mySerial.begin(9600);
delay(1000);
playFirst();
Playing = true;
void loop ()
{
if (digitalRead(btnPause) == LOW)
if(Playing)
pause();
Playing = false;
}
else
{
Playing = true;
play();
if (digitalRead(btnNext) == LOW)
if(Playing)
next();
if (digitalRead(btnPrevious) == LOW)
if(Playing)
previous();
}
if(digitalRead(volumeUP) == LOW)
volumeINC();
if(digitalRead(volumeDOWN) == LOW)
volumeDEC();
}
}
void playFirst()
exe_cmd(0x3F, 0, 0);
delay(500);
exe_cmd(0x06, 0, volume);
delay(500);
exe_cmd(0x11,0,1);
delay(500);
void pause()
exe_cmd(0x0E,0,0);
delay(500);
void play()
exe_cmd(0x0D,0,1);
delay(500);
void next()
exe_cmd(0x01,0,1);
delay(500);
}
void previous()
{
exe_cmd(0x02,0,1);
delay(500);
void volumeINC()
volume = volume+1;
if(volume==31)
volume=30;
exe_cmd(0x06, 0, volume);
delay(500);
void volumeDEC()
volume = volume-1;
if(volume==-1)
{
volume=0;
exe_cmd(0x06, 0, volume);
delay(500);
{
word checksum = -(Version_Byte + Command_Length + CMD +
mySerial.write(Command_line[x]);
//---------Developed by R.Girish------//
push buttons and inclusion of TSOP 1738 IR receiver. The received signal from IR
Now to control this Mp3 player you need a spare TV, or any other IR based remote
which might be lying on your junk box. You have to decide which the buttons for
2) Next song
3) Previous song
4) Volume increase
5) Volume decrease
You need to choose the buttons on the remote and find its Hexadecimal codes of those
buttons which will be transmitted by the remote. To find the hexadecimal code,
github.com/z3t0/Arduino-IRremote
Add the library to arduino software and navigate to File> Examples> IRremote >
You need to enter the hexadecimal code on the program given below. Once you entered
the hexadecimal codes in the given program, upload it. You are ready to control your
//---Developed by R.Girish--//
#include <SoftwareSerial.h>
#include <IRremote.h>
SoftwareSerial mySerial(10,11);
IRrecv irrecv(receive);
decode_results dec;
int eqset = 0;
void setup ()
irrecv.enableIRIn();
mySerial.begin(9600);
delay(1000);
playFirst();
Playing = true;
void loop ()
if(irrecv.decode(&dec))
{
if (dec.value==pause_play)
if(Playing)
pause();
Playing = false;
}
else
{
Playing = true;
play();
if (dec.value==next_song)
if(Playing)
next();
if (dec.value==prev_song)
if(Playing)
previous();
}
}
if(dec.value==vol_inc)
volumeINC();
if(dec.value==vol_dec)
{
volumeDEC();
}
if(dec.value==sound_equalizer)
equalizer();
irrecv.resume();
void playFirst()
exe_cmd(0x3F, 0, 0);
delay(100);
exe_cmd(0x06, 0, volume);
delay(100);
exe_cmd(0x11,0,1);
delay(100);
void pause()
{
exe_cmd(0x0E,0,0);
delay(100);
void play()
exe_cmd(0x0D,0,1);
delay(100);
}
void next()
exe_cmd(0x01,0,1);
delay(100);
void previous()
exe_cmd(0x02,0,1);
delay(100);
void volumeINC()
volume = volume+1;
if(volume == 31)
volume = 30;
exe_cmd(0x06, 0, volume);
delay(100);
void volumeDEC()
volume = volume-1;
if(volume == -1)
{
volume = 0;
}
exe_cmd(0x06, 0, volume);
delay(100);
void equalizer()
eqset = eqset+1;
if(eqset == 6)
eqset = 0;
exe_cmd(0x07, 0 ,eqset);
delay(100);
mySerial.write(Command_line[x]);
}
//---------Developed by R.Girish------//
NOTE 1: you may see warning in the program while compiling, please ignore it.
Author’s prototype:
By Girish Radhakrishnan
Introduction
The ISM band is operated at 2.4 GHz, which can be used without licensing with
reasonable power output.
The proposed project is general purpose ON/OFF wireless switch, which can be
utilized to turn ON/OFF Lights, fans, home appliances to home automation if are
confident enough to bring hardware or software alterations to this project.
The project is divided into two parts: The remote and the receiver.
The acknowledgement LED will light up momentarily every time when we press
a button on the remote and only if the transmitted signal is received by the
receiver and then the receiver send a feedback signal back to remote to trigger
the LED.
This process will ensure the remote controller’s ON/OFF command is reached its
destination with visual confirmation.
Circuit Diagram:
The above is the complete circuit diagram for the remote controller. The pin
connection diagram for NRF24L01 is also given in the same schematic.
The Receiver:
The receiver circuit consists of Arduino which can be of your choice, 10 current
limiting resistors of 330 ohm, 10 transistors and 10 relay forms the output
stage.
Circuit Diagram:
If you are confused with wiring diagram between Arduino and NRF24L01
module, just take a look at the table beside the schematic, it is same for remote
controller circuit too.
PIN 2 – OUTPUT 1
PIN 3 – OUTPUT 2
PIN 4 – OUTPUT 3
PIN 5 – OUTPUT 4
PIN 6 – OUTPUT 5
PIN 7 – OUTPUT 6
PIN 8 – OUTPUT 7
PIN A0 – OUTPUT 8
PIN A1 – OUTPUT 9
PIN A2 – OUTPUT 10
Output Stage:
The output is just showcased with two output stages for simplicity of the
diagram. You must expand it to ten, if you are using all the 10 channels.
• If you press the first button the corresponding output gets triggered i.e.
output 1 turns ON. If you press the same button on remote again, it will turn
OFF the output 1 at receiver.
If you have any further questions regarding the above discussed 2.4 GHz 10
channel remote control switch, please express them in the comment section.