[Plugin] pirate audio

I get similar error, with Pi Zero, Volumio 2.917, pirautaudio 3W Amp version. I already applied the October 10th solution by AxLED. I get a scrambled screen. It flickers, off periodically (corresponding to scheduling restart - below, I assume). The screen is scrambled no matter what is playing.

In the ‘live log’ part of the the error message is:

File “/usr/local/lib/python2.7/dist-packages/ST7789/init.py”, line 361, in image_to_data return result.byteswap().tobytes() AttributeError: ‘numpy.ndarray’ object has no attribute ‘tobytes’ pirateaudio.service: main process exited, code=exited, status=1/FAILURE Unit pirateaudio.service entered failed state. pirateaudio.service holdoff time over, scheduling restart.

Any further things to try? (I can also wait for new version 3)

To reply to my own question, after further experimentation with fresh Volumio installation, I got the plugin (display) to work.
I followed ARCKUK (Nov 1).

I installed the plugin via the command line, though what made the difference, I think was the following:

  • sudo pip uninstall ST7789
  • sudo pip install ‘ST7789==0.0.3’

This is is after previously applying AxLED’s instructions

1 Like

I need to ask a little help here. Just trying this plugin with a brand new Pirate Audio 3W amp board, and whilst I can get the audio to work, the display doesn’t seem to be doing anything (blank screen).

I’ve tried it on a 2.917 install, and also now on a 3.159 beta install (the former on an old Pi Zero, the latter on a Pi Zero 2). The Pi0-2 install was done via SSH using the procedure above (in arckuk’s post 1 Nov).

The buttons are working (checked with the test_gpio script from another thread on this forum, via SSH), with button Y on pin 24 as expected.

Can anyone confirm what/when I should be seeing stuff on the display?

The good news is that this is up and running with Volumio 3 Beta and a Pi Zero 2.
Pi Zero 2 > Pirate Audio Line out > Volumio 3 Beta [Volumio-3.163-2021-12-02-pi]

Screen, DAC, Buttons everything is working fine… (so far!). I used a combination of the AxLED post in Nov 1 and arckuk’s method above. Big thank you to both of you :slight_smile:
I might have also tweaked the config.json but I’m not sure if that did anything!

I got a warning that we are still on Python 2 … Really ! Is it safe to upgrade this to Python 3?

I am also in the late stages of designing a 3D printed case for these, It’s not quite ready to share, I will share the files and more details when it’s ready. Here are a couple of work in progress images of previous iterations. CAD:


A print of a even earlier version:

Drew

3 Likes

OK made some progress.

By going back to Ax-LED’s Github and following those steps, the display is working now, as are the buttons (except Y, which I think I can tweak as it is maybe on the wrong GPIO pin).

The main menu display doesn’t look so nice as it has the Volumio background which interferes with reading the menu, and it seems to be in German (basically it looks like the images on the GH page). But I can work further on it.

Would be nicer of course to be in Python3 and to install as a plugin, so hopeful for an upcoming update once Volumio3 is officially released!

Edited to add - changing the pin 20 to 24 in a few places in display.py has fixed the Y button up, and also in there manually replacing the German menu text with English has fixed that up too. So it’s working fully…

@Dr_Ew

i like your case drafts.
To all other pirate audio users, today i started checking my code to port it to volumio 3.x and python3 and it doesnt look that bad so far. I will keep you informed within the next days.

AxLED

4 Likes

@AxLED Thanks :grin:

Having testing your plug in for a few days on the Zero 2 and Volumio 3, the only problem I can see is that when I am on the menu and I press the GPIO Up & down buttons, I usually get double presses and skip up and down on the Zero 2 which I didn’t get on the Zero 1, I hope it is as simple as it just needs a little bit more debounce time on the buttons.

I did a quick test with a Pirate audio Line out and the last Volumio 3 beta which I suspect is similar to today’s release.
Zero 1W boots in 2 min 59 seconds :sob:
Zero 2 boots in 54 seconds
It’s 3 times faster :grinning:

But… yesterday installed a test set up of Moode Audio with the same set up on the Zero 2, and that booted in Just 28 seconds!
It looks like Volumio 3 still has a lot of room for optimisation on boot up time. I prefer the UI on Volumio and It was bloody hard to get the TFT working on Moode and I’ve not managed to get the GPIO to work yet, so I’m back on Moode.

Drew

To all pirate audio hat users,

i changed some code in 4 files of pirateaudio plugin, so it works with Volumio 3 (tested on beta Build 3.163).
At this time i dont want to do a pull request to volumios github repo, as Volumio 3 isnt finally released.

The following files were changed:

  • display.py (modified code to work with python3)
  • install.sh (modified code for installing depencies and pirateaudio.service)
  • package.json (raised version number to 0.0.6)
  • pirateaudio.service (modified path to work with python3)

How to install and use pirateaudio in the meantime?
Installation:

  • connect via ssh on your raspberry volumio 3
  • change to a directory you want (f.e. /home/volumio/) by command cd /home/volumio
  • git clone my repository by command git clone https://github.com/Ax-LED/volumio-plugins.git
  • change into pirateaudio pluginfolder by command cd /home/volumio/volumio-plugins/plugins/miscellanea/pirateaudio
  • install plugin manually by command volumio plugin install
  • this should install the plugin under /data/plugins/miscellanea/pirateaudio with all needed dependencies
  • (remove folder /home/volumio/volumio-plugins, if you like)
  • now open your browser and enter http://volumio.local
  • go to the plugin section and activate plugin and set settings
  • restart your raspberry pi

After reboot the display and the buttons of your pirate audio hat should work.

Please let me know if it worked.

AxLED

1 Like

After two atempts, both from a completely new instalation of Volumio3, on a Pi 0 W, the screen remains off and the buttons don’t seem to work.
Looking forward for a solution, if there’s some test that you need, just let me know.

@vmiguel

thanks, i think i forgot some letters in install.sh, now changed, please try again.

AxLED

1 Like

@AxLED
I’m a happy camper! :headphones: :grinning:

@AxLED Working fine for me too, although the button action is a bit quick (the fun of the Pi Zero 2!).

One improvement suggestion is to use a plain background. Whilst the Volumio logo looks nice in itself, having text beneath a text menu can get a bit confusing sometimes and looks messy. Maybe use the current default.jpg as a boot splash-screen and then replace it with a plain background for running?

I’ve tweaked my set-up to swap out the file to a plain grey background, and it looks clearer.

But that’s a minor suggestion, many thanks for implementing it now in Python 3 :smiley:

@AxLED - I upgraded two pi Zero 1s and they both worked. I also tried Darren’s tweak - swapping-out the background with a dark, slightly-blended image - it improves the clarity of the menus. Many thanks!

@AxLED, today installed the latest volumio image on a new 16GB sd card for a raspberry pi 0 with waveshare ethernet hat.
I have my pirateaudio lineout working great with Iris as per Pimoroni (using wires as i have other stuff attached as well). Thought i’d try the new volumio when i found out you did this plugin for volumio (i have 2 older versions working fine - 1 on a dell thin cleint 1 on an old raspberry pi 2b). Result is quite disappointing after using your install instruction above ==> screen & buttons are not working at all ! so i suspect something else has changed in the latest version…3.173

@Brommer

i guess you need help on your pi zero install, right?
Which pirate audio hat is connected to your pi zero?
Did you follow the pirate audio plugin install steps from Thread 110 ?

AxLED

@Brommer Check the config.txt file on your set-up. It should look like this:

initramfs volumio.initrd
gpu_mem=32
max_usb_current=1
dtparam=audio=on
audio_pwm_mode=2
dtparam=i2c_arm=on
disable_splash=1
hdmi_force_hotplug=1
force_eeprom_read=0

include userconfig.txt

#### Volumio i2s setting below: do not alter ####
dtoverlay=hifiberry-dac

gpio=25=op,dh
dtparam=spi=on
### AxLED - Fix for Button X Y of pirate audio ####
gpio=16=pu
gpio=24=pu

My guess would be that one or more of the lines is missing, and so the HAT isn’t getting set up properly.

To view/edit that file, the simplest way is to put the uSD card into a PC or Mac. Ignore the errors that Windows pops up about the card (and do not select the option to format anything), and go to the “boot” partition.

You should find the config.txt file in there along with various others, just open it in your text editor of choice and check/update it. Then put the card back into the Pi and boot it up.

1 Like

@DarrenHill

unfortunatelly your hint is wrong.
The settings

gpio=25=op,dh
dtparam=spi=on
### AxLED - Fix for Button X Y of pirate audio ####
gpio=16=pu
gpio=24=pu

are part of userconfig.txt and some of them are not needed anymore.

AxLED

@AxLED - Ah ok. That’s what’s in my config.txt, after using the set-up you refered to in your previous post above.

I did have the Pirate Audio plugin installed before (the older version) so I guess it may be from that. But I know initially I had exactly the same issue that Brommer reports (no screen image and the buttons doing nothing, although they were being registered as I checked that using the Python script reading GPIO).

In that case, setting up the file entries got it working.

I just updated my Pi Zero W2 to 3.173 and can confirm the HAT and plugin are still working fine.

First of all @AxLED the post# you mention is the one i used (mine here tells me it’s post#108, but that’s semantics). I can tell you your instructions work beautifully i didn’t get a single error. So all must be good on that side (the web page shows the pirateaudio under plugins in Volumio). Oh and as mentioned i used the Pirate Audio LineOut.

So as @DarrenHill mentioned my thoughts went to the config file as well. However from previous posts that looks OK. My confix.txt is exactly like yours. My userconfig.txt has an extra line “gpio=13=op,dl” & no reference to buttons at all. After fixing that (i also included the button code, just in case) i can see then OLED get’s at least power, but that’s where it ends…So my config.txt is:
initramfs volumio.initrd
gpu_mem=32
max_usb_current=1
dtparam=audio=on
audio_pwm_mode=2
dtparam=i2c_arm=on
disable_splash=1
hdmi_force_hotplug=1
force_eeprom_read=0

include userconfig.txt

Volumio i2s setting below: do not alter

dtoverlay=hifiberry-dac

And my userconfig.txt:

Start of parameters for pirateaudio plugin

dtparam=spi=on
gpio=25=op,dh
#gpio=13=op,dl

AxLED - Fix for Button X Y of pirate audio

gpio=16=pu
gpio=24=pu

End of parameters for pirateaudio plugin

# Add your custom config.txt options to this file, which will be preserved during updates

@Brommer

can you please connect via ssh and execute the following command:

sudo python3 /data/plugins/miscellanea/pirateaudio/display.py

and tell me the output?

AxLED