Pi Zero W, Pirate Radio and the PhatBeat

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?

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. 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.

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

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 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/) 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

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.

1 Like

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

and

chmod +x start.sh

That’s how I got passed the error.

I am liking slay radio @gadgetoid

1 Like

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 sorted it for me.

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 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.

1 Like

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.

1 Like

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.

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

#Radio Caroline
http://sc3.radiocaroline.net:8030

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

#MITA Radio
http://cloudrad.io/mitaradio/listen.m3u[/code]

1 Like

Ah I tried the scripts manually one at a time starting with 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 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.

1 Like

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.

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.

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.

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. :)

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…

Ran the OLI again for phat beat then the 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!

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 for details!

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.

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