David Rios Fall 2024

Class Info

Tuesdays 9:30am
Room: 408
Instructor Email: rios@nyu.edu
Office Hours Calendar link (If times are unavailable or do not work for your schedule please email ! )

Class Blogs

Add your name and blog URL to this spreadsheet

Weekly Resident Workshops

P-comp:
Mondays 1:30p-3:30p
Fridays 2p-3:30p
@ ITP Shop / White Tables Near Shop

Fabrication:
TBD

ICM:
Thursdays 3:30p-5p @room 410
Mondays 12:30p-2p @room 408

Class Notes

Class 09 – Serial continued + Finals and Show

p5 Template (for general 2 way coms)
Prototyping and Planning
Show Info

p5 Example for Arduino Parsing multiple values (controlling 2 arduino outputs with p5 while also controlling p5 with 3 arduino inputs )

Arduino example below:

#include <Servo.h>

Servo motor;
int brightness = 255;
int angle = 0;

int counter = 0;

void setup() {
  Serial.begin(9600);
  pinMode(2, INPUT);
  pinMode(3, OUTPUT);
  motor.attach(9);
  Serial.setTimeout(10);
}

void loop() {
  int pot = analogRead(A0);
  int light = analogRead(A1);
  int button = digitalRead(2);

  if (Serial.available() > 0) {
    //int reading = Serial.read();
    int reading = Serial.parseInt();

    if (counter == 0) {
      brightness = reading;
      counter++;
      Serial.print(pot);
      Serial.print(",");
    } else if (counter == 1) {
      angle = reading;
      counter++;
      Serial.print(light);
      Serial.print(",");
    } else if (counter >= 2) {
      Serial.println(button);
      counter = 0;
    }
  }
  analogWrite(3, brightness);
  motor.write(angle);
}

Class 08 – Serial

Slides
p5.Webserial Library
David’s p5 template

int pot = 0;
int light = 0;
int button = 0;


void setup() {
  Serial.begin(9600);
  pinMode(A0, INPUT);
  pinMode(A1, INPUT);
  pinMode(2, INPUT);
}

void loop() {
  pot = analogRead(A0);
  light = analogRead(A1);
  button = digitalRead(2);

  if ( Serial.available() > 0 ) {
    int reading = Serial.read();
    Serial.print(pot);
    Serial.print(",");
    Serial.print(light);
    Serial.print(",");
    Serial.println(button);
  }
}

Class 07 – Midterms

Feedback Guidelines
Feedback Document

Class 06 – Motor

Slides:
Motors / Relays
Enclosures

From Projects:
I2S Sound Board Lab
Sensor Change / State Change Lab
OLED Screen Lab
Hayeon Hwang: Expressive Tactile Controls
Neil Mendoza: Spambots
Neil Mendoza: Electric Knife Orchestra
Mozzi Sound Library
Knob Feel

Class 05 – Midterm Check in

Extras:
Soft Button Tutorial
Sensor
Motors
I2S Lab

Class 04 – Analog

Questions Week 04
soldering
Soldering Sparkfun, Adafruit
Wirewrapping
Analog I/O Slides
Sensor
Tone , Servo, 5V?
Motors (maybe next week)

Class o3 – Digital I/O, Analog Input

Questions Doc
Slides? N/A
State Change, counters, Timers?
Soldering?

Code from Class

int button;
int pbutton;
int led1 = 3;
int led2 = 4;
int led3 = 5;
int counter = 0;


void setup() {
  Serial.begin(300);
  pinMode(2, INPUT);
  pinMode(led1, OUTPUT);
  pinMode(led2, OUTPUT);
  pinMode(led3, OUTPUT);
  pbutton = digitalRead(2);
}

void loop() {
  button = digitalRead(2);

  if (pbutton != button) {
    if (button == 0) {   
       counter++;      //not pressed
    } else if (button == 1) {  
      // pressed but do nothing for now
     
    }
    Serial.print("previous button: ");
    Serial.println(pbutton);
    pbutton = button;
  }

  if (counter == 0) {
    digitalWrite(led1, HIGH);
    digitalWrite(led2, LOW);
    digitalWrite(led3, LOW);
  } else if (counter == 1) {
    digitalWrite(led1, LOW);
    digitalWrite(led2, HIGH);
    digitalWrite(led3, LOW);
  } else if (counter == 2) {
    digitalWrite(led1, LOW);
    digitalWrite(led2, LOW);
    digitalWrite(led3, HIGH);
  } else if (counter == 3) {
    digitalWrite(led1, LOW);
    digitalWrite(led2, LOW);
    digitalWrite(led3, LOW);
  }


  if (counter > 3) {
    counter = 0;
  }
}

Class 02 – Circuits

Class 01 – Intro

Tips for using this site:

Tips adopted and amended from Jeff Feddersen:

With the ITP site, we’ve tried to do two things:

  1. Provide a week-by-week syllabus for the semester that takes you through the physical computing material in a logical progression. Each week has clear tasks, assignments for the following week, and links to labs, write-ups, and videos that support or explain the current material. Follow along here and you’ll be fine. A more concise table view can also be found here
  2. Provide an organized set of materials covering the core physical computing topics, to serve as a first resource for any questions you may have as you study the subject. These live under the Topics, Videos, Resources, and Labs tabs. These materials are also linked to from the syllabus, but here they’re organized by subject matter, whereas the week-by-week syllabus is chronological. Many of these resources are also not assigned or covered in labs so there are plenty of extras that are intended to help as you need it, or provide a starting point for something you may want to use later.

Doing the labs:

  1. Please make sure to budget enough time to read through each lab before plugging things in. Read everything first without trying to follow along. Then re-read and follow the appropriate steps with your kit and code in front of you.
  2. Class is flipped so the idea is to do the labs, write down any questions and bring those questions to class. We will discuss an review in class before moving to new content. 
  3. If you are having a lot of success with the labs and have no questions, try to figure out next steps eg”How can the lab be applied creatively or taken further?”. Apply what you learned to a mini project or question. Questions can be creative or technical.
  4. Bring your kits to class.  We will often do things in class and use parts from the shop
  5. There are parts in the labs that are not in the kits!  These parts are in the Yellow bins in the shop. 
  6. I recommend doing your labs at ITP, we have a lot of resources and things that are hard to find in the outside world.
  7. Make sure you know what you need for the labs if you are not doing homework at ITP
  8. Talk to Adrian at the front desk to get a red bin.  These are used to store things on the floor Adrian can help you get a red bin and a locker if you want one. You can also email him am13084@nyu.edu

Arduino References

Pin out diagram of the Arduino Nano 33 IoT
Labelled Pin out diagram of the Arduino Nano 33 IoT

Windows Driver Installation for Arduino

Resources:

Ordering parts and Suppliers
How to read a schematic
Resistor Calculator