GMU:Autonomous-Collaborative/patchbox setup: Difference between revisions

From Medien Wiki
No edit summary
 
(23 intermediate revisions by the same user not shown)
Line 1: Line 1:
Objective: We want to be able to connect to the RaspberryPi with patchboxOS so we can connect to it via a local ethernet cable directly connected to the computer without any router. Steps to follow:
Objective: We want to be able to connect to the RaspberryPi with patchboxOS so we can connect to it via a local Ethernet cable directly connected to the computer without any router. Steps to follow:


# download the patchbox image and put it on SD card with Etcher
== Prepare the system ==
# setup fallback fixed IP if no DHCP server is in the network
download the patchbox os image and put it on SD card with Etcher.
## Method A: connect an HDMI monitor and USB keyboard to the RaspberryPi. Go to step 6 :)
#setup fallback fixed IP if no DHCP server is in the network
## Method B: connect Raspberry and Computer to a Router with DHCP.
## Method A: connect an HDMI monitor and USB keyboard to the RaspberryPi. Go to step 5 :)
## Method B: connect Raspberry and computer to a router with DHCP.
# open the terminal type <tt>ifconfig</tt> to see the local  IP address of the computer.
# open the terminal type <tt>ifconfig</tt> to see the local  IP address of the computer.
# type <tt>ping patchbox.local</tt> to see if the Rapberry is running and find its IP address. Tto stop the output press Ctl+Shift+C.
# type <tt>ping patchbox.local</tt> to see if the Raspberry is running and find its IP address. Tto stop the output press Ctl+Shift+C.
# type <tt>ssh -X patch@{IP-address}</tt> to connect to the Raspberry. (Replace the curly brackets with the IP adress from the previous step.) Default password of the user "patch" is "blokaslabs"
# type <tt>ssh -X patch@patchbox.local</tt> to connect to the Raspberry. Default password of the user "patch" is "blokaslabs"
# Follow the setup and change the password.
# Follow the setup and change the password.
# add a fallback static IP if no DHCP server is in the network: Type <tt>sudo nano /etc/dhcpcd.conf</tt> You are in a text editor now. Uncomment (remove the # symbol) the lines defining the fallback address like this https://wiki.archlinux.org/index.php/dhcpcd#Fallback_profile
# add a fallback static IP if no DHCP server is in the network: Type
sudo nano /etc/dhcpcd.conf
You are in a text editor now. Uncomment (remove the # symbol) the lines defining the fallback address like this https://wiki.archlinux.org/index.php/dhcpcd#Fallback_profile
 
Once that is done, you can connect to the internet and bring the OS up to date:
sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
sudo apt install -y patchbox-cli
 
== run config scripts ==
sudo patchbox-config
allows to set the password and the default soundcard
sudo raspi-config
lets you autologin to the console [https://maker-tutorials.com/raspberry-pi-benutzer-automatisch-anmelden-booten/#variante-raspi-config Source (German)].
Alternatively in the desktop go to menu -> Preferences -> Raspberry Pi Configuration -> System : Set Auto Login to true.
 
== Copy your files onto the RaspberryPi ==
to exit the ssh connection and return to the shell of your computer use the command
exit
change into the local directory of your patches
cd /Documents/Pd/path/to/patches
scp to copy the pd files to the RaspberryPi. ([http://www.hypexr.org/linux_scp_help.php Source])
scp startupPatch.pd patch@patchbox.local:/Pd/
For testing purposes our file is called startup.pd and looks like this:
[[File:startup-pd.png]]
 
==Make a startup script==
Note: There is an easier method through patchbox-config: select module puredata then selecting a patch in the directory <tt>/usr/local/puredata-patches/{your_name}/main.pd</tt> [https://community.blokas.io/t/script-for-launching-pd-patch-with-midi-without-aconnect/1010/19 see here]. It works, but the method below has the advantage that you can define the pd startup flags yourself.
 
Start the text editor "nano" ([https://tutorials-raspberrypi.com/raspberry-pi-autostart-start-program-automatically/ Source])
sudo nano /etc/init.d/startPdPatch
Paste the following:
#! /bin/sh
### BEGIN INIT INFO
# Provides: Pd patch startup
# Required-Start: $syslog
# Required-Stop: $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Pure Data Patch startup
# Description:
### END INIT INFO
case "$1" in
    start)
        echo "ending Jack"
        sudo systemctl stop jack
        sleep 3
        echo "Pd is starting"
        # Starting Programm
        pd -nogui -alsa -rt -r 44100 -channels 2 -audioadddev "USB AUDIO  CODEC (hardware)" /home/patch/Pd/startup.pd
        ;;
    stop)
        echo "Pd is ending"
        # Ending Programm
        killall pd
        ;;
    *)
        echo "Use: /etc/init.d/startPdPatch {start|stop}"
        exit 1
        ;;
esac
exit 0
 
then Ctl-O to save and Ctl-X to quit the editor.
 
To make the script executable, type:
sudo chmod 755 /etc/init.d/startPdPatch
 
== Test and make persistent ==
this should start the Pd patch:
sudo /etc/init.d/startPdPatch start
Ctl-c to abort
sudo update-rc.d startPdPatch defaults
Will schedule the script to be run at startup.

Latest revision as of 21:22, 16 August 2019

Objective: We want to be able to connect to the RaspberryPi with patchboxOS so we can connect to it via a local Ethernet cable directly connected to the computer without any router. Steps to follow:

Prepare the system

download the patchbox os image and put it on SD card with Etcher.

  1. setup fallback fixed IP if no DHCP server is in the network
    1. Method A: connect an HDMI monitor and USB keyboard to the RaspberryPi. Go to step 5 :)
    2. Method B: connect Raspberry and computer to a router with DHCP.
  2. open the terminal type ifconfig to see the local IP address of the computer.
  3. type ping patchbox.local to see if the Raspberry is running and find its IP address. Tto stop the output press Ctl+Shift+C.
  4. type ssh -X patch@patchbox.local to connect to the Raspberry. Default password of the user "patch" is "blokaslabs"
  5. Follow the setup and change the password.
  6. add a fallback static IP if no DHCP server is in the network: Type
sudo nano /etc/dhcpcd.conf

You are in a text editor now. Uncomment (remove the # symbol) the lines defining the fallback address like this https://wiki.archlinux.org/index.php/dhcpcd#Fallback_profile

Once that is done, you can connect to the internet and bring the OS up to date:

sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
sudo apt install -y patchbox-cli

run config scripts

sudo patchbox-config

allows to set the password and the default soundcard

sudo raspi-config

lets you autologin to the console Source (German). Alternatively in the desktop go to menu -> Preferences -> Raspberry Pi Configuration -> System : Set Auto Login to true.

Copy your files onto the RaspberryPi

to exit the ssh connection and return to the shell of your computer use the command

exit

change into the local directory of your patches

cd /Documents/Pd/path/to/patches 

scp to copy the pd files to the RaspberryPi. (Source)

scp startupPatch.pd patch@patchbox.local:/Pd/

For testing purposes our file is called startup.pd and looks like this: Startup-pd.png

Make a startup script

Note: There is an easier method through patchbox-config: select module puredata then selecting a patch in the directory /usr/local/puredata-patches/{your_name}/main.pd see here. It works, but the method below has the advantage that you can define the pd startup flags yourself.

Start the text editor "nano" (Source)

sudo nano /etc/init.d/startPdPatch

Paste the following:

#! /bin/sh
### BEGIN INIT INFO
# Provides: Pd patch startup
# Required-Start: $syslog
# Required-Stop: $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Pure Data Patch startup
# Description:
### END INIT INFO

case "$1" in
   start)
       echo "ending Jack"
       sudo systemctl stop jack
       sleep 3
       echo "Pd is starting"
       # Starting Programm
       pd -nogui -alsa -rt -r 44100 -channels 2 -audioadddev "USB AUDIO  CODEC (hardware)" /home/patch/Pd/startup.pd
       ;;
   stop)
       echo "Pd is ending"
       # Ending Programm
       killall pd
       ;;
   *)
       echo "Use: /etc/init.d/startPdPatch {start|stop}"
       exit 1
       ;;
esac

exit 0

then Ctl-O to save and Ctl-X to quit the editor.

To make the script executable, type:

sudo chmod 755 /etc/init.d/startPdPatch

Test and make persistent

this should start the Pd patch:

sudo /etc/init.d/startPdPatch start

Ctl-c to abort

sudo update-rc.d startPdPatch defaults

Will schedule the script to be run at startup.