Originally posted in French by Cédric Locqueneux on http://www.maison-et-domotique.com, translated and slightly updated to the current installation process of Max2Play by HiFiBerry.
Since a long time I wanted to overhaul my multiroom audio system completely to adapt it to one which fits better to my needs and with a superior sound quality, while keeping control over the budget. If you don't know multiroom systems yet: These audio systems allow you to play back sound in different rooms of your house, so you can listen to the music you want wherever you want.
I had my current multiroom system installed a couple of years ago. During the construction of my house, I asked the plasterer to install a duct in each room's ceiling, all end in the garage. Further, I bought 150 m audio cable (1.5 mm diameter = approx. gauge 15) for about 60 €, half of its usual price, which was enough to wire the 7 main rooms of my house.
Additionally, I bought 6 standard build-in speakers and a sealed one, originally made for boats, for the bathroom. These are not high-end speakers, but they were good enough for the intention I had, to have background music in all rooms. I used the SPE 178WT, which were at that time 19.95 € (the price increased quite a bit since then…).
- Impedance: 8 Ohm
- RMS power: 20 W
- Band width: 80 – 21000 Hz
- Sound pressure: 90 dB
- Mounting diameter: 150 mm
- Mounting depth: 48 mm
Finding the right loudspeakers is a very individual choice, depending not at least on the budget, some people use speakers like the Yamaha NS-ICS600 for 230 € each, which sums up very fast for the whole house. This can be also an evolution, I will for sure upgrade certain rooms like the living room, but this is something I will look into later…
To play back audio I was using at the very beginning a 5.1 sound card and fed with foobar the 6 channels to six loudspeakers. The constantly running PC was noisy like a gas turbine.
Later, I used 4 Squeezeboxes and 3 Raspberry Pis with Squeezeplug installed, since Logitech decided to discontinue its Squeezebox system. In between the Squeezeboxes and the loudspeakers, I used small amplifiers from computers, since the sound needs to be amplified. In the end, it was looking like this:
My old system was close to the one in this scheme from Aurel's multiroom tutorial.
But I must admit, in reality it was a big mess of cables, since in this scheme are still three units and the different power cables missing.
It needs to be said, this system let quite some room for improvement. The sound wasn't that great (my friend Max got me with the “good sound” virus infected), and the amplifiers were audible humming when no music was played. In the end, we were using this system much less then we were expecting in the beginning, which was maybe also since my wife found the operation too complicated.
Therefore, with all the developments made since then, I decided to start everything from the scratch. The requirements were simple:
- The Squeezebox system, since it is the most open and the easiest to integrate in a home automation system. The leading alternative would have been obviously Sonos, but that was clearly out of my budget.
- Spotify support, since our family uses now since a few years the premium account.
- Airplay support, since we have multiple Apple devices in the household and it is very easy to use.
Searching forums and blogs, I discovered the company Hifiberry who makes audio boards for the Raspberry Pi.
It is known that the Raspberry Pi's phone audio output isn't really great. Additionally, the humming of my old system was most likely related to these low-quality outputs (only the HDMI output of the Raspberry Pi is fine). Therefore, a Swiss company specialized itself to improve this issues, products are e.g. a DAC, and even a board which combines a DAC and an amplifier! After a successful test of this setup, I decided to base my complete system on Raspberry Pi and Hifiberry Amp+.
Now a presentation of my complete setup…
1 Preparing the hardware installation
1.1 Raspberry Pi and Hifiberry
The Hifiberry Amp+ is a daughter board for the Raspberry Pi A+, B+ and 2B which is directly plugged onto its GPIO pins. It is delivered with some small plastic spacers:
The speciality of this board is, additionally to converting the digital signal with a much better quality then the Raspberry Pi, it serves as well as a 25 W amplifier.
On the backside, you can see the connector to plug it easily onto the GPIO pins of the Raspberry Pi:
On the side, a jack to power the board, and 6 wire terminals. The two left can be used as well to power the board instead of the jack, and the other 4 to connect directly a stereo pair of loudspeakers, using audio cables (2 per speaker).
Important: The board needs 12-18 V, the Raspberry Pi is directly powered from it, it is important to not use the 5 V power supply on the Raspberry Pi as usually. This is great, since a cable less is needed!
The board is very small so it does not protrude the Raspberry Pi:
To avoid the breaking of the GPIOs, some plastic spacers hold the Amp+ board in place. The Raspberry Pi has already some holes for them:
After the Amp+ can be plugged and fixed on the Raspberry Pi:
Here it is, our audio player!
Now we can connect the audio cables:
With this setup, we need much less cables then before and the quality of it increases drastically. Less connections means less possible sources of problems.
Finally I set this up for 7 boards:
- 6 Raspberry B+, which I got for 25.90 €.
- 1 Raspberry Pi 2B as the Squeezebox server to stream the music. It has enough power to handle this without problems, I will come to this later.
- 7 Hifiberry Amp+, which work with all newer Raspberry Pis (A+/B+/2B)
- 7 micro SD cards
For the later I was choosing some 16 GB micro SD cards, because there was a special offer, but 8 GB are more then enough. Finally I was discovering a known incompatibility of Samsung's SD cards with the Raspberry Pi, which sometimes don't boot. Of course I experienced this problem, that's why I finally went with some cards of Transcend, which work without any problems.
Small series assembly:
And here they are ready:
1.2 Rack Design
Even if I need for 7 Raspberry Pis much less cables then before, I still need them for the power supplies, the Ethernet connection and the loudspeakers. To arrange all this properly, and since I own a 3D printer, I decided to design my own custom made rack. I used Google Sketchup to design a rack which would hold not only the 7 Raspberry Pis, but also an Ethernet switch with 8 ports:
Even though my BCN3D+ 3D printer has a quite large plate, I had to print it in 2 steps, which took about 20 h, that's how this main case looks like:
At the front the Ethernet and USB plugs are accessible, even though the later ones are not used here:
The openings on the side are for the audio and power cables, while the other plugs of the Raspberry Pi (hdmi, audio jack, …) are covered, since I don't need them.
The inside has flanges to hold the Raspberry Pis while still allowing air flow in between them. Even though the Raspberry Pis don't heat up much, some air flow is never wrong.
Once everything is in place, it looks like this:
Clean and tidy.
1.3 Power Supply
The goal was to reduce the cables needed. The Raspberry Pis with the Amp+ boards need a 12-18 V power source, therefore I was choosing a large 12 V / 30 A regulated power supply to power the 7 Raspberry Pis:
Connected to 220 V mains voltage, the output delivers stable 12 V, perfect for our audio system.
I then build tiny “splitters” of 1 mm² cables and quick connectors. I used four of these, since I was not finding connectors which hold at least 8 wires.
It's fast and easy.
These tiny splitters I connected to the power source's output, where two of the three outputs are now used.
1.4 Installation in the switch cabinet
Now it was time to place the whole thing in the switch cabinet, where all the audio cables to the loudspeakers arrive. Connecting the power supplies:
Connecting the audio cables:
And placing them in the rack:
Connecting the Ethernet switch which is placed on the side using short 25 cm Ethernet cables which I got for a special offer:
And at the end, labelling the Raspberry Pis to keep the overview:
And that's how it looks now in my switch cabinet:
With this setup, I need only two power cords (one for the power supply and one for the Ethernet switch) and one network cable from my router to the switch. Before I needed for the “real” Squeezeboxes and amps 14 power cords and 7 network cables…
Ok, I had it a bit easier since I had a 3D printer available. If you have one too, here are the files available: http://www.thingiverse.com/thing:892473.
If you don't, it is of course also possible to build it equally clean without, for example like I found it here:
2. Software installation
I tested different distributions to find one which easily supports the Hifiberry boards. At the beginning I was thinking of picoreplayer, a very lightweight distribution which supports the hardware:
- The installation is very simple, it is enough to copy the files on the Micro SD card. There is no need to use a tool to write an image on the card, just copy-paste.
- All settings are made through a web interface, no need to type terminal commands.
- Support of various useful plugins, with new ones being added often.
- Features like Airplay are pre-installed.
The only thing to note, it is necessary to buy a license for 9 € to use the Hifiberry card, and it unlocks some other options for the Raspberry Pi as well. In the end, it is not really expensive, since it is possible to use one license for all 7 Raspberry Pis.
Update: Max2Play now provides a HiFiBerry image that can be used without a licences. However, for the full feature set you still need to buy a licence.
2.1 Common installation for all Pis
All 7 Raspberry Pis have the same software basis, just a few differences are made in the end in between the clients and the server.
(At the writing of the original article, the HiFiBerry installer was not available yet. Since it makes it easier to install the distribution on the SD card and helps you with first steps setting the system up, it is described after this part of the installation tutorial as an alternative.)
Therefore we start with downloading the Max2Play Noobs Image from the Max2Play-webpage, which once extracted gives you these files. It is enough to copy them on the Micro SD card:
Now it's time to insert the Micro SD card in the Raspberry Pi and boot it (with all connections been made before). It is not necessary to connect a monitor, the installation is done completely automatic. Just wait for about 15 min and it is done, just take care to not remove the power supply during this time. When this is finished, a new device (or multiple, if you did them all at once) will appear in your network. Just type either it's IP address, or “http://max2play” (depending on your system, it might also be “max2play.local”) in your webbrowser to reach the web interface.
If you are curious and attach a screen to the Raspberry Pi, it looks like this:
The installation progress:
After the reboot the common Raspberry Pi boot information can be seen. In the end, nothing interesting here, everything happens automatically and no need for the monitor.
With the IP address (or http://max2play or max2play.local) in your web browser, the web interface is more interesting. It looks like this:
Different tabs are available to configure the device. The “Audioplayer” tab gives access to the options of the Squeezelite client, Airport (which is called here “Shairport”), DLNA and others.
The audio output can be as well chosen, but as you can see, we can't select the Hifiberry card, only the standard Raspberry Pi outputs are shown.
It is necessary to buy a license on the Max2Play webpage which gives access to all plugins of this software. Since just one license is necessary to set up all the players, it seems quite fair.
Once the license is bought, it is enough to go to the tab “Settings/Reboot” and enter the email address which was used to buy the license. At the same time, you could rename already the name of the Raspberry Pi (e.g. living room, bedroom, etc.). This name appears in the network later when using the multiroom system. Further, you could select the language for the desktop here as well, the webinterface uses automatically your favourite language, as you might have noticed. Don't forget to save these settings with the button below them.
At the very end of the page, you can enter the download links of plugins, and activate them:
Therefore we enter http://shop.max2play.com/media/downloadable/currentversion/raspberrysettings.tar to install the Hifiberry plugin and click on “Install new plugin”:
The installation is again automatic.
The only thing left to do is to activate this plugin “Raspberry Settings” now by selecting it in the list and click the button “>” to move it to the active plugins, and save the setting with the button just below.
A new tab “Raspberry Settings” appears, where we can find a list to select the Hifiberry board. As we can see, all the different models are supported:
If you want you could also overclock the Raspberry Pi here, but it is not necessary.
Once this is done, we get the message we could not use the Hifiberry board with multiple players simultaneously. In other words, it does not work with Squeezelite and Shairport at the same time. But don't worry, we'll use the trick which max2play is telling us in the same notification.
For making the board available to Squeezelite, reboot the Raspberry Pi by using the “Reboot” button in the “Settings/Reboot” tab.
Once it is back, select the “Audioplayer” tab and select “Edit Advanced Options“ of Squeezelite:
Select the Hifiberry board (the one with “sysdefault” in the name), and in the ALSA parameters, I entered “2000:4::” which gives me 2000 ms cache to avoid interruptions during playback.
Disable as well the “Autostart Shairport (Airplay)”, since we don't need it anymore.
Further, it is very likely an update of Max2Play is proposed, which you can do in the “Settings/Reboot” tab.
All these changes need to be made for each of the Raspberry Pis. Someone who knows how to make a copy of the SD card image could copy it easily to the other ones, but the steps described here don't take very long.
Now to the small differences in between the players.
Alternative installation using the HiFiBerry installer:
The easiest way to install the software on the SD card is using HiFiBerry's installer, some of the steps described above can be skipped by using it, since the installer configures them by itself. The installer exists for Windows and Mac, just select “Max2Play” as your distribution in the first step, this will automatically write the Max2Play Hifiberry image on the card.
Once this is done, insert the card in the Raspberry Pi and power it. You have immediately access to the webinterface by typing “http://max2play” (depending on your system this might also be “max2play.local”), as described above.
There, your are in a first step asked which HiFiBerry product you use, select it from the menu and save this setting. Just below, you can select how you want to use your media player. Since we want a multiroom solution, we need to select the second option, “Advanced”. After this, go to the “Settings/Reboot” tab to update the system using the “Update Max2Play” button and reboot using the “Reboot” button. After the few seconds the system is back.
After this is done, continue in the process as described above by entering the license code. The settings in the tab "Audioplayer" are already preconfigured.
Please note, using this process instead of the above described Noobs image gives you an additional tab in the webinterface, which is called "Hifiberry". Here you can select the HiFiBerry board you use, it is not part of the "Audioplayer" tab anymore.
2.2 Server installation
Having a Synology NAS in my house, one could ask why I not just installed the Squeezebox server directly on the NAS. I tried it out, but was having some trouble getting Airplay working.
Max2Play supports Shairport, which brings easily Airplay to the Raspberry Pi, but it is not possible to use at the same time Squeezelite and Shairport, and indeed, I get no sound with the later one. But since it is possible to install various plugins on a Squeezebox system, we use this possibility to install Shairport as a plugin of the Squeezebox system. Since then everything is managed by the Squeezebox server, the sound is switched automatically as desired. My problem: This plugin is a bit difficult to install on my Synology, since some command codes need to be run in a terminal. Even though there are tutorials around, I could not get it properly working, and whenever the Synology gets an update, these installations would need to be done again, which isn't very practically. That's why I finally decided to install the Squeezebox server as well on a Raspberry Pi, and to not have any performance problems, I took the Raspberry Pi 2B (this one will act both as the server and as a client). And who would have thought it, like this the plugin installs itself nearly alone, since it is provided by Max2Play.
For installing the server part, we need to select the “Squeezebox Server” tab and click on “Show available versions” to display the different version of LMS (Logitech Media Server) we can install, and click on “Squeezebox Server start installation”:
This installation needs some minutes, but is automatic:
Ensure to check “Autostart Squeezebox Server” to be sure the server boots when the Raspberry Pi is switched on:
Finally, select the “Shairtunes Plugin”at the bottom and click “Install plugin” to start the automatic installation of the Airplay plugin.
Last step: I have all my music on my NAS, so I need to add the network share option. For this select the tab “Filesystem Mount”, add the network path to the music folder location, its mount point on the Raspberry Pi, and the password to connect to your network folder:
If you don't have a NAS, just plug a harddrive into the USB port of the Raspberry Pi which runs the server.
Then, restart the Raspberry Pi. When it is back, open “Open Squeezebox Server Webadministration” in the “Squeezebox Server” tab to access the control interface of the Squeezebox system. This first time the system asks you where your music is located, and you select the previously mounted folder.
Go over to the “Settings” on the very right bottom, and select the tab “Plugins” and ensure the Shairtunes plugin is activated to be able to use Airplay.
If you want Spotify support as well, uncheck the original “Spotify” plugin and check the “3rd Party Spotify Plugin” of Triode, which works much better (if you can't see it, select “view third party plugins”). However, you'll need a Spotify premium account to use Spotify with the Squeezeboxes. Click “Settings” next to this plugin to enter your Spotify account details.
These two plugins allow you to use both Airplay and Spotify on all the the connected Squeezeboxes!
That's all for the server!
2.3 Client installation
We complete the installation of the Raspberry Pis with the plugin “SD card write protection”. This plugin sets the SD card into read-only mode to protect the system against overwriting or power cuts, so the card would not get corrupted.
We return therefore to the “Settings/Reboot” tab of the Max2Play configuration and add the link http://shop.max2play.com/media/downloadable/currentversion/sdcardprotection.tar to the plugins to install, and click “Install new Plugin”.
As always, the installation runs automatically.
A new tab “SD Card Protection” appears, where we need to click “Install” to activate the plugin.
To confirm the plugin is running, it displays now “enabled”.
A yellow note is now reminding in all of the tabs that the SD card protection is active. If you ever need to change anything again, just return to the tab “SD Card Protection” and enable writing until the next reboot.
Warning: Never install this plugin on the Raspberry Pi which runs the server, since the server could not work anymore. If you have done this, you would need to uninstall the plugin.
3. Using the Multiroom System
The system is now up and running. There are different ways to control and use it. The “simple” way, which my wife prefers: Airplay. For example using the iPad, I get a list of all my Squeezeboxes when clicking on Airplay.
If it is music from your iTunes library, Spotify, Youtube, … all can be send to the room you want, just select it. If you are using Android, no worries, there are many apps which allow sending music from Android to Airplay, like AllCast or Allstream. The most of them cost approx. 5 €, which I find reasonable. Since I haven't used any of them, feel free to give me feedback on these.
You can control the playback as well from the Squeezebox webinterface, which can be found under the IP of the server Raspberry Pi, followed by the port “:9000”. There you can select the music you want, from local files to web radio and Spotify, and the room in which you want to play it:
If you like, you could even synchronize different players to play the same music in different rooms:
This works good, but the webinterface looks a bit outdated and rather boring.
There is as well an Squeezebox app for phones and tablets (Logitech Squeezebox Controller for iOS and android), but I don't like this one very much. For the iPad/iPhone, there is the app iPeng 8, which looks much nicer. This one isn't free (8.99 €), but I highly recommend it. One has easy access to the playlists in the different rooms:
It is very easy to synchronize them:
The music selection from different sources, with Spotify integrated:
It's possible to create automatic random playlists according to your taste:
During playback, the cover and the main control buttons are displayed. It is possible to display the lyrics via a Squeezebox plugin as well:
It's even possible to set an alarm clock which gradually increases the music's volume, the last played track will be played automatically to wake you up.
Beside, there is a “Party Mode”: Your guests install “iPeng Party” on their smartphone and can select the music they want to listen next, without being able to alter the current playlist or the volume (this is up to the master). Nice!
I can say, I am absolutely satisfied with this system! Finally my multiroom system is how I want it to be. In the switch cabinet, it is relatively clean and compact. The power consumption is, as I can see from Fibaro, in total approx. 25 W, which is completely fine for playing music in 7 rooms. Much less cables and easy maintenance. The only downside is the noisy power supply with its tiny ventilation which runs the whole time. This is not a big problem since it is in the garage, but this needs to be in mind when you think about where to place the system. Otherwise a less noisy power supply needs to be found, I guess a PC power supply with a big 12 cm ventilation should be fine.
On the quality side: no noise or humming when no music is played back, even at maximal volume. Great! Therefore the system is running all the time, when I don't play any music, I can use it for audio notifications of the home automation system in all rooms (this will be explained in a later article). When playing back music, the sound quality is awesome, especially for my entry level loudspeakers. Some of the speakers I will update in the future for sure, e.g. in the living room, but for the moment the sound is really great.
The usability is highly improved. If for example my wife finds a nice lullaby on youtube, 2 s later she has send it through Airplay into our children's room. iPeng is a tiny bit more complicated, but it is very easy to get used to it. The only thing I still have to figure out is how to give our kids control over the speakers in their rooms, so they would not need any other HiFi system in their rooms.
At very last, of course a note about the price of the whole. The loudspeakers and the cables were already there in our house, and the price of the speakers depend highly on the quality you wish to have, so they are difficult to include in the calculation. Everything else: the Raspberry Pi cost me 26 €, 60 € for the Hifiberry Amp+ and 7 € for the micro SD card, which makes 93 € per room. Additionally, one license for Max2Play for 10 €, an Ethernet switch with 8 ports for 19 €, and a power supply with 12 V for approx. 40 €. That is in total, without the speakers, 720 € for 7 rooms, which is less then the original Squeezeboxes from Logitech when they were still available, and much less then installing Sonos or a similar systems. To have a similar system with speakers mounted in the ceiling, it would have been necessary to use the Sonos Connect in each room, where one alone costs already 349 €, and there would be still a small amplifier necessary, since it is not possible to connect speakers directly.
I am very satisfied with this system, for this price, and I am sure it will now stay quite a while like this.