I want to share my latest open-source project built around the ESP32-C3-DevKitM-1 (RISC-V). It is a professional-grade, compact Internet Radio featuring a responsive Web UI, hardware controls, and real-time audio visualization.
The main goal of this project was to achieve smooth audio playback and rich visual feedback using cheap, accessible hardware (~$10 total BOM cost) while maintaining rock-solid system stability.
Video/GIF of OLED Visualizers:
Audio Processing: High-quality MP3 streaming via HTTP (up to 320 kbps). Powered by a custom FreeRTOS task architecture where the Audio Decoder > Input > Display > WiFi. It utilizes a large 128KB buffer with 2-second prebuffering to ensure zero stuttering even on weak WiFi.
Hardware Setup: * MCU: ESP32-C3 (RISC-V single-core, 160MHz)
DAC/AMP: MAX98357A Class D amplifier connected via digital I2S interface.
Display: 0.91" SSD1306 OLED (128×32) operating via Fast Mode I2C at 400kHz.
Controls: KY-040 Rotary Encoder (utilizing interrupt-driven quadrature decoding and a hardware debounce layer).
9 Real-Time Audio Visualizers: When the radio is idling, the OLED screen switches to a 60 FPS visualizer with 9 selectable styles (Classic Bars, Scrolling Wave, Hexagons, Mirror, Tesseract, etc.) driven by a 16-band audio spectrum analyzer.
Modern Responsive Web UI: Hosted via ESPAsyncWebServer with a LittleFS-backed filesystem. Includes dynamic station management (drag-and-drop reordering, up to 25 stations, JSON import/export), real-time WiFi diagnostics, system uptime metrics, and a rolling 20KB system log.
Power & Protection Systems:
Smart Deep Sleep Mode (~10µA consumption) with shutdown animations.
4-level WiFi recovery system (auto-reconnect, manual force, fallback credentials support).
Hardwired Brown-out detection logic (trigger at 2.51V) with flash-safe event logging.
Flash memory protection with a 5-second volume/state save debounce.
Plaintext
ESP32-C3-DevKitM-1
┌─────────────────────────────────────────┐
│ 5V ───> KY-040 VCC & MAX98357A VIN │
│ 3V3 ───> OLED SSD1306 VCC │
│ GND ───> Common Ground │
│ GPIO2, 3, 10 ───> KY-040 Encoder (SW/DT/CLK)
│ GPIO4, 5, 6 ───> MAX98357A I2S (BCLK/LRC/DIN)
│ GPIO8, 9 ───> OLED I2C (SDA/SCL) │
└─────────────────────────────────────────┘
The project is entirely built using PlatformIO and utilizes several highly optimized libraries like ESP8266Audio, ArduinoJson, and Adafruit GFX.
To make it fully functional, you need to flash both parts:
Code: Select all
pio run --target upload (Program code)
pio run --target uploadfs (Web interface data to LittleFS)
I would love to get your feedback on the FreeRTOS task prioritization choices and hear any suggestions for future expansion (e.g., adding BLE configuration or expanding display support).
Let me know what you think!