Make a Raspberry Pi Pandora Player with Web Interface

In this tutorial you will be making a Pandora music player with a Raspberry Pi that you, your family or friends can control through any device connected to your network through a web browser.

The web interface.


Enable the USB sound card

The Raspberry Pi defaults to the onboard sound. We need to change this to your USB sound card. We do this by creating /etc/asound.conf
sudo nano /etc/asound.conf
Paste the following code into asound.conf

[sourcecode language=”plain”]pcm.!default {
type hw card 1
ctl.!default {
type hw card 1

Save and exit. Now your USB sound card should be enabled.

Install NodeJS

First we need to add NodeSource packages to your apt repositories.
curl -sL | sudo -E bash -
Install NodeJS with apt.
sudo apt install nodejs

Install Packages

Our Pi will use a combination of Patiobar, Screen, and Pianobar to control Pandora and provide a web interface. Additionally, we’ll need git to install Patiobar.
sudo apt install pianobar screen git
Move to your home directory.
cd ~
Clone Pianobar’s git repository.
git clone
Change to newly created directory.
cd Patiobar

Configure Patiobar

Now we need to add your username and password to the configuration file.
nano ~/.config/pianobar/config
The file will look something like this.

[sourcecode language=”plain”]user = [email protected]
user = [email protected]
password = password
#autostart_station = 123456
audio_quality = high
event_command = /home/pi/Patiobar/
fifo = /home/pi/Patiobar/ctl
tls_fingerprint = FC2E6AF49FC63AEDAD1078DC22D1185B809E7534[/sourcecode]

Here you need to replace [email protected] with your Pandora user account and password with your password.
Save and exit.
If you haven’t created any stations on Pandora, go ahead and do so now.
Now launch Pianobar.
Pick a station from the list that you would like to use as the default station.
Pandora should start playing, you will see something like this.

The number that I highlighted in red you will need for the next step.
Edit your configuration file again.
nano ~/.config/pianobar/config
The line that reads,
#autostart_station = 123456
Should be replaced by the number highlighted in red from the previous step.
Save and exit.

Now launch pianobar again.
Now it should launch and play your default station.

Prepare Patiobar

We need to create a few scripts. First, we must make some preparations.
Make sure you are in the home directory.
cd ~
Make a new directory called bin
mkdir bin
Next we need to edit your .bashrc file to include bin in our PATH variable. This will allow the scripts we are about to make to be invoked from anywhere without needing the full path to the file.
nano .bashrc
Add this to the bottom of the file.
export PATH="$HOME/bin:$PATH"
Save and exit.
Process the changes you made by running,

Now let’s create a script to start Patiobar.
nano ~/bin/pbstart
Copy and paste the following into the new file.

[sourcecode language=”plain”]#!/bin/bash
cd /home/pi/Patiobar
# Kill any old Patiobar processes running
/home/pi/bin/pbstop 1> /dev/null
screen -S pianobar -d -m bash -c ‘pianobar’
# The "patiobar" in the end is not needed and is used as an identifier so we can kill it when stopping.
# Otherwise, we might kill other "node index.js" processes.
node index.js patiobar > /dev/null 2>&1 &
echo "Go to http://$(hostname):3000/ to launch the Web interface."

Next create another script called pbstop,
nano ~/bin/pbstop
Copy and paste the following into the new file.

echo Closing out Pandora processes…
pkill -xf ‘SCREEN -S pianobar -d -m bash -c pianobar’
pkill -xf ‘node index.js patiobar’
echo done

Now give permission for user pi to run the scripts.
chmod u+x ~/bin/pbstart
chmod u+x ~/bin/pbstop
Congratulations, you now have a Raspberry Pi Pandora player. Start the web interface and the Pandora backend (pianobar).
The music should start playing and you should now be able to navigate to the web interface to control Pandora on port 3000. Browse to your Pi’s ip address. Run ifconfig to find out your ip address.
ip addr show
Your ip address is listed as inet.
Browse on any device to http://ipaddress:3000


Issue the command pbstop to stop Pandora from streaming and close the web interface.

Start Pandora on Reboot

You may find it inconvenient to log in through SSH and issue the pbstart command. One solution is to have pbstart run on startup. Just be aware of your data usage.

Edit your rc.local file as root.
sudo nano /etc/rc.local
Above the last line, exit 0, insert:
sleep 15 && sudo -iu pi /home/pi/bin/pbstart
Save and exit.
Now test to see if it works by rebooting.
sudo reboot

For a more detailed explanation of all the steps and for troubleshooting tips check out

You can use a cheap Amazon Dash button as a next button. See my other tutorial at

Follow the steps, and use
sudo -u pi sh /home/pi/bin/pbstart
as your command.

Now your button should function as a next button.


On rare occasion, Patiobar will stop working due to Pandora’s TLS certificate expiration and renewal. To verify that this is the problem, run Paniobar.
If you receive the error, “TLS fingerprint mismatch”, then you are facing this problem.

First, copy the script provided with pianobar.
cp /usr/share/doc/pianobar/contrib/ .
Make it executable.
chmod u+x
Run the script
It should read something like:

Now edit your pianobar config file.
sudo nano /home/pi/.config/pianobar/config
Replace tls_fingerprint with the output of the last step.

Run pianobar again to see if the problem is resolved.

Leave a Comment

Your email address will not be published. Required fields are marked *