The story behind...
It was Tuesday and my kids, wife and dog were asleep.
I've wanted to do something with the components I've been ordering for a long time. You could build an MP3 player.
The beginnings were made quickly. Stinky and dirty radio play packed on an SD and the first tests started. The resistors were quickly used up and hardcoding is no fun.
Code written, tested, code rewritten, tested... You know that.
When everything was running, the display fell into my hands and most of the code had to be rewritten.
The MP3 player is now running and consumes just 60mA at its peak.
🛠️ เจาะลึกเบื้องหลังการทำงาน (Deep Dive / Technical Analysis)
While an Arduino can easily generate simple beeps and "Happy Birthday" using the tone() function, it cannot play high-quality vocals or MP3 audio files natively. The NodeMCU MP3 Player solves this using a dedicated audio decoding chip.
Heavy Lifting: The DFPlayer Mini
The secret to this project is the DFPlayer Mini module.
- It has its own Micro SD card slot.
- It contains a dedicated hardware MP3 decoder chip.
- It has a built-in 3-Watt amplifier, meaning you can plug a small speaker directly into it!
- The NodeMCU doesn't process any audio; it simply acts as the "remote control." It sends commands over Serial to the DFPlayer like
myDFPlayer.next();ormyDFPlayer.volume(15);.
Building the Graphic Interface
With the audio handled off-board, the NodeMCU can use its processing power to draw the UI.
- You use an I2C OLED Screen to create a menu.
- Push Buttons allow the user to scroll through track numbers (e.g., Track 001, Track 002).
- The NodeMCU updates the screen with a "Now Playing" icon and a pause symbol when toggled.
Parts Checklist
- ESP8266 NodeMCU or Arduino Nano.
- DFPlayer Mini MP3 Module.
- 0.96" OLED Display.
- Micro SD Card (formatted to FAT32, with MP3s named
001.mp3,002.mp3). - 3W 8-Ohm Mini Speaker.