A simple ESP32-based internet radio player that streams MP3 audio from online radio stations and outputs to I2S audio amplifiers like the MAX98357A. Includes SD card functionality for future expansion.
WiFi Connectivity: Connects to WiFi networks to stream internet radio
MP3 Streaming: Decodes and plays MP3 streams from internet radio stations
I2S Audio Output: Compatible with MAX98357A and similar I2S amplifiers
SD Card Support: Ready for local file playback or logging
Auto-reconnect: Automatically restarts on connection failure
ESP32 development board
MAX98357A I2S amplifier (or similar)
MicroSD card module
ESP32 Pin MAX98357A Pin SD Card Module GPIO 26 DIN GPIO 27 BCLK GPIO 14 LRCLK GPIO 5 CS (Chip Select) GPIO 18 SCK (Clock) GPIO 23 MOSI GPIO 19 MISO 3.3V VCC VCC GND GND GND
Arduino IDE or PlatformIO
ESP32 board support installed
Install the following libraries via Arduino Library Manager or PlatformIO:
ESP32 board package
ESP8266Audio by Earle F. Philhower
SD (usually included with ESP32)
WiFi (included with ESP32)
Open internet_radio.ino in your IDE
Update WiFi credentials in the code:
cpp #define STASSID "YOUR_WIFI_SSID" #define STAPSK "YOUR_WIFI_PASSWORD" Change the radio stream URL if desired:
cpp const char* URL = "YOUR_RADIO_STREAM_URL";
Connect your ESP32 via USB
Select the correct board and port
Upload the sketch
Usage Power on the ESP32 with all components connected
The device will attempt to connect to WiFi
Once connected, audio streaming will begin automatically
Serial monitor (115200 baud) will display connection status and debugging information
Changing Radio Stations Replace the URL in the code with your preferred stream:
Find an MP3 stream URL from your favorite internet radio station
Common formats: http://server:port/stream or http://server/stream.mp3
##Adding Local Playback The SD card functionality is initialized and ready for expansion. You can modify the code to:
Play local MP3 files from SD card
Implement a station presets system
Add logging capabilities
##Audio Output The code uses I2SNoDAC output. To use different audio outputs:
For internal DAC: Use AudioOutputI2S
For Bluetooth: Add Bluetooth A2DP support
Issue Possible Solution No WiFi connection Check credentials, signal strength No audio output Verify I2S wiring, speaker connection SD card not detected Check SPI wiring, format card as FAT32 Stream stops Check internet connection, stream URL validity Project Structure text internet_radio/ ├── internet_radio.ino # Main sketch file ├── README.md # This file └── libraries/ # Required libraries (install via IDE)