ESP32/IoT B.Tech/Diploma Beginner

Simple ESP32 Internet Web Radio with OLED Display

ESP32 Based Internet Web Radio Streaming with OLED Display & UDA1334ATS DAC IC. The Code, Circuit & I2S audio library & 3D Casing STL File

  • Suitable forB.Tech/Diploma ESP32/IoT students
  • Build time1-2 weeks
  • LevelBeginner
  • Available atAjvika Labs, Kakinada

About this project

Overview: ESP32 Web Radio
In this project, we will make
ESP32 Web Internet Radio
using ESP32 Board, Audio Expansion Shield & OLED Display. The combined ESP32 Audio inherited the
DAC chip
and
SD card module
.The
I2S chip
allows you to play songs stored on the Internet.The SSD1306 screen displays basic information about the song, and the scroll wheel switch on Audio allows you to switch and pause the music.
The Commercial internet
radio receivers
available in the market are relatively expensive and cost more than 100$. So I decided to make an Internet Radio that is
functional, easy to make, and inexpensive
. Earlier I made
ESP32 Music Player
which worked very well, so I decided to use the same device to make an Internet Radio.
Bill of Materials
All the components required for this projects can be easily purchased from
Makerfabs
. The components purchase link is given below.
S.N.
Components Name
Description
Quantity
Buy Online

Customized ESP32 Board
MakePython ESP32 Board

Audio Expansion Board
MakePython Audio Expansion

3D Casing
ESP32 Audio Fixture Kit

Speakers
Speaker with 3.5mm Audio Jack

Amazon
AliExpress

5V Power Supply
Power Bank

Amazon
AliExpress
Block Diagram of the ESP32 Web Radio
The block diagram of the ESP32 Internet Radio is given below. We use customized ESP32 Module along with ESP32 Audio Expansion Board. The ESP32 Connects to wifi and look for defined radio station online data.
The principle behind the project is that if we can deliver a chunk of
streaming data
in an exact quantity of 32 bytes to the board in the form of a stream, it will just keep on playing. That means the ESP32 is to connect the streaming site at the fixed port and then receive the streaming data in an exact
chunk
of 32 bytes at a time. On the other hand, the board will keep on processing the data like an
inflow/outflow
machine and the stream will continue to play.
Hardware Requirement & Assembly
For this project we need a customized ESP32 Board.
MakePython ESP32
is a
powerful, generic Wifi+ BLE MCU module
that supports both C/C++ & Python programming. It is true “breadboard compatible”, with the very
detailed pins explanation
, it is easy to learn & use. The MakePython ESP32 is programmed via Arduino IDE.
Similarly, we need an Audio Expansion Board. The Audio expansion board is based on the
UDA1334ATS
audio
DAC
, to implement audio functions to ESP projects. It communicates with ESP32 with
I2S
, and output relative
good quality audio
Apart from these we modules we need 3D Casing which is designed using 3D Modelling Software. The 3D case makes the device compact and small. You can download the STL files from here:
3D Case STL File
Assemble all the hardware explained in
ESP32 Music Player
Now your ESP32 Web Radio is ready to rock.
Adding Esp32-AudioI2S Library to Arduino IDE
The UDA1334ATS IC on ESP32 Audio does not support MP3 hardware decoding. So this library is used for MP3 decoding and volume control. Not only can you read MP3 files from your SD card, but you can also play MP3 stations directly from the Internet.
Download:
ESP32-audioI2S Library
Source Code & Program
Copy the code from below and upload it to the ESP32 Board. Before uploading there is some modification required in the code.

const
char
*
ssid
=
"Alexahome"
;
const
char
*
password
=
"loranthus"
;
Change the WiFi SSID & Paasword from the line above.

String
stations
[
]
=
{
"0n-80s.radionetz.de:8000/0n-70s.mp3"
"mediaserv30.live-streams.nl:8000/stream"
"www.surfmusic.de/m3u/100-5-das-hitradio,4529.m3u"
"stream.1a-webradio.de/deutsch/mp3-128/vtuner-1a"
"mp3.ffh.de/radioffh/hqlivestream.aac"
// 128k aac
"www.antenne.de/webradio/antenne.m3u"
"listen.rusongs.ru/ru-mp3-128"
"edge.audio.3qsdn.com/senderkw-mp3"
"macslons-irish-pub-radio.com/media.asx"
}
;
Add your local radio station link or the stations that you want to listen to. For example, I am staying in India & I want to listen to Indian Radio Channels, I would add Indian Radio Stations link.
Here is a complete code for the project.

#include "Arduino.h"
#include "Audio.h"
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
//Digital I/O used //Makerfabs Audio V2.0
#define I2S_DOUT 27
#define I2S_BCLK 26
#define I2S_LRC 25
//SSD1306
#define MAKEPYTHON_ESP32_SDA 4
#define MAKEPYTHON_ESP32_SCL 5
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
#define OLED_RESET -1 // Reset pin # (or -1 if sharing Arduino reset pin)
Adafruit_SSD1306
display
(
SCREEN_WIDTH
SCREEN_HEIGHT
&
Wire
OLED_RESET
)
;
//Button
const
int
Pin_vol_up
=

;
const
int
Pin_vol_down
=

;
const
int
Pin_mute
=

;
const
int
Pin_previous
=

;
const
int
Pin_pause
=

;
const
int
Pin_next
=

;
Audio
audio
;
const
char
*
ssid
=
"Alexahome"
;
const
char
*
password
=
"loranthus"
;
struct
Music_info
{
String
;
int
length
;
int
runtime
;
int
volume
;
int
status
;
int
mute_volume
;
}
music_info
=
{
""

}
;
int
volume
=

;
int
mute_volume
=

;
int
runtime
=

;
int
length
=

;
String
stations
[
]
=
{
"0n-80s.radionetz.de:8000/0n-70s.mp3"
"mediaserv30.live-streams.nl:8000/stream"
"www.surfmusic.de/m3u/100-5-das-hitradio,4529.m3u"
"stream.1a-webradio.de/deutsch/mp3-128/vtuner-1a"
"mp3.ffh.de/radioffh/hqlivestream.aac"
// 128k aac
"www.antenne.de/webradio/antenne.m3u"
"listen.rusongs.ru/ru-mp3-128"
"edge.audio.3qsdn.com/senderkw-mp3"
"macslons-irish-pub-radio.com/media.asx"
}
;
int
station_index
=

;
int
station_count
=
sizeof
(
stations
)
/
sizeof
(
stations
[

]
)
;
void
setup
(
)
{
//IO mode init
pinMode
(
Pin_vol_up
INPUT_PULLUP
)
;
pinMode
(
Pin_vol_down
INPUT_PULLUP
)
;
pinMode
(
Pin_mute
INPUT_PULLUP
)
;
pinMode
(
Pin_previous
INPUT_PULLUP
)
;
pinMode
(
Pin_pause
INPUT_PULLUP
)
;
pinMode
(
Pin_next
INPUT_PULLUP
)
;
//Serial
Serial
begin
(
115200
)
;
//LCD
Wire
begin
(
MAKEPYTHON_ESP32_SDA
MAKEPYTHON_ESP32_SCL
)
;
// SSD1306_SWITCHCAPVCC = generate display voltage from 3.3V internally
if
(
!
display
begin
(
SSD1306_SWITCHCAPVCC
0x3C
)
)
{
// Address 0x3C for 128x32
Serial
println
(
F
(
"SSD1306 allocation failed"
)
)
;
for
(
;
;
)
;
// Don't proceed, loop forever
}
display
clearDisplay
(
)
;
logoshow
(
)
;
//connect to WiFi
Serial
printf
(
"Connecting to %s "
ssid
)
;
WiFi
begin
(
ssid
password
)
;
while
(
WiFi
status
(
)
!=
WL_CONNECTED
)
{
delay
(

)
;
Serial
(
"."
)
;
}
Serial
println
(
" CONNECTED"
)
;
lcd_text
(
"Wifi CONNECT"
)
;
//Audio(I2S)
audio
setPinout
(
I2S_BCLK
I2S_LRC
I2S_DOUT
)
;
audio
setVolume
(

)
;
// 0...21
open_ne

Technologies used

ESP32ArduinoLoRaWiFiBLESSD1306OLEDLCDPythonArduino IDEC++

Hardware components

  • ESP32
  • Arduino
  • SSD1306
  • OLED
  • SD Card

Software & tools

  • Arduino IDE

What you get

  • Working project / hardware kit, tested before delivery
  • Complete source code with explanation
  • Project demo and guidance for your viva
  • Project report, PPT and IEEE paper support (on request)
Delivery & Payment
Delivery takes a minimum of two weeks from the date your inquiry is confirmed. Payment is in two parts: • 50% advance to start the project • Remaining 50% before delivery Note: • Documentation and PPT are not included by default • If you need documentation/PPT, it can be arranged for extra time and cost We'll confirm the exact timeline and cost with you after reviewing your requirements.