Yet another version of an ESP32 Internet radio, implemented using Phil Schatzmann's versatile Arduino audio tools library. The program runs as an independent task in Core 1. The main loop is idle or performs other tasks.
The mp3-encoded ICY or HTTP stream from the Internet passes through the pipeline consisting of a copier, decoder, and volume control and is finally forwarded as an I2S stream to the DAC/Class-C amplifier MAX98357.
ch1 .----------. _ /|
.----> | MAX98357 |--> |_| | spkr
| `----------´ \|
.--------. .---------. .--------. |
icy --> | copier | --> | decoder | --> | volume | ----+ i2s
`--------´ `---------´ `--------´ |
| .----------. _ /|
`----> | MAX98357 |--> |_| | spkr
ch2 `----------´ \|
After establishing a WiFi connection to the local router using AutoConnect, go to http://webradio. You can now listen to the preset radio station and operate the radio via the web interface.
- Selection of a Radio URL from a predefined list
- Adjustable volume via a slider
- Speaker on/off
- Display of meta data (composer, opus) and time and date
- The last station played and the volume setting are saved and recalled the next time the device is started
The ESP32 supplies the LRC, BCLK, and DIN signals to its pins 21, 27 and 22. To separate the stereo channels, the two MAX98357 modules are connected from 5V to the SD inputs with different resistors. At an operating voltage of 5V, they have values of 560k and 180k, respectively.
.-----------------.
21 --> o LRC |
27 --> o BCLK MAX |
22 --> o DIN 98357 |
o Gain | Spkr right
5V Vin ---[560K]----o SD | _/|
GND --> o GND o---| |
5V --> o Vin (5V) o---|_ |
`-----------------´ \|
.-----------------.
21 --> o LRC |
27 --> o BCLK MAX |
22 --> o DIN 98357 |
o Gain | Spkr left
5V Vin ---[180K]----o SD | _/|
GND --> o GND o---| |
5V --> o Vin (5V) o---|_ |
`-----------------´ \|
- AsyncTCP @ 3.4.10
- ESPAsyncWebServer @ 3.9.5
- audio-tools @ 1.2.2+sha.053efdb
- libhelix @ 0.9.2+sha.0d70b7f
- LittleFS @ 3.3.5
- WiFi @ 3.3.5
- Preferences @ 3.3.5
- Ticker @ 3.3.5
Thanks to Phil Schatzmann for his audio tools and to Stéphane Calderoni for his inspiring CSS designs for the web interface.
