LabJack Photo Resistor - Web Services Overview

Download Report

Transcript LabJack Photo Resistor - Web Services Overview

ECE 102
Engineering Computation
Chapter 11
LabJack Photo Resistor &
Mechanical Switch Interface
Dr. Herbert G. Mayer, PSU
Status 9/2/2015
For use at CCUT Fall 2015
Syllabus

LabJack HW Overview

LabJack Features

LabJack HW Control

Input & Output Channels

Digital Input Output\Analog Input

Analog Output

Summary
Photoresistor

A photoresistor, or photocell, is a semiconductor
device whose resistance depends (inversely) on the
incident light intensity.

Symbol:

illumination increases  resistance decreases
2
Connect photoresistor to analog FIO channel
VS
←OR→
Rp
R
AIN
Vin
Sense
LabJack
Read AIN:
R
VAIN 
VS
R  Rp
AIN
Issues:
• AIN range is 0
to +2.44 V
R
You need to
add the
external
resistor R.
VS
• Sensitivity of
response
depends on R
Vin
Sense
Rp
LabJack
Read AIN:
Rp
VAIN 
VS
R  Rp
3
Mechanical Switch

A switch is a component that can interrupt or divert
electric current in a circuit.

Symbol:
SPST

SPDT
Pushbutton
Mechanical switches have “contact bounce”.
Courtesy of Wikimedia Commons
4

In the lab exercises and project, a mini push button
switch (SPST, momentary ON) is used.
Switch Input
→ Left two pins are
internally connected
together (same node)
1
Switch Output
→ Right two pins are
internally connected
together (same node)
1
1
1
Schematic
view
5

Connect switch to digital FIO channel:
Internal circuit – You do
not need to build this.
Assume switch is
normally open.
+3.3 V
100K Ω
SW
FIO
Vin
• SW pushed → Vin = 0 V
Digital value read is 0.
• SW released → Vin = +3.3 V
Digital value read is 1.
Sense
LabJack
Read FIO:
If 0 → SW pushed (ON)
If 1 → SW released (OFF)
6

Connect switch to analog FIO channel (AIN):
VS
Assume
switch is
normally
open.
• SW pushed → Vin = 0 V
• SW released → Vin = VS
1K Ω
SW
Threshold value = VS / 2
AIN
You need to
add the
external
pull-up
resistor.
Vin
Sense
LabJack
Read AIN:
If Vin < VS / 2 → SW pushed (ON)
If Vin ≥ VS / 2 → SW released (OFF)
7

What if there are not enough FIOs available to
support multiple switches?
Example:
Connect three switches to a single FIO
channel on the LabJack.
→ Configure the FIO for analog input
(AIN) and connect the switches to a
voltage divider network.
SW0 pressed : VAIN  0
SW1 pressed : VAIN 
R1
VS
Rup  R1
SW2 pressed : VAIN 
R1  R2
VS
Rup  R1  R2
VS
SW0
SW1
SW2
Rup
VAIN
AIN
R1
LabJack
R2
No switch pressed : VAIN  VS
8