Raspberry Pi Workshop

Raspberry Pi Workshop

Burning Raspbian to an (micro)SD Card

For Mac:

For Windows:

Download and install Etcher: https://etcher.io/

Flash the image

  1. Open Etcher
  2. Select the Raspbian image
  3. Select the drive to which you want to burn
  4. Double check your selections
    • This is critical, as you run the risk of overwriting the wrong drive (including your primary hard drive)
  5. Click “Flash!” and wait until Etcher writes and validates the image. This can take around 10 minutes.
  6. Once finished, eject your SD card

Ports

Plugging in your peripherals

  1. HDMI
  2. Keyboard and Mouse
  3. MicroUSB Power Supply (5V/2.1A)

Boot for the First Time

Get your MAC Address

  1. In the Raspberry Pi GUI, click the Terminal icon in the top left toolbar
  2. Run the command ifconfig
  3. Locate the wlan0 section and find and write down the HWaddr; it should look something like: b8:27:eb:00:00:00
  4. This is the MAC Address for your wireless adapter on the Raspberry Pi; you will use it to register the Pi on the network

Register with the CMU Legacy Network

  1. Go to https://netreg.net.cmu.edu/
  2. Enter and select the link to “Register New Machine”

Select the “Legacy Wireless Network” and click the in-line “Continue” button.

Enter a name for your Raspberry Pi

Enter the wlan0 MAC address from the raspberry pi

Now we wait…

Changing the Default Settings

  1. Open Raspberry Pi Menu > Preferences > Raspberry Pi Configuration

System

  1. Change Password
  2. Change Hostname
  3. Boot to CLI

Interfaces

  1. Set everything to enabled, except VNC

Reboot

Open Terminal and type

CRON

  1. Cron is a task scheduler
  2. You can add tasks to cron using the crontab

The command

will take you to the root crontab, meaning your tasks will run regardless of which user is logged in

You can also use special signifiers

A common example is to start a program a few seconds after startup:

Connecting to WiFi

  1. This is easiest to do in the GUI
  2. To enter the GUI from commandline mode, run the command startx
  3. Find the WiFi icon and select CMU

We are going to test to see if our connection has propagated by running the command

If it returns with a list similar to this:

then you are connected. If not, keep waiting.

SSH

  1. Once your pi is on the CMU network, you should be able to SSH into the device from your laptop
  2. Run the command (but fill in your own info)

    ssh $USER@$URL

for example ssh pi@hostname.wv.cc.cmu.edu

It will ask if you want to add this to the list of known hosts, type Yes

Updating Packages

Linux has a built-in package manager called apt-get

We need to update the list of package repositories:

Next, we want to get the newest versions of all our packages:

(this may take a while and require some user confirmation)

Installing Packages

Raspbian comes with Node.js installed, but the version is very old.

We need to add a new repository to our package manager:

Now, install Node.js:

Install and Configure Samba

Install Samba with:

Go to the Samba configuration folder:

Rename the configuration file (so we have a backup):

Make and edit a new one:

  1. Copy this into new file:

Set up a new password:

Restart the Samba service:

  1. On your Mac laptop, you can now mount the Raspberry Pi filesystem on your computer by going to Finder and typing ⌘+k
  2. Enter smb://pi@$yourIPAddress

Getting the example code

  1. Clone the repo to your Pi by running

    git clone https://github.com/Making-Things-Interactive/button-twitter.git

Raspberry Pi 3 Pinout

Project 02 — Monitor & Alert

Prompt

Watch [a] physical or digital source[s] and trigger a digital or physical alert. Your project must be physically durable.

Details

You will work in two-person groups to design, program and build a system that monitors some stream, signal, or state and alerts users when a specific threshold, event or change occurs.

The signal that you monitor can be physical or digital; you can watch a sensor or series of sensors in the physical world, or use an API to monitor events or signals on the web.

Likewise, the alerting component of your system can also be physical or digital; ringing a physical bell, popping a balloon, sending a series of text messages, emailing your local congressman… all fair game.

At least one of the two components must be physical. Robustness is a key part of this project; make your device droppable. Both the source and alert may be physical, if they communicate over a network.

This project continues to build your skills in rapid prototyping and basic electronics, and it exposes you to networked technologies such as APIs and web protocols.

Deliverables (Crit/Demo on 3/1)

  • A functioning system that completes the prompt
  • Documentation
    • A well-documented Git repo of all your code on GitHub
    • Photos of your process work (take these throughout)
    • Photos of your machine both stationary and in action
    • A step-by-step Instructables post walking a user through the process of building the system.
      • Only one post is necessary
      • Each team member must email a link to the post to Jake and John, accompanied by a brief explanation of their role in the project.

Examples

Nest Protect

Range Dial Thermometer

pplkpr by Lauren McCarthy and Kyle McDonald

The Deep Sweep by The Critical Engineering Working Group

Weather Service + IFTTT

blink(1)

Withings Aura

Project 01 — Artifactory

Prompt

Generate [a] physical artifact[s] from expressive user input

Details

You will work on your own to design and build your own machine that creates physical object[s] when given user input. The output must be tangible/holdable. The input can be physical (read by a sensor), or digital (for example: scraped from the web).

Combine parts like DC motors, Servos, and Stepper Motors with gears and linkages to create a drawing, jewelry, sculpture, etc. Read expressive input with analog sensors. Feel free to use parts from around the PhysComp lab, and found parts from local Pittsburgh stores, like PCCR, Goodwill Computer Works, and Construction Junction.

This project starts to build your skills in rapid prototyping, basic electronics, kinematics, and basic microcontroller programming.

Deliverables (Crit on 2/13)

  • A machine that completes the prompt
  • If possible, an assortment of your artifacts
  • Documentation
    • A well-documented Git repo of all your code on GitHub
    • Photos of your process work (take these throughout)
    • Photos of your machine both stationary and in action
    • An overhead step-by-step guide video/gif, similar in style to the instructional GIFs you might find on /r/GIFRecipes

Project 00

Complete as many sub-projects as you can, in order, before the next class:

  1. Draw a circle with a stroke and a fill in the center of the screen
  2. Draw 200 circles of increasing size and color value in a rectangular grid
  3. Animate a circle so it chases your cursor, like a ghost chasing after Pac-Man
  4. Draw three circles with different personalities that chase your cursor
  5. Build your own copy of Agar.io or Boomshine
  6. Animate two shapes with the following script (for inspiration: Heider and Simmel):
    1. Shapes enter scene
    2. Shapes begin discussion
    3. Shapes begin to bicker
    4. Shapes angrily walk away from each other, leaving the scene

  Deliverables:

  1. A Git repo (hosted on GitHub) with a separate folder for each sub-project
  2. All code for each project, liberally commented
  3. Screen recordings (video or GIF) of each sub-project