Download Lab8_Introduction

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Power engineering wikipedia , lookup

Ground (electricity) wikipedia , lookup

Resistor wikipedia , lookup

Immunity-aware programming wikipedia , lookup

Power inverter wikipedia , lookup

Pulse-width modulation wikipedia , lookup

Variable-frequency drive wikipedia , lookup

Islanding wikipedia , lookup

Three-phase electric power wikipedia , lookup

Mercury-arc valve wikipedia , lookup

Electrical substation wikipedia , lookup

History of electric power transmission wikipedia , lookup

Diode wikipedia , lookup

Multimeter wikipedia , lookup

Ohm's law wikipedia , lookup

Schmitt trigger wikipedia , lookup

Power electronics wikipedia , lookup

P–n diode wikipedia , lookup

Metadyne wikipedia , lookup

Power MOSFET wikipedia , lookup

Electrical ballast wikipedia , lookup

Rectifier wikipedia , lookup

Voltage regulator wikipedia , lookup

Current source wikipedia , lookup

Stray voltage wikipedia , lookup

Surge protector wikipedia , lookup

Switched-mode power supply wikipedia , lookup

Buck converter wikipedia , lookup

Voltage optimisation wikipedia , lookup

Alternating current wikipedia , lookup

Mains electricity wikipedia , lookup

Resistive opto-isolator wikipedia , lookup

Opto-isolator wikipedia , lookup

Transcript
Automatic Night Light
Write a program that will automatically control the brightness of
a light based on the surrounding light level.
DIODES
Diodes are “one-way” devices that only allow current to flow in
one direction. An LED is a diode that emits light when sufficient
current is flowing through it. Diodes are used in many, many
applications such as:
• LED flashlights and light bulbs provide very bright light and
use significantly less power than incandescent bulbs, last
much longer than incandescent bulbs, and stay cool.
• Diodes are used in circuits to convert AC power to DC
power (laptop chargers, phone chargers, appliances that
run on dc …)
• LEDs are used in displays, signs, and traffic signals.
Light Emitting Diode (LED)
When the positive side of a
voltage source is applied to
the anode (+) side of an
LED, current will flow
through the circuit and the
LED will light up.
Anode (+)
Cathode (-)
Current
Flows
When the positive side of a
voltage source is applied to
the cathode (-) side of an LED,
current will not flow through
the circuit and the LED will not
light up.
Anode (+)
Cathode (-)
No
Current
Flows
Analog Discovery DAQ
Analog OUT Channel:
The yellow wire labeled W1 and black
ground wire labeled form an Analog
OUT channel. OUT means out of the
DAQ and applied to the circuit.
This output channel will be used to
apply a voltage between 0 and 5V
across the LED and 1 kΩ resistor.
Analog Discovery DAQ
Sample MATLAB Commands to Digilent:
DAQ.outputSingleScan(5)
% Provides 5V across LED/Resistor
DAQ.outputSingleScan(2.5)
% Provides 2.5V across LED/Resistor
Photocells
• Photocells are sensors that detect the
surrounding light level.
• The resistance of the photocell
decreases as the surrounding light
level increases.
• The photocells we will be using have
a resistance of about 1 kΩ in bright
light and a resistance of about 10 kΩ
when it is completely dark.
PHOTOCELLS
Voltage Divider Rule:
𝑉𝑅 =
10 𝑘Ω
∙ 5𝑉
(10 𝑘Ω + 𝑅𝑝ℎ𝑜𝑡𝑜𝑐𝑒𝑙𝑙 )
In Bright Light:
10
𝑉𝑅 ≈
∙ 5 = 4.5 𝑉
10 + 1
_
In Complete Darkness:
VR
+
𝑉𝑅 ≈
10
∙ 5 = 2.5 𝑉
10 + 10
Analog Discovery DAQ
Analog IN Channels:
The two orange wires labeled 1+ and
1- form an Analog IN channel. IN
means into the DAQ from hardware.
This input channel is our replacement
for the multi meter. The orange wires
will be placed across the 10 kΩ
resistor to measure the voltage.
A smaller voltage reading for VR
means it is darker around the photocell
so we should make the LED brighter.
Analog Discovery DAQ
MATLAB Command to Read Voltage:
VoltageLevel = DAQ.inputSingleScan
% Reads Voltage
Analog Discovery DAQ
To apply a constant 5V supply across the
photocell and 10 kΩ resistor, we will use
the Red wire (V+) and the Black wire
(GND)
MATLAB Command to turn on Power
Supply:
DAQ.setPowerSupply('positive','on');
Complete Circuit
Measured
voltage
Output
voltage
W1
V+
LED
1+
1-
Photocell
10kΩ
resistor
1kΩ
resistor
How the system works:
• As the light level
decreases, the voltage
measured between the
photocell and the 10kΩ
resistor decreases
• Your program will take
the measured voltage and
determine an appropriate
voltage level to send to
the LED
• The voltage output to the
LED will cause it to
illuminate at different
levels
Circuit
Pay close attention to the color code on the resistors. The 1 kΩ
(Brown-Black-Red) should be connected in series with the LED.
The 10 kΩ (Brown-Black-Orange) should be connected in series
with the photocell.
 The USB cable should fit very easily into the Digilent
DAQ.
 If it doesn’t fit easily, you may have it upside down.
 Under no circumstances should you attempt to force
it – ask a T.A. for assistance if needed!