Introduction: WiFi Enabled MP3 Player Using the ESP8266 Module and CATALEX Serial MP3 Player

A really simple solution to building a Network controlled MP3 player.

The project utilizes the ESP8266 module, I am using a Wemos D1 mini that is really inexpensive . The MP3 player is available from various supplier on eBay and AliExpress, AliExpress seems to be cheaper but takes for ever to arrive.

D1 Mini ESP8226

YX5300 UART MP3 Player

both items available on eBay here.

Step 1: ESP8266 Web Controlled MP3 Player

I am using the ESP8266 with the MicroPython firmware, head over to the MicroPython website for instructions on how to do that.

Step 2: The MP3 Player

For the MP3 Player I am using the CATALEX uart controlled MP3 player. The player expects commands on the serial ports and then carries them out.

Commands include

Play

Pause

Next

Previous

Stop

Volume Up

Volume Down

Volume Set

Sleep

Wake up

and many more ...

Step 3: Connecting the Two Components.

There are just 4 wires to connect. I am using jumper leads in my test setup.

  • Connect the Gnd from the MP3 player to the ground on the ESP8266
  • Connect the VCC from the MP3 player to the 5v pin on the ESP8266
  • Connect the RX from the MP3 player to the TX on the ESP8266
  • Connect the TV from the MP3 player to the RX on the ESP8266

That's all for the wiring, just plug an amplified speaker to the audio jack of the MP3 player and we are done with the setup.

Step 4:

Go over to the GitHub repository and download all the files,

You will need to upload the following to the ESP8266 module.

  • yx5300.py
  • mp3.py
  • main.py

The MicroPython firmware automatically runs the main.py script at startup if it exists. So once these three files have been transferred you should have a working WiFi MP3 player.

Transferring the files to the ESP8266 Module.

I am aware of at least two ways to transfer the files.

Ampy

A command line utility that connects to the ESP8266 module over the serial port.

WebRepl

The official MicroPython utility that connects to the module over IP. One useful advantage of the WebRepl in this instance is that it displays the console output. This is not possible otherwise as we are using the serial port on the ESP8266 to control the MP3 player.

Comments

author
Nazgul (author)2017-06-01

Hi, nice instructable. I have one question: if I were to use another MP3 module, I would have to change the protocol defintion inside the YX5300.py file, is that correct? (Grove mp3 2.0)

Thanks.

author
usear (author)Nazgul2017-06-01

Hi,

Yes that should be all that is needed. The protocol for the Grove module seems very similar so I think you should have little problem. If you get that to work feel free to add that to the protocol definition to github, it may help others.

regards

author
Nazgul (author)usear2017-06-20

Hi, in your guide it says to copy the three files. Shoud I remove the original boot.py file from the esp8266?

Thank you.

author
usear (author)Nazgul2017-06-20

Yes, back up the existing one and replace it. or you could modify the existing one. the boot.py is automatically run when the module restarts.

A better solution maybe to have all the code for the web server and mp3 module handling external and launch it from a generic boot.py it's been a long time since I have reviewed the code so there may be other possibilities too.

author
Nazgul (author)usear2017-06-20

Thanks for a swift reply, and sorry for bothering you.

After making a back up of boot.py, do I just delete boot.py and then copy your files? That's what I did now, but it doesn't work just yet.
It does show up as an access point. I've checked the the ESP's IP on my router and tried to connect to this IP on my phone (which was connected to the ESP acces point), but no result.
Are you certain the three files you've listed are all the files required?

Thank you for your time.

author
usear (author)Nazgul2017-06-20

To the best of my knowledge and what I can recall, I will have to go through it again.

author
Nazgul (author)usear2017-06-21

I see - understandable. On your hackster.io I read:
"My uPython code does not include the necessary instructions for configuring the WiFi aspect of the ESP-8266".
I guess this is the bit that is missing. I will attempt to fix this. Let me know if you came to have a look at it.

Thank you.

author
Balu_Sk (author)2016-11-30

What is maximum bitrate this module supports...?

Is it has stereo output...?

author
usear (author)Balu_Sk2016-12-01

It supports sampling rates up to 48KHz and yes it is stereo.

author
mrsharkit (author)2016-10-03

does this mp3 module support id3 tag reading from the mp3 files? thanks

author
usear (author)mrsharkit2016-10-03

Unfortunately it does not. I have looked at other modules and they don't seem to support them either. The only work-around I can think of is a solution where the mp3 module is reading of a external sd card.

author
mrsharkit (author)usear2016-10-03

The vs1053 seems to support it, using the adafruit library... I'll order one, let's see

author
usear (author)mrsharkit2016-10-03

That would be interesting. It's a bit costly but would make for a nice MP3 player implementation. I just realized after commenting that the one from SparkFun has the ability too.

author
Swansong (author)2016-10-03

Thanks for sharing :)

author
usear (author)Swansong2016-10-03

You are welcome, I hope you find it helpful.