Pirate Radio
Hi guys:
I thought I’d buy a Pirate Radio as an Xmas Present for various nephews and a daughter who are doing coding. But first, to see whether it was the right thing and easy to set up, I thought I’d build the first one myself.
I’ve had some experience in UNIX and DOS and can do more than wire a plug. It should be easy although I don’t have much experience with Pi’s.
The headline is that it took me twelve hours by the time I’d tried three bare-metal installs without too many instructions to follow and loads of googling around on the interweb.
Once I’d done three reinstalls, the last one took about an hour so I’d thought I’d write down to benefit those who want to have it up and running for Xmas lunch on 25th December. It’s a great product but it needs all the steps written down in one place for newbies.
Assembly
Putting the components together was pretty straightforward and took an hour including the secondary stereo speaker and the ‘hammered’ non-solder connectors. The instructions at
learn.pimoroni.com/tutorial/sandyj/assembling-pirate-radio
were alright but could have benefitted from some more front & side-on pictures.
I’d plugged in the NOOBS micro-CD, turned it on and expected it to work. Call me naïve!
So, the first decision to take is whether you want to
- Use the Pirate Radio to listen to a limited number of Radio Station mp3 streams that you’ll copy-and-paste enter into a config file on the pi
- Use the Pirate Radio to listen to Spotify Radio – but only if you have a premium account.
I tried both methods before deciding the Spotify variant was better for me…
Set-up
So, this is what I did to get it working
Burn the MicroSD Card
- Download Raspian Stretch Lite from here www.raspberrypi.org/downloads/raspbian/
- Download the Etcher software from here www.raspberrypi.org/documentation/installation/installing-images/
- and burned the Raspian Stretch Lite file to the MicroSD disk using my PC [using the caddy] [You’ll need a PC that can read SD cards for this step]
Get Ready for First Time Switch On
- Put the SD card in the Pi
- Connect using the Pi to a TV using a HDMI cable [using the adapter provided in the kit]. You’ll need a TV that has a HDMI slot and a HDMI cable]
- Connect a USB keyboard to the Pi using the adapter cable provided. [You’ll need a USB Keyboard]
- When all of this is done, switch on and see the boot-up text to roll up the screen
Log On and start the config
When you see the prompt, logon with username: pi password: raspberry
Connect to Wifi
Use the command sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
Edit country=GB
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="MyNetwork"
psk="NetworkPassword"
}
Make sure you include the double-quotes
Save the file using Ctrl-X, [Y]es, Return
Now turn on SSH
sudo raspi-config
In interfaces, select SSH and use the cursor buttons to turn it on
At the prompt, reboot,
sudo reboot
Your Pi should now be connected to Wifi
Logon
Find the IP address using
ifconfig
Look for the IP address in wlan
Connect to the Pi using SSY
Download putty from here www.putty.org/
Start a new session connecting to the IP address
Logon to the raspberry
If you’ve chosen the Radio Option
##in radio mode
curl https://get.pimoroni.com/vlcradio | bash
It takes some time. Press the play button. Cycle through the four pre-selected stations using the fast-forward button.
If you want to change station list to listen so something you might prefer
I googled “bbc radio mp3 streams” and found some here www.suppertime.co.uk/blogmywiki/2015/04/updated-list-of-bbc-network-radio-urls/
Comment out the ones you don’t want by prefixing the line with a # symbol
cd /etc/vlcd
sudo nano default.m3u
Ctrl X, Y, return
Hint: If you have copied the URL, position the cursor in the file and paste using the right-click button on the mouse.
sudo reboot
when the radio reboots, you can cycle through YOUR stations.
## in spotify mode
Remember that you need to have a paid-for spotify premium account to use the mopidy server and spotify add-on. Make sure you have your Spotify username and password to hand.
So I started here learn.pimoroni.com/tutorial/sandyj/streaming-spotify-to-your-pi
curl https://get.pimoroni.com/spotipy | bash
It takes about 30 minutes to download and install. It’s an attended install because you’ll need to press [Y]es and [R]eturn at several steps during the process.
Whilst this is going on, you must visit https://www.mopidy.com/authenticate/ to get some tokens that you’ll need to copy and paste into the mopidy.conf file when the Pi install is completed.
When the install is complete you’ll need to edit /etc/mopidy/mopidy.conf file
cd /etc/mopidy
sudo nano mopidy.conf
Use the down cursor to find the [http] block. Comment-out the line that says 127.0.0.1 and replace with a new line 0.0.0.0
[http]
#hostname = 127.0.0.1
hostname = 0.0.0.0
That’s a really important bit. I wasted hours doing bare-metal installs without knowing to change the hostname.
In the Spotify Block….
[spotify]
username = myusername
password = 4qFZ0thH
Paste-in the text you were given when you logged into the [https://www.mopidy.com/authenticate/ website](https://www.mopidy.com/authenticate/ website)
client_id = b229b207-f3e4-9af1-7a1cf45a96fe
client_secret = CZVGX050b7UCBQ8t-UJLJo1y3etk5K637aPk4=
Save the file, Ctrl-X, Y, [R]eturn
Reboot
sudo reboot
You can check everything using mopidyctl status found here https://docs.mopidy.com/en/latest/service/
sudo mopidyctl config
sudo systemctl status mopidy
Now you can listen from your web browser
raspberrypi.local:6680/iris
or
192.168.0.112:6680/iris or whatever your IP address is using the ifconfig command
Hope this is helpful. Happy Xmas.