Lab3 – Optical Sensor

Download Report

Transcript Lab3 – Optical Sensor

Lab3 – Optical Sensor
1
Lab3 – Optical Sensor
• When a light path is interrupted and when
it is completed, the AVR records both
events.
• Uses typically include counting objects
such as highway toll stations or events
such as computing RPM’s of a rotating
shaft with a “blade” that interrupts the light
path every 1 or ½ cycles.
2
Lab3 – Optical Sensor
Resistor values may differ in different manufacture lots.
Choose the resistor values by measuring Ic
When the NTE3100’s light path is not blocked it produces +5V at Vc.
R1 is a current limiting resistor.
3
Lab3 – Optical Sensor
V
Input
DD
Voltages
Output
V
CC
0V
0
15
Time(ns)
x
x+10
4
One Design Example of the Optical Sensor
STK500 Board
VTG
INT0
VTG
16
10K
150
Start Switch
SW7
2.5K
CD4050
3
2
NTE3100
20K
40
PA0
VTG
GRD
ATMEGA16
INT1
17
10K
150
Stop Switch
SW6
VCC
14
To Computer Serial Port
15
150
RXD
VTG
LED7
TXD
PB0
10K
Running LED
1
Notice: In this design, PA0 is used to receive the input
PB0 is used to light the LED7
5
Hardware design is given except proper selection of resistor values
Software design needs to support
(1) a start button
(2) a stop button
(3) a reset button to reset counter
(4) counter recording number of objects blocking the light.
(5) a heartbeat signal on LED0
(6) LED7 toggles when a block is detected.
6