Google Home Mini has been my default smart speaker for streaming music, as the sound was decent, and Google made streaming your own tracks extremely easy. Just sync the files with your Google Play Music and you are good to go. I wouldn’t look for other solutions if not for Amazon Echo Dot (3rd gen). This Amazon offering simply blows the Google Home Mini out of the water music-wise. It was time I do something about my private music collection.
Stream music on Amazon Echo
Amazon Prime Music subscription previously had support for uploading your own tracks to the cloud, however, the option has been available only for premium subscribers and it won’t be supported for much longer. I had to look for other solutions if I wanted to take advantage of the much nicer sound of the Echo Dot device.
Some time ago, I made a NAS-pi – Plex-enabled network drive which stores my files, and streams videos. Plex isn’t something that is immediately associated with music streaming, but it comes with full voice controls for music search and playback. While building the entire 3HDD NAS box is excessive, a Raspberry Pi board loaded with Plex and a USB stick would be sufficient to actually hold your music collection and not to break the bank in the process.
I have tested the following boards to see what would be the cheapest but reliable option:
- Raspberry Pi 3B ($32) (Ethernet + WiFi)
- Raspberry Pi 3A+ ($22) (WiFi)
I have tried to use Raspberry Pi Zero series, however, the armv6x is no longer supported and as such these boards cannot be used for Plex services. This is a shame as Raspberry Pi Zero would be a perfect board to stream audio files only.
I’m going to use Raspberry Pi 3A+ because it’s cheaper. It comes with a single USB socket and the onboard WiFi is fast enough to deliver audio content while not limiting me to a single location. USB drives can be picked up for about $10 off the Amazon, so the entire setup will cost you about $30 providing you have a spare USB charger to use.
If you are interested in making it look as nice as my MusicPi – the process of modding the Raspberry Pi 3A+ and building enclosure will be posted soon.
Plex on Raspberry Pi
Grab a fresh Raspbian image and connect to the Raspberry Pi. If you are not sure how here is a tutorial for you.
Update the board using the commands:
sudo apt-get update sudo apt-get upgrade
Then add dev2dat repo so we could install plex:
wget -O - https://dev2day.de/pms/dev2day-pms.gpg.key | sudo apt-key add - and echo "deb https://dev2day.de/pms/ jessie main" | sudo tee /etc/apt/sources.list.d/pms.list
Then update the package list running:
sudo apt-get update
Now, you are ready to install plex:
sudo apt-get install -t jessie plexmediaserver
Once done, change the plex user to “pi” by changing the line in the file
sudo nano /etc/default/plexmediaserver.prev
Close the file (Ctrl+X and Y) and reboot the Raspberry Pi. I would also advise you to set the static IP, so you could connect to the correct IP each time. I have the complete tutorial showing you how to do it here.
Before you can add the files, you need to mount the drive. Run
sudo fdisk -l
and look for your USB Drive – then mount it as
sudo mount /dev/sda1 /home/pi/Music
if you just put the folders with your music in the root directory of the USB stick. If your drive failed to mount after the reboot, use crontab to force mount it after restart:
sudo crontab -e
and add the line:
@reboot sudo mount /dev/sda1 /home/pi/Music &
Now when you open in your web browser (check the IP with ifconfig):
The Plex interface will open and you can configure and add your music libraries.
Make Amazon Echo play your stuff
Open the Alexa app and add Plex skill to the list of skills. You will be asked to log in with your credentials. When the skill is enabled ask Alexa:
Alexa, ask Plex to set server?
And you are ready to stream music! Below, a list of the most popular Plex voice actions:
Adding more music
Preloading all the music on the USB stick makes sense as the Raspberry Pi network isn’t the fastest. You can also add the files via SFTP using Filezilla or similar software. Use the same credentials as you would with SSH to upload more music to the USB drive without removing it from the Raspberry Pi.
For about $35 (depending on the USB stick size) you could enable your Amazon Echo to stream the local files instead. The system works great if you don’t mind the “ask Plex” prefix. If you want to play video files at the same time, you probably want to upgrade to Rpaspberry Pi 3B series to get the dedicated Ethernet and more USB ports for your drives.