The cheap and tiny Raspberry Pi seems suited for projects requiring a tiny “headless” computer. Headless means without a screen, and thus implies that one or more applications have to start automatically on start-up. Linux is embeded extensively in many devices, and can be configured to do a job in auto-pilot mode.
This is all very cool, but until recently I had no idea how to go about using the Raspberry Pi as a headless device. Fortunately, I came accross this free book by William E. Shotts, Jr., and I learned a few helpful things. Below is short tutorial that’ll help you run a Pd patch on a headless Raspberry Pi running Raspbian (we’re assuming that your patch can output audio without your input, that it’s called “nicorette.pd”, and that it’s in your Desktop folder. You can change this of course).
1) Start your RPi, enter your login and password (pi and raspberry if you haven’t changed them), and DON’T type “startx”. We’ll do everything with the command line.
2) Create a /bin folder in your home/pi folder by typing this :
mkdir ./bin (hit enter)
3) Move to this folder by typing :
4) Create a file in this folder named “script_pd” (or whatever you want to call this) :
sudo nano script_pd (this opens a blank text file in the nano editor)
5) In the nano editor, type this script :
# This script will start Pd in nogui
# mode and will open the patch
# named "nicorette.pd"
echo "Starting Pd..."
pd -nogui /home/pi/Desktop/nicorette.pd &
6) Save your script by pressing Ctrl+X, hitting y, and Enter.
7) This script is still nothing but a text file. We need to make it executable by typing this :
sudo chmod 755 script_pd
(7-bis) You can check that your script is working by typing “/home/pi/bin/script_pd” and pressing Enter. You should see “Starting Ps…” and your patch should start. You’ll need to reboot your RPi to turn Pd off)
8) Now we need to tell the RPi to launch our script at start-up. To do this we have to edit a file called “rc.local”. Open it in the nano editor with :
sudo nano /etc/rc.local
9) Add the following line after the first comments (comments start with a #) :
10) Save and quit nano (Ctrl+X, y, Enter). Anything that’s in this rc.local file is executed at start-up. We’ve simply asked to run our script to launch Pd when we start our Raspberry Pi.
11) You can reboot your RPi, and if all went well, it should work. Note that you can still type commands while Pd is running (for instance, you can kill pd by typing “sudo killall pd” and hitting Enter).