New Human Computer Interfaces Class 3 Amnon Dekel – CSE, Spring 2007

advertisement
New Human Computer Interfaces
Class 3
March14 2007
Amnon Dekel
HUJI – CSE, Spring 2007
On the Menu
•
•
•
Homework review
Electronics and Circuits
Introduction to the OpenBoard
microcontroller System
– Hello World
– Digital Output
•
Program and circuit
– Digital Input
•
Program and circuit
New Human Computer Interfaces - HUJI - Spring 2007
2
Homework Review
• Project Folio
– Description and architecture
– Parts Needed: Research the parts you will
need to make it happen
– Psuedocode
• Create a Project WIKI page with the
Project Folio
New Human Computer Interfaces - HUJI - Spring 2007
3
A bit about Electronics
Electronics
• Today:
– Basic Concepts
• Voltage
• Current
• Resistance
– From idea to circuit:
• Circuit Symbols
• the Prototyping Board
• Meters and Continuity
– Some Basic Circuits
• Switches (for Control)
• Digital Output (for Effect)
New Human Computer Interfaces - HUJI - Spring 2007
5
Voltage and Current
• Voltage and Current are vital to
understanding electronics, but they are
quite hard to grasp because we can't see
them directly.
New Human Computer Interfaces - HUJI - Spring 2007
6
Voltage and Current
• Voltage is the Cause, Current is the
Effect
– Voltage attempts to make a current flow, and
current will flow if the circuit is complete.
– Voltage is sometimes described as the 'push'
or 'force' of the electricity, it isn't really a force
but this may help you to imagine what is
happening.
• It is possible to have voltage without current, but
current cannot flow without voltage.
New Human Computer Interfaces - HUJI - Spring 2007
7
Voltage and Current
Voltage and Current
The switch is closed making a complete circuit so current can flow.
New Human Computer Interfaces - HUJI - Spring 2007
8
Voltage and Current
Voltage but No Current
The switch is open so the circuit is broken and current cannot flow.
New Human Computer Interfaces - HUJI - Spring 2007
9
Voltage and Current
No Voltage and No Current
Without the cell there is no source of voltage so current cannot flow.
New Human Computer Interfaces - HUJI - Spring 2007
10
Voltage, V
• Voltage is a measure of the energy carried by
the charge.
Voltage is supplied by the battery (or power
supply).
• Voltage is used up in components, but not in
wires.
• Voltage is measured in volts, V.
• You may find it helpful to think of voltage like
height in geography.
– The zero volts in an electronic circuit is like the sea
level in geography.
New Human Computer Interfaces - HUJI - Spring 2007
11
Current, I
• Current is the rate of flow of charge.
• Current is not used up, what flows into a
component must flow out.
• Current is measured in amps (amperes), A.
• The symbol I is used for current in
equations. (Intensity of current )
New Human Computer Interfaces - HUJI - Spring 2007
12
Resistance
• Resistance is the property of a component which
restricts the flow of electric current. Energy is
used up as the voltage across the component
drives the current through it and this energy
appears as heat in the component.
• Resistance is measured in ohms, the symbol for
ohm is an omega .
• Resistors used in electronics can have
resistances as low as 0.1 Ohms or as high as 10
M Ohms.
New Human Computer Interfaces - HUJI - Spring 2007
13
The Prototyping “Bread” Board
The Prototyping Board
• Allows you to build circuits without needing
to solder anything together.
• Makes it easy to test and change a circuit
quickly.
New Human Computer Interfaces - HUJI - Spring 2007
15
How to use the Prototyping Board
• Two TOP and BOTTOM rows are
connected Horizontally
• Two inner rows: Connected Vertically
New Human Computer Interfaces - HUJI - Spring 2007
16
Setting up Power
New Human Computer Interfaces - HUJI - Spring 2007
17
Setting up Power
• Is this circuit complete?
New Human Computer Interfaces - HUJI - Spring 2007
18
Setting up Power
• Now it is. But is it usable?
New Human Computer Interfaces - HUJI - Spring 2007
19
Setting up Power
• Now it is- we can add elements into the
central areas to create a working circuit
New Human Computer Interfaces - HUJI - Spring 2007
20
Building Circuits
• We will build a simple LED circuit
New Human Computer Interfaces - HUJI - Spring 2007
21
Building Circuits
1. connect the power to the central circuit area
New Human Computer Interfaces - HUJI - Spring 2007
22
Building Circuits
2. Add the first element (a protective resistor)
New Human Computer Interfaces - HUJI - Spring 2007
23
Building Circuits
3. Add the LED
New Human Computer Interfaces - HUJI - Spring 2007
24
Building Circuits
4. Finish the circuit- connect to the – (GND)
New Human Computer Interfaces - HUJI - Spring 2007
25
Building Circuits
• If all is Well- enjoy the light!
New Human Computer Interfaces - HUJI - Spring 2007
26
Building Circuits
• Hmm… But what if it doesn’t work? Ideas?
New Human Computer Interfaces - HUJI - Spring 2007
27
Building Circuits
• Hmm… But what if it doesn’t work? Ideas?
– Maybe the wires are not in the correct place (the
circuit is not wired properly)
– Maybe there is a bad wire in there somewhere
– Maybe the LED is burned
– Maybe the battery is dead
New Human Computer Interfaces - HUJI - Spring 2007
28
Building Circuits
• How do we check these things?
– Circuit
– Wires
– Components
– Power
New Human Computer Interfaces - HUJI - Spring 2007
29
Building Circuits
• To check wires and the circuit: we want to
check for CONTINUITY
– This means checking that electricity flows all
the way through the circuit.
– If it is disrupted somehow- there will be no
continuity.
• OK- but how do we check this?
New Human Computer Interfaces - HUJI - Spring 2007
30
Multi-Meter
• Meet the Multi-Meter:
Analog
Digital
New Human Computer Interfaces - HUJI - Spring 2007
31
Checking for Continuity
• To check for Continuity, set the meter to
test Resistance (the Omega symbol)
• Now touch both ends (Red and Black) to
each other. What do you get?
New Human Computer Interfaces - HUJI - Spring 2007
32
Checking for Continuity
• Some Multi-Meters have a Continuity
Check mode.
– In this case, touching the leads will give you
an audible beep.
– This is good because you don’t need to look
at the meter, just listen:
• continuity: Beep
• No continuity: No Beep
New Human Computer Interfaces - HUJI - Spring 2007
33
Checking for Continuity
• If any of the elements in the circuit are
broken, there will be no continuity!
New Human Computer Interfaces - HUJI - Spring 2007
34
Procedure for Checking for Continuity
1. Check both ends of the circuit
2. No continuity?
a. Check one half of the circuit.
1. Good Continuity?
» The problem is in the other half of the circuit
2. Bad continuity?
» continue checking this half of the circuit until you
zero in on the culprit (simply do the same
procedure from this point downwards , each time
checking the remaining 2 halves of the circuit until
you reach a point where you find the problem)
New Human Computer Interfaces - HUJI - Spring 2007
35
Some Circuits
• Now that we know how to build simple
circuits with the Prototyping Board, we will
look at a few simple circuits
– A Buzzer
– A Beeper
New Human Computer Interfaces - HUJI - Spring 2007
36
A Buzzer
• Remind you of something?
Bzzzzzzzzz
New Human Computer Interfaces - HUJI - Spring 2007
37
A Beeper
• Remind you of something?
Beeeeeeep
New Human Computer Interfaces - HUJI - Spring 2007
38
Introduction to the Arduino
microcontroller System
The Arduino System
• Hardware:
– MCU
– USB Cable
• Software
– Arduino IDE
New Human Computer Interfaces - HUJI - Spring 2007
40
The Arduino System
http://www.arduino.cc/en/Guide/Board
New Human Computer Interfaces - HUJI - Spring 2007
41
The Arduino System
• Basic Setup:
Arduino IDE
PC
Serial Connection
(Also supplies Power)
MCU
New Human Computer Interfaces - HUJI - Spring 2007
42
The Arduino System
• Basic Setup:
Arduino IDE
PC
Serial Connection
+
9V
Power -
MCU
New Human Computer Interfaces - HUJI - Spring 2007
43
The Arduino System
• Basic Setup:
Arduino IDE
PC
Serial Connection
+
9V
Power -
MCU
New Human Computer Interfaces - HUJI - Spring 2007
WARNING:
NEVER connect
or Disconnect
The Programmer
To the MCU
When the
MCU is ON
ALWAYS TURN
THE MCU OFF
BEFORE HAND
44
The Arduino System
• Software IDE
• Win, Mac, Linux
http://www.arduino.cc/en/Main/Software
New Human Computer Interfaces - HUJI - Spring 2007
45
The Arduino System
• Software Setup
– Have JAVA installed on the machine
– Download and install the IDE
• Win
• MacOSX-PPC, MacOSX-Intel
• Linux
– Check what Port is assigned to the USB Serial Port
on your PC (COM4, 5, 7…)
– The Environment
– How To (Windows, Mac OS X, Linux): step-by-step
instructions on getting your first Arduino program
working.
New Human Computer Interfaces - HUJI - Spring 2007
46
The Arduino System
• Class Workshop:
– Get an Arduino board and cable
– Download the Arduino environment
– Install the USB drivers
– Connect the board
– Connect an LED
– Run the Arduino environment
– Upload a program
– Look for the blinking LED
See Instructions: http://www.arduino.cc/en/Guide/Windows
New Human Computer Interfaces - HUJI - Spring 2007
47
The Arduino System
• Digital OUTPUT
http://www.arduino.cc/en/Tutorial/BlinkingLED
New Human Computer Interfaces - HUJI - Spring 2007
48
The Arduino System
• Digital INPUT
– Lets create a circuit with a Switch
http://www.arduino.cc/en/Tutorial/Pushbutton
New Human Computer Interfaces - HUJI - Spring 2007
49
Homework
• Create a reactive system:
– Input creates output – be creative
• Move forward with your projects:
• Design
• Hardware
• Programming
New Human Computer Interfaces - HUJI - Spring 2007
50
Download