Motion Detected Music-Raspberry Pi

The end result of this project is for someone to walk by the Raspberry pi and have Pandora auto play automatically.

Step 1: Installing Pianobar

Run the following commands in the Lxterminal which can be accessed from the home screen
When copying command make sure their are no spaces after the command
sudo apt-get update
sudo apt-get install pianobar
Motion Detected Music-Raspberry Pi schematich schematich
Create and go into painobar configuration folder
mkdir -p .config/pianobar
cd .config/pianobarCreate the configuration file
nano config

Paste this into the configuration
# This is an example configuration file for pianobar. You may remove the # from
# lines you need and copy/move this file to ~/.config/pianobar/config
# See manpage for a description of the config keys
# User
user = [email protected]
password = password
# or
#password_command = gpg –decrypt ~/password

# Proxy (for those who are not living in the USA)
#control_proxy =

# Keybindings
act_help = ?
act_songlove = +
act_songban = –
act_stationaddmusic = a
act_stationcreate = c
act_stationdelete = d
act_songexplain = e
act_stationaddbygenre = g
act_songinfo = i
act_addshared = j
act_songmove = m
act_songnext = n
act_songpause = p
act_quit = q
act_stationrename = r
act_stationchange = s
act_songtired = t
act_upcoming = u
act_stationselectquickmix = x
act_voldown = (
act_volup = )

# Misc
#audio_quality = low
#autostart_station =
#event_command = /home/pi/.config/pianobar/scripts/
#fifo = /home/pi/.config/pianobar/ctl
#sort = quickmix_10_name_az
#love_icon = [+]
#ban_icon = [-]
#volume = 0

# Format strings
#format_nowplaying_song = [32m%t[0m by [34m%a[0m on %l[31m%r[0m%@%s
#format_nowplaying_station = Station [35m%n[0m
#format_list_song = %i) %a – %t%r

# high-quality audio (192k mp3, for Pandora One subscribers only!)
#audio_quality = high
#rpc_host =
#partner_user = pandora one
#partner_password = TVCKIBGS9AO9TSYLNNFUML0743LH82D
#device = D01
#encrypt_password = 2%3WCL*JU$MP]4
#decrypt_password = U#IO$RZPAB%VX2
tls_fingerprint = 2D0AFDAFA16F4B5C0A43F3CB1D4752F9535507C0

The login credentials are at the top of the file
Insert your login credentials
password = YOUR_PASSWORD
After you are done editing the file press CTRL O then CTRL M then CTRL X

Type CD to go out of the configuration folder
Run the command pianobar
To test that it is installed correctly

Step 2: Copy the configuration to the root folder

Make a directory in the root directory for the configuration file to go to
sudo mkdir /root/.config/pianobarCopy the file
sudo cp .config/pianobar/config /root/.config/pianobar Motion Detected Music-Raspberry Pi

Step 3: Edit Pianobar Config to autoplay a station

Start Pianobar using the command pianobar
When the station starts take note of the string of numbers beside the name of the station
Hit q to exit pianobarEdit the configuration for pianobar to auto play that station
sudo nano /root/.config/pianobar/config
Find the line that says
Remove the #

Paste the number on the right side
autostart_station = Numbergoeshere

Find the line that says
#volume = 0
Remove the #
Set the volume according to your speaker
5 is very quiet I wouldn't set it to loud at first

Again make sure their are not spaces after your lines in the configuration

After you are done editing the file press CTRL O then CTRL M then CTRL X



For more detail: Motion Detected Music-Raspberry Pi

About The Author

Ibrar Ayyub

I am an experienced technical writer with a Master's degree in computer science from BZU Multan University. I have written for various industries, mainly home automation, and engineering. I have a clear and simple writing style and am skilled in using infographics and diagrams. I am a great researcher and is able to present information in a well-organized and logical manner.

Scroll to Top