Saturday, 26 January 2019

Setting up a music player using PiCorePlayer and Bluetooth speakers

I've used LMS (Logitech Media Server) for quite some time.  I stared off running it on a windows machine many years ago.  It was where I already had my music files and the service seemed quite light running.

I'd been on the search for an easy way to play my MP3s via my stereo system rather than my crappy computer speakers for ages.  The Logitech range of hardware helping you do so seemed ideal. 

I started off with the Squeezebox Duet:
As you can see you have a rather nice remote with just enough screen to show off your lovely album art and another small box:  which turns out to be the interface between your data (in my case on the computer connected through the network) and my stereo system.

Joy abounded: for quite some time.  And then.....well the hardware got older.  I stopped using the remote because it kept disconnecting and the battery degraded.  So,  when setting things up again I had to configure the squeezebox in a headless fashion as I was no longer using the remote: it can be done,  but easy its not.   If anyone is interested in how this is done: comment on the piece and I'll see if I can remember.

Then (still aeons ago!) I moved over to Linux,  so I needed a way of keeping my system going using a new operating system for the server.

My home server runs on vanilla debian: and there is a version of the server software which runs just fine on there : after some persuasion.  So,  once you get the service running you can do the rest from the web interface:


To bring things up to date,  this was all fine,  but it only connected to my main stereo in the front room.

For my bedroom upstairs I had a squeezebox radio:


This worked fine,  and doubled up as a handy alarm clock too.

However,  the darn thing gave up the ghost a short while ago leaving me bereft of sounds upstairs.

So,  in went my old LED alarm clock again (I convince myself it has a retro look) and I started to look at alternatives.

I've long been a fan of all things Raspberry Pi and as a result of this I had an old Pi 2 lying around not doing anything.

This is easily fast enough to convert into a standalone player which can expand your already existing LMS ecosystem. 

I've tried a number of music players running on this Raspberry Pi 2 before (because its fun and I'm sad) but I settled on PiCorePlayer this time.

My plan was to get up to date and use a bluetooth speaker with the player.  To this end I chose a soundbar eventually,  in fact this one,  the Azatom Studio Soundbar 2.1.  Its not bad,  for the approx £50 I shelled out,  but nothing special. 

So: how to do it?

The Build


  • Download the image file you require first.  As of writing,  this can be found here
  • Write the image file onto your SD card that is to be placed into the Pi.  You really don't need a large SD card,  4GB would be easily big enough.  Remember,  we are not putting any music on this thing,  that stays on the server.  I used USB image writer on my distro (currently ArcoLinux Openbox) to write the image onto the card.
  • Put the SD card into the PI.
  • I added a bluetooth dongle via USB so the Pi could connect to the soundbar.  The one I used was a Rocketek,  and it seemed to work fine.  I did check first and Amazon suggested it was fine to work with Linux and a Pi.  
  • The Pi will need to connect to the network (to find the server service and also "see" the music files) so I connected it via ethernet.  I've read warnings about using WiFi and bluetooth concurrently in this setup,  so a good old wired connection seemed a good idea (it was).  
  • Googling around suggested that the newest versions of PiCorePlayer would now work with bluetooth connections so once I had my hardware connected together I fired the thing up.
  • This is another piece of hardware with a web interface,  but to use this you need to know its assigned IP address.  I found this out by going into my router and looking at what was currently connected to the network.  
  • Once you know the IP you can open up your browser and check out the interface.  Once you are in,  click on the button labelled "main page" and have a look at the bottom of the page.  Here,  you will find a way to display the more exotic controls via the "beta" controls,  so make sure you have this selected as below:



  • By default only the player software "squeezelite" will be running.  You can use the PiCorePlayer to run a full version of LMS and make the unit a whole sound system in itself.  I've done this before with great success,  using a USB stick attached to the PI to hold the MP3 files.  However,  for this example we just need the player running.  
  • Lets have a go at setting it up.  My first port of call was expanding the image on the SD card so that the software could make full use of the space available on the SD card.  There's a button for this on the interface under "main page" and "advanced mode operations": like this

  • I decided to get everything up to date next,  so I did an update.  This is also on the main page,  under "main Pi Core operations":

  • With this done,  its a good idea to give it a restart.  You can see the button for this in the picture above as well.
  • You may want to take one of the other options on these dialogs as well: to set a fixed IP address for the player: this means that if you need to get onto the interface in the future,  you don't have to go rooting around in your router's settings to find its IP again.  
  • Given we are using an ethernet connection in this example,  I wanted to turn the WiFi off.  This is quite easy as you can see below:

  • Now we need to see if we can get things going with bluetooth.  This was the bit I was afraid of,  TBH.  I had done quite a bit of googling around in preparation,  but the help available on this was rather spartan as its quite a new feature.  There are some help pages available from the PiCorePlayer people,  but I was getting confused.  
  • I worked out that I had to change the output of the squeezelite player, but only after I had enabled my bluetooth setup.  There were references to the "squeezelite settings" tab on the interface,  but I couldn't for the life of me find where I could input these settings.
  • Eventually I did twig it: there is a small box labelled "Card Control" and that is where we have to head:

  • If you actually click on this box (which was non obvious,  to me) you see:

  • If you study the picture above you'll see that my bluetooth is recognised,  as is the soundbar (you can see that in the picture above and the one above that,  too),  but the devices are not currently connected.  You need to click on the "scan" buttons to get the bluetooth on your Pi to "see" the soundbar. 

Conclusions


Its quite a nice setup,  the Pi is tiny and can be kept out of the way (although not too far from the bluetooth device you want it to connect to) and it seems to run for ages with no errors. 

I run OrangeSqueeze on my android phone and tablet,  and on that you now only have to swap players to output music from the Pi to the bluetooth speaker. 

For music enthusiasts: you may wish to get a better bluetooth speaker than I did with my soundbar.  I'm not attacking the Azatom device here,  for the price I paid its excellent: but I would have liked something with slightly higher quality sound and a more reliable bluetooth connection.  I get bluetooth cutting out occasionally,  but its not a deal breaker at this stage. 

0 comments:

Post a Comment