thursday week 3: analog input theory and practice of tangible user...

27
Thursday Week 3: Analog Input 1 Theory and Practice of Tangible User Interfaces Sensor 1: Potentiometers Analog input week 03

Upload: others

Post on 08-Aug-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Thursday Week 3: Analog Input Theory and Practice of Tangible User Interface…courses.ischool.berkeley.edu/i290-13/f07/system/files/tangible_wk3thu... · Thursday Week 3: Analog

Thursday Week 3: Analog Input

1

Theory and Practice of Tangible User Interfaces

Sensor 1: PotentiometersAnalog input

week 03

Page 2: Thursday Week 3: Analog Input Theory and Practice of Tangible User Interface…courses.ischool.berkeley.edu/i290-13/f07/system/files/tangible_wk3thu... · Thursday Week 3: Analog

Thursday Week 3: Analog Input

2

Theory and Practice of Tangible User Interfaces

Red LED Recall

Page 3: Thursday Week 3: Analog Input Theory and Practice of Tangible User Interface…courses.ischool.berkeley.edu/i290-13/f07/system/files/tangible_wk3thu... · Thursday Week 3: Analog

Thursday Week 3: Analog Input

3

Theory and Practice of Tangible User Interfaces

DiffusersShowcase your diffuser!

Page 4: Thursday Week 3: Analog Input Theory and Practice of Tangible User Interface…courses.ischool.berkeley.edu/i290-13/f07/system/files/tangible_wk3thu... · Thursday Week 3: Analog

Thursday Week 3: Analog Input

4

Theory and Practice of Tangible User Interfaces

Page 5: Thursday Week 3: Analog Input Theory and Practice of Tangible User Interface…courses.ischool.berkeley.edu/i290-13/f07/system/files/tangible_wk3thu... · Thursday Week 3: Analog

Thursday Week 3: Analog Input

5

Theory and Practice of Tangible User Interfaces

Digital vs.

AnalogBinary vs. continuous signals

Binary / Digital = “whether or not”•

Continuous / Analog signal = “how much”

or “faster,”

“brighter,”

etc.

Binary / Digital :

0V (LOW) or 5V (HIGH)

Continuous / Analog : e.g.

0.095V

1.0V•

4.555V•

etc.

Page 6: Thursday Week 3: Analog Input Theory and Practice of Tangible User Interface…courses.ischool.berkeley.edu/i290-13/f07/system/files/tangible_wk3thu... · Thursday Week 3: Analog

Thursday Week 3: Analog Input

6

Theory and Practice of Tangible User Interfaces

Digitizing Analog InputMicroprocessor cannot deal with analog signal internally, so you

digitize it. Afterwards, computer only knows the dashed line so to computer, analog input is “chunky.”

digitized point

digitized signal

sampled point

time

analog

signal

voltage

Illustration adapted from Tod

Kurt’s Spooky Projects with Arduino

Page 7: Thursday Week 3: Analog Input Theory and Practice of Tangible User Interface…courses.ischool.berkeley.edu/i290-13/f07/system/files/tangible_wk3thu... · Thursday Week 3: Analog

Thursday Week 3: Analog Input

7

Theory and Practice of Tangible User Interfaces

Analog Input on Arduino•

Arduino has 6 ADC (Analog to Digital Converter) inputs

Reads voltage between 0 to 5 V

Resolution is 10 bits: 210 = 1024 states

5V/1024 = 4.8mV smallest voltage difference Arduino can measure

Analog Input

Page 8: Thursday Week 3: Analog Input Theory and Practice of Tangible User Interface…courses.ischool.berkeley.edu/i290-13/f07/system/files/tangible_wk3thu... · Thursday Week 3: Analog

Thursday Week 3: Analog Input

8

Theory and Practice of Tangible User Interfaces

Potentiometers•

Variable resistor (a type of “resistive sensor”)

Pot for short

When you need a “ranged”

input

Measures rotational position (knob for volume, light dimmer, etc.)

pot resistor

Page 9: Thursday Week 3: Analog Input Theory and Practice of Tangible User Interface…courses.ischool.berkeley.edu/i290-13/f07/system/files/tangible_wk3thu... · Thursday Week 3: Analog

Thursday Week 3: Analog Input

9

Theory and Practice of Tangible User Interfaces

turned anti-clockwise

turned clockwise

somewhere in the middle

Potentiometers•

It’s like a faucet (if current is analog to water flow)

Like any other resistor, but you can vary the amount of resistance

Generally used for making a varying voltage (remember, Arduino measures voltage differences, not resistance differences)

Illustration adapted from Tod

Kurt’s Spooky Projects with Arduino

Page 10: Thursday Week 3: Analog Input Theory and Practice of Tangible User Interface…courses.ischool.berkeley.edu/i290-13/f07/system/files/tangible_wk3thu... · Thursday Week 3: Analog

Thursday Week 3: Analog Input

10

Theory and Practice of Tangible User Interfaces

In Class ExerciseControlling LEDs

with potentiometers

Control your color mixer with multiple pots

Page 11: Thursday Week 3: Analog Input Theory and Practice of Tangible User Interface…courses.ischool.berkeley.edu/i290-13/f07/system/files/tangible_wk3thu... · Thursday Week 3: Analog

Thursday Week 3: Analog Input

11

Theory and Practice of Tangible User Interfaces

1. RGB LED Fade

2. Strip wires

3. Solder wires to pot

4. Control one LED

5. Control LED(s) with multiple pots

In Class Exercise

Page 12: Thursday Week 3: Analog Input Theory and Practice of Tangible User Interface…courses.ischool.berkeley.edu/i290-13/f07/system/files/tangible_wk3thu... · Thursday Week 3: Analog

Thursday Week 3: Analog Input

12

Theory and Practice of Tangible User Interfaces

Circuit with 3 LEDsPlug in the three LEDs, red, green, and blue, and make different colors

Page 13: Thursday Week 3: Analog Input Theory and Practice of Tangible User Interface…courses.ischool.berkeley.edu/i290-13/f07/system/files/tangible_wk3thu... · Thursday Week 3: Analog

Thursday Week 3: Analog Input

13

Theory and Practice of Tangible User Interfaces

1. RGB LED Fade

2. Strip wires

3. Solder wires to pot

4. Control one LED

5. Control LED(s) with multiple pots

In Class Exercise

Page 14: Thursday Week 3: Analog Input Theory and Practice of Tangible User Interface…courses.ischool.berkeley.edu/i290-13/f07/system/files/tangible_wk3thu... · Thursday Week 3: Analog

Thursday Week 3: Analog Input

14

Theory and Practice of Tangible User Interfaces

Strip the WiresTake 6 wires (2 red, 2 yellow, and 2 black) and strip off about ¼”

of insulation at both ends of each wire.

Photos from Tod

Kurt’s Spooky Projects with Arduino

Page 15: Thursday Week 3: Analog Input Theory and Practice of Tangible User Interface…courses.ischool.berkeley.edu/i290-13/f07/system/files/tangible_wk3thu... · Thursday Week 3: Analog

Thursday Week 3: Analog Input

15

Theory and Practice of Tangible User Interfaces

1. RGB LED Fade

2. Strip wires

3. Solder wires to pot

4. Control one LED

5. Control LED(s) with multiple pots

In Class Exercise

Page 16: Thursday Week 3: Analog Input Theory and Practice of Tangible User Interface…courses.ischool.berkeley.edu/i290-13/f07/system/files/tangible_wk3thu... · Thursday Week 3: Analog

Thursday Week 3: Analog Input

16

Theory and Practice of Tangible User Interfaces

Potentiometers

to GND

to 5V

to Analog In

Solder the wires to your pots. Solder the wires for two pots.

Page 17: Thursday Week 3: Analog Input Theory and Practice of Tangible User Interface…courses.ischool.berkeley.edu/i290-13/f07/system/files/tangible_wk3thu... · Thursday Week 3: Analog

Thursday Week 3: Analog Input

17

Theory and Practice of Tangible User Interfaces

SolderingHeating the joint, not the solder. Use lead-less solder.

1 2 3Heat the joint, not the solder

Melt the solder Release the solder

Illustrations from http://www.chaneyelectronics.com/training/soldering.htm

Page 18: Thursday Week 3: Analog Input Theory and Practice of Tangible User Interface…courses.ischool.berkeley.edu/i290-13/f07/system/files/tangible_wk3thu... · Thursday Week 3: Analog

Thursday Week 3: Analog Input

18

Theory and Practice of Tangible User Interfaces

Soldering: Helping Hands

Page 19: Thursday Week 3: Analog Input Theory and Practice of Tangible User Interface…courses.ischool.berkeley.edu/i290-13/f07/system/files/tangible_wk3thu... · Thursday Week 3: Analog

Thursday Week 3: Analog Input

19

Theory and Practice of Tangible User Interfaces

Soldering: SafetyPlease wear safety goggles! It’s stylish!

Page 20: Thursday Week 3: Analog Input Theory and Practice of Tangible User Interface…courses.ischool.berkeley.edu/i290-13/f07/system/files/tangible_wk3thu... · Thursday Week 3: Analog

Thursday Week 3: Analog Input

20

Theory and Practice of Tangible User Interfaces

1. RGB LED Fade

2. Strip wires

3. Solder wires to pot

4. Control one LED

5. Control LED(s) with multiple pots

In Class Exercise

Page 21: Thursday Week 3: Analog Input Theory and Practice of Tangible User Interface…courses.ischool.berkeley.edu/i290-13/f07/system/files/tangible_wk3thu... · Thursday Week 3: Analog

Thursday Week 3: Analog Input

21

Theory and Practice of Tangible User Interfaces

Controlling your LED with a Potentiometer

Page 22: Thursday Week 3: Analog Input Theory and Practice of Tangible User Interface…courses.ischool.berkeley.edu/i290-13/f07/system/files/tangible_wk3thu... · Thursday Week 3: Analog

Thursday Week 3: Analog Input

22

Theory and Practice of Tangible User Interfaces

Controlling an LED with a Pot

Make one LED to dim and blink at different rate

Page 23: Thursday Week 3: Analog Input Theory and Practice of Tangible User Interface…courses.ischool.berkeley.edu/i290-13/f07/system/files/tangible_wk3thu... · Thursday Week 3: Analog

Thursday Week 3: Analog Input

23

Theory and Practice of Tangible User Interfaces

1. RGB LED Fade

2. Strip wires

3. Solder wires to pot

4. Control one LED

5. Control LED(s) with multiple pots

In Class Exercise

Page 24: Thursday Week 3: Analog Input Theory and Practice of Tangible User Interface…courses.ischool.berkeley.edu/i290-13/f07/system/files/tangible_wk3thu... · Thursday Week 3: Analog

Thursday Week 3: Analog Input

24

Theory and Practice of Tangible User Interfaces

Controlling multiple LEDs with multiple Pots

Option 1:

control one LED with two pots

Option 2:

control three LEDs

with three pots

Page 25: Thursday Week 3: Analog Input Theory and Practice of Tangible User Interface…courses.ischool.berkeley.edu/i290-13/f07/system/files/tangible_wk3thu... · Thursday Week 3: Analog

Thursday Week 3: Analog Input

25

Theory and Practice of Tangible User Interfaces

Soldering

Be careful: It could be 1000 degrees!

Page 26: Thursday Week 3: Analog Input Theory and Practice of Tangible User Interface…courses.ischool.berkeley.edu/i290-13/f07/system/files/tangible_wk3thu... · Thursday Week 3: Analog

Thursday Week 3: Analog Input

26

Theory and Practice of Tangible User Interfaces

Next ThursdaySensor 2: Force sensitive resistors and photocells

Arduino as an interface board: Processing

Read Intro to Processing at processing.org

Page 27: Thursday Week 3: Analog Input Theory and Practice of Tangible User Interface…courses.ischool.berkeley.edu/i290-13/f07/system/files/tangible_wk3thu... · Thursday Week 3: Analog

Thursday Week 3: Analog Input

27

Theory and Practice of Tangible User Interfaces

Thanks!