ESP32 Based Internet Radio using MAX98357A I2S Amplifier Board
To build our ESP32 web radio, we have chosen the ESP32 development board (obviously) and the MAX98357A I2S Amplifier board.
- Suitable forB.Tech IoT students
- Build time3-4 weeks
- LevelIntermediate
- Available atAjvika Labs, Kakinada
About this project
Analog radios are becoming extinct in this digital world since everything, from movies to songs, is being directly streamed from the Internet today. Let’s see how an Internet radio can be made by leveraging some simple digital electronics, coding, and an active Internet connection. Now, those who are following us regularly might already know that we have built a Raspberry Pi-based Internet Radio previously, but in this tutorial, we will further simplify it by just using an ESP32.
ESP32 Internet Radio - Quick Overview
Build Time: 2-4 hours | Cost: $15-25 | Difficulty: Beginner-Intermediate
What You'll Learn: I2S protocol, Wi-Fi connectivity, Audio streaming, ESP32 programming
Applications: Home audio streaming, Portable radio, Custom music player, IoT audio device
What is ESP32 Internet Radio?
Why use ESP32 for Internet Radio Projects?
What is ESP32 Internet Radio?
Internet Radio, also known as streaming, web, IP, or online radio, is generally used to telecast messages, music, discussions, etc. in the form of audio. In other words, it is a digital audio service transmitted via the Internet. However, broadcasting on the Internet or web is usually referred to as webcasting, as no transmission happens broadly through wireless means. ESP32 internet radio (also referred to as ESP32 web radio) is a device that is capable of streaming audio from internet radio stations via Wi-Fi, playing through the connected speakers.
The Internet radio can be created as a stand-alone device that runs through the internet, or as software running through a computer that is connected to the internet. Here, we will make a stand-alone device that will be connected to the Wi-Fi, access the internet, and finally play the audio. To build our ESP32 web radio, we have chosen the ESP32 development board (obviously) and the MAX98357A I2S Amplifier. If you are looking to build a simple FM Radio that can work offline, then you should check the linked article. Now we build a powerful ESP32 internet radio player with the MAX98357A I2S amplifier board with this complete tutorial. Accessing online radio stations using Wi-Fi has never been easier! Setting up the circuit connections and programming your own internet radio player is explained in detail.
Why use ESP32 for Internet Radio Projects?
Built-in WiFi: Internet streaming audio.
I2S Supported: Digital audio output for quality audio.
Price: Cheap compared to commercial Internet radios.
Modify: You will be able to add functions such as display, volume control, and so forth.
Low Power: A low-power mode of operation must be supported. For example, running on batteries for portable use.
Components Required to Build ESP32 Web Radio
You will need the following components to build our Internet radio using ESP32. Most of the parts should be available easily.
8-Ohms Speaker with a rating of 0.5W to 1W.
Active internet connection
Understanding I2S Communication Protocol
As most of us already know, ESP32 is a very low-cost, low-power system on a chip microcontroller that has integrated Wi-Fi and dual-mode Bluetooth. We have previously built many ESP32 projects; you can check them out if interested. However, we are not going to use the Bluetooth functionality of ESP32 here, but still, we have selected ESP32 for the three reasons listed below.
It has a Wi-Fi Module
It has I2S peripheral support.
Now, why is I2S important?
The Integrated Inter-IC Sound Bus (I2S) is a serial bus interface standard that is used for connecting digital audio devices. It is made by Philips Semiconductor. This interface is most commonly used by audio ADC and DAC components.
Since to run a radio we need to use a Speaker and need to produce analog output, we need some sort of digital-to- analog converter. Here comes the interesting part of the project. The MAX98357A module. It offers a Digital Class D amplifier that uses the Digital Audio Interface or I 2 S to communicate with microcontroller units.
Could provide 3.2W output Power into a 4-ohm load at 5V
Click and Pop-up noise reduction
Short circuit and thermal protection
Supports Left, Right or (Left/2 + Right/2) Output
Works from 2.5V to 5.5V.
The MAX98357A I2S module that we have used in this project is shown below.
ESP32 Internet Radio Circuit Diagram
The schematic is simple. The MAX98357 connection is given in the table below.
Gain Select. If connected with VDD, Gain is 6dB, If GND, Gain 12dB.
Shutdown. To activate, pull it low.
Since the Gain pin is connected with the GND, the gain is 12dB.
ESP32 Internet Radio Code Implementation
Well, this project uses the ESP32-audioI2S library that is available on GitHub. Before we get into the code, make sure you download the library from the link below and add it to the Arduino IDE.
ESP32 Audio I2S Library
The full code is provided at the bottom of this page. You can directly copy and use the code, but if you want its explanation, then read further.
First, the libraries required for the project are included, as shown below.
Then, the pinouts of the MAX98357A are specified. If you are using the same module shown above, you can leave it as shown below.
Put your Wi-Fi SSID and Password; this allows the ESP32 to connect to the internet.
In the setup, the WiFi password and SSID are being set, and the WiFi is started. After the Wi-Fi is connected, the Audio Pinouts are selected, and the volume is also set to the maximum.
Set the streaming URL here. You can choose any streaming URL of your choice, and you can also introduce a potentiometer to switch between multiple streaming channels if needed.
After all of this, the audio is played continuously in the void loop using the code below.
Testing our ESP32 Internet Radio Player
The circuit is connected properly as per the schematic and connected to the Wi-Fi. As soon as the setup is powered, it connects to the internet and starts streaming the audio from the URL mentioned in the program.
I also found that the audio is quite clear and very usable without any additional amplifiers in between. You can check out the video below that demonstrates the complete project to test the audio quality yourself.
Troubleshooting Common Issues
Future Improvements or ESP32 Web Radio
∗ LCD Display: Song name, connection state, and station info are displayed on the LCD. ∗ Rotary Encoder: Volume control and station switching capability. ∗ Multiple Stations : Storage of chosen radio streams in memory. ∗ Web Interface: Possible control over radio via browser interface. ∗ Bluetooth: Ability to stream from Bluetooth-enabled mobile devices. ∗ Touch Controls: A modern capacitive touch interface. ∗ Battery Powered: To make portable with a rechargeable battery. ∗ Other Antenna: If necessary, a more sensitive antenna to pick up the WiFi better.
Technical Summary and GitHub Repository
The Technical Summary highlights the core design, working, and applications of the project, while the GitHub Repository provides complete source code, schematics, and documentation for developers.
ESP32 Internet Radio FAQ - People Also Ask
⇥ Does the ESP32 internet radio function without a stable WiFi connection? No. The ESP32 device needs a continuous WiFi connection to stream. However, SD card support can be added for offline play, or an auto-reconnect algorithm can be implemented to manage momentary network loss.
⇥What audio quality does the ESP32 web radio output? The ESP32 internet radio produces excellent audio through the I2S protocol. MAX98357A amplifier supporting 16-bit/48kHz audio at an efficiency of 92%, powers it at 3.2W, producing clear audio to rival that of any commercial streaming device.
⇥ How many radio stations can the ESP32 internet radio save? ESP32 can save hundreds of URLs for radio stations inside flash memory. Given 4MB of space, storing 200+ station presets is no challenge. Some very advanced applications can use an external SD card to store unlimited stations and playlists.
ESP32 Internet Radio - Quick Overview
Build Time: 2-4 hours | Cost: $15-25 | Difficulty: Beginner-Intermediate
What You'll Learn: I2S protocol, Wi-Fi connectivity, Audio streaming, ESP32 programming
Applications: Home audio streaming, Portable radio, Custom music player, IoT audio device
What is ESP32 Internet Radio?
Why use ESP32 for Internet Radio Projects?
What is ESP32 Internet Radio?
Internet Radio, also known as streaming, web, IP, or online radio, is generally used to telecast messages, music, discussions, etc. in the form of audio. In other words, it is a digital audio service transmitted via the Internet. However, broadcasting on the Internet or web is usually referred to as webcasting, as no transmission happens broadly through wireless means. ESP32 internet radio (also referred to as ESP32 web radio) is a device that is capable of streaming audio from internet radio stations via Wi-Fi, playing through the connected speakers.
The Internet radio can be created as a stand-alone device that runs through the internet, or as software running through a computer that is connected to the internet. Here, we will make a stand-alone device that will be connected to the Wi-Fi, access the internet, and finally play the audio. To build our ESP32 web radio, we have chosen the ESP32 development board (obviously) and the MAX98357A I2S Amplifier. If you are looking to build a simple FM Radio that can work offline, then you should check the linked article. Now we build a powerful ESP32 internet radio player with the MAX98357A I2S amplifier board with this complete tutorial. Accessing online radio stations using Wi-Fi has never been easier! Setting up the circuit connections and programming your own internet radio player is explained in detail.
Why use ESP32 for Internet Radio Projects?
Built-in WiFi: Internet streaming audio.
I2S Supported: Digital audio output for quality audio.
Price: Cheap compared to commercial Internet radios.
Modify: You will be able to add functions such as display, volume control, and so forth.
Low Power: A low-power mode of operation must be supported. For example, running on batteries for portable use.
Components Required to Build ESP32 Web Radio
You will need the following components to build our Internet radio using ESP32. Most of the parts should be available easily.
8-Ohms Speaker with a rating of 0.5W to 1W.
Active internet connection
Understanding I2S Communication Protocol
As most of us already know, ESP32 is a very low-cost, low-power system on a chip microcontroller that has integrated Wi-Fi and dual-mode Bluetooth. We have previously built many ESP32 projects; you can check them out if interested. However, we are not going to use the Bluetooth functionality of ESP32 here, but still, we have selected ESP32 for the three reasons listed below.
It has a Wi-Fi Module
It has I2S peripheral support.
Now, why is I2S important?
The Integrated Inter-IC Sound Bus (I2S) is a serial bus interface standard that is used for connecting digital audio devices. It is made by Philips Semiconductor. This interface is most commonly used by audio ADC and DAC components.
Since to run a radio we need to use a Speaker and need to produce analog output, we need some sort of digital-to- analog converter. Here comes the interesting part of the project. The MAX98357A module. It offers a Digital Class D amplifier that uses the Digital Audio Interface or I 2 S to communicate with microcontroller units.
Could provide 3.2W output Power into a 4-ohm load at 5V
Click and Pop-up noise reduction
Short circuit and thermal protection
Supports Left, Right or (Left/2 + Right/2) Output
Works from 2.5V to 5.5V.
The MAX98357A I2S module that we have used in this project is shown below.
ESP32 Internet Radio Circuit Diagram
The schematic is simple. The MAX98357 connection is given in the table below.
Gain Select. If connected with VDD, Gain is 6dB, If GND, Gain 12dB.
Shutdown. To activate, pull it low.
Since the Gain pin is connected with the GND, the gain is 12dB.
ESP32 Internet Radio Code Implementation
Well, this project uses the ESP32-audioI2S library that is available on GitHub. Before we get into the code, make sure you download the library from the link below and add it to the Arduino IDE.
ESP32 Audio I2S Library
The full code is provided at the bottom of this page. You can directly copy and use the code, but if you want its explanation, then read further.
First, the libraries required for the project are included, as shown below.
Then, the pinouts of the MAX98357A are specified. If you are using the same module shown above, you can leave it as shown below.
Put your Wi-Fi SSID and Password; this allows the ESP32 to connect to the internet.
In the setup, the WiFi password and SSID are being set, and the WiFi is started. After the Wi-Fi is connected, the Audio Pinouts are selected, and the volume is also set to the maximum.
Set the streaming URL here. You can choose any streaming URL of your choice, and you can also introduce a potentiometer to switch between multiple streaming channels if needed.
After all of this, the audio is played continuously in the void loop using the code below.
Testing our ESP32 Internet Radio Player
The circuit is connected properly as per the schematic and connected to the Wi-Fi. As soon as the setup is powered, it connects to the internet and starts streaming the audio from the URL mentioned in the program.
I also found that the audio is quite clear and very usable without any additional amplifiers in between. You can check out the video below that demonstrates the complete project to test the audio quality yourself.
Troubleshooting Common Issues
Future Improvements or ESP32 Web Radio
∗ LCD Display: Song name, connection state, and station info are displayed on the LCD. ∗ Rotary Encoder: Volume control and station switching capability. ∗ Multiple Stations : Storage of chosen radio streams in memory. ∗ Web Interface: Possible control over radio via browser interface. ∗ Bluetooth: Ability to stream from Bluetooth-enabled mobile devices. ∗ Touch Controls: A modern capacitive touch interface. ∗ Battery Powered: To make portable with a rechargeable battery. ∗ Other Antenna: If necessary, a more sensitive antenna to pick up the WiFi better.
Technical Summary and GitHub Repository
The Technical Summary highlights the core design, working, and applications of the project, while the GitHub Repository provides complete source code, schematics, and documentation for developers.
ESP32 Internet Radio FAQ - People Also Ask
⇥ Does the ESP32 internet radio function without a stable WiFi connection? No. The ESP32 device needs a continuous WiFi connection to stream. However, SD card support can be added for offline play, or an auto-reconnect algorithm can be implemented to manage momentary network loss.
⇥What audio quality does the ESP32 web radio output? The ESP32 internet radio produces excellent audio through the I2S protocol. MAX98357A amplifier supporting 16-bit/48kHz audio at an efficiency of 92%, powers it at 3.2W, producing clear audio to rival that of any commercial streaming device.
⇥ How many radio stations can the ESP32 internet radio save? ESP32 can save hundreds of URLs for radio stations inside flash memory. Given 4MB of space, storing 200+ station presets is no challenge. Some very advanced applications can use an external SD card to store unlimited stations and playlists.
Technologies used
Hardware components
- ESP32
- ESP8266
- Arduino
- DHT22
- Relay
- OLED
- NodeMCU
Software & tools
- Arduino IDE
- Blynk
- Firebase Console
- Node-RED
- MQTT Broker
Project demo video
What you get
- Working project / hardware kit, tested before delivery
- Complete source code with explanation
- Project demo and guidance for your viva
- Project report, PPT and IEEE paper support (on request)
Delivery & Payment
Delivery takes a minimum of two weeks from the date your inquiry is confirmed.
Payment is in two parts:
• 50% advance to start the project
• Remaining 50% before delivery
Note:
• Documentation and PPT are not included by default
• If you need documentation/PPT, it can be arranged for extra time and cost
We'll confirm the exact timeline and cost with you after reviewing your requirements.