My New Squeeze box Music Server
My first blog post:
For the last year or two i have been running a raspberry pi b based logitech media server. The system worked well but with the recent release of the new raspberry pi2 Quad core it was time for an upgrade. Here’s an overview of my project .
. Raspberry pi2
. Hifi berry Dac
. Hd4780 16×02 lcd – eBay
. Arduino nano – eBay
. Ir receiver -eBay
. Rotary encoder (not connect at present)
. Level shifter 5 -3. 3v -pimoroni.com
. Aluminum chassis ( pre amp kit model PGA2311) – eBay
. Bi-stable latching relay -eBay
The aluminum chassis
I found this on ebay and it seemed to be exactly what was required as it had all the right cut- outs on the front panel. This amp kit chassis was originally designed to have the lcd attached to a pcb therefore i had to drill and tap new mounting threads for the lcd to be attached. The chassis also came with a push latch on- switch but i was able to convert it into a ‘momentarily push to make’ by simply removing a latching pin from inside the switch.
Arduino and Power control
The main reason for using an arduino is to provide a safe shut down sequence for the raspberry pi. This is done by removing the power a few seconds after sending a halt cmd ensuring that the file system is fully shutdown. Also as the arduino is powered all the time it allows the system to be powered on as well as off via infrared remote. The rotary encoder is also connected to the arduino to save resources on the raspberry pi. The arduino is connected to the raspberry pi via serial port and as the arduino is 5v and raspberry pi is 3.3v a level converter is used.
Hd4780 16×02 lcd wired as per the lcd proc user guide with the exception of one pin used by the hifi berry dac hat (GPIO18). This was changed to an unused pin.
As most raspberry pi fans know that the built in audio has improved over the years but its isn’t HIFI quality yet so i decided to use a hifiberry dac . It comes in the b+ HAT format and requires no wiring and best of all sounds great. I followed the guides on the hifi berry website and soon got it working with Sqeezeslave.
In my previous music server i used a 500gb usb drive, this worked ok but again with this new build i decided to try something new and found a sandisk micro 32gb usb memory stick and for somebody with a good size music collection (mp3 format) like myself this is ample! If it runs out of space then i can just simply add an additional stick or connect a hard disk.
In my previous music server i used a pre made image called squeezeplug, but in this new build i decided to start from scratch, i would recommend this for people just starting out as the setup is all menu based.
Logitech media server
Found this good guide to install logitech media server here : http://allthingspi.webspace.virginmedia.com/lms.php
This is a player for Logitech media server.
I used this and not squeezelite due to the built in lcd output option with Lcdproc
Good installation guide here:
Note if you want the Lcd to display the track playing then run with “–lcd”
This is the software for driving character based lcds, theres a few Linux software out there that have options to send data to Lcdproc such as squeezeslave or able to display text via a python script.
My custom Python script and web interface
The main purpose of this is to talk to the arduino and contains functions for shutdown and receiving the IR remote codes. Other custom functions include a sleep timer and load default playlist on boot up. Also using Flask – a python library, to make a simple web base remote interface for functions such as reboot and copy music to pen drive so can play it in a car ect. Scan library etc show lastfm page for artist currently playing.
Three python libraries are used which will require also installing.
Pyserial : Use serial port in python to talk to arduino
Pylms: used to send cmds to logitech media server players ie. play stop
Flask: used for basic webserver framework in python.
I haven’t yet posed this script online as its very messy and totally tailored to my setup and plan to do a few tutorials on this soon especially the web remote control so keep a watch over this blog.
Samba is a program that lets you share files and folders over your network. The main purpose of installing samba is being able to access the music folder on my desktop so i can easily add new music etc.
This guide seemed to work fine:
Please only use this for reference with the correct manuals for hardware and software. I hold no responsibility to any damage to any equipment caused .