A minimalistic Internet Radio

1. Motivation

In the previous project I dealt with the I2S subsystem of the esp8266. During the research I found interesting applications like MP3 decoder, LED driver, Internet Radio. The first thing I realized was the internet radio, because it requires minimal hardware.

2. Parts

3. Wiring

                                       Vext (5..25V) o-----+-------o            
                                                          _|_      | /|
                                                          / \     |¨| | Loud      
    WEMOS D1 R2                                           ¨|¨     |_| | Spkr             
  ----------------+                                        |       | \|
                  :                                        +-------o
                  |                                        |
                  |                                    |¦--' N-CH MOSFET
                  |                                    |¦<-. T40N03G
      GPIO_3 / RX o-- audio out ------> Vin o-----+----|¦--|     
                  |                               |        |          
                  |                              |¨|       |    
                  |                              |_| 10k   |  
                  |      _I_                      |        |      
      GPIO_0 / D3 o -----o o----/ GND   GND o-----+--------'              

6. User interface

I chosed the same single pushbutton operation as in the previous project. The radio stations are stored in an array with name and URL. The clicks with the push button select a station from that list forward or backwards. A double click shows the currently played station.

7. Program Code

The program is based on Earle Philhowers excellent library ESP8266audio and is an adaption of his example code StreamMP3FromHTTP. Check out his examples and you'll be rewarded with an overwhelming amount of food for thought.

The program excerpt shows only the setup() routine and the main loop, in which the MP3 stream of the radio station is played and the button.loop() handles the user interactions.

  void setup()

  void loop()
    if (decoder && decoder->isRunning()) 

My programming environment is not the native Arduino™ IDE but PlatformIO™ on top of Microsoft's Visual Studio Code™. This combination offers many advantages and allows a much better structuring of the code into several modules especially when we adopt The Object Oriented way.

Interested? Please download the entire program code. The zip-file contains the complete PlatformIO project.