useful circuitsx

Download Report

Transcript useful circuitsx

A few useful circuits
Boris van Sosin,
Commissar-Engineer
A lecture for Arduino Course, Winter 2016/17
Technion, IIT
Voltage Divider
β€’ Ohm’s Law:
π‘‰π‘œπ‘™π‘‘π‘Žπ‘”π‘’
πΆπ‘’π‘Ÿπ‘Ÿπ‘’π‘›π‘‘ =
π‘…π‘’π‘ π‘–π‘ π‘‘π‘Žπ‘›π‘π‘’
𝑉
𝐼=
𝑅
𝑉
𝐼=
𝑅
Voltage Divider
𝑉
𝐼=
𝑅
β€’ Assume:
β€’ Voltage reader has
R=∞ to ground
β€’ When open:
β€’ V read = 0V
𝐼=0
𝑉 = 0𝑉
𝑉 = 𝑉𝐺𝑁𝐷 = 0𝑉
Voltage Divider
𝑉
𝐼=
𝑅
β€’ Assume:
β€’ Voltage reader has
R=∞ to ground
β€’ When closed:
β€’ V read = 5V
𝑉𝐢𝐢
𝐼=
𝑅1
𝑉 = 5𝑉
𝑉 = 𝑉𝐺𝑁𝐷 = 0𝑉
Generalized Voltage Divider
𝑉
𝐼=
𝑅
β€’ Total current:
𝐼=
𝑉𝐢𝐢
𝑅1+𝑅2
β€’ Equal to current
over each resistor
𝑉𝐢𝐢
𝐼=
𝑅1 + 𝑅2
π‘‰π‘‚π‘£π‘’π‘Ÿ 𝑅2
𝑅2
= 𝑉𝐢𝐢 β‹…
𝑅1 + 𝑅2
𝐼 = πΌπ‘‚π‘£π‘’π‘Ÿ 𝑅2
β€’ Therefore:
β€’ π‘‰π‘‚π‘£π‘’π‘Ÿ 𝑅2 = πΌπ‘‚π‘£π‘’π‘Ÿ 𝑅2 β‹… 𝑅2
𝑅2
= 𝑉𝐢𝐢 β‹…
𝑅1 + 𝑅2
𝑉 = 𝑉𝐺𝑁𝐷 = 0𝑉
Voltage Divider
β€’ Uses:
β€’ Lots of Arduino inputs
Low-Pass Filter
β€’ Charging a capacitor through a resistor
β€’ Initially capacitor is empty
β€’ π‘‰π‘Ÿπ‘’π‘Žπ‘‘ = 0𝑉
β€’ As capacitor charges, π‘‰π‘Ÿπ‘’π‘Žπ‘‘ rises
Low-Pass Filter
β€’ Charging a capacitor through a resistor
β€’ RC Law:
βˆ’π‘‘β‹…πΆπ‘œπ‘›π‘ π‘‘
𝑉 𝑑 = π‘‰π‘šπ‘Žπ‘₯ β‹… 1 βˆ’ 𝑒
𝑉
𝑑
Chart by desmos.com
Low-Pass Filter
β€’ Charging a capacitor through a resistor
β€’ RC Law
β€’ RC Constant depends on
resistor and capacitor
𝑑
𝑅⋅𝐢
βˆ’
β€’ 𝑉 𝑑 = π‘‰π‘šπ‘Žπ‘₯ β‹… 1 βˆ’ 𝑒
β€’ Greater resistance and/or
capacitance means slower
charge
Low-Pass Filter
β€’ Uses:
β€’ Smoothing a signal
Low-Pass Filter
β€’ Uses:
β€’ Smoothing a signal
β€’ Smoothing digital waveform
to (nearly) analog
β€’ Smoothing high frequency
analog
β€’ Noise filtering
H-Bridge
β€’ Recall first tutorial:
β€’ Powering a DC motor:
β€’ Reversing a motor:
H-Bridge
β€’ Control direction
via logic?
β€’ Simplified solution:
Switches
H-Bridge
β€’ Control direction
via logic
β€’ Close diagonal pair
of switches to power
motor
β€’ Close other pair to
reverse
H-Bridge
β€’ Control direction
via logic
β€’ Problem: illegal states
Short circuit!
H-Bridge
β€’ Connecting to logic:
Replace switches with
transistors
β€’ HIGH (or PWM) to D5
β€’ HIGH (or PWM) to D6
for reverse direction
β€’ NEVER POWER BOTH!
β€’ What is missing?
H-Bridge
β€’ Connecting to logic
β€’ Diodes,
capacitor,
protection
against
illegal state
H-Bridge
β€’ Can be contained
in a chip
β€’ L293D
4x Half
H-Bridge
β€’ L298
2x Full
H-Bridge
Increasing No. of Outputs
β€’ Arduino UNO has 20 I/O pins
β€’ TX/RX
β€’ 12 digital I/O
β€’ 6 digital Out + Analog In
β€’ How can this be increased?
Shift Register
β€’ Shift register
β€’ Recall from
Digital Systems / Logic Design
β€’ Convert Serial to parallel
Shift Register
β€’ Shift register
β€’ Demo:
Write 1100 to a 4-bit
shift register
β€’ Strategy:
Write in reverse order
Shift Register
β€’ Shift register
β€’ Write 0
0
0
?
?
?
Shift Register
β€’ Shift register
β€’ Write another 0
0
0
0
?
?
Shift Register
β€’ Shift register
β€’ Write 1
1
1
0
0
?
Shift Register
β€’ Shift register
β€’ Write another 1
1
1
1
0
0
Shift Register
β€’ Problem: look at previous
state
β€’ Current output is 100
1
1
0
0
β€’ Is it valid?
?
Shift Register
β€’ Problem: Intermediate
output states
β€’ Solution: second layer of
registers
β€’ Requires β€œLatch out” control