Home > Projects > Radio Projects > ESP32 Internet Radio

ESP32 Internet Radio

Summary of ESP32 Internet Radio


Summary (under 100 words) A compact ESP32 internet radio uses a VS1053 codec board to stream Ogg/MP3/AAC/WMA/MIDI audio by feeding continuous 32-byte chunks to the decoder. The project uses minimal code (under 15 lines for the core) and optionally an SSD1306 OLED and a push-button on GPIO D13 for station switching via soft reset. Power is from a single 3.3V LiPo supply; advice is given to modify the VS1053 regulators or use a low-drop HT7333-1 regulator to avoid damage and audio noise from long wiring.

Parts used in the ESP32 Radio Project:

  • ESP32 board
  • VS1053 codec shield (MP3 decoder)
  • SSD1306 OLED display (64x128) — optional
  • Push-to-on switch (wired to GPIO D13)
  • LiPo / Li-Ion battery (3.3V supply)
  • HT7333-1 low-drop 3.3V regulator (recommended)
  • Jumpers and short wiring
  • 8 Ohm speakers (0.3 watt) or headphones
  • Small soldering/prototyping hardware

Prototype

The affordable MP3 VS1053 codec processor available on aliexpress.com is said to have the ability to decode different music formats such as Ogg Vorbis/MP3/AAC/WMA/MIDI audio. VS1053 can also record in Ogg Vobis file, but the available guidance online is mainly for proprietary boards or ESP32-IDF, which is not recommended due to the amount of coding required. A code with over 20 lines is sufficient to make me travel a distance of 100 miles!

The Idea

The idea driving the project is that by sending a 32-byte chunk of streaming data to the board continuously, it will continue playing without interruption.

This implies that the ESP32 will establish a connection with the streaming site on a specific port and subsequently receive the streaming data in precise 32-byte chunks. However, the board will continue to process the data as if it were a machine for inflow/outflow, while the stream will persist in its activity.

The primary code is just under 15 lines in length!

Construction

The ESP32 VS1053 library, which is open source, comes with several examples for reference. I have utilized a GPIO (D13) pin as a push-to-on switch for changing stations by performing a soft Reset on the VS1053 board to switch to the next station. To ensure smooth operation without bouncing, I added a boolean operator to switch between ‘false’ and ‘true’ to avoid multiple switches with a single button press.

You can easily modify VS1053 to run on 3.3 volts, even though it is originally a 5Volt device. On the ESP32 radio, you will only need a single supply voltage of 3.3 volts, which can be powered by a single LiPo battery. The VS1053 board has two voltage regulators, providing outputs of 3.3 volts and 2.5 volts labeled as [AM1117]. Using a digital multimeter, identify the functions first, then link a jumper wire from 3.3 volts to the input of the 2.5 volts regulator, converting the lead to a 3.3 volts input for the board.

VS1053 wiring

Try to minimize the length of the connecting wires. Extended and intertwined wires could result in a buzzing sound in the sound output, a common issue with this type of circuit boards. The output sound is in stereo and loud enough to drive small speakers or headphones, but to use larger speakers you might need to include amplifiers/amplifier boxes.

Construction hurdle

A fully charged Li-Ion / Li-Po battery can increase the voltage to 4 without risking damage to the ESP32, but it may cause the VS1053 board to fail and require a 40-day wait for a replacement from aliexpress.com. Thus, it is advisable to utilize a low power, low loss HT7333-1 3 pin voltage regulator with minimal drop in voltage and minimal quiescent current loss. However, the issue lies in the fact that HT7111-1 is a small surface mount component.

Schematic with ( OLED – Optional)

Schematic

Prototype

Prototype

Testing

To connect to the WiFi system, update the SSID and password at the start of the code and then upload it using the regular Arduino method. After being uploaded, the ESP32 will initially greet with ‘Hello’ to show that the VS1053 is operational. It will then hold off for a few seconds for the computer’s serial output to connect. After connecting online, it will switch to the designated station and begin streaming the lovely Beatles music. Activate the switch linked to D13 one time and the following station will be selected. The variable char *sname[7] is not required. You are able to select names for each radio station that is programmed. More station names can be included in the arrays for host, path, and port.

ESP32 Radio with OLED (Optional): The only issue remaining is the absence of a screen to indicate the current station playing! Now, the only thing needed to finish it all is an I2C universal display. However, using both the heavyweight Adafruit SSD1306 and Adafruit_GFX library together will cause the sound to be unpleasant. Hence, I employed a small SSD1306 library called esp8266-oled-ssd1306-master designed specifically for ESP8266 to operate SSD1306 OLED screens. This library enables the I2C display to function properly without impacting the audio output. Nevertheless, the OLED is not required – The radio functions perfectly even in its absence!

BOM

ESP32 $7.5
OLED 64*128 – $3
VS1053 codec shield – $6
HT-7333-1 -$1
8 Ohm speakers (0.3 watt) extra.

Softwares

Two sketches available – bare_minimum_radio_player.ino & simple_esp32_radio_mod3.ino The former consists of minimal code to receive 32-byte data from a streaming website and play it back. The second design involves a detailed plan to operate the radio with an OLED screen and a push-to-on button for station selection. Every sketch comes with a ‘helloMP3.h’ file that contains code for a short music or sound greeting. Compile the drawing with this document.

The essential Arduino libraries are included in the software package as well.

Download source folder

Quick Solutions to Questions related to ESP32 Radio Project:

  • Can the VS1053 decode multiple audio formats?
    Yes; the VS1053 is said to decode Ogg Vorbis, MP3, AAC, WMA, and MIDI audio according to the article.
  • How does the project keep audio playing without interruption?
    By continuously sending 32-byte chunks of streaming data to the VS1053 so it keeps processing the stream.
  • Is the main code lengthy?
    No; the primary code is just under 15 lines for the core streaming functionality.
  • How is station switching implemented?
    A push-to-on switch on GPIO D13 performs a soft Reset on the VS1053 to switch to the next station, with a boolean debounce to avoid multiple triggers.
  • Can the VS1053 run from a 3.3V supply?
    Yes; you can modify the board by bridging the 3.3V regulator output to the 2.5V regulator input so the board runs on 3.3V.
  • Do I need an OLED display for the radio to work?
    No; the OLED is optional and the radio functions perfectly without it.
  • Which OLED library avoids audio issues?
    Use the small esp8266-oled-ssd1306-master library instead of the heavier Adafruit SSD1306 and Adafruit_GFX libraries to prevent audio degradation.
  • What power regulator is recommended to protect the VS1053?
    Use a low-drop HT7333-1 3-pin regulator to maintain stable 3.3V and reduce quiescent current, though it is surface-mount.
  • How can I reduce buzzing in the audio output?
    Minimize the length and crossing of connecting wires between components to avoid buzzing.
  • What example sketches are provided?
    Two sketches: bare_minimum_radio_player.ino for minimal 32-byte streaming, and simple_esp32_radio_mod3.ino for OLED and button station control; both include helloMP3.h.

About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter
Scroll to Top