Especially if your RaspberryPi spends most of the day in standby mode, it makes sense to give it tasks other than those originally intended.
This is what happened, for example, with the RaspberryPi that I use for my MagicMirror. It takes over the display of current content for my MagicMirror in the bathroom. Apart from this task, however, it doesn't actually have much to do. So the first thing I thought of was: why not use the RaspberryPi as an Internet radio? Brushing your teeth, showering and so on are definitely more fun with music.
While searching for a suitable solution for integrating an Internet radio, I soon came across the possibility of expanding the RaspberryPi with a DLNA streaming client.
All you need to do is connect an active speaker to the RasperryPi and install and configure the appropriate software.
How to do this and what you need to consider is described in the following article.
Safety instructions
I know the following notes are always kind of annoying and seem unnecessary. Unfortunately, many people who knew "better" have lost eyes, fingers or other things due to carelessness or injured themselves. Data loss is almost negligible in comparison, but even these can be really annoying. Therefore, please take five minutes to read the safety instructions. Because even the coolest project is not worth injury or other trouble.
https://www.nerdiy.de/sicherheitshinweise/
Affiliate links/advertising links
The links to online shops listed here are so-called affiliate links. If you click on such an affiliate link and make a purchase via this link, Nerdiy.de will receive a commission from the relevant online shop or provider. The price does not change for you. If you make your purchases via these links, you support Nerdiy.de in being able to offer other useful projects in the future. 🙂
Requirements
Helpful articles:
So that you can install a DLNA client on your RaspberryPi, it should of course be prepared so that you can access it via SSH.
The following three articles describe what needs to be done to prepare the RaspberryPi:
RaspberryPi – setup for nerdiys!
RaspberryPi – The first configuration!
RaspberryPi – Control the RaspberryPi via SSH
Required tool:
-no-
Required material:
In the following list you will find all the parts you need to implement this article.
Log in to the RaspberryPi via SSH
To start, you must first log in to the Rasp Pi with Putty via SSH. How to do this is in the article RaspberryPi - Control the RaspberryPi via SSH described.
Update package management
The package management in Linux is a "central place" through which various software packages can be installed. In order for this to work reliably, the lists and sources of the package management should be updated before each installation of new packages.
sudo apt-get update && sudo apt-get upgrade
Install the required packages
sudo apt-get install libupnp-dev libgstreamer1.0-dev gstreamer1.0-libav gstreamer1.0-plugins-* -y
sudo apt-get install gstreamer0.10-plugins-* pulseaudio -y
Create folders and clone software from a GIT repository
Now you have to download the actual program files of the "gmrender" from the corresponding GitHub.
mkdir dlnaClient
cd dlnaClient
git clone https://github.com/hzeller/gmrender-resurrect.git
Execute automatic configuration
In this step you have to execute a few of the configuration scripts provided.
cd gmrender-resurrect
./autogenous.sh
./configure
Build or compile software
This step is about compiling and installing the "gmrender".
make
sudo make install
Setting the audio sources
gconftool-2 -t string --set /system/gstreamer/0.10/default/audiosink pulsesink
gconftool-2 -t string --set /system/gstreamer/0.10/default/audiosrc pulsesrc
gconftool-2 -t string --set /system/gstreamer/0.10/default/musicaudiosink pulsesink
Setting the Alsamixer volume
In this step, you "turn up" the output volume of the RaspberryPi to the maximum level. Don't worry: The volume can be adjusted later via the "music transmitter". However, to ensure that you have the maximum available volume range, it makes sense to set the maximum volume in the RaspberryPi.
alsamixer
Setting the autostart of the software
To ensure that the DLNA client starts automatically the next time the RaspberryPi is restarted, you can activate the autostart.
sudo crontab -e
@reboot pulseaudio --start @reboot /home/pi/dlnaClient/gmrender-resurrect/src/gmediarender -f "RaspiDlna"
Carry out an initial test
Thanks to standardization, you can feed the installed DLNA client from different sources. One option is to use a smartphone with the appropriate app.
You can find an app for Android that works well in the PlayStore under "Hi-Fi Cast Music Player". There are also corresponding apps for Apple devices. Search here for apps that support DLNA or UPNP. You can now test the output on the RaspberryPi with one of these apps.
Have fun with the project
I hope everything worked as described for you. If not or you have questions or suggestions please let me know in the comments. I will then add this to the article if necessary.
Ideas for new projects are always welcome. 🙂
PS Many of these projects - especially the hardware projects - cost a lot of time and money. Of course I do this because I enjoy it, but if you think it's cool that I share the information with you, I would be happy about a small donation to the coffee fund. 🙂