ESP32-based Internet Radio Streamer

A long time ago I bought an ESP32 module off of Ebay. I can’t really remember what for, but I did.

These things are dirt cheap, costing something like 4-5€ with shipping and feature a 32 bit dual core processor, plenty of flash and RAM and a wireless module supporting both WiFi and Bluetooth. They also sport a lot of GPIO and there is official Arduino support from the manufacturer ( https://github.com/espressif/arduino-esp32 ), so programming them is very easy. In fact, here is a guide to flashing the module with the Arduino IDE.

So the module arrived a couple of months later, in typical China-to-Greece-by-post fashion. By that time I had literally forgotten what I had bought it for. So it then lay there in a drawer for 4 or 5 years until I randomly came across an article that mentioned that it can output I2S! That was news to me, and obviously interesting.

After a brief google search I came across this project: https://how2electronics.com/simple-esp32-internet-web-radio-with-oled-display/ which then led me to this very cute library: https://github.com/schreibfaul1/ESP32-audioI2S

So I entered my favorite internet radio’s URL, plus my WiFi credentials into the code and loaded it to my ESP32 using the Arduino IDE. Surely enough, I saw in my serial port that the ESP32 connected to my WiFi access point and then opened successfully the streaming radio station. I could see on my oscilloscope that it was indeed outputting I2S. Excellent!

Then I hooked up a tiny DAC board that I had lying around (sporting an ES9023 chip – very practical since the ESP32 does not output an MCLK signal), and the thing worked flawlessly on the first try!

So I thought that I should do a carrier board for the ESP32 that would perform the following:

  1. Host the ESP32 board,
  2. Provide regulated power to the ESP32,
  3. Provide headers for serial port (programming), SD card, extra I/O, and perhaps for an LCD,
  4. Do galvanic isolation of the I2S signals,
  5. Provide buffered I2S output for connecting to an outboard DAC board,
  6. Have an on-board DAC with line level outputs.

Since this device would only stream internet radio (a.k.a. “heavily compressed audio”), the on-board DAC did not have to be anything special. So let’s go with the all time classic ES9023.

Let’s also do a relatively good power supply for the critical component (dac chip) but nothing extreme. The rest of the audio-related components can be powered by well respected LP5907 LDOs, while the actual ESP32 can be powered by a run-of-the-mill LM1117.

So this is what I came up with:

Gerbers were generated ( ESP32_DAC_v1_Gerbers (924 downloads ) ) and an order was put into a well known Chinese board manufacturer.

A couple of weeks later the boards turned up:

And were promptly populated:

Here is the complete Bill of Materials for this board: ESP32_DAC_v1_BoM (1361 downloads )

A suitable power supply was also implemented and integrated into a proper case:

And here is the completed device in action:

This was a pretty simple and relatively low cost project, an ideal way to keep busy for a couple of winter evenings.

Also it is a good way to listen to high fidelity internet radio without needing to keep an entire PC and DAC powered up. So it’s good for the environment.

It would not be difficult to add an LCD that would display the artist and track that is playing.. perhaps sometime in the future.

Comments

comments

23 thoughts on “ESP32-based Internet Radio Streamer

  1. Dimdim – long time no hear. Good to see you active again. Great project – timely, too, as I have a couple ESP32’s to play with.

    Do you get any wifi signal degradation when you close the top of that chassis?

    Thanks for posting gerbers/BOM.

    Derek

    • Hi there Derek, Happy New Year!
      I’ve remained active, my blog has not.. not enough time..
      Yes, the metal chassis pretty much shields the WiFi signal. That is why you might notice that I have included an external WiFi antenna. I have since bought another ESP32 module, one that has a U.FL socket for an external antenna. Unfortunately its dimensions are slightly larger than the one used to design this board, so I had to modify the board a bit, but it was doable.
      Take care,
      Dimitris

  2. Excellent work, very tidy, and low cost . i use Pi plus allo dac/ volumio, – modular – supports my aging skills/brain. Do try radio paradise flac streams – I listen all day long – 4 channels.

  3. Hi DimDim, long time without a post…
    This a great idea, perfect time for me, my wife just asked me to build something useful ( ! 😄) in order to listen to the radio in the kitchen…

    I grabbed a used Sony speaker in the dumpster, still good looking, I have some home made amp, some power brick, I just was missing the core and not easiest to DIY:the internet player able to connect through WIFI.

    Thank you for this 2024 project idea and happy new Year

    Chris

    • Happy New Year to you too Chris!

      I’m happy that you found this useful.. I use it to listen to music in the workshop without having to power up the entire computer.

  4. Pingback: An ESP32-based internet radio streamer #ESP32 @ddimitr « Adafruit Industries – Makers, hackers, artists, designers and engineers!

  5. Pingback: An ESP32-based web radio streamer #ESP32 @ddimitr « Adafruit Industries – Makers, hackers, artists, designers and engineers! - Funnier9

    • It is a dual TPS7A4701 based power supply of my own design. Pretty standard stuff.. I could post the design files if there is interest.

  6. Pingback: Dimitris Dimitrakoudis Turns a Junk-Drawer Espressif ESP32 Module Into a Hi-Fi Internet Radio – Techno News

  7. Pingback: Dimitris Dimitrakoudis Turns a Junk Drawer Espressif ESP32 Module Right into a Hello-Fi Web Radio - artificialintelligence360

  8. Very nice! 🙂

    I came across that same how2electronics article, but when I tired it out the audio was popping and lagging out and I got “slow stream” messages in the serial output (for any stream I tired). Did you have that issue at all? Did you make updates to the firmware code?

    • I didn’t make any changes to the code, I didn’t need to. It just worked.
      I did get some “slow stream” messages, but they were caused by spotty WiFi reception. Moving around a bit fixed things. Right now the device is streaming happily one (concrete) floor away from my access point. But it has the lid off.
      Also using an external antenna helps a lot.

  9. Pardon my nitpicking, but ESP32 isn’t ARM processor, it uses Xtensa processor. Still a nice project. Thanks for sharing.

  10. hey,

    thanks for your great informational ressource, I appreciate a lot. I am about to design my first (non-R2R) DAC.

    what surprises me is the huge amount of electrolytic caps you spend all over the place. what’s th reasoning behind it? could you drop a few words?

    the 500u + 220u + 22u in the ESP-power supply feel like they should be 4u7 max, the 2x 100u aoround the ESS-DAC are 1u and 10u as per the datasheet.

    Am I seeing things wrong? I’d prefer MLCCs over drying out Electrolytics…

  11. Oh, and another question came to my mind. how does audio sync work on your system? I mean pretty much on any I2S DAC that doesn’t integrate MCLK, but uses a free running crystal like here.

    How is ensured the DAC isn’t overrun by a ever so slightly too fast clocking BCK, or audio underruns if it’s slow. Or is the ESS DAC “overplaying” it by dropping samples or repeating – the datasheet isn’t very insightful and for my taste it’s just a brief summary of a datasheet 😉

    thanks for explanations or pointers to further ressources!
    m

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.