Forum >How to Make a DIY Music Player?
General

How to Make a DIY Music Player?

userHead naddour 2017-07-14 23:06:49 11502 Views19 Replies
I always want to make a DIY music player, but I don’t know why I failed every time. So I searched information on line and I finally found a guide at other forum.

Components:

DFRduino UNO R3 (same as Arduino UNO Rev3)*1

IR Kit for Arduino*1

DFPlayer - A Mini MP3 Player For Arduino *1

Jumper Wires

Resistors
Image

Official statement:

Arduino can be directly used to supply power for this module, which will not cause any impact on Arduino.

If you use Arduino to supply power, be sure to add two 1K resistors on the serial-port communication port to eliminate the noise!

The circuit below has been constructed:
Image
Image

Step 1: Code
Code: Select all
/*
* name: DFPlayer_Mini_Mp3
* version: 1.0
* Author: Apple tec.<[email][email protected][/email]>
* Date: 2015-07-16
* Description:
* note: mp3 file must put into mp3 folder in your tf card
*/
#include
#include
#include
//定义对应16进制数值的常量名
#define POWER 0xFD00FF
#define VOLUP 0xFD807F //VOL+
#define STOP 0xFD40BF //FUNC/STOP
#define PREV 0xFD20DF
#define PAUSE 0xFDA05F
#define NEXT 0xFD609F
#define DOWN 0xFD10EF
#define VOLDOWN 0xFD906F //VOL-
#define UP 0xFD50AF
#define ZERO 0xFD30CF //0
#define EQ 0xFDB04F //EQ
#define REPT 0xFD708F //ST/REPT
#define ONE 0xFD08F7 //1
#define TWO 0xFD8877 //2
#define THREE 0xFD48B7 //3
#define FOUR 0xFD28D7 //4
#define FIVE 0xFDA857 //5
#define SIX 0xFD6897 //6
#define SEVEN 0xFD18E7 //7
#define EIGHT 0xFD9867 //8
#define NINE 0xFD58A7 //9
int recvPin = 2;
boolean a = true;
int i = 20;
int z = 0;
IRrecv recv(recvPin);
decode_results res;
void setup() {
Serial.begin(9600);
recv.enableIRIn();
mp3_set_serial (Serial);
mp3_set_volume (i);
mp3_set_EQ (z);
}
void loop() {
if(recv.decode(&res)) {
switch(res.value) {
case POWER:
if (a == false) {
a = !a;
mp3_stop ();
}
break;
case PREV:
if (a == true) {
a = !a;
}
mp3_prev ();
break;
case NEXT:
if (a == true) {
a = !a;
}
mp3_next ();
break;
case PAUSE:
if (a == true) {
a = !a;
mp3_play ();
}
else {
a = !a;
mp3_pause ();
}
break;
case VOLUP:
if (i < 30) {
i = i+1;
mp3_set_volume (i);
}
break;
case VOLDOWN:
if (i > 0) {
i = i-1;
mp3_set_volume (i);
}
break;
case EQ:
if (z < 5) {
z = z+1;
}
else {
z = 0;
}
mp3_set_EQ (z);
break;
case REPT :
if (a == true) {
a = !a;
}
mp3_random_play ();
break;
case ONE:
if (a == true) {
a = !a;
}
mp3_play (1);
break;
case TWO:
if (a == true) {
a = !a;
}
mp3_play (2);
break;
case THREE:
if (a == true) {
a = !a;
}
mp3_play (3);
break;
case FOUR:
if (a == true) {
a = !a;
}
mp3_play (4);
break;
case FIVE:
if (a == true) {
a = !a;
}
mp3_play (5);
break;
case SIX:
if (a == true) {
a = !a;
}
mp3_play (6);
break;
case SEVEN:
if (a == true) {
a = !a;
}
mp3_play (7);
break;
case EIGHT:
if (a == true) {
a = !a;
}
mp3_play (8);
break;
case NINE:
if (a == true) {
a = !a;
}
mp3_play (9);
break;
default:
;
}
recv.resume();
}
}
Step 2: IR Remote Control Music Player

If everything goes well, you will get a music player controlled by IR remote control unit.
Image
Image

* Please carefully read the notes on use of DFPlayer Mini Module below!

* DFPlayer Mini can read files in MP3 & WAV format (the actual test indicates 320K super high quality music can be decoded), but audios with duration less than 1 second cannot be played.

* Be sure to place all music files in MP3 folder, and MP3 files shall be named with four digits, e.g., "0001.mp3", and then placed in MP3 folder. If Chinese or English name is required, English words shall be added at the rear of digits, e.g., "0001hello.mp3" or "0001后来.mp3". See the data manual for the details.

DFPlayer mini library files used in the code have been modified, and “all cycle” function is added.
2021-10-28 03:47:42 Hey Ho! Check out this source, which gonna help to create Music player! https://www.instructables.com/How-to-Ma ... ic-Player/
I wish I help you. Good luck.
userHeadPic mcan.kevin
2021-10-28 03:47:42 Hey Ho! Check out this source, which gonna help to create Music player! https://www.instructables.com/How-to-Ma ... ic-Player/
I wish I help you. Good luck.
userHeadPic mcan.kevin
2021-06-26 06:35:27 Time is tricky.It is difficult to control and easy to waste more time than you need.escorts userHeadPic cv0qzwx6
2021-06-26 06:35:27 Time is tricky.It is difficult to control and easy to waste more time than you need.escorts userHeadPic cv0qzwx6
2021-05-06 23:42:23 Did you finish the project according to this guide, and is there a video demonstration? userHeadPic bancroftli
2021-05-06 23:42:23 Did you finish the project according to this guide, and is there a video demonstration? userHeadPic bancroftli
2021-04-29 18:08:10 Music products you compose, I need to download to my phone. userHeadPic mildredoralie
2021-04-29 18:08:10 Music products you compose, I need to download to my phone. userHeadPic mildredoralie
2021-02-15 04:40:22 Solder the header pins with a soldering iron. Be careful while soldering!
Take the FM-16p speaker and solder the two input terminals of the speaker to the mini-player.
Put the FM speaker in the plastic box for audio amplification.
Connect the momentary push button to the plastic box for changing the output. The push-button is used to change the output by triggering the input from the external source. The audio amplification of the circuit is done by connecting the speaker directly to the power source.
Connect the LED light to the circuit for getting the signal about its present condition. If the LED light flashes, it indicates the ON condition and vice versa for the MP3 circuit.
Connect the power supply to the circuit. After a moment, the LED should start flashing, representing that it is working.
Cover the plastic box carefully without breaking any connecting wires
userHeadPic raresky1
2021-02-15 04:40:22 Solder the header pins with a soldering iron. Be careful while soldering!
Take the FM-16p speaker and solder the two input terminals of the speaker to the mini-player.
Put the FM speaker in the plastic box for audio amplification.
Connect the momentary push button to the plastic box for changing the output. The push-button is used to change the output by triggering the input from the external source. The audio amplification of the circuit is done by connecting the speaker directly to the power source.
Connect the LED light to the circuit for getting the signal about its present condition. If the LED light flashes, it indicates the ON condition and vice versa for the MP3 circuit.
Connect the power supply to the circuit. After a moment, the LED should start flashing, representing that it is working.
Cover the plastic box carefully without breaking any connecting wires
userHeadPic raresky1
2021-02-09 01:24:14 A debt of gratitude is in order for Sharing data. userHeadPic jacquelynpatte1.9
2021-02-09 01:24:14 A debt of gratitude is in order for Sharing data. userHeadPic jacquelynpatte1.9
2021-01-07 06:26:15 mnay thanks userHeadPic vojowew649
2021-01-07 06:26:15 mnay thanks userHeadPic vojowew649
2020-12-29 23:56:09 Have you finished your music player product yet? I really want to experience it userHeadPic jerremyhamston
2020-12-29 23:56:09 Have you finished your music player product yet? I really want to experience it userHeadPic jerremyhamston
2018-10-21 00:37:15 Thank for your writting. userHeadPic sonidosgratis102
2018-10-21 00:37:15 Thank for your writting. userHeadPic sonidosgratis102
2017-07-14 23:06:49 I always want to make a DIY music player, but I don’t know why I failed every time. So I searched information on line and I finally found a guide at other forum.

Components:

DFRduino UNO R3 (same as Arduino UNO Rev3)*1

IR Kit for Arduino*1

DFPlayer - A Mini MP3 Player For Arduino *1

Jumper Wires

Resistors
Image

Official statement:

Arduino can be directly used to supply power for this module, which will not cause any impact on Arduino.

If you use Arduino to supply power, be sure to add two 1K resistors on the serial-port communication port to eliminate the noise!

The circuit below has been constructed:
Image
Image

Step 1: Code
Code: Select all
/*
* name: DFPlayer_Mini_Mp3
* version: 1.0
* Author: Apple tec.<[email][email protected][/email]>
* Date: 2015-07-16
* Description:
* note: mp3 file must put into mp3 folder in your tf card
*/
#include
#include
#include
//定义对应16进制数值的常量名
#define POWER 0xFD00FF
#define VOLUP 0xFD807F //VOL+
#define STOP 0xFD40BF //FUNC/STOP
#define PREV 0xFD20DF
#define PAUSE 0xFDA05F
#define NEXT 0xFD609F
#define DOWN 0xFD10EF
#define VOLDOWN 0xFD906F //VOL-
#define UP 0xFD50AF
#define ZERO 0xFD30CF //0
#define EQ 0xFDB04F //EQ
#define REPT 0xFD708F //ST/REPT
#define ONE 0xFD08F7 //1
#define TWO 0xFD8877 //2
#define THREE 0xFD48B7 //3
#define FOUR 0xFD28D7 //4
#define FIVE 0xFDA857 //5
#define SIX 0xFD6897 //6
#define SEVEN 0xFD18E7 //7
#define EIGHT 0xFD9867 //8
#define NINE 0xFD58A7 //9
int recvPin = 2;
boolean a = true;
int i = 20;
int z = 0;
IRrecv recv(recvPin);
decode_results res;
void setup() {
Serial.begin(9600);
recv.enableIRIn();
mp3_set_serial (Serial);
mp3_set_volume (i);
mp3_set_EQ (z);
}
void loop() {
if(recv.decode(&res)) {
switch(res.value) {
case POWER:
if (a == false) {
a = !a;
mp3_stop ();
}
break;
case PREV:
if (a == true) {
a = !a;
}
mp3_prev ();
break;
case NEXT:
if (a == true) {
a = !a;
}
mp3_next ();
break;
case PAUSE:
if (a == true) {
a = !a;
mp3_play ();
}
else {
a = !a;
mp3_pause ();
}
break;
case VOLUP:
if (i < 30) {
i = i**;
mp3_set_volume (i);
}
break;
case VOLDOWN:
if (i > 0) {
i = i-1;
mp3_set_volume (i);
}
break;
case EQ:
if (z < 5) {
z = z**;
}
else {
z = 0;
}
mp3_set_EQ (z);
break;
case REPT :
if (a == true) {
a = !a;
}
mp3_random_play ();
break;
case ONE:
if (a == true) {
a = !a;
}
mp3_play (1);
break;
case TWO:
if (a == true) {
a = !a;
}
mp3_play (2);
break;
case THREE:
if (a == true) {
a = !a;
}
mp3_play (3);
break;
case FOUR:
if (a == true) {
a = !a;
}
mp3_play (4);
break;
case FIVE:
if (a == true) {
a = !a;
}
mp3_play (5);
break;
case SIX:
if (a == true) {
a = !a;
}
mp3_play (6);
break;
case SEVEN:
if (a == true) {
a = !a;
}
mp3_play (7);
break;
case EIGHT:
if (a == true) {
a = !a;
}
mp3_play (8);
break;
case NINE:
if (a == true) {
a = !a;
}
mp3_play (9);
break;
default:
;
}
recv.resume();
}
}
Step 2: IR Remote Control Music Player

If everything goes well, you will get a music player controlled by IR remote control unit.
Image
Image

* Please carefully read the notes on use of DFPlayer Mini Module below!

* DFPlayer Mini can read files in MP3 & WAV format (the actual test indicates 320K super high quality music can be decoded), but audios with duration less than 1 second cannot be played.

* Be sure to place all music files in MP3 folder, and MP3 files shall be named with four digits, e.g., "0001.mp3", and then placed in MP3 folder. If Chinese or English name is required, English words shall be added at the rear of digits, e.g., "0001hello.mp3" or "0001后来.mp3". See the data manual for the details.

DFPlayer mini library files used in the code have been modified, and “all cycle” function is added.
userHeadPic naddour