Antique Radio Software Page


Home                               Craigs Pages                               Heathers Pages

November 2023

Operation of the Antique Radio

When power is first applied to the radio the user must decide what local WiFi network to connect to (this process is described in detail below). Then the user is presented with a screen indicating the radio is attempting connection to the assigned WiFi network. After that, a welcome screen is presented followed by the navigation screen. Next a screen is presented for selection of the mode the radio will work in. Three modes are provided: Internet Radio mode, SD music player mode and Web music player mode. Once a mode selection is made the radio will remain in this mode until either the radio is powered down and back up or the Volume control is double clicked. In either case, the ESP32 is rebooted.

If Internet Radio mode is selected, the user is then presented with a list of 20+ genres of radio stations to choose from. Once a genre is selected (by single clicking the Songs control) some number of internet radio stations of that genre will be returned for selection. Once a station is selected, it hopefully plays*. Double clicking the Songs control returns the user to the genre selection screen where a new or the same genre can be selected. Single clicking the Songs control while a Internet Radio station is playing pauses playback. Single clicking again resumes playback. Rotating the Songs control during playback will select a different Internet Radio station to play.

If SD music player mode is selected the user will need to navigate to the song of interest. First the user selects the artist, then the album/CD of the artist and then the song of interest to play. Single clicking the Songs control moves deeper into the menuing system while double clicking moves back out. A single click of the Songs control during playback will put the player into looping mode where the selected song is played over and over. Single clicking again turns looping mode off.
Rotating the Songs control during song playback will select a different song to play.

Web player mode operates similarly to SD music player mode except the only songs available are one I have recorded and put on my website where the songs are sourced.

The Volume control works for all modes of operation.

*Internet Radio stations come and go all of the time so you are not guaranteed to hear a station you have selected. No worries, just rotate the Songs control to select another station. Internet radio stations are all over the world and some only broadcast during their day and not at night. The source this software uses to gather the radio stations (see nl1.api.radio-browser.info) does a
periodic check on whether or not a station is still alive and if not, removes it from their database and therefore it won't be returned when we ask for radio stations.

All music files placed on the SD memory card for playback must be organized in a specific format of directories for the software to function. At the root level of the SD card is a collection of artist sub directories. Within an artists' sub directory are sub directories for each of the artists albums/CDs. The actual music files are store within the album/CD sub directory. The VS1053 module used in the Antique Radio can play a variety of formats including Ogg Vorbis/MP3/AAC/WMA/FLAC/WAV and others.

While in the SD music player mode it is possible to update the contents of the SD card remotely via FTP. This is done by selecting "Remote Access" from the SD operations menu. After a short delay the screen will change and an IP address of the form:
192.168.0.XX
will be displayed. It is to this address that you need to point an FTP client (like FileZilla). The username for the FTP transfer is "craig" and the password is "music". Once connected you can add or delete artists, albums or songs. When you have finished with remote access, click the Songs rotary encoder or double click the Volume rotary encoder to reboot the Antique Radio. Any changes  made with FTP should be available the next time you select SD music player mode.


Software for the Antique Radio

All software was developed in the Arduino IDE Ver: 2.2.1.

Software Libraries used in the Antique Radio

Library
Functionality
Adafruit_GFX.h
Graphic functions for the ST7735 display controller
Adafruit_ST7735.h
Driver for ST7735 based displays
PinButton.h
Library for recognizing single, double and long clicks of a button or switch
SD.h
Library for reading and writing SD memory cards
JsonStreamingParser.h
Library for parsing Json as a stream of characters thereby lowering memory requirements.
WiFiManager.h
Library for handling connections to a local WiFi network. See  below.

The Antique Radio uses the WiFiManager library as an aid for connecting to a local network. This library was used so that code changes would not be required if this device is moved to a different network or maybe to a different location.

How this works is that the first time power is applied to the Antique Radio, it creates a network access point (AP) called AntiqueRadio that you need to connect your computer to. Accessing 192.168.4.1 in your browser then brings up a web page for selection of the WiFi network you really want to use. After a valid local WiFi network is selected the AP goes away. Going forward, the Antique Radio will remember your selected network and use it each time it is powered up so you don't need to go through this process again unless your network changes.

Custom Software I developed
Files listed in no particular order

File
Functionality
Hardware.h
This file defines the connections between the ESP32 and all of the other electronic components.
DisplayHelper.h
This code extends the Adafruit ST7735 driver with text display functions needed for this application.
ListBox.h
My implementation of an on screen list box control
Navigation.h
This code  brings together rotary encoder functionality with the PinButton functionality to define a very simple navigation model used throughout the Antique Radio program.
RotaryEncoder.h
Code for determining the direction a rotary encoder is turned
VS1053.h
A driver for the amazing VS1053 sound module
AJsonListener.h
A custom Json listener used for parsing Internet Radio station data.
AntiqueRadio.ino
The main Antique Radio application which controls everything
FTPServer.h*
A basic FTP server used for remote access when updating the content of the micro SD card's music files.
IR_Player.h
A class providing the Internet Radio functionality
MiscCode.h
A collection of misc code
SD_Player.h
A class providing the SD music player functionality
StationGatherer.h
Code that gathers Internet Radio station of a specified genre
URLParser.h*
Code for parsing a URL into its component parts
WEB_Player.h A class providing the Network music player functionality
WebScraper.h
A class that accessed my website to gather information on my recorded songs

* I didn't write this code but I modified it for my use.

Beta software for the Antique Radio is available for free here.

See Also
Antique Radio Part 1 - Cabinet
Antique Radio Part 3 - Speakers

 
Questions and comments to me Craig at: calhjh@gmail.com


Home                               Craigs Pages                               Heathers Pages