Arduino WebRadio player


 

Published on:

10 October 2014

Designed by:

Vassilis Serasidis on 5 October 2014 

Programming language:

Wiring

IDE:

Arduino 1.5.7

Target MCU:

Any Arduino but it is tested with Arduino Pro mini.

Used hardware:

ENC28J60 ethernet module, 84x48 LCD (Nokia 5110) and VS1053 MP3 - AAC - WMA audio codec chip.

 

Highslide JS

Highslide JS

Highslide JS

 

 

Introduction

 

There are a thousand of radio stations are broadcasting music/reviews/interviews over the internet. To listen these radio stations you will need a personal computer or tablet or smartphone or a stand alone web radio player.

The circuit I have designed is an inexpensive web radio player with high quality stereo sound.

The WebRadio player is controlled by two switches for going to the next or previous radio station. That WebRadio has 14 pre-defined radio stations that can be replaced with the radio stations of your choice by re-programming the modified sketch to the arduino pro mini.

So far, the WebRadio player supports sound streams up to 64-kbps (audio streams over internet). Choosing radio stations that broadcasts AAC sound streams instead of mpeg (mp3) will give you the best sound quality.

 

The WebRadio player  successfully managed to play  320 kbps mp3 audio streams that are stored on my local network!

 

 

Highslide JS

 

 

The circuit


The circuit is constituted by a few components (as I use to do in my electronic circuits). Most of components are modules that can be assembled among them with a few wires. The modules are:

 

  • Arduino pro mini: The hart of the circuit.
  • ENC28J60 ethernet module. Connects the circuit to the internet
  • VS1053B. Decodes the audio streams from the webradio servers and leads the sound to the speakers.
  • Nokia 5110 LCD module. Displays the information about the webradio station (station name, bit rate, etc)

The arduino sends a request to a WebRadio server through the ethernet module (ENC28J60). The ENC28J60 is connected to the webradio server, sends the request and waits for response from the server. The response will be the header information of the radio station followed by the audio stream (mp3, aac etc). The arduino gets the answer from the server and sends the received data to the VS1053B mp3, aac, wma decoder. The VS1053B automatically recognizes the kind of the received format, decodes it and outputs it to the speakers. On LCD is appeared the WebRadio station number (1-14) and the first 122 characters of the server header response.

 

 

 

The WebRadio audio streams header

 

A typical response from an ICECAST server is like the following data

 

ICY 200 OK

icy-notice1:<BR>This stream requires <a href="https://www.winamp.com/">Winamp</a><BR>

icy-name:Ellinikosfm Radio www.ellinikosfm.com GREECE GREEK HELLAS INTERNATIONAL LAIKA RADIO

icy-genre:Greek

icy-url:https://www.ellinikosfm.com

content-type:audio/mpeg

icy-pub:1

icy-metaint:32768

icy-br:128

icy-notice2:SHOUTcast Distributed Network Audio Server/Linux v1.9.8<BR>

 

(-= it follows the audio data =-)

 П¦«pI8 b Z ~X¬ TD|Q ؏"s[,f¬ ;²m!+mYr¤» ¤c)f M»O­­§?{/  L E tB兛1AFs ¬ U ! (oJ¤u t \6c^ڊ¨@ s3,hDךNq$©PO}«crµ±j   B# I9-.............

 

icy-name: is the webradio station name

icy-metaint: Every 32768 transmitted bytes, the server will transmit an additional information string. For example transmits the song name that is playing now.

icy-br: The baud rate of the audio stream. In our example the baud rate is 128 kilo bits per second (kbps).

 

 

 

Adding your favorite webradio stations

 

Open the  https://www.internet-radio.com/ web site and select a radio station with 64-kpbs. Then copy the port and IP number of the icecast server.

 

 

 

 

 

 

Open the WebRadio_player.ino sketch and change the IP and Port numbers you copied previously. Then, re-program the sketch to arduino pro mini and ... that's it!

Your favorite station was added to the WebRadio player !

The final step is to try playing the stream. The WebRadio player doesn't have big RAM buffer. That will cause some delays in audio playing in case the internet connection between the server and the webplayer is not fast enough.

 

 

 

Demonstration of the WebRadio player (720p)

 

 

 

  v1.00 You can download the Arduino sketch, schematic and pictures of Arduino WebRadio player from here.

 

Modifications::

William Dudley had made some modifications to the webradio player by adding new features.

The new sketch (WebRadio_player.20141120.ino) is included in to the Arduino_WebRadio_player.zip file above.

 

Additional features:

    - 16x2 LCD is used

    - Analog A0 pin buttons are used  (See LCDKeypad library)

    - Last selected radio station is stored in eeprom for retrieving back after next power ON.  

     

This modification requires different Arduino pin order.

    

Arduino

A5

A2

A3

A4

 

 

 

VS1053

cs_pin

 dcs_pin

dreq_pin

reset_pin

 

 

 

 

Arduino

8

GND

9

4

5

6

7

 LCD 16x2

RS

R/W

E

DB4

DB5

DB6

DB7

   

   The schematic for LCD keypad can be found here:

 

 

Reference:

The whole project (sketch and libraries) can be found also on GitHub

 

 

 

Created and published by Vassilis Serasidis on 10 October 2014