HowTo: Raspberry Pi – Use Raspberry Pi with “Raspotify” as a Spotify speaker

In the article RaspberryPi - Install "Shairport" Airplay on the RaspberryPi I have described how you can relatively easily expand your RaspberryPi to include the function of an AirPlay speaker.

Thanks to another cool open source project, it is also possible to use your RaspberryPi as a Spotify speaker. All you need is a connected speaker, the right software and a Spotify Premium account.

Everything you need 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:
Before you start with this article you should have prepared the RaspberryPi so that it is accessible via the network and controllable 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.

After entering your username and password you can enter the first commands.

Set up package source

First you have to prepare the package source of your RaspberryPi.

To do this, install the two packages "transport-https" and "curl" by entering the following command.

sudo apt install -y apt-transport-https curl

Now you first have to add the GPG key of the raspotify repository. To do this, enter the following command.

curl -sSL https://dtcooper.github.io/raspotify/key.asc | sudo apt-key add -v –

Once you have done this, you can add the actual repository to the package list. To do this, enter the following command.

echo 'deb https://dtcooper.github.io/raspotify raspotify main' | sudo tee /etc/apt/sources.list.d/raspotify.list

In order to retrieve the contents of the now updated package list, you must now enter the following command.

sudo apt update

Once this command has "run through", your package list is updated and "Raspotify is ready for installation.

It continues in the next paragraph. 🙂


Install Raspotify

The actual installation of "Raspotify" is done quickly thanks to the prepared package list.

To start the installation, simply enter the following command into the console of your Raspberry Pi.

sudo apt install -y raspotify

The installation should then run independently.

To start "Raspotify", simply enter the following command.

sudo systemctl start raspotify


checking the status

You can then use the command line tool "systemctl" to check whether "Raspotify" has started successfully.

To display the status of "Raspotify", simply enter the following command.

sudo systemctl status raspotify

Here you can now see whether "Raspotify" has started or could not be started, for example.


Set up autostart

To ensure that "Raspotify" starts automatically after restarting your RaspberryPi, you should now activate the autostart.

To do this, enter the following command into the console of your Raspberry Pi.

sudo systemctl enable raspotify


Start playback on your mobile phone

Now you can start your first test, because you should be able to use "Raspotify" even without further changes to the configuration. You will find further setting options for the Raspotify configuration in the next section.

To do this, (for example) open your Spotify app on your cell phone and click on the marked symbol in the playback view.

Your RaspberryPi should now appear in the list displayed. Once you have selected this, the audio output from Spotify should be redirected to your Raspotify speaker.


Customize configuration file

In the "Raspotify" configuration file, you can edit various settings such as the name of your Raspotify speaker.

To do this, open the Raspotify configuration file by entering the following command.

sudo nano /etc/default/raspotify

In the file you will find various configuration options. You can find the corresponding description of each option in the corresponding comment.

Among other things, you can also set the name of your Raspotify speaker here.

Simply change the parameter for "DEVICE_NAME" to your desired name.

For example:

DEVICE_NAME="MyLoudspeaker"


Restart Raspotify

After changing the configuration file, you must restart Raspotify for the changes to take effect.

You can restart Raspotify by entering the following command.

sudo systemctl restart raspotify


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. 🙂

Buy Me a Coffee at ko-fi.com       

Kommentar hinterlassen

Your email address will not be published. Erforderliche Felder sind mit * markiert

This site uses Akismet to reduce spam. Learn how your comment data is processed.