Building a Media Server with a Raspberry Pi for Streaming Music to a Galaxy S5
All I wanted to do was listen to my music and look at my rather large collection of photos, from a Linux notebook or my Galaxy S5 super phone. I wasn’t all that interested in streaming videos, since I don’t have very many. Watching online movie services like Netflix, didn’t appeal to me either.
This story outlines how I put together a basic system to stream music and give me access to my photo collection wirelessly, using a popular nano-computing platform. There’s a lot of possibilities for taking the project further, so feel free to use this as a starting point.
You’ll need a Raspberry Pi or a clone, the minidlna media server, a WiFi connection, some content on an external USB disk drive, a WiFi network adapter, and the Media House app for your Android phone.
Set Up The Server
I started with a Raspberry Pi clone, known as a Hummingboard, by Solid-Run. I used their high-end Hummingboard-i2eX model, with 1 GB of RAM, 2 USB ports, an i.MX6 Dual processor, and a wired Ethernet socket. The Hummingboard also has a micro-SD socket as opposed to the Pi’s normal SD type configuration. I used a copy of Debian Linux, instead of a more common Raspbian, because I had used in another project and didn’t . The distribution shouldn’t make much difference in performance or installation. I’ll assume that you have a basic Raspberry Pi or Hummingboard that’s attached to your local network and can access the board using ssh, from a Linux notebook.
Plug the big external USB drive and a network adapter into the two USB ports on the Hummingboard and apply power.
ssh into the Hummingboard (in my case it was just user: debian, p/w: debian), from your Linux notebook with the following, substituting whatever IP address the board is using.
rob% ssh -X email@example.com
I used the mini-dlna media server program because it’s easy to set up and pretty light weight. It’s new name is ReadyMedia. I’ll refer to it as mini-dlna, because that’s what it’s still called in all the package managers, including apt-get.
Back on the Hummingboard, install mini-dlna with the following command line.
debian% sudo apt-get install mini-dlna
After a little while mini-dlna will show that it’s been installed on the little nano-computer.
Connecting the external drive comes next. Create a new directory to use for your drive, on the Hummingboard. I called mine “bigdisk”.
debian% sudo mkdir /bigdisk
Next, mount the external drive (probably named /dev/sda1) to the directory, so mini-dlna can serve the files. Use the lsblk command to find the right device.
debian% sudo mount /dev/sda1 /bigdisk
The configuration file named /ect/minidlna.conf needs to be edited to tell minidlna where the music and photos reside.
debian% sudo vi /etc/minidlan.conf
Scroll down to the “Use a different container as the root of the directory tree” section. Comment out the “root_container=.” line and add the following.
Android UPnP/DLNA client programs, like MediaHouse, are then able to search from that directory downward to find music, photos, videos, etc.
Look for the “Path to the directory you want scanned for media files” section and add the following lines at the bottom of those comments.
These lines direct minidlna to scan through the directories and index the various music and image files, that alread existed on my external USB drive.
A little further down in the minidlna.conf file find the following and modify the lines accordingly.
“#network_interface=” change to “network_interface=wlan0” (you’d probably use eth0, if you are using the wired Ethernet port)
“#listening_ip=” change to “listening_ip=192.168.1.107” (use the address of your network interface).
“#inotify=” change to “inotify=yes”
“#friendly_name=” change to “friendly_name=hummingboard”
After making the changes, save and exit the minidlna.conf file.
Now update the mini-dlna database.
debian% sudo service minidlna force-reload
And, then restart minidlna.
debian% sudo service minidlna restart
Next, we’ll install and configure MediaHouse on the Galaxy S5 super phone.
Using MediaHouse On The Galaxy S5
Go to the Play Store and install the MediaHouse UpnP/DLNA Browser by Diwakar Bhatia on your Galaxy S5.
Make sure that your Galaxy is connected to the same local network as the minidlna media server and open the MediaHouse app.
You should immediately see a “Devices” screen and the “hummingboard” minidlna server name. Click on the name and it will take you to a screen with icons for Browse, Movies, Play Lists, and so on. Click Browse. You’ll then be able to choose between looking at the various folders or pictures and listening to music. The pictures and images you’ve saved on your external disk drive should all appear under the various directories.
Pictures are easy to view. Just go down through the directories and click on an image to view it.
Music works the same way. Traverse down through the directories and choose a song. A little player will come up where you can stop, pause, move ahead, and so on. Use the back button to move back up through the directories.
If you don’t see any files, you might have to restart the minidlna server.
debian% sudo service minidlna restart
I’ve only covered the basics for building a Raspberry Pi powered DLNA media server. Taking the idea further might include starting the server on boot up or adding the capability to upload music and photos to the machine. Other ideas might be to use it with a solid-state drive or running off of batteries. Combine the batteries with configuring the WiFi as an access point for a go-anywhere portable music server.