Thank you for your donation!

Idea: Pirate Audio 240x240 cover display
(02-27-2020, 10:33 AM)maartin Wrote: Hi Russ,

next level is calling:

PHP Code:
pi@moode-pim:~/tft-cover python3
(most recent call last):
 File ""line 24in <module>
   spi_speed_hz=80 1000 1000
"/usr/local/lib/python3.7/dist-packages/ST7789/"line 124in __init__
._spi spidev.SpiDev(portcs)
FileNotFoundError: [Errno 2No such file or directory 

We are getting closer!  Go go go!


I think SPI is not enabled on your pi. Apologies, as I should have put that in the readme.

SSH into pi
sudo raspi-config
Select “Interfacing Options”
choose “SPI” option and activate
then Select
then Yes
then OK
and the Yes to reboot

And then i hope were real close

(02-27-2020, 11:51 AM)maartin Wrote: That did the trick. Now I have the MoOde Logo on the TFT (very nice!). I had to reboot twice before I was able to listen to Webradio again, but there a no images of the stations, only "moOde".

apologies again. Something else for the readme.

The metadata file must be turned on in moode as the python script uses a combination of data from this file and mpd itself to know where to get the images.

Open the moode web page
then go to...
Configure -> System
Scroll to Local Services
click the Metadata file switch to on and click "set"

can't remember if a reboot is required.

That should help.

The buttons...
The Mopidy setuo won't work for moode.

Moode has some shell scripts that should do what you want for volume. pc cappands can do the rest.
check out this forum thread on using Moode's gpio config feature.

play_pause,active_low,150      use mpc toggle
volume_down,active_low,150     use /var/www/ dn 1
next,active_low,150            use mpc next
volume_up,active_low,150       use /var/www/ up 1

Hope this all works
Quote:Where to tweak to have it loaded at booting?

Easiest is to add a line to the rc.local file

SSH into the pi

sudo nano /etc/rc.local
 then add

/usr/bin/python3 /home/pi/ > /dev/null 2>&1

betweenthese lines

/var/www/command/worker.php > /dev/null 2>&1

exit 0

Then reboot, of course.

Try this, but if there are issues with images not displaying correctly on the pirateaudio, let me know.

I need to tidy the code a bit to prevent some issues anyway, but it may be a couple of days.

I will also add files to allow you torun the script as a systemd service if you wish, which I find works well for other python scripts.

Quote:It is so nice to have that Logo visible.  Thanks so much!

Glad to help.
Do you only use the pirateaudio for radio stations?
I am adding some extra functionality that will display cover art that is embedded in files.
So far it works for mp3, flac, m4a and ogg files.
So if you play songs from your own collection, embedded cover art will display.



I have made some updates.

  1. It can now be run as a systemd service
  2. The MediaFile library is now used as a wrapper for mutagen - this makes embedded art easy to access.
If you want to try this update:

Remove the line you added to rc.local if it's still there
install mediafile

sudo pip3 install mediafile
python3 -m pip install mediafile

install tft-cover again

git clone

then cd into tft-cover

chmod u+x
chmod u+x tft-cover_start

install the service

and follow the prompts
reboot required

I have tested the service and it runs on my rpi zero w fine.
I just cant see if the display works Big Grin 

but the st7735 version works fine for me

If nothing shows on the display, check the service status

sudo systemctl status tft-cover

There is a 30 second delay built into the service start to ensure the mpd service starts fully at boot

Glad to see that it's working as intended for you.

I have tidied the readme on github, so hopefully if anybody else wants to install, all of our trial and error will have been invaluable.

Happy listening

(03-01-2020, 12:04 PM)maartin Wrote: Hi there Russ,
strange new problem here.
Because of not having any sound anymore I installed all from scratch.
All as expected. But when starting the Station first time the sound stops just after parts of a second, but the clock in the GUI is still running.
When rebooting after this happens, strangely my playlist is gone. Adding a station and start play leads to the having no sound at all, while the clock in GUI is turning.

Any ideas anybody??

Quote:Audio information
Input / Output
Encoded at: VBR compression
Decoded to: 24 bit, 48 kHz, Stereo, 128 kbps
Destination: Local
Output rate: 24 bit, 48 kHz, Stereo, 2.304 Mbps
DSP operations
Volume ctl: Software (MPD 32-bit float with dither)
Resampling: off
Polarity inv: off
Crossfade: off
Crossfeed: off
Parametric EQ: off
Graphic EQ: off
Replaygain: off
Normalize vol: off
Chip options: , Gain=-6dB, Boost=0dB
Audio Device
Device: Pimoroni pHAT DAC
Chip: Burr Brown PCM5102A
Interface: I2S
Formats: S16_LE, S24_LE, S32_LE
Platform: Pi-3B+ 1GB v1.3
Any other output needed to find the problem?

All the Best

I have no issues with the script on my pi zero, albeit with the ST7735 driver

Can we test to see if the cover script with the ST7789 driver is causing this?

Can you try this?

Disable the tft-cover service and reboot the rpi without the cover script

SSH into the rpi, then..

sudo systemctl stop tft-cover
sudo systemctl disable tft-cover
sudo reboot

Then start the radio station again and see if the problem persists without the cover display.


[quote pid='17092' dateline='1583164826']
Quote:SSH into the rpi, then..

sudo systemctl stop tft-cover
sudo systemctl disable tft-cover
sudo reboot

Then start the radio station again and see if the problem persists without the cover display.

This helps to have the sound back, of course no more TFT.

On the MoOd- GUI I have this error message if the ST7789-Script is active:

MPD error
JSON.parse: unexpected end of data at line 1 column 1 of the JSON data

Hope this is a hint to the error which seems to be found in the ST7789-Script.

If there are any other test to do I am glad to help.

All the Best

I may have found the issue.

Some of the Pimoroni documentation appears to have errors, and pirateaudio owners were having the same problem with players other than moode

I have updated github with a correction to that removes the problem on my RPI zero with Pimorone Phat Dac.
As I don't have an ST7789 display I cannot be sure if the covers will still display.

Please reinstall the script from github.
cd /home/pi
git clone
and make bash scripts executable
cd /home/pi/tft-cover
chmod u+x
chmod u+x

The update was to the backlight control pin, so I hope the display still works


thanks Ross, Maartin & Kent for this feature.
Happily using my Pirate Audio headphone HAT

Have successfully setup the GPIO button handler.
found in
Local Services section of System Config.

Button 1, PIN 5   CMD /var/www/ up 1
Button 2, PIN 6   CMD /var/www/ dn 1
Button 3, PIN 16  CMD /var/www/ mute
Button 4, PIN 20  CMD mpc next

(don't forget to then turn GPIO button handler to ON and then SET)

gleaned from
further information at


Attached Files Thumbnail(s)
@maartin  and @kenling

Glad it's all working for you both Smile
Thanks all for the good information about the Pirate Audio. Is it possible to display the artist and trackname on the tiny display like on the added image ? Can`t find any information about it.


Forum Jump: