Arduino Retro Style MP3 Player!

by Neutrino-1 in Circuits > Arduino

24961 Views, 133 Favorites, 0 Comments

Arduino Retro Style MP3 Player!

MP3 using DFplayer and Arduino | Soundpod part 2 [DIY]

Mp3 player may sound quite outdated. Smartphones can do much better than this! With all those apps and streaming services, you don’t even need to download any music or song.

But when I encountered the DFplayer module it really excited me with a bunch of features. From volume control, a 3W amplifier, equalizer, ability to play ads between the mp3 files, and much more. I wanted to explore all these features and put them to good use in a single device. So this MP3 player was a perfect choice.

The end product was quite interesting to use with the following features:

  • EQ Adjustment
  • Volume Control
  • Pause/play MP3 files
  • Next/previous
  • 2 screen navigation
  • rechargeable battery

Supplies

Here is the list of parts I used in this project (affiliate links):

Setting Up the OLED Display

vlcsnap-2020-06-19-14h10m55s317.png

1.3-inch OLED and 0.96-inch OLED may look similar, but they don’ t share the same display driver, So if you try to use a library like Adafruit SSD1306, the display won't work because the 1.3inch OLED display has Sh1106 display driver.

So, we are going to use the U8g2 library. You can download this library for your Arduino IDE with this link or go to your library manager and install the latest version of U8g2.

This library has a lot of flexibility when compared to other libraries, for example, you can run the same code for a variety of displays with very minimal code change and importantly gives you a wide range of fonts and open icons to use in your project.

The 1.3-inch display has 4 pins VCC, GND, SDA, and SCL.
Since the display supports an I2C communication, connect the VCC and GND to +5V and GND of the Arduino pro mini and connect the SDA and SCL to A4 and A5 of the Arduino pro mini.

You can test the display either by running the demo sketch which comes with the u8g2 library or you can compile and run my sketch which is in Soundpod.rar file or use the Github link.

Downloads

Setting Up DFPlayer

vlcsnap-2020-06-19-14h32m38s399.png

DFplayer is a small and cheap MP3 module with a simplified output that can be directly connected to a speaker without an amplifier.

Features

  • 24bit DAC
  • Supports FAT16, FAT32 file system
  • Up to 32GB SD card support
  • Built-in 3Watt Amplifier
  • supports 100folders, each folder can support up to 1000songs
  • 5 levels of EQ adjustment and 30 levels of volume adjustment

Circuit

This module can be used standalone with an attached battery, speaker & push buttons or can be used with an Arduino or any other microcontroller. It uses UART/serial communication for sending and receiving commands to microcontrollers. So we can use the Arduino's serial read/write function to control this module.

Connect 4 push buttons to the pin 2,3,4 of the Arduino for controlling the volume/start/stop and then connect the pin Rx and Tx pin of the DFplayer to Arduino pin 10 and 11. Finally, connect the speaker to spk+, spk- of the DFplayer, and connect +5v supply to VCC and GND to GND of the DFplayer.

You can test your module with the code which is in the folder 'DFPlayer'. This instructable would help you more in easily getting started with Arduino and DFPlayer.

Downloads

Preparing the Components

vlcsnap-2020-06-19-18h02m28s389.png
vlcsnap-2020-06-19-18h06m53s488.png
vlcsnap-2020-06-19-18h13m29s947.png
vlcsnap-2020-06-19-18h15m37s180.png

You would have seen the final built looks messy and you may think it would be way better to print a PCB. I totally agree! But this is comparatively more fun and personally they are pretty cool to look at as well. Anyway, I will drop a link where you can use the existing circuit and build a PCB.

Since there are too many components to use, a 2 sided PCB would be a perfect fit. Then cut 2 sided PCB in such a way that horizontally it has 14 holes and vertically 21. Then placed the push buttons which will help us in navigation, pause, and play of the song. While placing other components you need to be really careful where you place them and how many pins each component has. From my experience of building this twice, keep only the pins that are used and cut the rest of them, It would solve more problems down the road. You can refer to this circuit diagram and cut the unnecessary pins.

Placing the Components

vlcsnap-2020-06-19-18h26m21s959.png
vlcsnap-2020-06-19-18h26m54s881.png
vlcsnap-2020-06-19-18h27m31s934.png

Place the digital pins of the Arduino close to the buttons and the analog pins pointing toward the top of the board so it would be easy connecting to the OLED display. Then do the same process for the DFplayer, place the module in such a way that the SD card slot is pointed inward, and also remove the black separator from the header pins, so the DFplayer has a proper fit in the board along with the Arduino.

I wanted to run DFplayer with full capacity, so I added a small boost converter to convert the 3.7 volts from the lithium battery to 5V. But in the end, this module couldn’t provide enough current to run the DFPlayer. And I felt it was doing much better with the 3.7-volt battery alone So, in the end, I discarded the boost converter(the green PCB module next to the Arduino pro mini).

Finally, to finish it off the backside of the PCB install the slide switch and the 3.5mm audio jack.

Soldering Everything Together

vlcsnap-2020-06-19-18h41m37s390.png
vlcsnap-2020-06-19-18h42m01s911.png
vlcsnap-2020-06-19-18h41m47s886.png
vlcsnap-2020-06-19-18h42m32s691.png

Follow the circuit diagram and solder the components close to each other, where you can merge two connections easily, and try to avoid using wires. Instead, use a bare single strand wire to make the connections and make sure you don’t touch any of the components on the bottom side too. And I Placed 2 single strand wires which are poking out of the board, this will be later used to solder the TP4056.

More Soldering!

vlcsnap-2020-06-19-18h55m20s006.png
vlcsnap-2020-06-19-18h56m33s813.png
vlcsnap-2020-06-19-18h57m18s583.png
vlcsnap-2020-06-19-18h54m53s338.png
vlcsnap-2020-06-19-18h55m06s083.png

Place the TP4056 module, which we will be using to charge our MP3 player with micro-USB. I used double-sided tape to place the Lithium polymer battery next to the charging module. This is a 300Mah module that fits perfectly within the PCB. If you build a bigger one, You can easily expand the battery without any modification to the current circuit.

Finally, solder the OLED display to finish it off, If you could follow the circuit diagram and place the components in the same order it will be a lot easier to work with.

Need to Develop This Project Into a PCB?

PCB-Cupid-logo-Design_Black_070123.png

Getting a electronics project into production would be nightmare. To ease you into the production world we have developed a platform (PCB CUPID) for PCB enthusiasts and hobbyists to ask and answer questions related to PCB design, fabrication, and assembly.

In addition to the Q&A feature, this website also has a wealth of blog posts and useful resources to help you learn about developing and manufacturing printed circuit boards. Whether you're a beginner looking for a crash course on PCB basics, or an experienced designer looking for tips and tricks, you'll find something of value on the site

So head on over and check it out, and don't forget to participate in the Q&A community to get help and share your own knowledge. Thanks!

Uploading the Code and Finishing Touches

vlcsnap-2020-06-19-18h58m02s493.png
vlcsnap-2020-06-19-18h58m11s002.png
vlcsnap-2020-06-19-19h06m22s762.png
vlcsnap-2020-06-19-18h58m40s725.png
vlcsnap-2020-06-19-18h58m54s968.png

Then I gave some final touch, by giving it some smooth rounded corner and I drilled a hole at the top corner so I can use this as a keychain!

Now, we can look into the programming part!

Instructions for the installation of the required libraries and how to use them is given in the Readme file on my git repository of this project. Just follow the instructions and use an FDTI module to program which is in the soundpod.rar file to Arduino pro mini. We are using an FDTI module because Arduino pro mini doesn't support USB to program it.

Finally, I removed the lights from the Arduino pro mini and DFplayer to save some battery and distraction it was causing while playing the song.

Finished Project!

vlcsnap-2020-06-19-12h54m35s963.png
DFplayer Helper.png

If you turn on the circuit after uploading the code, you can see Arduino boots up and the OLED screen works. Before jumping in and seeing all the features of this MP3 module, copy some music files to SD. For this, you have to follow some certain naming convention, where your folders should be named 01,02,..etc and your files inside each folder should be named 001,002,003..etc.

So to make everything simple I have a python script in the GitHub repo along with the code for this project. Just run the script in the command prompt and you should get a GUI interface where you can transfer files to your SD card hustle free for your DFPlayer.

Here you can create as many folders as you want, and you can add as many as files as you need in the files list. You can also remove unwanted folders and files (The program is designed to look like software from the past decade so it matches our mp3 build). Insert the SD card and turn on the soundpod(That's the name I gave for my MP3 player XD).

You can see the working of this soundpod in the video posted above!