Infrared Controlled MP3 Player
Infrared Controlled MP3 Player
by TigerFarmPress
Build an infrared remote controller MP3 player for about $10 (usd). It has the usual features: play, pause, play next
or previous, play a single song or all the songs. It also has equalizer variations and volume control. All controllable
through a remote.
Programed functionality:
The rst step is testing the Arduino and wiring it to the breadboard. The steps following that are designed to work
independently. Each step has wiring instructions and testing instructions. When I build projects, I wire and test each
component to con rm they are working. This helps integrating components because know that each work and I can
focus on the integration requirements.
This Instructable requires that you have the Arduino IDE installed. You are also required to have the basic skills to
download an Arduino sketch program from the links in this project, create a directory for the program (directory
name same as the program name). The next steps are to load, view and edit the program in the IDE. Then, upload
the program through a USB cable to your Arduino board.
Supplies:
Nano V3 ATmega328P CH340G Micro controller board for Arduino. As an alternative, you can use an
Uno.
Infrared receiver and remote control. I used an IR Wireless Remote Control Module Kits which came
with an Infrared receiver and infrared remote control.
One resister, 1K to 5K. I'm using a 5K resister because I have a bunch of them. The resister removes
noise that exists when not using the resister.
Breadboard Wire cables
5 volt wall adapter
Approximate costs: Nano $3, Infrared kit $1, breadboard $2, package of 40 wire cables $1, $1 for a 5 volt wall
adapter. Total, about $8. Note, I bought the Nano with the breadboard pins already soldered in place, as I my solder
skills are poor.
https://www.youtube.com/watch?v=AKIe-0Zp6NA
Plug the Arduino Nano into the Breadboard. Or, if you prefer, you can use an Arduino Uno for this project; they both
use the same pins for this project. Connect the Nano (or Uno) to your computer via a USB cable.
Connect power and ground from the Arduino to the breadboard's power bar. Connect the Arduino 5+ pin to the
breadboard's positive bar. Connect the Arduino GRN (ground) pin to the breadboard's negative (ground) bar. This
will be used by other components.
Download and run the basic Arduino test program: arduinoTest.ino. When running the program, the onboard LED
light will turn on for 1 second, then turn o for 1 second. Also, messages are posted which can be viewed in the
Arduino IDE Tools/Serial Monitor.
+++ Setup.
+ Initialized the on board LED digital pin for output. LED is off.
++ Go to loop.
+ Loop counter = 1
+ Loop counter = 2
+ Loop counter = 3
...
As an exercise, change the time delay on the blinking light, upload the changed program, and con rm the change.
In the above photo is a 140 piece solderless breadboard jumper wire kit box you can get for 3 to 5 dollars. They
make boards neater that using long cables for short connections.
Plug the female to male cable wires into the infrared receiver(female ends). Connect the ground pin of the clock
module, to the breadboard's ground bar strip. Connect the power pin of the clock module, to the breadboard's
positive bar strip. Connect the output pin of the infrared receiver, to the Arduino A1 pin.
In the Arduino IDE, install an infrared library. Select Tools/Manage Libraries. Filter your search by typing in
‘IRremote’. Select IRremote by Shirri (for reference, the library link).
Download and run the basic test program: infraredReceiverTest.ino. When running the program, point your remote
control at the receiver and press various buttons such as the number from 0 to 9. Serial messages are output
(printed) which can be viewed in the Arduino IDE Tools/Serial Monitor.
As an exercise, use a TV remote to see the values printed. You can then modify the program to use the values in the
infraredSwitch() function's switch statement. For example, press the "0" key and get the value for your remote, for
example, "0xE0E08877". Then, add a case into the switch statement as in the following code snippet.
case 0xFF9867:
case 0xE0E08877:
Serial.print("+ Key 0:");
Serial.println("");
break;
Since the DFPlayer is small inexpensive piece of hardware, it manages les and folders in a simplistic manner. I have
had mixed results when playing MP3 les that don't follow the following recommended formats, and therefore, I
recommend the following. Also, I haven't tested other options, such as 3 digit lenames (example: 003.mp3),
however I have seen 3 digit lenames used in other instructions and samples.
It's recommended that you format the card before adding les. This insures that the card is clean of system les.
Format using FAT32 MS-DOS.
On Mac, use the disk utility to format the disk: Applications > Utilities > open Disk Utility.
Click Erase.
I wrote a Java program that will copy a directory of MP3 les into a destination directory, using directory and le
names that work with a DFPlayer module. To run the program, you will need the Java JRE installed. Following is the
program's help output.
----------------------
This program copies a directory of MP3 files
to create another directory of MP3 files
using using directory and file names that work with a DFPlayer module.
To view the source code, click here. Click here, to download the JAR program le that you can run.
Fo r R e f e r e n c e
On the Mac, from command line, you can run the following.
Copy les in order onto the SD card. Since the DFPlayer may sort on the timestamp, copy the les in the le name
order.
$ dot_clean /Volumes/MUSICSD
Your SD card is now ready to use. Insert it into your DFPlayer module.
1. Connect the Arduino RX/TX pins to the DFPlayer module. Connect a wire between Arduino pin 10 and DFPlayer
pin 3 (TX). Connect a resister, I'm using a 5K resister from DFPlayer pin 2 (RX), to an empty row between the Arduino
and the DFPlayer. Connect a wire from Nano pin 11 to the 5K resister. The 5K resister removes noise that exists when
not using the resister.
2. Connect the ground pin (GND) of the DFPlayer module, to the breadboard's ground
bar strip. Connect the power pin (VCC) of the DFPlayer module, to the breadboard's positive bar strip.
3. If you have a single small speaker, connect it to pins 6 (SPK-) and 8 (SPK+) as in the above photo with Nano.
In the Arduino IDE, install the DFPlayer library. Select Tools/Manage Libraries. Filter your search by typing in
‘DFRobotDFPlayerMini’. Select DFRobotDFPlayerMini by DFRobot mini player library (for reference, the library link).
For my implementation, I loaded version 1.0.5.
Load MP3 les onto the micro SD card. You can have songs in separate directories. Put the SD card into the DFPlayer.
Download and run the MP3 player program: mp3infrared.ino. When running the program, point your remote
control at the receiver and press the okay button to start playing the rst song. When it starts playing, the DFPlayer
blue light will turn on, and stay on, while a le is playing.
A d v a n c e d C o n g ur a t i o n
I have built an Altair 8800 emulator computer that uses an Arduino Mega. When I added the DFPlayer there was a
lot of noise. To get rid of the noise, I used a separate power supply for the DFPlayer. The Mega has one power
supply, and sends serial control signals to the DFPlayer. The DFPlayer has another power supply, and receives and
implements the serial control signals from the Mega.
In the above photo, the Altair emulator's white mini USB hub powers the Mega and is connected to the laptop
black mini hub. The DFPlayer has a USB cable that connects it directly to the laptop black mini hub. This
con guration removed the noise that existed when the DFPlayer was powered through the emulator white mini
hub.
Click here, for the code con gured for the Mega. That version of the code using Mega RX/TX pins, where as a Nano
or Uno uses software serial port pins.
T he f o l l o w i n g i s f o r r e f e r e n c e .
2. Power options.
Connect from the Arduino directly to the DFPlayer:
VCC to +5V. Note, also works with +3.3V in the case of an NodeMCU.
GND to ground(-).
Use a completely different power source:
VCC to +5V of the other power source.
GND to ground(-) of the other power source.
I seen another power option:
From the Arduino +5V, use a 7805 with capacitors and diode to the DFPlayer VCC pin.
GND to ground(-).
3. Speaker output.
For a single speaker, less than 3W:
SPK - to the speaker pin.
SPK + to the other speaker pin.
For output to a stearo amp or ear phones:
DAC_R to output right (+)
DAC_L to output left (+)
GND to output ground.
For the DFPlayer wiki page, click here. Following the key library function calls.
DFRobotDFPlayerMini myDFPlayer;
https://youtu.be/sAK_PyEEkIM
On low volume, there was an irritating background static noise. The noise was okay when the DFPlayer volume was
higher and music was playing. But when the music was quiet, the static was there.
I found a StackExchage page that had lots of suggestions. The following worked for me:
The above was tested on my Altair 8800 emulator which I enhanced with a DFPlayer to play music. The player is
controlled by ipping the front panel toggles.