mailto: blog -at- heyrick -dot- eu

Rick's Net Radio Revised

As I have mentioned, I've been working on making my NetRadio more configurable, and that work is now complete.

If you have not already built your NetRadio hardware (it's simple - just an ESP32 board, an LCD, an MP3 decoder board, and two button), please read this.
Don't be put off by the complexity of the diagram. All the bits cost about €30 from Amazon with Primer Delivery (probably half that if you don't mind waiting for stuff to arrive from China), and there's no soldering involved. I simply used jumper wires to hook everything together.

The previous version needed to have your WiFi details and channels built right into the firmware, which you then had to flash to the device. Every modification required the firmware to be updated and reprogrammed. What a pain!

Now? Now the only complicated part is getting the firmware onto the device in the first place. If you aren't familiar with the Arduino IDE but know somebody who is, you could ask if they could program the ESP32 board for you? Everything else can be done using a USB lead and a computer running a terminal program. On older versions of Windows, they would be HyperTerminal. On Windows 10, you'll need to download a serial terminal program - try Tera Term or KiTTY.

When you first power up your NetRadio, it will give you the following messages on the display:

Set me up using 
a serial cable. 
and:
115200,8N1,NoFlw
[Enter] to begin

What this is telling you is that you need to connect to the NetRadio using a serial connection. For this, simply plug in a proper USB lead and then hook it into your computer. It should, in a moment, be recognised as a serial device and assigned an identity such as COM5.

If you don't know what COM port your device has, you can look in your Device Manager (press WinKey and R, and when the pop-up dialogue appears, type in devmgmt.msc and run it, then look at your "Ports (COM and LPT)" to see which one is a USB to UART Bridge (or words like that). The end of the description will say something like COM5.
A simpler method may be to simply start up your terminal program and see what COM ports it offers you as being available. Do this before plugging in the NetRadio, and then again after plugging it in, and the assigned COM port will be clear.

There is a little more than simply using the correct COM port. You also need to set up the correct type of serial link. In this case, the display is telling you that you need the following:

  • Speed of 115200 baud (bps), may be written as 115kbps.
  • 8N1 means 8 data bits, no parity, and one stop bit. You may have to set these up individually, or just pick an option like "8N1".
  • No flow control.

On HyperTerminal, the defaults are 2400bps, 8N1, hardware flow control - so it's the speed and flow control that you'll need to change.
More recent software will likely have the above settings already set up as their default.

Note that you need a proper terminal that is capable of sending and receiving Backspaces. The Arduino IDE's "Serial Monitor" just won't cut it.

Once you've done that, you should see:

Press [Enter] to begin setup.
appearing every four seconds.

So press the Enter key. ☺

You will see this:

SYSTEM SETUP
============

WiFi AP : 

Stations:
 0: Heart 80s (http://media-ice.musicradio.com/Heart80s)
 1: Love 80s (M) (http://rss-streaming.co.uk:8042/;)
 2: Classic FM (http://media-ice.musicradio.com/ClassicFM)
 3: Retro Hits Canada (http://149.56.183.178:8300/stream)
 4: BBC Radio 4 FM (http://bbcmedia.ic.llnwd.net/stream/bbcmedia_radio4fm_mf_p)
 5: Alouette (http://alouette.ice.infomaniak.ch/alouette-high.mp3)
 6: JPopsuki Radio! (http://jpopsuki.fm:8000/stream)
 7: Birdsong FM (http://streaming.radio.co/s5c5da6a36/listen)
 8: Gothique13 (http://66.55.145.43:7037/)
 9: PPN Radio (http://streamingV2.shoutcast.com/PPNR02)

Note:  It is NOT recommended to use the Arduino IDE Serial Monitor,
       use a terminal that supports Backspace and Enter = CR or CRLF.

Press: [W] to set up WiFi, [0]-[9] to set up the numbered station,
       or: [E]rase settings, [Q]uit setup, or [R]estart the radio.

>

This is the system setup. You can see that no access point has been configured, and since no radio stations were available, the NetRadio has installed the default programmed selection (basically, the sorts of things I might want to listen to).

The first task is to decide if you want to go with the default choices (these can be edited later on) or not. If you do not want them, then at this point you should press E to erase the current settings. You'll need to press Y to confirm that you want to do this.

Now press W to set up WiFi. It will scan for access points, and list what it finds:

>WiFi settings
Scanning for available access points...

Discovered 3 WiFi access points.
 #  Name                                  Sig  Ch  Enc?
-------------------------------------------------------
 1  Verbatim-1234                         -44  1   *
 2  DIRECT-FF-HP DeskJet 3630 series      -51  1   *
 3  Livebox-1234                          -89  1   *

Which access point (1-3, or X to abort) ?

A signal strength of -50 or less is excellent, -60 to -70 is good, -70 to -80 is mediocre, and anything greater than -80 is poor. My signal strength (-87, really poor) is because of a metre thick solid stone wall...

Choose which access point you wish to connect to connect to. In this example, I want to connect to the Livebox (ADSL router), not the media sharer or the printer, so I would press 3.

You'll then be asked for the access point password. Enter this in the space provided. You can use the Delete key to back up and correct errors. Press Enter when done.

Selected access point "Livebox-1234".

Password: [                                                                ]

The NetRadio will attempt to connect to the access point. You should see this:

Verifying.............connected.
Your radio will connect to this access point from now on.

Press [Enter] to continue...

If you see this, you should check that your password is correct and that new devices are authorised to connect to the access point (some only allow known devices to connect):

Verifying.............failed.
Saving the values given, but if connection keeps
failing, you should check the password is correct.

Press [Enter] to continue...

The settings are always saved, in case it's a simple thing that needs fixed and you don't fancy entering a long and complicated password again.

 

Now let's look at editing a station. What we shall do is change ClassicFM to Hits 93 Toronto (picked at random - but it doesn't appear to play advertising? it's been 9am-noon Canada time).

First, you'll need to know the underlying URL of the stream that you wish to listen to. The blog entry linked about (how to build the NetRadio) gives some suggestions.
Personally, I use UBlock Origin in Firefox. Call up UBlock's control page in a new tab, then click on the icon to list everything that is fetched. Switch back to the original tab and start playing the online stream.
Switch back to the UBlock list tab, and look (from the top down) for things described as media. One will be the streaming link. Copy this.
An easy way to test if the link is the correct thing is to try to open it in the original tab - if the station starts playing, you have the correct link.

I press 2 to replace ClassicFM, so I see this:

>Edit station
Editing station 2

Please enter the station name.
  [ClassicFM                                                      ]
Press Delete a few times to erase the previous title, and then enter the station name (Hits 93 Toronto), then press Enter.

Please enter the station URL. This should be a full URL in the
form http://domain.tld/ or http://domain.tld:port/, with or
without a path. Please note that the stream must be MP3 (not OGG
or AAC) and that https is not supported.
  [http://media-ice.musicradio.com/ClassicFM                                 ]
Now Delete the previous URL and enter the new one (http://listen.radioking.com/radio/75868/stream/113899) and press Enter again.

You'll see a confirmation, and you should press Enter to continue.

SYSTEM SETUP
============

WiFi AP : "Livebox-1234"
Password: "ThisIsMyPassword"

Stations:
 0: Heart 80s (http://media-ice.musicradio.com/Heart80s)
 1: Love 80s (M) (http://rss-streaming.co.uk:8042/;)
 2: Hits 93 Toronto (http://listen.radioking.com/radio/75868/stream/113899)
 3: Retro Hits Canada (http://149.56.183.178:8300/stream)
 4: BBC Radio 4 FM (http://bbcmedia.ic.llnwd.net/stream/bbcmedia_radio4fm_mf_p)
 5: Alouette (http://alouette.ice.infomaniak.ch/alouette-high.mp3)
 6: JPopsuki Radio! (http://jpopsuki.fm:8000/stream)
 7: Birdsong FM (http://streaming.radio.co/s5c5da6a36/listen)
 8: Gothique13 (http://66.55.145.43:7037/)
 9: PPN Radio (http://streamingV2.shoutcast.com/PPNR02)

Note:  It is NOT recommended to use the Arduino IDE Serial Monitor,
       use a terminal that supports Backspace and Enter = CR or CRLF.

Press: [W] to set up WiFi, [0]-[9] to set up the numbered station,
       or: [E]rase settings, [Q]uit setup, or [R]estart the radio.

>

When the setup screen is shown again, you will see that the station has been updated.

Now time to rock and roll. Press R to restart the radio!

The radio will restart, and you will see some nerdy rubbish - you can ignore this.

ets Jun  8 2016 00:22:57

rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0018,len:4
load:0x3fff001c,len:928
ho 0 tail 12 room 4
load:0x40078000,len:9280
load:0x40080400,len:5860
entry 0x40080698

You will see an intitialising message, and after a few seconds connection should be successful and the first station will begin to play.

Rick's NetRadio is initialising...
(version 0.09 built at 15:22:20 on Jan 15 2021)

Connecting to http://media-ice.musicradio.com/Heart80s

Connected to Heart 80s

Controls: [P]revious/[N]ext station, [L]ouder/[Q]uieter, [M]ute,
          show [A]ll stations, [0]-[9] direct station choice,
          [S]etup (playing stops), [C]opyright, or [R]eset device.

Don't worry if the device resets itself once or twice. Mine seems to need to kick itself in order to successfully connect to WiFi - perhaps because my signal is so weak? I don't know. Just pointing out that it can and does happen.

As the controls indicate, you can press a number to directly choose a station, or P/N to step through them. L and Q makes the sound louder or quieter.
You can, of course, use the buttons, a short press to change volume, and a longer press to change the station.
Note that the currently selected station and volume are saved and restored when you next start up the NetRadio.

You can also press S to enter system setup should you ever wish to change a station.

Every time the song changes (if you are receiving metadata), the current song will be output to the serial port...

Currently playing "Party In the USA" by Miley Cyrus.
Currently playing "Writing's On the Wall" by Sam Smith.

 

Of course, once the NetRadio has been set up, you don't need the serial stuff any more. You can plug it into any 1A (or greater) USB power supply and use it in the traditional sense with the buttons.

 

Here is the updated Rick's Net Radio source code:

And, now, here is a precompiled binary that can be written to the ESP32 using pytool or similar:

 

Oh FFS

Had an... interesting... discussion with the postman today.

He is not getting vaccinated. He asks why the companies making the vaccines don't want to accept liability for problems caused by the vaccine. In his mind, this equates to it being "untested".

The thing is, medications can and do go wrong. Some people can have unexpected and adverse reactions to things that everybody else uses (just like from time to time there's a girl that has a fatal toxic shock reaction to a sanitary product used regularly by millions of other girls and women). And, of course, I'm quite familiar with adverse side effects to medication considering that's what killed my mother.

So, yes. The vaccine might work for me. It might do nothing for me. Or it might kill me. However, given that my lungs aren't great - look how hard a pneumonia (?) took me out last winter. Couple that with regular mild exposure to nasty chemicals, I feel that if I should be unlucky enough to have the virus, there's a non-negligible chance that it will hit hard. I'd love to be asymptomatic, but one won't know until a test comes back positive. Until then, the possible effects range from nothing to death... or possible worse (in the case of the long-term severe version).
So, on the balance of probabilities, I would prefer to get myself vaccinated.

It is acceptable if the postman doesn't want to take the vaccine. It is his choice, and if he should suffer bad effects of the virus (which I hope he doesn't, of course), then it was his decision to not get vaccinated. I don't agree, but, like I said, his choice.

 

Then he starts talking about 5G masts. Ye, seriously. I've not been keeping up with the conspiracy bullshit, but translating from his French, it seems that if the vaccination doesn't kill you outright, then you'll seem normal and happy until a 5G mast goes up near you, and then "poof", it will interact with the vaccine and then you'll die.

Die of stupidity, perhaps. I don't think I've ever tried so hard in my life to keep a straight face. I mean, how is it that a person who seems otherwise reasonably intelligent actually believes such complete and utter rubbish?

It's made me wonder exactly how many other people are walking around with the same crap in their heads, and how this might affect things should the government eventually get to rolling out a vaccination program for everybody?

 

Whatever, I want to be vaccinated. Unfortunately I can't blag my way as an over-75 so I'll have to wait a little bit longer. But I do worry that the more people who refuse for idiotic reasons, the more chance there is of a mutated variation that the current vaccines are not effective against.
Either way, I think Covid is going to be "something that does the rounds" like the yearly flu. So I think we'll need to learn to live with it and not freak out and bounce in and out of lockdown.

 

Speaking of the flu - given our increased personal hygiene, lack of interpersonal contact, and mask wearing... so far this winter I've had no flu and exactly zero colds. So I'm not complaining about the minor issue of wearing a mask. Or not meeting people, but then as an introvert that was pretty much a given anyway.

 

The not-sales

Given the harsher English variant Covid doing the rounds, I don't think it would be a great idea to go into Big Town for the sales (starting next Wednesday). So I went into Big Town yesterday, just in case the government announced a new lockdown - they did not, we just have a 6pm curfew across the entire country.

I picked up three things of interest in place of doing the sales.

Things I bought.
Things I bought (instead of sales).

On the left is a battery soldering iron. Charges from USB.
I remember back at boarding school, the physics lab had this cool soldering iron powered by NiCads. A chunky orange thing from RS that heated up in about ten seconds, and has a light to illuminate the work.
This one heats up in 25 seconds (it says), and also has a light. Unlike the RS one from the '80s, it doesn't heat/work while the button is pressed. Instead, a long press will turn it on and it will begin heatng up. It takes about half a minute for the LED to turn green (meaning it is up to temperature).

In the middle is a Nurses/Carers charity calendar - with a euro of the sale price being donated to a foundation that helps those who need a little help what with being on the front lines of this virus problem.
Interestingly the women are just posing normally (except Miss Grumpy in January) while the guys seem to think they are in some sort of "nursing hunks" calendar. It's amusing.

On the right, a Bluetooth speaker. It was advertised as having bass. Compared to my existing Bluetooth speakers, that wouldn't be too hard. As the power output and ability to generate decent bass depends greatly on how much air the speaker can push around. And, well, size matters.
This speaker is a 5.5cm speaker in an empty ball, so it does manage some sort of bass. At least, listening to Nightwish isn't entirely painful.

 

 

Your comments:

Please note that while I check this page every so often, I am not able to control what users write; therefore I disclaim all liability for unpleasant and/or infringing and/or defamatory material. Undesired content will be removed as soon as it is noticed. By leaving a comment, you agree not to post material that is illegal or in bad taste, and you should be aware that the time and your IP address are both recorded, should it be necessary to find out who you are. Oh, and don't bother trying to inline HTML. I'm not that stupid! ☺ ADDING COMMENTS DOES NOT WORK IF READING TRANSLATED VERSIONS.
 
You can now follow comment additions with the comment RSS feed. This is distinct from the b.log RSS feed, so you can subscribe to one or both as you wish.

David Pilling, 16th January 2021, 03:03
We (UK population not me) went through a phase of blowing up 5G masts, what with everything else, it has vanished from the news. 
David Pilling, 16th January 2021, 18:42
There'll be some interesting events with vaccines - bad batches, ineffective ones, side effects. If half the population are immune, do you allow the other half who refuse the vaccine to overload health care (depriving others) and keep the economy closed down. I suspect it'll be a case of you don't come in here without a certificate. 
Rick, 16th January 2021, 21:10
I have no problem with that - the certificate thing. 
 
Actually, in France everybody has a "carte vitale", which is a smartcard used for medical information. I'm sure there is enough unused data capacity on the card that it can also be used as a proof of vaccination (harder to take than a certificate). Set up card readers, and let the card permit you entry into the big supermarkets, cinemas, restaurants, any form of public transport... 
sergio, 1st March 2021, 19:25
Thank you for such a great project! My internet radio is working OK but some stations 'stutter' during reception. Is there a way to implement a ring buffer to increase the the number of bytes stored to avoid stutter (i.e., a value of 50 to 200ms)?
Rick, 6th March 2021, 10:46
Hi Sergio, 
I explained in the previous article (2021/01/08) that I dropped the ring buffer idea because it wasn't working correctly, and with the compiler taking around 10 *minutes* to build the firmware on my old 2.4GHz P4 PC, I really didn't have the patience to try to work out why it wasn't behaving. 
Maybe some time in the future. 
ANDREA TARANTINO, 7th April 2021, 13:03
Very nice project and works perfectly!!! 
I used other projects examples, but with some problems to read the music streaming and show the music data. 
I started from your project adding the TFT display, IR remote control and another button for Mute/Unmute. In the display I added more info like the station, bitrate, volume and other info. With remote I can control it from away.  
Rick, 25th April 2021, 13:14
That's great Andrea. Could you please give a pointer to your sources, so others can consider your enhancements? 
The IR controller sounds really useful. 

Add a comment (v0.10) [help?] . . . try the comment feed!
Your name
Your email (disabled)
Validation Are you real? Please type 89847 backwards.
Your comment
French flagSpanish flagJapanese flag
Calendar
«   January 2021   »
MonTueWedThuFriSatSun
    12
456910
111213141617
181920212223
252729

(Felicity? Marte? Find out!)

Last 5 entries

List all b.log entries

Return to the site index

Geekery

Search

Search Rick's b.log!

PS: Don't try to be clever.
It's a simple substring match.

Etc...

Thank you:
  • Fred
  • Bernard
  • Michael
  • David

Last read at 20:31 on 2021/09/16.

QR code


Valid HTML 4.01 Transitional
Valid CSS
Valid RSS 2.0

 

© 2021 Rick Murray
This web page is licenced for your personal, private, non-commercial use only. No automated processing by advertising systems is permitted.
RIPA notice: No consent is given for interception of page transmission.

 

Have you noticed the watermarks on pictures?
Next entry - 2021/01/24
Return to top of page