# Pi Zero W, Pirate Radio and the PhatBeat

**URL:** <https://forums.pimoroni.com/t/pi-zero-w-pirate-radio-and-the-phatbeat/4099>\
**Category:** Support\
**Created:** [March 1, 2017, 12:57pm UTC](https://forums.pimoroni.com/t/pi-zero-w-pirate-radio-and-the-phatbeat/4099 "2017-03-01T12:57:01Z")\
**Posts on this page:** 20\
**Page:** 3

<div class="post-metadata">

**Author:** ![sandyjmacdonald](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/sandyjmacdonald/32/393_2.png) [@sandyjmacdonald](https://forums.pimoroni.com/u/sandyjmacdonald)\
**Post date:** [March 5, 2017, 10:26pm UTC](https://forums.pimoroni.com/t/pi-zero-w-pirate-radio-and-the-phatbeat/4099/41 "2017-03-05T22:26:14Z")

</div>

Out of interest, what is the problem? I use crontab a lot and would be interested to know the issue. I’m guessing it’s a permissions thing?

---

<div class="post-metadata">

**Author:** ![jimbo](https://avatars.discourse-cdn.com/v4/letter/j/d78d45/32.png) [@jimbo](https://forums.pimoroni.com/u/jimbo)\
**Post date:** [March 6, 2017, 10:00am UTC](https://forums.pimoroni.com/t/pi-zero-w-pirate-radio-and-the-phatbeat/4099/42 "2017-03-06T10:00:20Z")

</div>

Hi, newbie here, this seems to be the most relevant topic for my question, sorry if not, didn’t want to start a new topic.  
I have assembled a prate radio, following the instructions at [https://learn.pimoroni.com/tutorial/sandyj/assembling-pirate-radio](https://learn.pimoroni.com/tutorial/sandyj/assembling-pirate-radio). At the end there is a link “Getting Started with pHAT BEAT” but it goes to “Internal Server Error”.  
I have installed Raspbian Lite and applied to “fixes” found elsewhere to get the NTP and SSH to work via the onboard WIFI but even after a fair amount of searching these forums etc. I am lost as to how to proceed with the Pirate Radio.  
Any pointers would be greatly appreciated. TIA.

---

<div class="post-metadata">

**Author:** ![sandyjmacdonald](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/sandyjmacdonald/32/393_2.png) [@sandyjmacdonald](https://forums.pimoroni.com/u/sandyjmacdonald)\
**Post date:** [March 6, 2017, 2:39pm UTC](https://forums.pimoroni.com/t/pi-zero-w-pirate-radio-and-the-phatbeat/4099/43 "2017-03-06T14:39:56Z")

</div>

Ahoy! You’ve come to the right place.

I’m just putting the finishing touches to that pHAT BEAT tutorial, hence why the link 404s, but it should be ready in the next couple of days. I’ll take it out for now, actually.

The beauty of the Pirate Radio is that there are lots of possibilities with it.

If you have an iPhone then you can use AirPlay to stream music to Pirate Radio. We’ve put together a tutorial here -\> [https://learn.pimoroni.com/tutorial/sandyj/streaming-airplay-to-your-pi](https://learn.pimoroni.com/tutorial/sandyj/streaming-airplay-to-your-pi)

Phil has put together a solution to stream internet radio, with full support for the buttons on pHAT BEAT to control it. You can find the rough guide here -\> [https://gist.github.com/Gadgetoid/47d8f873fde39fcbe83e6dab0e855f72](https://gist.github.com/Gadgetoid/47d8f873fde39fcbe83e6dab0e855f72) We’ll be putting together a one-line installer for this to make it really easy to set up.

Mopidy ([https://docs.mopidy.com/en/latest/](https://docs.mopidy.com/en/latest/)) also works really well, and has a number of plugins to stream music from Spotify, Soundcloud, Google Music, or local mp3 files and such. You can dig in a try to install this yourself, or wait for a couple of days and we’ll have a tutorial.

Our Bilge Tank YouTube show this week will hopefully be a Pirate Radio special too, showing you what the possibilities are. [https://www.youtube.com/channel/UCuiDNTaTdPTGZZzHm0iriGQ](https://www.youtube.com/channel/UCuiDNTaTdPTGZZzHm0iriGQ)

---

<div class="post-metadata">

**Author:** ![kenjara](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/kenjara/32/1953_2.png) [@kenjara](https://forums.pimoroni.com/u/kenjara)\
**Post date:** [March 7, 2017, 9:24pm UTC](https://forums.pimoroni.com/t/pi-zero-w-pirate-radio-and-the-phatbeat/4099/44 "2017-03-07T21:24:54Z")

</div>

I have just this minute finished building my radio and it looks awesome. Just been scanning through here to try and find the best course of action software wise.

As I have music on google play I think I am going to give Mopidy a shot.

 ![](https://us1.discourse-cdn.com/flex016/uploads/pimoroni/original/2X/2/243ba692c1ab01529820a42f434ecca2e3dc49d9.JPG)

---

<div class="post-metadata">

**Author:** ![kenjara](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/kenjara/32/1953_2.png) [@kenjara](https://forums.pimoroni.com/u/kenjara)\
**Post date:** [March 7, 2017, 10:42pm UTC](https://forums.pimoroni.com/t/pi-zero-w-pirate-radio-and-the-phatbeat/4099/45 "2017-03-07T22:42:58Z")

</div>

Hi Guys,

To fix the VLC script permission error you need to give yourself permission to execute the shell scripts.

You will need to run at terminal in the vlc folder the following

chmod +x [vlc.sh](http://vlc.sh)

and

chmod +x [start.sh](http://start.sh)

That’s how I got passed the error.

I am liking slay radio @gadgetoid

---

<div class="post-metadata">

**Author:** ![Feek](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/feek/32/2100_2.png) [@Feek](https://forums.pimoroni.com/u/Feek)\
**Post date:** [March 7, 2017, 10:58pm UTC](https://forums.pimoroni.com/t/pi-zero-w-pirate-radio-and-the-phatbeat/4099/46 "2017-03-07T22:58:01Z")

</div>

No, it wasn’t that for me as I’d already done that.

As I said above, simply adding a sleep line into [shart.sh](http://shart.sh) sorted it for me.

---

<div class="post-metadata">

**Author:** ![triviadave](https://avatars.discourse-cdn.com/v4/letter/t/71c47a/32.png) [@triviadave](https://forums.pimoroni.com/u/triviadave)\
**Post date:** [March 7, 2017, 11:06pm UTC](https://forums.pimoroni.com/t/pi-zero-w-pirate-radio-and-the-phatbeat/4099/47 "2017-03-07T23:06:25Z")

</div>

Hi, sorry for the slight delay in getting back, I had to work through a few things.  
The problem I was having (I’ll get to this in a minute) was that [start.sh](http://start.sh) didn’t start on bootup, after it was put into crontab. It would work fine if executed from the command line using the same command as in crontab. It did work if the time to run the script was specified.

I had tried several things, including putting the command in rc.local, adding it to the root crontab etc, but couldn’t get it to do anything.

Thanks Feek for your suggestion, that worked perfectly, now vlc starts everytime I start the Pi, I am a happy pirate now, just looking for some streams to play. I have found a few BBC ones, just need to carry on looking for others now.

Kenjara, thanks for the chmod comment, I had done that as part of my flailing around, and wasn’t sure if it was necessary, it is useful to know I was moving in the right direction.

As far as the @reboot issue is concerned, I haven’t been able to find the bug report again, it was a few years old and my search history from the weekend is all over the place from all of the searches I did trying to solve the problem, across a number of devices. I will carry on trying to find it just in case it is still an issue; but happily, my radio appears to be working perfectly.

---

<div class="post-metadata">

**Author:** ![kenjara](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/kenjara/32/1953_2.png) [@kenjara](https://forums.pimoroni.com/u/kenjara)\
**Post date:** [March 7, 2017, 11:09pm UTC](https://forums.pimoroni.com/t/pi-zero-w-pirate-radio-and-the-phatbeat/4099/48 "2017-03-07T23:09:07Z")

</div>

You must not have had the permission error as adding a sleep into a script will do nothing to grant you permissions.

For people with permission issues what I suggest will solve that error at least.

Anyway here’s a video of mine up and running.

---

<div class="post-metadata">

**Author:** ![Feek](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/feek/32/2100_2.png) [@Feek](https://forums.pimoroni.com/u/Feek)\
**Post date:** [March 7, 2017, 11:23pm UTC](https://forums.pimoroni.com/t/pi-zero-w-pirate-radio-and-the-phatbeat/4099/49 "2017-03-07T23:23:00Z")

</div>

Thanks kenjara, yours is looking good :)

I did say that I hadn’t checked any logs to see what my error was but that I had the same symptoms, ie it sometimes not starting up after reboot when using the VLC method described above.

The sleep command fixed that, as it seems to have done for triviadave.

So we’re all working, everything is good.

---

<div class="post-metadata">

**Author:** ![Feek](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/feek/32/2100_2.png) [@Feek](https://forums.pimoroni.com/u/Feek)\
**Post date:** [March 7, 2017, 11:29pm UTC](https://forums.pimoroni.com/t/pi-zero-w-pirate-radio-and-the-phatbeat/4099/50 "2017-03-07T23:29:20Z")

</div>

Here’s how my playlist.m3u file looks. Radio Caroline seemed appropriate because, well, it’s an old pirate radio station on my Pirate Radio (and I’m involved to a very minor level with Radio Caroline themselves). I like Planet Rock and MITA radio reminds me very much of Laser 558 from the 80s.

[code]  
#Radio Caroline Flashback  
[http://sc2.radiocaroline.net:10558](http://sc2.radiocaroline.net:10558)

#Radio Caroline  
[http://sc3.radiocaroline.net:8030](http://sc3.radiocaroline.net:8030)

#Planet Rock  
[http://tx.sharp-stream.com/icecast.php?i=planetrock.mp3](http://tx.sharp-stream.com/icecast.php?i=planetrock.mp3)

#MITA Radio  
[http://cloudrad.io/mitaradio/listen.m3u[/code]](http://cloudrad.io/mitaradio/listen.m3u%5B/code%5D)

---

<div class="post-metadata">

**Author:** ![kenjara](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/kenjara/32/1953_2.png) [@kenjara](https://forums.pimoroni.com/u/kenjara)\
**Post date:** [March 7, 2017, 11:33pm UTC](https://forums.pimoroni.com/t/pi-zero-w-pirate-radio-and-the-phatbeat/4099/51 "2017-03-07T23:33:27Z")

</div>

Ah I tried the scripts manually one at a time starting with [start.sh](http://start.sh) before setting up the cronjob. That’s what threw the permissions errors so I thought I would sort those before adding the job to crontab.

A word of warning to anyone playing with the scripts. (although obvious if you can read the code)

Running [vlc.sh](http://vlc.sh) on its own will run the radio station without allowing you to change the volume. If you do this don’t panic and pull the plug, just hit ctrl+c then type killall vlc.

This will quit the script and kill all instances of vlc turning the radio off.

---

<div class="post-metadata">

**Author:** ![mneja](https://avatars.discourse-cdn.com/v4/letter/m/d9b06d/32.png) [@mneja](https://forums.pimoroni.com/u/mneja)\
**Post date:** [March 9, 2017, 9:54pm UTC](https://forums.pimoroni.com/t/pi-zero-w-pirate-radio-and-the-phatbeat/4099/52 "2017-03-09T21:54:53Z")

</div>

Hi,

similar topic here, just a little different. I just bought a phat beat (currently in the mail, does not have it yet) that I will pair with a Rasp Zero (non-w) that I have. I plan to use it a a music player in the garage with some old speakers I have laying around.

Now, I have been running mpd (music player daemon) before (with phat dac and external amp) and really liked it. Would like to do so again with this setup. I do, however, need to figure out how to let mpd now what buttons are pressed. @gadgetoid, how vlc-centric is your python script above (I have read it but know next to nothing about vlc so did not get 100%).

I think mpd could be just what a pirate radio needs, can handle both mp3 and radio stations, app for droid and phone available. Might be simpler than vlc and definitely so than Volumio (which is built on mpd anyway).

Sure, I could use Volumio since I am using a non-w zero, but hey, why go the simple route (besides, I like to keep thing bare minimum if I can)? Will allow me to use plain vanilla raspbian (lite), which is probably better/quicker supported than Volumio given the sheer difference in user base.

Edit: tips on cli commands to control volume on mpd would be appreciated.

---

<div class="post-metadata">

**Author:** ![gadgetoid](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/gadgetoid/32/13_2.png) [@gadgetoid](https://forums.pimoroni.com/u/gadgetoid)\
**Post date:** [March 10, 2017, 9:37am UTC](https://forums.pimoroni.com/t/pi-zero-w-pirate-radio-and-the-phatbeat/4099/53 "2017-03-10T09:37:30Z")

</div>

> [@mneja](#):
>
> I think mpd could be just what a pirate radio needs

I totally agree, but I had a whale of a time trying to get it to work with Pi VU Meter due to its insistence on running under a specific user/group combo.

Managed to solve it with permissive settings on `/dev/i2c-1` which seems sane enough.

I think Mopidy, which @sandyjmacdonald has been getting up and running, is based on MPD and a quick google suggests it’s possible to get the buttons up and running.

---

<div class="post-metadata">

**Author:** ![RogueM](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/roguem/32/311_2.png) [@RogueM](https://forums.pimoroni.com/u/RogueM)\
**Post date:** [March 10, 2017, 11:29am UTC](https://forums.pimoroni.com/t/pi-zero-w-pirate-radio-and-the-phatbeat/4099/54 "2017-03-10T11:29:52Z")

</div>

both Volumio and Mopidy do indeed have hooks into GPIO, but I don’t think that’s part of mpd, they are extensions of their own framework. Still it should be possible.

---

<div class="post-metadata">

**Author:** ![kenjara](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/kenjara/32/1953_2.png) [@kenjara](https://forums.pimoroni.com/u/kenjara)\
**Post date:** [March 13, 2017, 1:19pm UTC](https://forums.pimoroni.com/t/pi-zero-w-pirate-radio-and-the-phatbeat/4099/55 "2017-03-13T13:19:07Z")

</div>

I see the phat-beat repo has been upgraded with a more developed version of the vlc project. Is it ok to just run the curl installer again to get this or will this cause issues if the installer has been run previously?

I see the power button is now handled in the code. That’s what I am looking forward to. :)

---

<div class="post-metadata">

**Author:** ![RogueM](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/roguem/32/311_2.png) [@RogueM](https://forums.pimoroni.com/u/RogueM)\
**Post date:** [March 13, 2017, 2:02pm UTC](https://forums.pimoroni.com/t/pi-zero-w-pirate-radio-and-the-phatbeat/4099/56 "2017-03-13T14:02:43Z")

</div>

you should be able to just run the `setup.sh`, but I advise to take the OLI route as you suggest, mostly because I can’t say I have tested the setup script independently a great deal (but it should work nonetheless, if you have a working pHAT BEAT complete with VU).

… the advantage of going back to the OLI parent script is that it will also pull the latest pivumeter (which hasn’t changed recently, but will in the near future). The downside is that - as the situation as now - it will recompile it from source, possibly to end up with the same compiled shared lib, which is a bit of a waste of CPU…

---

<div class="post-metadata">

**Author:** ![kenjara](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/kenjara/32/1953_2.png) [@kenjara](https://forums.pimoroni.com/u/kenjara)\
**Post date:** [March 13, 2017, 6:47pm UTC](https://forums.pimoroni.com/t/pi-zero-w-pirate-radio-and-the-phatbeat/4099/57 "2017-03-13T18:47:10Z")

</div>

Ran the OLI again for phat beat then the [setup.sh](http://setup.sh). It threw an error do do with a bracket somewhere so did the OLI for the VLC project and it worked fine. Disabled the cronjob from the old method and copied my playlist over to the service folder so now everything’s running perfectly. Cheers!

---

<div class="post-metadata">

**Author:** ![RogueM](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/roguem/32/311_2.png) [@RogueM](https://forums.pimoroni.com/u/RogueM)\
**Post date:** [March 13, 2017, 7:22pm UTC](https://forums.pimoroni.com/t/pi-zero-w-pirate-radio-and-the-phatbeat/4099/58 "2017-03-13T19:22:58Z")

</div>

note that there is now a dedicated user playlist - I don’t recommend overwriting or editing the `default.m3u`, since it will be crushed every time you run the OLI/setup (for example when/if we roll some features).

see [https://github.com/pimoroni/phat-beat/blob/master/projects/vlc-radio/README.md](https://github.com/pimoroni/phat-beat/blob/master/projects/vlc-radio/README.md) for details!

---

<div class="post-metadata">

**Author:** ![Feek](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/feek/32/2100_2.png) [@Feek](https://forums.pimoroni.com/u/Feek)\
**Post date:** [March 13, 2017, 7:53pm UTC](https://forums.pimoroni.com/t/pi-zero-w-pirate-radio-and-the-phatbeat/4099/59 "2017-03-13T19:53:28Z")

</div>

Thanks for the work that’s gone into this. I’m going to blat what I’ve got and start again using the setup described here instead of my original VLC installation. I like the idea of it not starting as soon as I boot. the power button will also be very useful, thanks.

---

<div class="post-metadata">

**Author:** ![kenjara](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/kenjara/32/1953_2.png) [@kenjara](https://forums.pimoroni.com/u/kenjara)\
**Post date:** [March 13, 2017, 8:01pm UTC](https://forums.pimoroni.com/t/pi-zero-w-pirate-radio-and-the-phatbeat/4099/60 "2017-03-13T20:01:18Z")

</div>

I meant I put it in the .confg/vlc folder. I assume that overrides the default and is safe from getting replaced?

[Previous page](https://forums.pimoroni.com/t/pi-zero-w-pirate-radio-and-the-phatbeat/4099.md?page=2)

[Next page](https://forums.pimoroni.com/t/pi-zero-w-pirate-radio-and-the-phatbeat/4099.md?page=4)
