week 02 - coursescourses.ischool.berkeley.edu/i290-4/f08/slides/...thursday week 2: physical...

Post on 05-Aug-2020

1 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Thursday Week 2: Physical Computing Theory and Practice of Tangible User Interfaces

1

Physical ComputingBridging the gap between the physical and virtual

week

02

Thursday Week 2: Physical Computing Theory and Practice of Tangible User Interfaces

2

How the Computer Sees Us

Shall we take a better look at ourselves to see our full range of expression?

Illustration from O’Sullivan and Igoe

Thursday Week 2: Physical Computing Theory and Practice of Tangible User Interfaces

3

Physical Computing

A conversation between the physical world and the virtual world of the computer.

Thursday Week 2: Physical Computing Theory and Practice of Tangible User Interfaces

4

Physical Computing

A conversation between the physical world and the virtual world of the computer.

TransductionThe conversion of one form of energy into another

Physical energy

Electric signals

Thursday Week 2: Physical Computing Theory and Practice of Tangible User Interfaces

5

Input

Ways of sensing your physical energy/expressions. Input is usually easier than output because it takes less energy to sense activity than to move things.

Input and Output

Thursday Week 2: Physical Computing Theory and Practice of Tangible User Interfaces

6

Output

Physical computing is not just about sensing the world, but also about changing it. But moving things are hard (you need electrical and mechanical skills).

Input and Output

Thursday Week 2: Physical Computing Theory and Practice of Tangible User Interfaces

7

Transducers

output transducersActuators (e.g., motors, buzzers)

input transducerssensors (e.g., switches, levers, sliders, etc.)

Arduino

Illustration adapted and modified from O’Sullivan and Igoe

Thursday Week 2: Physical Computing Theory and Practice of Tangible User Interfaces

8

Microcontrollers

Arduino

Illustration adapted and modified from O’Sullivan and Igoe

1) Receiving information from sensors, 2) controlling basic motors and other devices that create physical change, and 3) sending information to computers and other devices.

Gateway between the physical and the virtual

Thursday Week 2: Physical Computing Theory and Practice of Tangible User Interfaces

9

Transduction

output transducers

input transducers

Arduino

Adapted and modified from O’Sullivan and Igoe

Your job is to find and learn to use transducers to convert between the physical energy appropriate for your project and the electrical energy used by the computer!

Thursday Week 2: Physical Computing Theory and Practice of Tangible User Interfaces

10

Digital and Analog

Digital signal

Difference between two possible states

“whether or not”

Is the cat on the mat or not?

Analog signal

continuous range of possible states

“how much” or “stronger” “faster” “brighter”

How heavy is the cat that’s on the mat?

Thursday Week 2: Physical Computing Theory and Practice of Tangible User Interfaces

11

Word of Caution: Your Idea is Important

1. Don’t get trapped in technological seduction

2. Don’t spin your wheels for so long that you give up your project. There might be an alternative way that makes things easier.

Work at a high level. Talk to us. Ask other people. Take frequent breaks.

From O’Sullivan and Igoe

Thursday Week 2: Physical Computing Theory and Practice of Tangible User Interfaces

12

Working with ArduinoAn open-source electronics prototyping

Create interactive objects and environments

Thursday Week 2: Physical Computing Theory and Practice of Tangible User Interfaces

13

What is Arduino

A tiny computer you can program, for rapid prototyping

Thursday Week 2: Physical Computing Theory and Practice of Tangible User Interfaces

14

Arduino as an Interface Board

Illustration adapted and modified from O’Sullivan and Igoe

Arduino

Thursday Week 2: Physical Computing Theory and Practice of Tangible User Interfaces

15

Arduino as an Interface Board

Illustration adapted and modified from O’Sullivan and Igoe

Arduino

Thursday Week 2: Physical Computing Theory and Practice of Tangible User Interfaces

16

Arduino as an Embedded Computing Device

Illustration adapted and modified from O’Sullivan and Igoe

Arduino

Thursday Week 2: Physical Computing Theory and Practice of Tangible User Interfaces

17

What is Arduino

Relatively cheap (compare with LEGO Mindstorm)

$250 ~$31

Thursday Week 2: Physical Computing Theory and Practice of Tangible User Interfaces

18

What is Arduino

It used to be a bit more complicated…

image from www.tangentsoft.net/elec/breadboard.html

Thursday Week 2: Physical Computing Theory and Practice of Tangible User Interfaces

19

Open source, so you can build one yourself!

Thursday Week 2: Physical Computing Theory and Practice of Tangible User Interfaces

20

Arduino Board Overview

Thursday Week 2: Physical Computing Theory and Practice of Tangible User Interfaces

21

Arduino Board Overview

• 16 kBytes of Flash program memory (your program stays in Arduino when powered off)

• 1 kByte of RAM

• 12 MHz (Apple II: 1 MHz) processor speed

Thursday Week 2: Physical Computing Theory and Practice of Tangible User Interfaces

22

Arduino Board Overview

• 13 digital input/output pins

• 5 analog input pins

Thursday Week 2: Physical Computing Theory and Practice of Tangible User Interfaces

23

Arduino Board Overview

Thursday Week 2: Physical Computing Theory and Practice of Tangible User Interfaces

24

Arduino Board Overview

• USB to serial chip (converts simple serial signal to USB)

Thursday Week 2: Physical Computing Theory and Practice of Tangible User Interfaces

25

Arduino Softwarewww.arduino.cc

Thursday Week 2: Physical Computing Theory and Practice of Tangible User Interfaces

26

Arduino Software

Thursday Week 2: Physical Computing Theory and Practice of Tangible User Interfaces

27

Arduino Sketches

Thursday Week 2: Physical Computing Theory and Practice of Tangible User Interfaces

28

Arduino Programming Cycle

edit

upload

run verify

Thursday Week 2: Physical Computing Theory and Practice of Tangible User Interfaces

29

Arduino Programming Cycle

edit

upload

run verify

Thursday Week 2: Physical Computing Theory and Practice of Tangible User Interfaces

30

Arduino Programming Cycle

edit

upload

run verify

Thursday Week 2: Physical Computing Theory and Practice of Tangible User Interfaces

31

Arduino Programming Cycle

edit

upload

run verify

1

2

Thursday Week 2: Physical Computing Theory and Practice of Tangible User Interfaces

32

Arduino Programming Cycle

Watch your LED blink!

edit

upload

run verify

Thursday Week 2: Physical Computing Theory and Practice of Tangible User Interfaces

33

Arduino Program

Program consists of 3 parts:

1. Declare variables at top

2. Initialize

setup() – run once at beginning, set pins

3. Run

loop() – run repeatedly, after setup()

Thursday Week 2: Physical Computing Theory and Practice of Tangible User Interfaces

34

Arduino Language

Like C but easier

Example functions

• pinMode() – set a pin as input or output

• digitalWrite() – set a digital pin high/low

• digitalRead() – read a digital pin’s state

• analogRead() – read an analog pin

• analogWrite() – write an “analog” PWM value

• delay() – wait an amount of time

Thursday Week 2: Physical Computing Theory and Practice of Tangible User Interfaces

35

Example (and many other examples at www.arduino.cc)

Thursday Week 2: Physical Computing Theory and Practice of Tangible User Interfaces

36

Example (and many other examples at www.arduino.cc)

Declare variables

Thursday Week 2: Physical Computing Theory and Practice of Tangible User Interfaces

37

Example (and many other examples at www.arduino.cc)

Initialize

Thursday Week 2: Physical Computing Theory and Practice of Tangible User Interfaces

38

Example (and many other examples at www.arduino.cc)

Run

Thursday Week 2: Physical Computing Theory and Practice of Tangible User Interfaces

39

Arduino and Breadboard

Thursday Week 2: Physical Computing Theory and Practice of Tangible User Interfaces

40

Arduino and Breadboard

Thursday Week 2: Physical Computing Theory and Practice of Tangible User Interfaces

41

Solderless Breadboard

Thursday Week 2: Physical Computing Theory and Practice of Tangible User Interfaces

42

Solderless Breadboard

Thursday Week 2: Physical Computing Theory and Practice of Tangible User Interfaces

43

Solderless Breadboard

Thursday Week 2: Physical Computing Theory and Practice of Tangible User Interfaces

44

Circuits: Avoid Shortcuts

Electricity always favors the path of least resistance to ground

Illustration from O’Sullivan and Igoe

Thursday Week 2: Physical Computing Theory and Practice of Tangible User Interfaces

45

Circuits: Avoid Shortcuts

Electricity always favors the path of least resistance to ground

Illustration from O’Sullivan and Igoe

Thursday Week 2: Physical Computing Theory and Practice of Tangible User Interfaces

46

Circuits

All the electrical energy in a circuit must be used

Illustration from O’Sullivan and Igoe

Thursday Week 2: Physical Computing Theory and Practice of Tangible User Interfaces

47

LED

• LED = Light-Emitting Diode

• Needs a “current limiting” resistor, or burns out

Illustration from Tod Kurt’s Spooky Projects

Thursday Week 2: Physical Computing Theory and Practice of Tangible User Interfaces

48

Circuits Summary

Avoid deadly shortcuts

• Flows to the lowest resistance

• All the electrical energy in a circuit must be used

When in doubt, talk to us, we can help

(Your Arduino has some fail safe, but in the worst case, you could fry your board [$33.00])

Thursday Week 2: Physical Computing Theory and Practice of Tangible User Interfaces

49

Try to be Neat

Color code:

• Red: power

• Black: ground

Be consistent

Good Bad

Thursday Week 2: Physical Computing Theory and Practice of Tangible User Interfaces

50

Be Careful

Thursday Week 2: Physical Computing Theory and Practice of Tangible User Interfaces

51

Lab Assignment This Week

• Get the course lab kit

• Download & install Arduino software (www.arduino.cc)

• Make an LED blink

• Make it blink at different rate

• Create your course web account

• Post the photo of your board and an optional comment on the course website

Thursday Week 2: Physical Computing Theory and Practice of Tangible User Interfaces

52

Lab Assignment: Blinking LED

Resistorred, red, brown, gold

LED

Thursday Week 2: Physical Computing Theory and Practice of Tangible User Interfaces

53

Your assignment looks like this

LED

Shorter leg groundPolarity matters

220 ohm resistorred, red, brown, goldPolarity does not matter

Thursday Week 2: Physical Computing Theory and Practice of Tangible User Interfaces

54

Next Thursday

Don’t forget to bring your lab kit in

Do use the lab hour to catch up

Create your course account

Post your assignemtn on the course website

Thursday Week 2: Physical Computing Theory and Practice of Tangible User Interfaces

55

Thanks!

top related