Retro Internet Radio Using ESP32
by indoorgeek in Circuits > Arduino
56752 Views, 408 Favorites, 0 Comments
Retro Internet Radio Using ESP32
Several years ago, I crafted an FM radio using the compact RDA5807M module, a tuner that delivered FM radio in a small package. While it functioned well and brought enjoyment to the entire family, the reception was subpar. I resorted to hanging a lengthy wire down my window to enhance reception just to get a usable audio on few of the stations.
Now, I've opted to construct another radio, but this time, it will be an internet radio instead of an FM one. It can be kept anywhere in the house without the need of an antennae. As far as it has good Wi-Fi reception, it should work fine. Also, there a lot of internet streaming stations which we can listen to and not just the regular stations.
Supplies
Major components
1x ESP-32
1x 1.51" Transparent OLED display
1x MAX98357 I2S 3W Class D Amplifier
1x Micro USB Type B Connectors
1x Tiny loudspeaker (I salvaged mine from an old phone)
1x DC-DC Charge Discharge Integrated Module 5V/2A
4x M3 x 4mm Threaded Round Inserts
and electronic components as per schematics
The Plan
The plan is to use ESP-32 as the brains of this internet radio. The ESP-32 will establish connections with streaming services on the internet to retrieve audio content. Using the ESP-32's in-built DAC and I2S protocol, the audio would be played on a tiny loud speaker which I salvaged from an old mobile phone via the MAX98357 amplifier.
I will be designing a custom PCB to reduce the overall size and to keep the electronics neat and clean. The design will mimic a cassette, adding a touch of retro aesthetics.
DFRobots was kind enough to provide a 1.51" Transparent OLED display, which I plan to incorporate into the project. Positioned at the center of the cassette, it could showcase audio data or even feature dynamic animations, contributing to the overall appeal of the device. Let's explore the possibilities and see how it enhances the final product!
Radio Stations
I would say that the trickiest part of this project is to find links to the streaming service that would work for the ESP32. I will be showing how you can get working links from internet-radio.com, a website I found with lots of internet radios from across the globe. The process would be more or less similar for other websites.
Open up the website and select a station of your choice. We now need to look for the source from where the audio is being streamed.
Right-click anywhere and select "inspect" or "view page source".
Look for the words 'live', 'stream', 'mp3', etc and you will most probably see a streaming link somewhere near. To test it, open the link in the browser. If you see a screen as shown in the photo with audio playing in the background, that should be it.
Gather all the links to your favorite stations along with their names. These need to be fed later before uploading the code.
3D Design
As discussed earlier, the radio would be in the shape of a cassette. The radio would consist of the following parts -
- Front PCB - This PCB only contains art to add some visual appeal.
- Back PCB - This PCB holds all the electronics
- Frame - to hold both the PCBs together
- Battery compartment & lid
- Front & Back Spacers to close the gap between PCBs and display
PCB Design
I first started prototyping on a breadboard to interface ESP32 with the transparent display and amplifier modules and to make sure everything worked as planned—electronics inspired from the Internet Radio project by Volos Projects.
Only two push buttons change the stations, start/stop the music stream, and adjust the volume. This helps in keeping the design simple and minimal.
CH340 is used to program the ESP32 module using a USB port.
All this would be powered by a lithium-ion battery along with an overcurrent/overcharge protection circuit.
To reduce the overall size of the radio, I decided to combine all the modules on a single PCB.
The speaker needed to be small as well with some decent audio output level. The mobile phone speaker is perfect for this job and I salvaged mine from an old Micromax mobile phone.
Once the electronics were finalized, I started designing the PCB using EasyEDA. I created the outline of the cassette in Fusion360 & exported the sketch as a DXF file. I then imported the DXF into EasyEDA to define the outline of the board. All the components were adjusted to fit the shape of the board.
Schematics are attached in this step. Click here to download the Gerber files.
Downloads
Assembly
After receiving the PCBs from PCBWay, it was time to put everything together. I utilized a stencil, also obtained from PCBWay, to apply solder paste and proceeded to solder all the components onto the PCB. During the time of making this project, I could not find a 24-pin FPC connector for the OLED display and I had to desolder it from the breakout board which got damaged due to excess heat but was still functional.
Once the PCB was assembled, I 3D printed the frame, battery compartment, and lid using white PLA filament. The battery compartment needs to be glued to the frame.
Place the battery in the compartment, thread its wire through the provided holes, and connect them to the charging module. Make the 5V IN & 5V OUT connections between the module and the PCB.
Glue the front and back spacers to the edge of the display cutout.
Place the OLED display and carefully connect its flat cable to the FPC connector on the PCB.
Place the thread inserts in their slots and screw in the front and back PCBs using M3 screws.
Code
Connect the PCB to your PC using a micro USB cable. If everything goes well, your PC should recognize the CH340 chip. Download the attached file and open it using Arduino IDE.
Before you upload, make the following changes:
- Enter your WiFi SSID & password
- Edit arrayURL with the streaming links of the radio stations of your choice
- Edit arrayStation with the name of the radio stations
Downloads
Enjoy!
Turn ON the radio and enjoy the station of your choice! There is a lot of scope for improvement or many features that can be added to the radio. For example, an audio spectrum analyzer on the display that reacts to the music being played. That would be cool to watch! Maybe a v2.0 in the future? But that's it for now.
Hope you all enjoyed this project. Give a like if you did and subscribe for more such projects. See you in the next one.