Pirate Radio Pirate Audio

Ops, forgot about this thread somehow. I just booted up my itty bitty beat box, and it decided it didn’t want to work? I’ll have a look see if I can revive it and see if the volume up down works.

Glad to hear you got it done and working.

Looks great!

Yes, nice to hear you got it working. Buttons on my Pirate Audio don’t do anything on my Itty Bitty Beatbox setup. On the plus side the volume is at a nice level by default. Its just as well my grand daughter can’t turn it up. I might still have a go at making them work though.

Hi, I stumbled on this thread by mistake while searching Zero2W volumio etc etc… Reason, yes I am quite happy with my existing setup Zero+PirateAudio-Volumio v2.917.
Actually quite happy with this, so why ? I got myself a Zero2W and ofcourse curious to adopt latest Volumio release v3.179 on a similar setup. Problem as I see I can’t find plugins för Pirate Audio and GPIO Buttons. So DarrenHill, I noticed on volumio forum you have been active in this matter. Are Plugins available ? I understand this conversation should actually be conducted on volumioforum, but I couldn’t find help there.

@calleblyh - Both plugins are currently under migration - Volumio 3 Plugin migration status - Plugins - Volumio

The Pirate Audio one is actually done and working, but it’s awaiting review and inclusion. Plus AxLED is working on updating it. But you can find details of where to download it and how to manually install it in the thread for it - [Plugin] pirate audio - Plugins - Volumio
(specifically here for the install instructions).

The PA plugin includes GPIO for the 4 buttons on the HAT, so that’s the only plugin you need if that is your thinking behind looking for the GPIO plugin as well. The PA one is the only one you need to use all the functionality of the HAT.

One other small note - I find that the set-up actually works better on a PiZero than a PiZero 2. The v2 is actually too fast/responsive, and makes the buttons on the HAT work too quickly (at least with Volumio and the plugin-in).

I’m sure it could be tweaked to lessen the sensitivity, but I just swapped the PiZero 2 out for an original Zero and it works fine. Have it built into a radio with a couple of speakers and a Waveshare UPS board as a battery and it works great.

Tkanx Darren for the comment. I havent yet started to work on the new volumio setup. Which volumio version are you using ? Anyhow I will try using both Zero and Zero2W. I will let you know…

I’m running the current v3 one (v3.179 if I remember correctly). It’s running on a first gen Pi Zero W and does fine. The GUI on the HAT screen is usable and the controls work ok. When you select stuff there are a few delays that aren’t there when you run it on a Zero W2, but on that the buttons tend to “double-press” (you click once to move down and it moves down two items in the menu).

It is set up to remove button bounce, it’s simply that the W2 is too responsive and quick and so is seeing two button presses rather than one. It can probably be coded around, but using a W2 for this seems like overkill so I swapped it out for a Zero W1 simply so I could keep the W2 for a project that does warrant the increased processing power (that still being as yet unidentified).

But it is a simple swap of HAT and SD card, so certainly try it yourself if you have both Pi versions available and see how you go.

In case it’s of interest, this is the battery (actually UPS) that I’m using - UPS HAT (C) - Waveshare Wiki . Got it from another Pi vendor (probably shouldn’t link to them here, but it rhymes with Hi Put) and it works wonderfully. It also has a Python script available (linked from the Waveshare page I linked) to give read-out of current/voltage etc, which I’ve hooked up to MQTT and feeds into my HA set-up (as does Volumio for remote control and monitoring that way too).

Indeed the only part of the whole project I’m not currently so satisfied with is the case mounting of the Pirate Audio board itself. The design is actually quite awkward to mount, having the screen offset and so close to the right hand screws makes getting the case cutting quite tricky to leave enough to secure the screws to properly but to not get in the way of the buttons.

Similarly you can’t properly surface mount it (with the board on top of the case) due to the connectors for the wires to the speakers being flush surface mounts on the back. And as for getting those wires corrected and secured properly, don’t even get me started… ;)

Hi Darren. Now installed successfully on Zero2W. Yes, I agree pushbuttons are reacting very fast. Not yet tried on Zero, I will later today. Thanx for your help.

A new tweak of Pirate Radio Pirate Audio under investigation…
I have been using PirateAudio3W for some time now and would like a slightly bigger display like Display Hat Mini 320*240 instead. So while waiting for delivery of AudioShim3W I removed the PirateAudio3W and hooked the DisplayHatMini. The software is Volumio v3.179. After bootup the Display came alive showing 2/3 thirds of display area and the orientation needs adjusting. Buttons do also work somehow, but I haven’t payed attention until I get the correct orientation of the display. See picture attached. As I have very little skills in programming I ask for advice. So I wonder where are the ST7789 settings located in volumio ??? Further investigations will continue after I have received my AudioShim3W module . I thought I should tell you about this idea as it could be of interest for other webradiofans too.

Kind Regards

Calle Blyh /Helsinki

1 Like

Both issues are because it still thinks your using the other display.
They both use an ST7789 driver but have different sizes and orientations.

The Pirate Audio screen is 240 x240 with the ribbon cable at the bottom.

The Display pack Mini is 320 x 240 with the cable on the left side.

I presume here you’re using the pirate audio Volumio plugin? If so it’s quite easy to adjust it for the display hat mini.

As @alphanumeric says, the orientation and display sizes are different between the two boards, but it’s quite easy to adjust.

Firstly you will need to enable SSH to access the files on your Pi. To do that, from a web browser on a PC/tablet/phone on the same network as your Volumio Pi, go to http://xxx.xxx.xxx.xxx/dev/ replacing the x’s with the IP address of your pi (basically it’s the same way as you access the web dashboard for Volumio, but with /dev/ added to the end). On that screen you should see SSH as the 4th option down with enable/disable buttons. Click enable to turn on SSH.

Next you need to use a suitable client (Putty is the best one for Windows) to access the Pi via SSH. Again you will need to use the IP address of the Volumio Pi there, using port 22 (not 23 as originally put here - that’s telnet). The login credentials there are volumio / volumio (user and pwd).

Then you need to edit the display.py file. To do that you need to:

cd /data/plugins/miscellanea/pirateaudio
nano display.py

A few lines down you will find the code:

# Create ST7789 LCD display class.
disp = ST7789.ST7789(
    height=240, #v0.0.6
    width=240, #v0.0.6
    rotation=90,  # Needed to display the right way up on Pirate Audio
    port=0,       # SPI port
    cs=1,         # SPI port Chip-select channel
    dc=9,         # BCM pin used for data/command
    backlight=13,
    spi_speed_hz=80 * 1000 * 1000,
    offset_left=0, #v0.0.6
    offset_top=0 #v0.0.6
)

That is for the screen on the pirate audio hat, 240x240 pixels and 90 degree rotated as noted above.

If you change it to:

# Create ST7789 LCD display class.
disp = ST7789.ST7789(
    height=240, #v0.0.6
    width=320, #v0.0.6
    rotation=180,  # Needed to display the right way up on Pirate Audio
    port=0,       # SPI port
    cs=1,         # SPI port Chip-select channel
    dc=9,         # BCM pin used for data/command
    backlight=13,
    spi_speed_hz=60 * 1000 * 1000,
    offset_left=0, #v0.0.6
    offset_top=0 #v0.0.6
)

It will give you the correct size and rotation for the display hat mini.

I have this set up on a Pi with such a hat on which I can use to remote control another Pi running Volumio, and it works fine.

That’s pretty well what I do in my Python files. I didn’t know it would work or how to do it in Volumio etc.

The volumio plugin is just Python 3, so same engine under the hood.

This may also help guide the access - SSH - Volumio Documentation

Thanks Darren…I tried to follow your advice, and was NOT successful. Orientation changed but screen is garbled. There are a few things I didn’t understand, Basically the http://xxx.xxx.xxx.xxx/dev/. I have ssh in boot folder and using PUTTY I get access using port 22 not 23. Asking “pwd” I get home/volumio. What should be the full location of display.py ? is it /data/plugins/miscellanea/pirateaudio. This is the modified section of my display.py. Seems ok to me, but is there another display.py located somewhere else ?
"# Create ST7789 LCD display class.
disp = ST7789.ST7789(
height=240, #v0.0.6
width=320, #v0.0.6
rotation=180, # Needed to display the right way up on Pirate Audio
port=0, # SPI port
cs=1, # SPI port Chip-select channel
dc=9, # BCM pin used for data/command
backlight=13,
spi_speed_hz=60 * 1000 * 1000,
offset_left=0, #v0.0.6
offset_top=0 #v0.0.6
)
I assume it’s my understanding how to do it causes the problem

See the SSH documentation I linked in my last post above - it gives more details on how to get the remote access alongside some screenshots. The SSH in the boot folder is to enable SSH, so you don’t need the use the dev web page to enable that.

Port 22 is correct for SSH, I made a typo above (port 23 is for telnet - I’ve corrected the post above).

The full location for the display.py file is the one listed, /data/plugins/miscellanea/pirateaudio . At least it is on my Volumio install.

Did you reboot after making the changes?

indeed I rebooted. I will give it another go later today… Thanks

Display Hat Mini setup slowly proceeding in my Pirate webradio. Display orientation and buttons working. I am still puzzled are the symbols fordropdown menu button x correctly positioned also volumebar. It requires lots of hours to get the understanding how to configure display.py. I just wanted to give you an update on my progress.
Br
Carl

1 Like

Looks nice :)

This might be useful to you - DisplayHat Pirate Audio - Pastebin.com

It’s the version of the display.py file I use on my Pi Zero which I use to remote control a separate Pi running Volumio.

In that file, in line 262 you can find the IP address of the Pi to be controlled:

socketIO = SocketIO('192.168.0.220', 3000)

Just change that to whatever the IP address is of the Pi running Volumio (127.0.0.1 if it is the same Pi which has the DisplayHat Mini on it and is running the script).

The script is also cut down to give only the web radio menu items rather than all the full selection, but you can put them back from the original script if you need to.

Full credit for the original script must go to AxLED - I just hacked about with it for my own personal needs (and for fun and learning Python).

If it can be of any help, I have built a DIY open source web radio receiver on top of the Pirate Audio. I was coming from the original Pirate Radio. But I have completely changed the software to play web radios, podcasts and serve as a bluetooth speaker. There is also a 3D printed case now.

Instructions and how to build it are here: GitHub - pirateradiohack/Transistor: Open source DIY web radio receiver!

Please let me know if you are interested, I’ll be glad to help.

1 Like