Sunday 26 April 2020

Pimoroni Pirate Audio MP3 server.

Pimoroni of Sheffield have recently introduced a range of PHAT form boards for the Raspberry Pi family of single board computers. Their Pirate Audio range offer high quality MP3 playback via a variety of outputs together with the a 240 x 240 full colour display..

I decided on the Pirate Audio Headphone Amp.

The Components


The board is supplied in an resealable anti-static bag.

 I was so excited when I received the package from Pimoroni, I opened it before taking the photograph.
The PHAT form boards are smaller than the standard HAT boards, they are designed to stack on top of any 40 pin Raspberry PI, but they are specifically designed to have the same board dimensions as the Raspberry Pi Zero. So with the Pirate Audio board, I also bought a Raspberry Pi Zero W, as soldering is not one of my skills,  Pimoroni offer them with  pre-soldered  headers.

 So this is the board itself. The screen is not cracked, the protective plastic sheet has partially lifted. Eventually I will remove it once I have finished working on it.
There are four buttons around the screen and a headphone jack on the laft side.
 You can see how the PHAT form boards fit directly on top of the Pi Zero board.
The back of the board showing the Hi/Lo Gain amplifier option switch. Though it is inside the board sandwich when assembled, the switch can be operated using a suitably sized rod.

Assembly

I had a 64GB Sandisk SD in stock (I buy them when they are on sale at my local supermarkets), but Linux in general has issues with the default ExFAT format and Raspberry Pis cannot boot from them. However it is easy to reformat them to FAT32. See this post for details.

I used the recently released Raspberry Pi Imager to install the latest version of Raspbian Buster.

The new SD card was inserted into the Pi Zero and it was connected to a keyboard, mouse, monitor and a USB Ethernet connector via a powered hub. The USB Ethernet connector speeds up the updates
Once the initial set up was complete, it was time to assemble the boards.
The two boards were offered up and then gently pushed together.
I also had a couple of stand offs that I used to support the front of the board sandwich.

Software Installation


The installation script has some issues. Over the Christmas 2019 holidays, the core music server underwent a major upgrade. Unfortunately this seriously broke the software used on the board.
You can follow the story here.

The only real issue to currently be aware of is that the Mopidy Local service is not included in the install script. It was included in the base Mopidy repository, but was split off during the upgrade.

It is easy to install:
sudo apt-get install mopidy-local
After that it is all set up.

Loading MP3s.

Of course a music player is not much use without some music to play.

Martin O'Hanlon has a useful post on Stuff About Code on copying CD music to MP3.
The Python code opens the CD drive, you pop a CD in, close it and off it goes. When it has finished, it pops the drive open again. If you put another CD in and close it, it will process it. This continues until you stop feeding it CDs. Ingenious.

I used his code, but did convert it to Python 3.

I have a Samsung external USB DVD drive. Now it is a bit power hungry. I initially used a powered hub to supply power to the Raspberry Pi, the mouse and keyboard, and the DVD player.

When I tried it, it kept throwing errors. I did wonder if the DVD drive was not compatible. So I tried it on my Raspberry Pi 3 and that happily copied and converted a CD.

So I powered the Raspberry Pi with a separate USB supply and used the USB hub to power the DVD drive, and the keyboard and mouse.

It does make a bit of a rat's nest of cables.

Once I had loaded a few CDs (18), it was time to  give it a try.

I plugged in my headphones and pointed the browser of my tablet at the IP and port number displayed on the Pirate Audio screen. Select the album of choice and...
The sound level is a bit high, so I will have a look at that.

Conclusion

With the exception of the installation of the mopidy-local, the installation was easy.
Remember, if you use a CD/DVD player to ensure you have a suitable power supply.

The Raspberry Pi Zero is a lot less computationally powerful than the Pi 3 or 4, so it does take a while to process the CDs, and the user interface is a bit slow when you run it locally. It is fine on the browser of another machine.