# This is how I got Pirate Radio to Work with Radio and Spotify

**URL:** <https://forums.pimoroni.com/t/this-is-how-i-got-pirate-radio-to-work-with-radio-and-spotify/9345>\
**Category:** Support\
**Created:** [December 13, 2018, 8:51pm UTC](https://forums.pimoroni.com/t/this-is-how-i-got-pirate-radio-to-work-with-radio-and-spotify/9345 "2018-12-13T20:51:55Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![bunnco](https://avatars.discourse-cdn.com/v4/letter/b/9e8a1a/32.png) [@bunnco](https://forums.pimoroni.com/u/bunnco)\
**Post date:** [December 13, 2018, 8:51pm UTC](https://forums.pimoroni.com/t/this-is-how-i-got-pirate-radio-to-work-with-radio-and-spotify/9345/1 "2018-12-13T20:51:55Z")

</div>

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](http://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/](http://www.raspberrypi.org/downloads/raspbian/)
- Download the Etcher software from here [www.raspberrypi.org/documentation/installation/installing-images/](http://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/](http://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](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/](http://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](http://learn.pimoroni.com/tutorial/sandyj/streaming-spotify-to-your-pi)

_curl [https://get.pimoroni.com/spotipy](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/](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/](https://www.mopidy.com/authenticate/) website]([https://www.mopidy.com/authenticate/](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/](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.

---

<div class="post-metadata">

**Author:** ![alphanumeric](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/alphanumeric/32/2729_2.png) [@alphanumeric](https://forums.pimoroni.com/u/alphanumeric)\
**Post date:** [December 14, 2018, 11:23am UTC](https://forums.pimoroni.com/t/this-is-how-i-got-pirate-radio-to-work-with-radio-and-spotify/9345/2 "2018-12-14T11:23:12Z")

</div>

Nice detailed post there. That should help a lot of first time users.  
It can be a bit tricky to setup depending on how you go about it.  
I’m not saying anything you did was wrong, just that there are usually more than one way to get there.

I personally avoid NOOBS, just my personal preference because I almost always only ever run Raspbian.  
I get the latest image from the Pi foundation site and use Etcher to image my card.

On a lot of my installs even headless setups I install the full Raspbian. Some would call it cheating as it lets me avoid most of the command line stuff. It’s what I used for my Prate Radio setup. All the language, location, and WIFI setup is done from the quick setup GUI menu. When I’m all done with that I set it to boot to command line instead of the desktop.

For the Pirate Radio I just run the one line installer and reboot.

A quick a dirty way to get you playlist in there is to take your SD card and plug it into another PC. Then just drag and drop your playlist.m3u file to the Boot partition. When you boot the Pi up it then gets copied / moved and becomes the new default playlist. You can edit the default one too. I have the path to that someplace, will post it when I can find it. I didn’t do much beyond the stock install.

Again nice detailed post, just thought I could add some of my experience to it. ;)

EDIT: To edit the default playlist its `sudo nano /etc/vlcd/default.m3u.`

---

<div class="post-metadata">

**Author:** ![alphanumeric](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/alphanumeric/32/2729_2.png) [@alphanumeric](https://forums.pimoroni.com/u/alphanumeric)\
**Post date:** [December 14, 2018, 11:41am UTC](https://forums.pimoroni.com/t/this-is-how-i-got-pirate-radio-to-work-with-radio-and-spotify/9345/3 "2018-12-14T11:41:30Z")

</div>

Just remembered one more tweak I do to mine. I had an issue where it wouldn’t always start up on the last channel / station I left it on when I shut down. Sometimes it would skip to the next station or just not play any music. I’d have to hit the play pause or channel up down to get it to play. In Raspbian I went into the configuration menu and set it to “wait for network”. It takes a little longer to boot up but always starts up and remembers what station it was on. Down side is I’m not sure what happens if you lose your Internet connection? Best guess is it eventually moves on and boots up anyway.

---

<div class="post-metadata">

**Author:** ![Caperjack1953](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/caperjack1953/32/7923_2.png) [@Caperjack1953](https://forums.pimoroni.com/u/Caperjack1953)\
**Post date:** [December 14, 2018, 7:33pm UTC](https://forums.pimoroni.com/t/this-is-how-i-got-pirate-radio-to-work-with-radio-and-spotify/9345/4 "2018-12-14T19:33:56Z")

</div>

i think Noobs is suggested because it easier to get to the sdcard ,just copy past the download to the sdcard ,not need for 2nd piece of software to burn to sdcard

---

<div class="post-metadata">

**Author:** ![alphanumeric](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/alphanumeric/32/2729_2.png) [@alphanumeric](https://forums.pimoroni.com/u/alphanumeric)\
**Post date:** [December 14, 2018, 9:24pm UTC](https://forums.pimoroni.com/t/this-is-how-i-got-pirate-radio-to-work-with-radio-and-spotify/9345/5 "2018-12-14T21:24:50Z")

</div>

Good point Jack, you can just copy and past it over to a formatted SD card. Still not a big fan of it though, but thats just me. ;) One down side to Noobs is it changes the file structure around a bit. That file you want to edit isn’t where it normally would be in a stock Raspbian install. Not a big deal as long as your aware of the differences.

---

<div class="post-metadata">

**Author:** ![Sagar](https://avatars.discourse-cdn.com/v4/letter/s/6de8d8/32.png) [@Sagar](https://forums.pimoroni.com/u/Sagar)\
**Post date:** [December 14, 2019, 3:00pm UTC](https://forums.pimoroni.com/t/this-is-how-i-got-pirate-radio-to-work-with-radio-and-spotify/9345/6 "2019-12-14T15:00:10Z")

</div>

> [@bunnco](#):
>
> me. Press the play button. Cycle through the four pre-selected stations using the fast-forward button.

Awesome written article which must be published as official guide for pirate radio. I struggled a lot to set it up till I found your this article. Thanks a lot. Everything worked out flawlessly after following it step by step. :)
