Class log
Note: “codebook” entries below are verbatim pasting of all of the code we used in class. It’s possible they may not compile (i.e. may have errors) if we left things unresolved, or were writing pseudocode, etc.
- #1 Monday Jan. 14th: intro
- #2 Wednesday Jan. 16th: bigger blinks
- #3 Wednesday Jan. 23rd: reading inputs, affecting outputs
- #4 Monday Jan. 28th: ins and outs
- №5 Wednesday Jan. 30th: –2ºF
- #6 Monday Feb. 4th: more ins and outs
- #7 Wednesday, Feb. 6th: Project 1 work day
- #8 Monday, Feb. 11th: Project 1 crit
- #9 Wednesday, Feb. 13th: Tech notes, Project 2, DSLR tutorial
- #10 Monday, Feb. 18th: First meetup
- #11 Wednesday, Feb. 20th: Ideation review
- #12 Monday, Feb. 25th: Guest speaker, prototype prep
- #13 Wednesday, Feb. 27th: Project 2 prototypes
- #14 Monday, March 4th: Project 2 work day
- #15 Wednesday, March 6th: Project 2 crit!
- #16 Monday, March 18th: welcome back, and timing and events
- #17 Wednesday, March 20th: design guest speaker; groups announced
- #18 Monday, March 25th: optional class
- #19 Wendesday, March 27th: prototyping meetings
- #20 Monday, April 1st: prototype work day
- #21 Wednesday, April 3rd: prototype work day
- #22 Monday, April 8th: prototype crit
- #23 Wednesday, April 10th: planning for final stretch
- #24 Monday, April 15th: final project work day 1
- #25 Wednesday, April 17th: final project work day 2
- #26 Monday, April 22nd: final project work day 3
- #27 Wednesday, April 24th: final project work day 4
- #28 Monday, April 29th: final presentations and critique
- #29 Wednesday, May 1st: debrief, clean up, and tech review
#1 Monday Jan. 14th: intro
- Class 1 deck
- Introduction to course content, policy, and housekeeping (with reference to the course website’s home page)
- Go around sharing names, identifiers, things people have built
- Quick overview of the Phys Comp Lab space (electronics, tools, resources, storage)
- Arduino Uno board tour (pins, components, ports, LED indicators)
- Navigating the Arduino IDE (Integrated Development Environment)
- Writing our first blinking sketch
- Homework 1 assigned, due at start of class 2
codebook: firstBlink
// make a light blink on and off
// let's use #13 since it has a built-in LED
void setup() { // stuff that happens once
pinMode(13, OUTPUT);
}
void loop() { // stuff that happens over and over
// to blink: 1) turn on, 2) turn off
digitalWrite(13, HIGH);
delay(500);
digitalWrite(13, LOW);
delay(100);
}
#2 Wednesday Jan. 16th: bigger blinks
- Class 2 deck
- Dan’s lab hours slot chosen: Tuesdays and Thursdays, 6:30–7:30 p.m.
- review of course policies
- review of Homework 1 projects
- circuit circle exercise using circuit stick
- series and parallel switch arrangements
- parts handed out and gathered from bins:
- Arduini
- medium breadboards
- male–male jumper wires
- LEDs
- 270Ω resistors
- wiring things with a breadboard
- Homework 2 assigned, due at start of class 3
#3 Wednesday Jan. 23rd: reading inputs, affecting outputs
- Class 3 deck
- Review of Homework 2 (individual)
- V=IR (Ohm’s Law relating voltage, current, and resistance)
C
int
andconst int
variables- comments in code are important
if...else
for logical branching
- wiring inputs
analogRead()
and a potentiometer- live data with
Serial
feedback
- Announcement: There’s a makerspace available to CMU students living in housing: Morewood Gardens Makerspace. 3D printers, a laser cutter, basic tools, an electronics bench, and even sewing equipment. The electronics bench has a soldering iron, oscilloscope, multimeter, power supply, hot air station, etc. Unfortunately, there are no parts, but there is hookup wire. It is open noon–midnight every day except for Saturday (noon–10pm).
codebook: simple Serial
printing of a value
// a "constant integer variable" won't change
const int POTPIN = A3;
void setup(){
pinMode(POTPIN, INPUT); // set pin as input
Serial.begin(9600);
}
void loop(){
// create a variable to store the analog read value
int potVal;
// read the potentiometer position
// and load its value into potVal
potVal = analogRead(POTPIN);
// print the value of potVal to the computer
Serial.println(potVal);
// the conditional!
// if the knob is turned mostly clockwise
if (potVal > 500) {
// turn on an LED
// only happens *if* potVal is greater than 500
}
else {
// only happens *if* potVal is *NOT* greater than 500
}
}
#4 Monday Jan. 28th: ins and outs
- review Homework 3
- review sample good schematic for Homework 3
- opportunity to redraw Homework 4 schematics based on feedback from Homework 3
- IDeATe spaces walking tour, including:
- FabLab (A5)
- lasers and 3D printers, too
- Media Lab (A10A)
- PhotoZone
- Lending booth
- wood shop
- FabLab (A5)
- new input: switch (and review button)
- new input: photoresistor
- assignment of Project 1: The Double Transducer
№5 Wednesday Jan. 30th: –2ºF
- all university classes canceled due to the latest Tri–Polar Vortex™ update being pushed
#6 Monday Feb. 4th: more ins and outs
- very fast tabletop review of Homework 4
- response to Project 1 ideation: sound as an input is difficult!
- how to find lab inventory and locate parts (start at this site’s useful links page)
analogWrite()
and PWM- can use 9V battery and barrel jack as power for Arduino
- new outputs:
- hobby servo motor course tutorial (and
map()
function) - I²C LCD display course tutorial
- hobby servo motor course tutorial (and
- new inputs:
- ultrasonic ranger course tutorial
- reflective infrared ranger course tutorial
- analog accelerometer course tutorial
- group consultations as time permits!
codebook: generic sketch formatting expectations
A generic example of properly formatted homework/project code.
This example code will turn on an LED when a potentiometer is above
a certain value, and vice versa.
/*
* Opening comment block addressing:
* * who you are
* * how long you spent on this assignment
*
* * whom you collaborated with (giving and/or receiving help)
* * what was challenging
* * what you'll do differently next time
*
* * what this code is intended to do
* * what inputs this code reads
* * what outputs this code writes to
*/
Global variables section, including pin assignments
Unchanging values like pin assignments should be saved into
constant variables and written in ALL_CAPS:
const int LEDPIN = 8;
const int POTPIN = A2;
Changing variables are written in camelCase:
int lightState = 0;
void setup() {
(all code that needs to run only once at power-on)
pinMode(LEDPIN, OUTPUT);
pinMode(POTPIN, INPUT);
}
void loop() {
(all code that runs over and over)
1) Read the state of the world
int potValue = analogRead(POTPIN);
2) Change any internal state variables as needed
if (potValue > 200){
lightState = 1;
}
else {
lightState = 0;
}
3) Make changes in the world
digitalWrite(LEDPIN, lightState);
}
int myFunction(char a, bool state){
(If you write your own functions, paste them below the
bottom of the loop(). There is no need to write function
prototypes in the global scope.)
}
#7 Wednesday, Feb. 6th: Project 1 work day
- please get 9V batteries and barrel jack adapters if you didn’t already have them
- settle on a design choice at the start of class
- tell me in person if you needed something ordered
- quick review of Project 1 documentation requirements
- additional RZ lab hours this week: Friday 1-4 p.m. (or email for an appointment at another time)
- work day!
#8 Monday, Feb. 11th: Project 1 crit
- projects presented in the arbitrary order that groups are listed on course site
- other announcements:
- homework #5 is due at 10 p.m. on Tuesday, Feb. 12th
- documentation for this project is due in a week
- bring your DSLR on Wednesday if you have one!
- all homework 4 to be graded and emailed out later today.
#9 Wednesday, Feb. 13th: Tech notes, Project 2, DSLR tutorial
- tech notes: data types on the Arduino:
bool
:0
or1
(i.e.false
ortrue
,LOW
orHIGH
)int
: whole numbers –32,768 –> 32,767long
: whole numbers –2,147,483,648 –> 2,147,483,647unsigned
versions of both of those:unsigned int
: whole numbers 0 –> 65,535unsigned long
: whole numbers 0 –> 4,294,967,295float
: any value –3.4028235E+38 –> 3.4028235E+38char
: a character likea
or%
String
: a series of characters likehey there
orA@8j0)
- tech notes: multimeter use
- as an ohmmeter: Ω
- and how to read color codes on a resistor
- as a continuity tester: little speaker symbol
- as a voltmeter: VDC
- as an ohmmeter: Ω
- introduction of Project 2: An Assistive Device for Someone You Know Very Well
- DSLR theory lesson and hands-on demo time
#10 Monday, Feb. 18th: First meetup
- shared ideation and getting-to-know-each-other session with our older friends
#11 Wednesday, Feb. 20th: Ideation review
- reminder: Project 2 prototype will be due in a week
- instructor/student conferences for ideation
#12 Monday, Feb. 25th: Guest speaker, prototype prep
- Homework 5 due at 9pm on Sunday, Feb. 24th
- Roly recruits ride operators for Carnival
- guest speaker Cassandra Masters, Age-Friendly Greater Pittsburgh Coordinator and PULSE Fellow, speaks about the older population in Allegheny County, building accessibility and livability for all, and related matters
- quick soldering and heat-shrinking demo
- Project 1 documentation (excepting code) is graded and I will post that after class. Code and schematic feedback to be handwritten by me, scanned, and emailed out to groups. Resubmissions for regrading of any aspect of documentation are possible through next Monday, March 4th.
- reminder: consumable materials (acrylic, wood/paper products) can be purchased using class funds from the IDeATe Lending Booth
- fabrication facilities reminders:
- IDeATe Open Fabrication Hours are Monday–Friday, 4:30–5:30 p.m. Student staff will help you use a laser cutter, 3D printer, etc. They are friendly and want to help!
- IDeATe Wood Shop is currently open 11 a.m.–6 p.m. on Wednesdays and Thursdays, but RZ can help you use the shop outside of those hours—just write me an email.
- work time: Project 2 prototype (really just evidence of meaningful work-in-progress) is due on Wednesday
#13 Wednesday, Feb. 27th: Project 2 prototypes
- Roly student presentation (recruiting volunteers for Carnival project) application link: http://www.bit.ly/oldmillrideops
- Project 1 regrading: make changes, email RZ. Due on Monday, 3/4
- Project 2 prototypes due
- Peer feedback on prototypes
- Instructor feedback on prototypes
- Work day
#14 Monday, March 4th: Project 2 work day
- Kelly Delaney, Assistant Director of IDeATe, will come by to speak quickly about IDeATe courses
- getting power to your project
- one good choice is a 5V wall supply to a jack in the side of your enclosure (attach the 5 volt input straight to the Arduino’s 5V to power it)
- or use a battery pack of 4 rechargeable AA batteries; these each provide 1.2V, so a 4-pack of them in series supplies 4.8V, which is close enough to 5V to work just fine
- work day
#15 Wednesday, March 6th: Project 2 crit!
- Table 1 deck for in-class feedback: https://docs.google.com/presentation/d/1TjRIPt7B7s-AlWGsspXW5arD0oebkRo1mRHPbp02dIk/edit?usp=sharing
- Table 2 deck for in-class feedback: https://docs.google.com/presentation/d/1H-WmGi8t3vVUHj6Tg80aoO4SHFziZfKEEAHtIyMUcfA/edit?usp=sharing
- Table 3 deck for in-class feedback: https://docs.google.com/presentation/d/1pDLXX52EZIMFX4JTZBVgC26sZ8tHcASLM3SwT2XtpH8/edit?usp=sharing
#16 Monday, March 18th: welcome back, and timing and events
- pictures of rocks I took over spring break (you are welcome)
- to “blink without blocking”: using event-loop programming to poll events on a schedule
- see Code bites: Blink without Blocking for example code developed before class; see codebook entry below for our in-class code
- using
INPUT_PULLUP
pin mode to save a resistor in your electronicspinMode(pin, INPUT_PULLUP)
will turn on an internal 20kΩ pull-up resistor inside the Arduino, which simplifies external wiring
- examples of stronger and less-strong documentation outcomes from last semester
- students in groups critique last semester’s Project 2 documentation, pointing out stronger and weaker aspects
- final project groups to be announced on Wednesday
- reminder: guest speaker on Wednesday (please aim to arrive on time)
- homework and documentation work time
- Homework 6: interview reading assigned; due Wednesday, March 20th
- Homework 7: events and timing assigned; due Wednesday, March 27th
codebook: event loop programming model
// "event loop programming"
// alternate one LED every second,
// alternate a 2nd LED every 1.5 seconds
// millis() returns the number of milliseconds since power on
unsigned long LED1timer = 0; // use unsigned long for timers
boolean LED1state = false;
unsigned long LED2timer = 0; // use unsigned long for timers
boolean LED2state = false;
void setup() {}
void loop() {
// if it has been one second, change the state of LED 1
if (LED1timer + 1000 >= millis()) {
Serial.println("flipping value of LED1");
LED1state = !LED1state; // flip the state variable
LED1timer = millis(); // reset the timer
}
// if it has been 1.5 seconds, change the state of LED 2
if (LED2timer + 1500 >= millis()) {
Serial.println("flipping value of LED1");
LED2state = !LED2state; // flip the state variable
LED2timer = millis(); // reset the timer
}
}
#17 Wednesday, March 20th: design guest speaker; groups announced
- Guest speaker Prof. Karen Berntsen from the Human-Computer Interaction Institute tells us about the design interview process
- Discussion of our own interview goals, with reference to the final project assignment page
- Announcement of final project groups, followed by random selection of design clients for each group; both of these pieces of information are recorded in an announcement on Canvas
- Reminder: Monday 3/25 class is optional to give groups time to meet with their clients
#18 Monday, March 25th: optional class
- groups given class time to meet with their design clients
#19 Wendesday, March 27th: prototyping meetings
- homework 7 grading and review
INPUT_PULLUP
pin mode- using state variables to track a change from one loop to the next (see codebook entry below)
- group conferences about interview results and prototyping ideation
codebook: debouncing to make a flip-flop
const int BUTTONPIN = 3;
const int LEDPIN = 5;
bool LEDstate;
bool oldButtonState;
void setup() {
pinMode(BUTTONPIN, INPUT_PULLUP);
pinMode(LEDPIN, OUTPUT);
}
void loop() {
int buttonState = digitalRead(BUTTONPIN);
// when button pressed, buttonState == LOW
// flip the state
// but only when the button went from unpressed to pressed
if ( !buttonState && oldButtonState ){
delay(50);
LEDstate = !LEDstate;
}
digitalWrite(LEDPIN, LEDstate);
oldButtonState = buttonState;
}
#20 Monday, April 1st: prototype work day
- teams work on prototype development
#21 Wednesday, April 3rd: prototype work day
- Note: a photographer from US News and World Report may swing through on Monday the 8th, during our formative critique. If you’d prefer not to be photographed, please let Zach know!
- If you need anything ordered, fill out the “IDeATe Course Purchase Request Form” (which is linked from the “Useful links” page to the left) and email Zach so he’ll be sure to get immediate notification.
- Monday’s presentations will use this deck
- As the prototype documentation will require many photos of your process…
#22 Monday, April 8th: prototype crit
Crit schedule:
- 9:30–9:45 a.m. instructor’s introduction
- 9:45–10:40 a.m. groups present to the class from this deck
- 10:30–11:20 a.m. group meetings with Osher clients
#23 Wednesday, April 10th: planning for final stretch
- Prototype documentation due at the start of class
- quick debrief from Monday’s prototype crit
- I’m behind in finishing grading Homework 7 (reading everyone’s code takes time), and regrading Project 2 final documentation. While you’re carnivalling tomorrow, that, plus grading the prototype documentation, is what I’m going to be doing
- possible brief visits from Prof. Paul Pangaro and TJ McLeish, who built a complete, functioning reproduction of Gordon Pask’s seminal Colloquy of Mobiles machine conversation system
- lots of practical considerations to consider (that’s a strange laundry list of thoughts)
- please collaborate as a group on a list of internal, group deliverables/deadlines/etc. in this Canvas assignment, which has no due date and carries no point value
- a Gantt chart with suggested tasks to help with scheduling (designed to print in landscape on 11”×17” paper)
- Naturally you should
#24 Monday, April 15th: final project work day 1
- all prior assignments should now be graded, including:
- Homework 7 (and prior homeworks)
- Project 2 regrading
- Final project prototype documentation If you have any outstanding grade or anything to discuss, talk to me!
- we’re two weeks out: a great time to return to your plan from last week, and make any adjustments you might think necessary to keep your team on track.
#25 Wednesday, April 17th: final project work day 2
- Please vote on when our final documentation is due: https://forms.gle/SZZpR2rH6wMaGvkw9
- Materials are coming in. It’s not too late to order more things—but let me know as soon as possible.
- I’ll be out Friday, but happy to make an appointment to meet with you or your group! Let me know.
#26 Monday, April 22nd: final project work day 3
#27 Wednesday, April 24th: final project work day 4
- On Monday, WESA science/health/tech reporter Sarah Boden will be joining us to do a radio story on our course and your projects. She will probably also take some pictures. If you don’t want to speak with her or appear in an image, please let me know, and I’ll pass that on to her.
- Monday format: like the prototype crit, but with rotation. I.e.:
- quick presentations to the room using this slide deck
- followed by rotating crits on a schedule, from table to table
#28 Monday, April 29th: final presentations and critique
#29 Wednesday, May 1st: debrief, clean up, and tech review
- debrief from the critique on Monday as well as overall project process
- RZ and Dan didn’t have time to actually see many of the projects on the 29th—we’ll do that briefly, to get as clear a sense as possible of the state of function and design from Monday’s crit
- final documentation is due on Friday, May 10th, at 5pm
- final projects to be handed off to RZ to give to their recipients on Monday, May 6th
- please be sure to talk with RZ about any oustanding grades, tying up loose ends, etc.
- A final reflection is posted on Canvas—I will not read these until I’ve already submitted your grade so please be as honest as possible! The sooner you submit this, the sooner I will work to compile and submit your final grade.
- cleanup protocol:
- you are welcome to keep all the contents of your course kit (as well as the box itself)
- you are encouraged to return any working components that you don’t plan to use
- if you’re not expecting to actually use any of your projects in the next few months, please just do the world a favor and disassemble them! For me to disassemble and reclaim parts will take a very long time; for you to do it on your own stuff will be much, much faster.
- please clear out the course shelves and any other storage areas you have used
- items left after noon on May 13th are subject to being discarded, absorbed into Lab stock, etc.