An ESP32-based internet radio player with web interface control
CubeRadio is an open-source internet radio player built on the ESP32 platform. It allows you to stream MP3 audio from HTTP URLs and control playback through a web interface or physical rotary encoder. The project features an OLED display for local status feedback and supports playlist management through a web API.
- Internet Radio Streaming: Play MP3 streams from HTTP URLs
- Web Interface: Control playback through a responsive web UI
- Physical Controls: Rotary encoder for volume control and navigation
- OLED Display: Real-time status information with scrolling text
- Playlist Management: Store and manage multiple radio stations with JSON/M3U/PLS support
- Volume Control: Adjustable volume through web interface or rotary encoder
- WiFi Configuration: Web-based WiFi setup with network scanning and multiple network support
- File Management: Upload/download playlists in JSON, M3U, or PLS formats
- WebSocket Communication: Real-time status updates between device and web interface
- MPD Protocol Support: Control via MPD clients (port 6600) with full command list support
- Favicon Support: Automatic favicon detection and display for radio stations
- ICY Metadata: Full ICY metadata support including stream URLs and descriptions
- Artist/Track Parsing: Automatic parsing of artist and track information from stream titles
- Enhanced Status Information: Detailed playback information including bitrates and elapsed time
- ESP32 development board
- I2S DAC (e.g., MAX98357A) or amplifier
- SSD1306 128x64 OLED display
- Rotary encoder with push button
- Audio amplifier and speaker
| Component | ESP32 Pin |
|---|---|
| I2S BCLK | GPIO 27 |
| I2S LRC | GPIO 25 |
| I2S DOUT | GPIO 26 |
| OLED SDA | GPIO 21 |
| OLED SCL | GPIO 22 |
| Rotary CLK | GPIO 18 |
| Rotary DT | GPIO 19 |
| Rotary SW | GPIO 23 |
Note: Pin assignments can be modified through the web interface or in
src/main.cppto match your specific hardware setup.
- Install PlatformIO
- Clone this repository:
git clone https://github.com/cstroie/CubeRadio.git cd CubeRadio
-
Build and upload the firmware:
pio run -t upload pio run -t uploadfs
-
After the device boots, connect to its WiFi access point (default: "CubeRadio-Setup") or access the device's IP address on your network
-
Configure your WiFi networks through the web interface
Once connected to WiFi, access the web interface by navigating to the ESP32's IP address in a web browser.
- Play/Pause: Start or stop playback of the selected stream
- Volume Control: Adjust volume through slider or rotary encoder
- Playlist Management: Add, remove, and organize radio stations
- WiFi Configuration: Configure multiple WiFi networks with priority ordering
- Upload/download playlists in JSON, M3U, or PLS formats
- Convert between JSON, M3U, and PLS formats on-the-fly
- Manage individual streams through the web interface
- Real-time validation of stream URLs and names
- Scan for available networks
- Configure multiple WiFi networks with priority
- Automatic fallback to next available network
- Secure password storage
| Endpoint | Method | Description |
|---|---|---|
/ |
GET | Main control interface |
/playlist.html |
GET | Playlist management |
/config.html |
GET | Hardware configuration |
/wifi.html |
GET | WiFi configuration |
/about.html |
GET | About page |
/w |
GET/POST | Simple web interface |
/api/streams |
GET | Get all streams in playlist |
/api/streams |
POST | Update playlist |
/api/play |
POST | Start playing a stream |
/api/stop |
POST | Stop playback |
/api/volume |
POST | Set volume level |
/api/tone |
POST | Set bass/midrange/treble |
/api/status |
GET | Get current player status |
/api/config |
GET | Get current configuration |
/api/config |
POST | Update configuration |
/api/config/export |
GET | Export all configuration files |
/api/config/import |
POST | Import configuration files |
/api/wifi/scan |
GET | Scan for WiFi networks |
/api/wifi/save |
POST | Save WiFi configuration |
/api/wifi/status |
GET | Get current WiFi status |
/api/wifi/config |
GET | Get current WiFi configuration |
Note: WebSocket server runs on port 81 for real-time status updates
├── data/ # Web interface files
│ ├── index.html # Main control interface
│ ├── playlist.html # Playlist management
│ ├── wifi.html # WiFi configuration
│ ├── config.html # Hardware configuration
│ ├── about.html # About page
│ ├── styles.css # Shared styles
│ └── scripts.js # Shared JavaScript
├── src/
│ ├── main.cpp # Main firmware code
│ ├── main.h # Main header file
│ ├── mpd.cpp # MPD protocol implementation
│ ├── mpd.h # MPD protocol header
│ ├── rotary.cpp # Rotary encoder handling
│ └── rotary.h # Rotary encoder header
├── platformio.ini # PlatformIO configuration
└── README.md # This file
This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.
- Fixed MPD command list handling to properly execute buffered commands instead of always returning an error
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
- ESP32 Audio library by Earle F. Philhower
- ArduinoJson library by Benoit Blanchon
- SSD1306 library by Adafruit
- WebSocket library by Links2004
- PicoCSS for the beautiful UI framework