A/V PI

OFFICE HOURS
PURE DATA
TERMINAL COMMANDS
EXERCISE FILES
PI PINOUT
GPIO, USB, AND SERIAL CONFIGURATIONS
SELECTED MICROCONTROLLER PINOUTS
P5 (ONLINE PROCESSING AP – FOR TESTING AND PRACTICE)

June 13th – July 25th, 2020
Saturdays, 1 – 4 pm CDT
7 class sessions total + dadageek Exhibition on Aug 1st

GOALS

  • Become familiar with Linux OS, terminal commands, shell scripts, and basic Python scripting
  • Learn DSP, data control, and video processing with Pure Data
  • Learn how to design GUIs and responsive visuals using Processing
  • Become Familiar with the Raspberry Pi architecture and GPIO in order to develop projects
  • Automate and facilitate communication between applications and the OS and in between applications using protocols, shell scripts, and python

PROJECTS

  • Control a Pure Data patch with a GUI designed with Processing
  • Make a responsive animation in Processing and control it with Pure Data
  • Create two windows in Processing with one that has a responsive animation and one that has a GUI to control it
  • Run Pure Data in -nogui mode and have it drive the sound component to the project above.
  • Create an autoloading script to run your project on boot or create a clickable shortcut that runs a lunching script for your project
  • Add a shutdown button to the Pi, integrate an Arduino, a webcam, and/or an HID device to your project

WEEK 1

  • SET UP PI
    Connect to Wifi
    Download, install, and setup VNC Viewer on Mac or PC
    Connect VNC Viewer on Mac/PC to VNC Server on Pi
    Connect Virtual Desktop (Virtual Mode) for larger screen resolution
    Install controlP5 Library into Processing
  • REVIEW PI OS – GUI and Terminal
  • PD INTRO
    PD CONTROL LEVEL
    PD SUPER BASIC SYNTHESIS
  • PROCESSING INTRO
    PROCESSING: Libraries and Example Projects

ZOOM RECORDING

WEEK 2

* BEFORE WE START*

FIX ERROR MESSAGE IN TERMINAL – copy and paste code below into terminal and press ENTER

sudo nano /etc/bash.bashrc

GOAL: BUILD SIMPLE SYNTHESIZER IN PD AND CONTROL IT WITH A GUI IN PROCESSING

ZOOM RECORDING

WEEK 3

There is no must in art because art is free.

– Wassily Kandinsky, 1866-1944, Russian, composer, painter, art theorist, credited with painting the first purely abstract works

ZOOM RECORDING

SHUTDOWN BUTTON SCRIPT

Add a single momentary type switch between GRND and GPIO21
In the terminal type

sudo nano /boot/config.txt

With the Nano Editor open, use the arrow keys to scroll all the way down to the end of the doc and paste the following line of the script

dtoverlay=gpio-shutdown,gpio_pin=21

SETTING UP PATHS TO EXTERNALS IN PD


ALWAYS DOUBLE CHECK AND MAKE SURE THAT THE PATHS ARE CORRECT. DELETE THE ONES THAT ARE NOT.


LAUNCHING SHORTCUTS

Week 4

ZOOM RECORDING

Week 5

ZOOM RECORDING

Week 6

INSTALL OFELIA WITH DENKEN
– With PD open select HELP/FIND EXTERNALS
– Type OFELIA into the search field and click to install the latest distribution

ZOOM RECORDING

Week 7

PDUINO OBJECT (USE OLDEST VERSION OF FIRMATA) – EXAMPLE
ARDUINO SERIAL OBJECT – SERIAL WRITE AND SERIAL PRINT
TOUCH OSC – EXAMPLE

ZOOM RECORDING

Resources

Video and Kinetic Art History, Theory, and Practice

Dialogues with Machines
History of Television
Handmade Cinema
Video Circuits (FB Page)
Vector Synthesis
Signal Culture

Work Samples

Kandinsky
Optical Poem – Oskar Fischinger 
Norman McLaren
John Whitney
Jordan Belson
Barbara Sykes
Robert Breer
Tony Conrad
Cornelius Cardew
Iannis Xenakis
Rainer Wehinger

Analog Input from MPC3008 IC to GPIO using I2C

  • PIN 16 – +3
  • PIN 15 – +3
  • PIN 14 – GRND
  • PIN 13 – SPISCLK
  • PIN 12 – SPIMISO
  • PIN 11 – SPIMOSI
  • PIN 10 – SPICS0
  • PIN 9 – GRND
  • PIN 1 – 8 ANALOG INPUTS
Image result for MPC3008

Set up RASPBERRY PI SD Card Image

  • Download the zip file for your Raspberry Pi disk image (avpi2020.dmg) 
  • It will take some time so while its downloading download and install the following software
  • SD Memory Card Formatter(MAC) or SD Memory Card Formatter(PC)
  • BalenaEtcher
  • After the disk image is downloaded put it somewhere safe on your computer
  • With your blank SD card connected to your card reader which connected to your computer, open SD Memory Card Formatter and do a quick format of your SD card
  • Open BalenaEtcher and click on SELECT IMAGE to select the unzipped Raspberry Pi disk image that you downloaded  avpi2020.dmg
  • Click on SELECT DRIVE to select your formatted SD card
  • Click on FLASH and wait for it to flash the SD card
  • When it is complete remove the SD card and then put it back into the reader. A disk volume with the name Boot should be mounted
  • Your SD card is now ready to be inserted into your Raspberry Pi, however, if you decide to boot your Pi before our first class meeting, please do not make any changes to files or the file structure before we start. We don’t want to spend class time troubleshooting individual problems caused by changes made to the current setup.

Clone a Backup of your Pi SD Card from Pi

  • Plug your SD card reader into your computer
  • Download SD Card Formatter
  • Put the SD card into the reader and format the SD card with SD Card Formatter application
  • Put SD card reader into Pi with the formatted SD card inside
  • On Pi use the Raspberry Pi Menu/Accessories/SD Card Copier
  • Copy from: Pi’s drive
  • Copy to: external SD card
  • Click Start and wait for it to copy
  • Always have a backup of your SD card before you make changes to files that will affect your OS

Set up Pi to Run on Boot

Back up you SD card

Make a folder called “scripts” in the /home/pi directory

In the terminal type: 

sudo nano /home/pi/scripts/launch_app_script

With nano open add the following code:

# This script will start Pd in nogui (without gui) 
# And it will open PD patch, "masterPlayer.pd"  

 echo "Starting Pd..." 
 pd -nogui  /home/pi/patches/masterPlayer.pd &

control/x: to exit
y: to commit changes
enter: to exit nano back to the terminal

Now we need to tell the Pi to launch our script at start-up. To do this, we have to edit a file called “rc.local”. 

Open “rc.local” in the nano editor by typing the following in the terminal:

sudo nano /etc/rc.local

Add the following line after the first comments (comments start with a #) :

. /home/pi/scripts/launch_app_script

control/x: to exit
y: to commit changes
enter: to exit nano back to the terminal

Once you’ve saved that file, you have to make it ‘executable’ by typing the following in the terminal:

sudo chmod 755 /home/pi/scripts/launch_app_script

Now, you should be able to test it by typing the following command into the terminal:

/home/pi/scripts/launch_app_script

On reboot, PD should launch in headless mode (no gui)
If you open the terminal, you will see PD activity.
You may also want to disconnect the Raspian gui completely in your Pi settings. This will take less processing power if you aren’t running Processing or anything else that needs a gui.

RASPBERRY PI RESOURCES

SSH INTO PI ON MAC:

ssh-keygen -R pi11.local
  ssh pi@pi11.local

USEFUL TERMINAL COMMANDS

  • sudo nano /etc/dhcpcd.conf: edit ethernet and wifi settings with nano
  • ssh pi@192.168.0.200: ssh via static IP
  • ssh pi@raspberrypi.local: ssh via without static IP

KEY COMMAND SHORTCUTS

  • Ctrl+B: Moves the cursor backward one character.
  • Ctrl+C: Cancels the currently running command.
  • Ctrl+D: Logs out of the current session.
  • Ctrl+F: Moves the cursor forward one character.
  • Ctrl+H: Erase one character. Similar to pressing backspace.
  • Ctrl+P: Paste previous line(s).
  • Ctrl+S: Stops all output on-screen (XOFF).
  • Ctrl+Q: Turns all output stopped on-screen back on (XON).
  • Ctrl+U: Erases the complete line.
  • Ctrl+W: Deletes the last word typed. For example, if you typed ‘mv file1 file2’ this shortcut would delete file2.
  • Ctrl+Z: Cancels current operation, moves back a directory or takes the current operation and moves it to the background. See bg command for additional information about background.

GENERAL COMMANDS

  • apt-get update: Synchronizes the list of packages on your system to the list in the repositories. Use it before installing new packages to make sure you are installing the latest version.
  • apt-get upgrade: Upgrades all of the software packages you have installed.
  • clear: Clears previously run commands and text from the terminal screen.
  • date: Prints the current date.
  • find / -name example.txt: Searches the whole system for the file example.txt and outputs a list of all directories that contain the file.
  • nano example.txt: Opens the file example.txt in the Linux text editor Nano.
  • poweroff: To shutdown immediately.
  • raspi-config: Opens the configuration settings menu.
  • reboot: To reboot immediately.
  • shutdown -h now: To shutdown immediately.
  • shutdown -h 01:22: To shutdown at 1:22 AM.
  • startx: Opens the GUI (Graphical User Interface).

FILE AND DIRECTORY COMMANDS

  • cat example.txt: Displays the contents of the file example.txt.
  • cd /abc/xyz: Changes the current directory to the /abc/xyz directory.
  • cp XXX: Copies the file or directory XXX and pastes it to a specified location; i.e. cp examplefile.txt /home/pi/office/ copies examplefile.txt in the current directory and pastes it into the /home/pi/ directory. If the file is not in the current directory, add the path of the file’s location (i.e. cp /home/pi/documents/examplefile.txt /home/pi/office/ copies the file from the documents directory to the office directory).
  • ls -l: Lists files in the current directory, along with file size, date modified, and permissions.
  • mkdir example_directory: Creates a new directory named example_directory inside the current directory.
  • mv XXX: Moves the file or directory named XXX to a specified location. For example, mv examplefile.txt /home/pi/office/ moves examplefile.txt in the current directory to the /home/pi/office directory. If the file is not in the current directory, add the path of the file’s location (i.e. cp /home/pi/documents/examplefile.txt /home/pi/office/ moves the file from the documents directory to the office directory). This command can also be used to rename files (but only within the same directory). For example, mv examplefile.txt newfile.txt renames examplefile.txt to newfile.txt, and keeps it in the same directory.
  • rm example.txt: Deletes the file example.txt.
  • rmdir example_directory: Deletes the directory example_directory (only if it is empty).
  • scp user@10.0.0.32:/some/path/file.txt: Copies a file over SSH. Can be used to download a file from a PC to the Raspberry Pi. user@10.0.0.32 is the username and local IP address of the PC, and /some/path/file.txt is the path and file name of the file on the PC.
  • touch example.txt: Creates a new, empty file named example.txt in the current directory.

NETWORKING AND INTERNET COMMANDS

  • ifconfig: To check the status of the wireless connection you are using  (to see if wlan0 has acquired an IP address).
  • iwconfig: To check which network the wireless adapter is using.
  • iwlist wlan0 scan: Prints a list of the currently available wireless networks.
  • iwlist wlan0 scan | grep ESSID: Use grep along with the name of a field to list only the fields you need (for example to just list the ESSIDs).
  • nmap: Scans your network and lists connected devices, port number, protocol, state (open or closed) operating system, MAC addresses, and other information.
  • ping: Tests connectivity between two devices connected on a network. For example, ping 10.0.0.32 will send a packet to the device at IP 10.0.0.32 and wait for a response. It also works with website addresses.
  • wget http://www.website.com/example.txt: Downloads the file example.txt from the web and saves it to the current directory.

SYSTEM INFORMATION COMMANDS

  • cat /proc/meminfo: Shows details about your memory.
  • cat /proc/partitions: Shows the size and number of partitions on your SD card or hard drive.
  • cat /proc/version: Shows you which version of the Raspberry Pi you are using.
  • df -h: Shows information about the available disk space.
  • df /: Shows how much free disk space is available.
  • dpkg – –get–selections | grep XXX: Shows all of the installed packages that are related to XXX.
  • dpkg – –get–selections: Shows all of your installed packages.
  • free: Shows how much free memory is available.
  • hostname -I: Shows the IP address of your Raspberry Pi.
  • lsusb: Lists USB hardware connected to your Raspberry Pi.
  • UP key: Pressing the UP key will print the last command entered into the command prompt. This is a quick way to repeat previous commands or make corrections to commands.
  • vcgencmd measure_temp: Shows the temperature of the CPU.
  • vcgencmd get_mem arm && vcgencmd get_mem gpu: Shows the memory split between the CPU and GPU.

RASPI STATIC IP SETUP

https://www.raspberrypi.org/learning/networking-lessons/rpi-static-ip-address/

VNC VIEWER SETTUP

  1. Turn your Mac’s wifi off
  2. Select file/new connection
  3. VNC Server: pi11.local (or your unique static IP address IE 192.168.0.200)
  4. NAME: pi11.local (or your unique static IP address IE 192.168.0.200)
  5. Click OK
  6. Click on the graphic that it makes
  7. USER NAME: pi
  8. PASSWORD: pi11
  9. Check Remember Password
  10. Click OK

Adding/Removing Software



TYPE INSIDE OF THE SEARCH FIELD ON THE TOP LEFT, SELECT APP PACKAGES THAT YOU WANT, AND CLICK “APPLY

LINKS

Accelerometer Tutorial

https://www.realvnc.com/en/connect/download/viewer/

RASPBERRY PI

GPIO Recipes

https://learn.sparkfun.com/tutorials/connecting-arduino-to-processing/all

https://www.raspberrypi.orgh

https://www.techrepublic.com/article/everything-you-need-to-know-about-the-raspberry-pi-3-model-b-a-guide-to-the-fastest-pi-yet/

https://www.c-sharpcorner.com/article/anatomy-of-raspberry-pi/

PURE DATA

https://puredata.info/

http://www.pd-tutorial.com/english/index.html

https://booki.flossmanuals.net/pure-data/list-of-objects/introduction.html

PD FACEBOOK GROUP

PURE DATA GEM FACEBOOK GROUP

PROCESSING

https://pi.processing.org/get-started/

controlP5

PI PINOUT

Highlighted GPIO pins are whats left after LCD screen is attached