ESP32 Internet Radio

Dear friends welcome to another project video! Today we are going to build an ESP32 Internet Radio device with a big 3.5” display using an inexpensive ESP32 board. Believe it or not, we can now build an ESP32 Internet Radio in less than 10 minutes and with less than 30$. There is a lot to cover so, let’s get started!

Intro to the ESP32 Internet Radio

Hello, guys, I am Nick and welcome to educ8s.tv a channel that is all about DIY electronics projects. In this channel, I share everything about the projects I build to help you develop similar projects or inspire you to start making things because it is easy, fun and creative. Subscribe to the channel now if you do not want to miss any future video.

A few months ago, I completed this FM Radio project which works great and looks even better in my opinion. If you want to see how I built this project you can watch the following video.

The problem is that, although this radio looks cool it is not practical because I live in a small town in southern Greece and the big Greek radio stations I prefer to listen to, do not have transmitters around here. So, I listen to my favorite radios online on my laptop or tablet pc which is also not so practical. So, today I am going to build an Internet radio device in order to be able to listen to my favorite radio stations from all over the world!

As you can see, a first version of the ESP32 Internet Radio project is ready on a breadboard. Let’s power it up. As you can see the project connects to the Internet and then streams music from predefined Radio Stations. Let’s listen to it for a few seconds.…………..I have tuned in to the Real FM radio station from Athens and by using these buttons we can change the Radio Station we are listening to. I have saved my favorite radio stations to the memory of the ESP32 so I can access them easily.

With this potentiometer, I can change the volume of the speaker. I display the Name of the Radio Station we are listening to on a big 3.5” display with a retro User Interface. The project works fine and it is very easy to build. You can build the same project in less than 10 minutes but you need to have some experience. If this is your first project, consider building a simpler one first, to gain some experience. Check my channel for simple project ideas and when you are more comfortable with the Arduino the electronics come back to build this cool project. Let’s now start building our own ESP32 Internet Radio.

——————–
WHERE TO BUY
——————–

ESP32: https://educ8s.tv/part/ESP32

MP3 decoder: https://educ8s.tv/part/MP3Decoder

Amplifier: https://educ8s.tv/part/PAM8403

3W speaker: https://educ8s.tv/part/3WSpeaker

3.5″ Nextion Display: https://educ8s.tv/part/Nextion35

Push Buttons: https://educ8s.tv/part/Buttons

Breadboard: https://educ8s.tv/part/LargeBreadboard

Wires: https://educ8s.tv/part/Wires

Full disclosure: All of the links above are affiliate links. I get a small percentage of each sale they generate. Thank you for your support!

The total cost of the project is around 40$ but if you don’t use a display the cost of the project is around 20$. Amazing stuff. We can build our own Internet radio with just 20$!

[adsense]

The Electronics

The heart of the project is, of course, the powerful ESP32 board which offers Wi-Fi connectivity and a lot of memory. As you can see from the specs, the ESP32 is a beast and it costs around 7$! The ESP32 board connects to the Internet and then it receives MP3 data from the radio station we are listening to.

The MP3 data is then sent to the MP3 decoder module using the SPI interface. This module uses the VS1053 IC. This IC is a dedicated hardware MP3 decoder. It gets the MP3 data from the ESP32 and converts it really fast into an audio signal. The audio signal that it outputs at this audio jack is weak, so we need to amplify it. That’s why I am using a PAM8403 audio amplifier to amplify the audio signal and then send it to a speaker. I have also connected two buttons to the ESP32 just to change the MP3 Stream we are getting data from and a Nextion display to display the Radio station we are listening to.

I chose to use a Nextion display for this project since it is very easy to use. We only need to connect one wire to control it. The Nextion displays are new kind of displays. They have their own ARM processor at the back which is responsible for driving the display and creating the graphical user interface. So, we can use them with any microcontroller and achieve spectacular results. I have prepared a detailed review of this Nextion display which explains in depth how they work, how to use them and their drawbacks. You can watch it by clicking on this card.

All we have to do now is to connect all the parts together according to this schematic diagram. You can find a link to it in the description of the video below. The connection is straightforward.

ESP32_Web_Radio

 

There is one thing to note though. The MP3 decoder module outputs a Stereo Signal but I am using only one audio channel in this project. In order to get the audio signal, I connected an audio cable to the audio jack of the module, and cut it to reveal four wires inside. I connected two of the wires. One of them is the GND and the other one is the audio signal of one of the two audio channels. If you wish you can connect both channels to the amplifier module and drive two speakers.

To send data to the display, we only need to connect one wire to the TX0 pin of the ESP32. After connecting the parts, we have to load the code to the ESP32, and we have to load the GUI to the Nextion display.

To load the GUI to the Nextion display, copy the InternetRadio.tft file I am going to share with you to an empty SD card. Put the SD card into the SD card slot at the back of the display. Then power up the display, and the GUI will be loaded. Then remove the SD card and connect the power again.

After successfully loading the code, let’s power up the project. It displays the text “Connecting…” for a few seconds on the display. After connecting to the internet the project connects to a predefined radio station. The hardware is working as expected but now let’s see the software side of the project.

The code of the ESP32 Internet Radio project

First of all, let me show you something. The code of the project is less than 140 lines of code. Think about it, we can build an Internet Radio with a 3.5” Display with 140 lines of code, this is amazing. We can achieve all this using various libraries of course which contain thousands of lines of code. This is the power of Arduino and the Open source community. It makes things easy for makers.

In this project, I am using the VS1053 library for the ESP32 board. At first, we have to define the SSID and the Password of the Wi-Fi network. Next, we have to save some Radio Stations here. We need the host URL, the path where the stream is located and the port we need to use. We save all this info into these variables. I have included 4 radio stations in this example. In the setup function we attach interrupts to the buttons, we initialize the MP3 decoder module and we connect to the Wi-Fi.

In the loop function, first of all, we check if the user has selected a different radio station than the one we are getting data from. If so, we connect to the new radio station else we get data from the stream and send them to the MP3 Decoder module. That’s all! When the user presses a button, an interrupt happens, and changes the value of a variable which tells which stream to connect to. To update the display, we simply send some commands to the serial port.

Now let’s take a look at the Nextion Display GUI. The Nextion GUI consists of a background picture and a picture which displays the name of the Radio Station. The ESP32 board send commands to change the name of the radio station from the embedded images. It is very easy. Please watch the Nextion display tutorial I have prepared some time ago for more information. You can quickly design your own GUI if you wish and display more things on it. As always you can find the code of the project in a link in the description of the video.

——————–
CODE
——————–

 

 

 

——————–

SUBSCRIBE ON YOUTUBE

——————–

Never miss a video: Subscribe to educ8s.tv