Building an open-source MP3 player on ESP32 with Arduino

NicolasBrondinBernard

Author
@NicolasBrondinBernard

Want to build an audio player from (almost) scratch? Here's a tutorial with circuit and code!

Article published on 21/05/2021, last updated on 10/08/2026

When our daughter was younger, my wife had a project to buy an audio player and white noise generator for her bedroom.

White noise sometimes has the effect of helping children fall asleep.

After finding a few compatible players for around €30 on Amazon, I suggested to her that I could build one myself for around €15, with the features she wanted, and that's what I did.

In reality, it ended up costing me around €17 in total.

Research

I had already had fun with Raspberry Pi and Arduino Uno before, but this time I wanted to try something new, smaller and with reduced power consumption.

If you're not familiar with the Arduino environment, I invite you to read the article I dedicated to it on the blog.

On the advice of my friend (and mentor) @Paul, I decided to go with an ESP32 board, Arduino-compatible with built-in WiFi and Bluetooth.

Looking back on this project, a simple Arduino Nano would have done the job, since I ended up using neither Bluetooth nor WiFi.

The next step was to find a component that would let me play music, and since I had never worked with this kind of thing before, I simply searched "arduino mp3 module" on Google, and the first result was: DFPlayer Mini.

The module is a standalone MP3 player (it doesn't require any external controller to read and play music), supporting microSD cards and already integrating an audio amp.

Exactly what I was looking for to keep things as simple and quick as possible!

After reading a few tutorials and watching some explanatory videos on YouTube, I managed to find a few creators who had already gotten both components working together, so I was able to confirm my order, adding a small speaker along the way.

Components

Here is the list of components I used, with prices and links to buy them (from amazon.fr, non-affiliated).

  1. ESP32 Dev Module - €9.49
  2. DFPlayer Mini - €3.11 (€6.21 pack of two)
  3. Speaker - €3.99 (€7.99 pack of two)

I also used 1 micro SD card (which I already had), 4 push buttons, 4 10KΩ resistors, 1 1KΩ resistor, 1 breadboard, and some wires from my starter kit.

Circuit

After receiving all the parts and consulting other tutorials to understand how to get the ESP32 and DFPlayer Mini working together, I ended up designing the circuit below:

As you can see, the ESP32 communicates with the audio player through its serial port pins, and according to the usage instructions found online, the TX-RX link needs a 1KΩ resistor to reduce interference.

Code

All the code you'll need to upload to the ESP32 to get it working with the diagram above is available directly on GitHub as an open-source project that you're free to contribute to!

As a bonus, here's a short video I took while putting it together, you'll see that the player works perfectly!


Finished reading this article?
Our newsletter

No spam. Only free content, news, and ever more resources to level up your skills!

Join +1500 developers

Comments (0)

to leave a comment

No comments yet