A few days ago, my wife told me she was thinking about buying a white noise and music player for our daughter's bedroom to replace the ipad we were using. If you don't know about it, white noise help babies to fall asleep and that's very handy to get a few more hours of sleep !
She found one she liked on Amazon for about 30€, but as it was something I wanted to build myself, I told her I could build one for 15€ with all the feature she'd like, and that's what I did. (Well it actually cost me around 17€ in total)
I played with Raspberry Pi and Arduino Uno before, but here I wanted to play with something new, smaller and with less power consumption. I decided to go with the ESP32 board, following an advice my very good friend @Paul gave me a weeks ago.
Next step was finding something to play audio from, and as I never tried it before I simply Googled "arduino mp3 module" which gave me it's first answer : DFPlayer Mini. The module is an autonomous (which means you don't need any additional chip to play audio from it) mp3 audio player supporting micro SD card and with audio amplifier included, exactly what I was looking for because I wanted to build it as quickly as possible.
After reading a few tutorials and watching some youtube videos, came across a some people who managed to make these two components work together so I ordered them along with a little audio speaker and jumped in !
Here are all the components I used to make the project along with prices and all the links to buy them (from amazon.fr, not sponsored).
I also used 1 micro SD card, 4 push buttons, 4*10KΩ resistors, 1*1KΩ resistor, a breadboard a some jump wires that I already had beforehand.
After receiving all the parts and looking at some more tutorials to understand how make the ESP32 and the DFPlayer Mini together I came with this circuit.
As you can see, the ESP32 communicate with the player by its serial pins and as I followed other people instructions, the TX-RX link need a 1K resistor to reduce noise on the communication.
All the code you need to send to the ESP32 to make it work is available on my GitHub as an open source project you are free to contribute ! Enjoy !
But in bonus, here is a little video I took while building the music player so you can see it works very well !
Hope you enjoyed this tutorial, see you later on the blog!
About the author
Hi, I am Nicolas Brondin-Bernard, freelance web engineer since 2015 with a passion for sharing knownledge and experiences.
I'm also a coach for junior web developers, you can message me on firstname.lastname@example.org, on my website or follow me on social networks like Twitter to avoid missing the bests posts or my future projects!