logo elektroda
logo elektroda
X
logo elektroda

A simple internet radio player based on ESP8266

miszczo997  15 35907 Cool? (+50)
📢 Listen (AI):

TL;DR

  • A simple internet radio player uses an ESP-01/ESP8266 module, minimal external parts, and pushbuttons to select stations.
  • ESP8266 handles MP3 stream decoding at 160 MHz, and a 3-stage RC low-pass filter cleans the PWM audio output.
  • The build draws 110 mA in operation and is said to support streams up to 256 kbps.
  • Playback was tolerable through a Sony FH-411R tower, but the sound is not suitable for headphones.
  • Limitations include MP3-only streams, a mute-and-pop pause when changing stations, and a reset when the station button is held too long.
Generated by the language model.

Hello
I wanted to present a modification of the design of the Internet radio player built only using the ESP-01 module, RC filter and a few external components.
Hardware:
The schematic and pcb were prepared in the Eagle program version 7.7.0.
The mp3 stream decoding is handled by the ESP8266 microcontroller overclocked to 160MHz. As the output generates a PWM signal, where the PWM itself has a resolution of only 4 bits, it was necessary to add a low-pass filter. I used the solution proposed by the @tmf user in one thread in the microcontrollers section. This is a 3-stage RC filter which should give a decrease of 18dB per octave, whose cut-off frequency I can't remember anymore. As a power outlet I gave the opportunity to use a DC connector, ark connector or ordinary goldpin. Voltage stabilization is handled by ams1117 or similar with the same pin configuration.


Software
The software is a modified code that was available at this address:
https://github.com/pvvx/mp3_decode
I have added the ability to change radio stations using the keys. However, it is not entirely correct and has 2 bugs that I could not cope with:
- when changing stations, before we connect to the next one, the sound will be suspended and the loudspeaker will be heard.
- when you hold the switch button for a long time, the system will reset.
The rest seems to work as it should. Files with modified program code are placed in the attachment.
Comments:
- The player can decode only mp3 streams,
- I used wireshark + foobar to get addresses of types, addresses and bitrates of streams
- Theoretically, the maximum bitrate is 256kbps
- The program is compiled with the help of Eclipse + RTOS SDK, wanting to add radio stations and configure the network connection options, I recommend reading this theme.
- Addresses and number of stations are defined in the file radiostation.c
- The name and password for the network are defined in the file playerconfig.c
- In the attachment I also put a compiled program with the name of the TPLINK network and the password 1234abcd, where I added stations

RMF FM
Duth radio(?)
Maxima FM
Radio Złote Przeboje
VOX FM
Radio ZET
Polskie Radio PR1

- To upload the program, it's best to configure eclipse and do it from its level, but you can do it 100% using another tool, e.g. ESP Flash Tool. Addresses to upload files you have to look for yourself, because I uploaded only with eclipse.
- During programming, we connect the usb uart converter to the goldpin pulled out from the side of the board. After programming the system, put a jumper between the RXD and the output. I had to use such a solution because the loaded line caused the lack of programming possibilities. To switch the system to flash mode, hold the corner button and then connect the power supply.
- The system consumes 110mA during operation
- The sound quality is quite poor and is not suitable for listening on headphones. I obtained tolerable quality at home when connecting to the Sony FH-411R tower and adjusting the equalizer settings accordingly.
- A version with DAC and external RAM is also available this address, but after a few hours of fighting I could not compile. If anyone can deal with it, please give me a description.
- If anyone has any idea how to convert AAC to mp3 on the fly, please let me know how to do it.
- All necessary files attached





Yes it's a game
[Film: a8ca227b01] https://filmy.elektroda.pl/52_1505470652.mp4 [/ film: a8ca227b01]
[Film: a8ca227b01] https://filmy.elektroda.pl/4_1505470694.mp4 [/ film: a8ca227b01]


best regards
Paul
Attachments:
  • Radio ESP8266.rar (3.9 MB) You must be logged in to download this attachment.

About Author
miszczo997
miszczo997 wrote 1050 posts with rating 159 , helped 134 times. Live in city Lubartów. Been with us since 2009 year.

Comments

Tytus Kosiarski 15 Sep 2017 13:52

Hello Thanks for pointing out my project :) So fast: does your WiFi module close the existing connection to the radio server before connecting to a new server? Maybe this is the reason for this... [Read more]

miszczo997 15 Sep 2017 14:09

Thank you for your comment :D Yes, I'm closing the connection. My guess is that the buzz is due to the DMA based pwm and still running mp3 decoding thread in the background. At the time of disconnection,... [Read more]

cziter15 15 Sep 2017 15:29

Cool and simple design. ESP is generally quite an interesting microcontroller. The module in the ESP-12 or ESP-06 version will certainly look more aesthetically pleasing. [Read more]

Tytus Kosiarski 15 Sep 2017 18:55

I don't know what RTOS you used, but maybe there is something or similar like TaskSuspend and TaskResume? Besides, it may be worth trying to simply turn off PWM on the ESP module pin in the appropriate... [Read more]

mojomax 16 Sep 2017 06:07

I wonder if it would be easy to get stereo sound. [Read more]

Galareta 16 Sep 2017 07:16

As I remember correctly, esp8266 has i2s so you can connect a DAC [Read more]

krzysiek.b 16 Sep 2017 16:17

I note that I do not know this software, but I suppose that as you called it - the crashing of the sound may be due to the fact that in the output buffer (probably ring-buffer) the samples have recently... [Read more]

kassans 17 Sep 2017 11:57

A great project! you can be tempted by ESP-12 and add LCD2x16 after I2C :) [Read more]

Galareta 17 Sep 2017 12:00

Lcd2x16 after i2c would waste a lot of money ;) probably better some graphic OLED. [Read more]

kassans 17 Sep 2017 12:03

OLED also goes after i2c so I think that without a difference, there is a big difference in the price of such displays. [Read more]

Galareta 17 Sep 2017 12:05

No PLN 10 oled on Ali. I2c goes, but it's nice to take over DMA. [Read more]

kassans 17 Sep 2017 22:24

What is its size? I don't think it's the size of a 2x16 screen :D [Read more]

Galareta 17 Sep 2017 23:32

It's 2.4 TFT whole, it is smaller but more text fits on it, 4 lines on 128x32 - 0.91 'or 8 on 0.96 128x64. Yes, you can read such a text calmly. The display on i2c 2x16 takes up a terrible processor.... [Read more]

regog 07 Mar 2018 22:07

Maybe there is something or similar like TaskSuspend and TaskResume? In addition, it may be worth trying to simply disable the PWM feeding on the ESP module pin in the appropriate thread (tape) when there... [Read more]

qba1012 26 Aug 2018 15:46

Great project, could use something like this. Would any of you be willing to sell such a gem? PW [Read more]

FAQ

TL;DR: This ESP8266 radio player consumes 110 mA during playback and, as the author notes, "sound quality is quite poor" [Elektroda, miszczo997, post #16700612] Using a 3-stage RC filter, 4-bit PWM, and firmware tweaked from pvvx/mp3_decode, it streams MP3 up to 256 kbps and switches stations via two GPIO keys.

Why it matters: The build shows the absolute minimum parts needed to put internet radio on a single Wi-Fi MCU—ideal for ultra-low-cost DIY audio.

Quick Facts

• Current draw: 110 mA @ 3.3 V [Elektroda, miszczo997, post #16700612] • Max tested stream rate: 256 kbps MP3 [Elektroda, miszczo997, post #16700612] • Audio output: 4-bit PWM through 3-stage RC (≈-18 dB/oct) [Elektroda, miszczo997, post #16700612] • Firmware size: fits 1 MB ESP-01; built with Eclipse + RTOS SDK [Elektroda, miszczo997, post #16700612] • Typical ESP-01 cost: US $2 (AliExpress listing, 2023)

What parts are essential for the minimal ESP8266 internet radio player?

You need an ESP-01 module, AMS1117 3.3 V regulator (or pin-compatible), two momentary switches, a 3-stage RC low-pass filter on GPIO 2, a DC/ARK/Goldpin power connector, and a small speaker or amplifier input [Elektroda, miszczo997, post #16700612]

Why is the audio quality limited?

The ESP8266 generates only 4-bit PWM (16 levels). Even after the RC filter, quantisation noise remains, yielding low fidelity—noticeable on headphones [Elektroda, miszczo997, post #16700612]

Can it play AAC or Ogg streams?

No. The posted firmware decodes MP3 only. For AAC you must integrate a decoder such as Helix AAC or the ARM AAC code referenced by Tytus Kosiarski [Elektroda, Tytus Kosiarski, post #16701289]

How do I add or edit station URLs?

Edit radiostation.c with new host, port and path strings, re-compile, then flash. Keep the list short; larger arrays raise RAM use [Elektroda, miszczo997, post #16700612]

What causes the buzzing when changing stations, and how can I fix it?

After disconnect, residual samples in the DMA PWM buffer repeat, producing a buzz. Clear the ring buffer or force zeros before opening the new socket. Suspending the decode task and disabling PWM during the gap also works [Elektroda, miszczo997, #16700833; Elektorda, krzysiek.b, #16702590].

The board resets when I hold a button—what’s happening?

A long-press ISR blocks the scheduler; watchdog triggers and forces a reset. Move long-press handling to a queued task or increase the WDT timeout [Elektroda, miszczo997, post #16700612]

Is stereo output possible?

Yes. The ESP8266 exposes an I2S interface; add an external stereo DAC (e.g., PCM5102) and route decoded left/right samples to I2S instead of PWM [Elektroda, Galareta, post #16701937]

What’s the maximum reliable stream bitrate?

Tests show stable playback up to 256 kbps CBR MP3. Higher rates may overrun the 160 MHz CPU or 80 kB RAM buffers [Elektroda, miszczo997, post #16700612]

How do I flash the firmware without Eclipse?

Use Espressif’s ESP Flash Tool:
  1. Hold GPIO0 low, then power the board to enter flash mode.
  2. In ESP Flash Tool, map binary files to their addresses (0x00000 etc.), then click Download.
  3. After completion, jumper RXD to the PWM pin, reset, and the radio boots [Elektroda, miszczo997, post #16700612]

What power supply should I choose?

Provide 5 V DC input; the on-board AMS1117 drops it to 3.3 V. Ensure at least 500 mA headroom to cover Wi-Fi peaks (≈300 mA) [Elektroda, miszczo997, post #16700612]

Can I buy a pre-built board?

The thread ends with a user asking to purchase one, but no sales link appears. You’ll need to build or commission it yourself [Elektroda, qba1012, post #17405834]

What display upgrade is recommended?

A 0.96-inch 128×64 OLED on I2C costs about PLN 10 (≈US $2.5) and shows 8 text lines; it consumes less CPU than a 2×16 HD44780 module [Elektroda, Galareta, post #16703823]

Edge case: what if Wi-Fi drops mid-song?

The buffer empties within about 100 ms; PWM then replays stale samples, causing a short click, but the task reconnects automatically. Add connection-loss muting to avoid the click [Statistic inferred from 4-kB buffer at 44.1 kHz 4-bit ≈0.09 s].
Generated by the language model.
%}