Lecture 5

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 33

EE 260

Lecture 5
Interfacing Circuits
Interfacing Circuits

• Connect the µC to the outside world

EE 260 Lecture 5: Interfacing Circuits


Interfacing Circuits
• Circuit Basics*!
• Basic Circuits*!
• Op-Amp Circuits*!
• Digital Interfacing!
• Analog Interfacing!
• Power Interfacing

*In a separate, background lecture.


EE 260 Lecture 5: Interfacing Circuits
Interface Circuits
• Two circuits need to be connected.!
• Often their characteristics are not “compatible”!
• A circuit needs to be inserted in between the two
devices

+ +

– –

EE 260 Lecture 5: Interfacing Circuits


Interface Circuits
Arduino Voltage Characteristics
• Operating voltage: 5v!
• Recommended Input voltage: 7-12v!
• Extreme Input voltage: 6-20v!
• Maximum voltage applied to any I/O pin: 5.5v!
• Maximum voltage applied to the 5V pin: 6v!
• Maximum voltage applied to the 3v3 pin: 3.6v!
• Maximum voltage applied to the RESET pin: 13v

EE 260 Lecture 5: Interfacing Circuits


Interface Circuits
Arduino Current Characteristics

• Maximum current on any I/O: 40mA!


• Maximum current sourced from any I/O: 20mA!
• Maximum current from Vcc: 200mA!
• Maximum current from each GND: 200mA!
• Recommended steady state current: 1/2 of max.

EE 260 Lecture 5: Interfacing Circuits


Interface Circuits
Arduino Resistance Characteristics

• Internal Pullup Resistors: 20kΩ!


• Steady-state load resistance (recommended): 

470Ω < R < 10kΩ!
• High Impedance (input) state resistance: 100MΩ!

EE 260 Lecture 5: Interfacing Circuits


Analog Interfacing

Sensor ±10v
Interface

EE 260 Lecture 5: Interfacing Circuits


Analog Signal Conditioner
Shifting and Scaling
b
dc offset

s(t) Ks(t) + b
K IN ADC
sensor signal
so ≤ s(t) ≤ s1 Gain

5 5so
K= b= s1 so
s1 so ARDUINO

EE 260 Lecture 5: Interfacing Circuits


Analog Signal Conditioner
0  K  10, 10  b  0
+s2
R3 R5
R2

R1
R4 vout
+
vin = s(t)
Ks(t) + b

R2 R5 5
K= =
R1 R4 s1 so

R5 s2 5so
b= =
R3 s1 so

EE 260 Lecture 5: Interfacing Circuits


Team Activity

• Given the voltage, vin, !


• -10 ≤ vin ≤ 10 !
• Design a circuit such that the output voltage, vout,
satisfies: 0 ≤ vout ≤ 5.
TL802
(TOP VIEW)

1OUT 1 8 VCC +
1IN 2 7 2OUT
1IN + 3 6 2IN
VCC 4 5 2IN +
EE 260 Lecture 5: Interfacing Circuits
Analog Input: Simple

• Potentiometer

Variable!
+5v Input Voltage:!
0 – 5v

EE 260 Lecture 5: Interfacing Circuits


Analog Output

• PWM!
• R-2R Network!
• “Hack Methods”! http://embeddednewbie.blogspot.com/2011/02/
review-­‐of-­‐arduino-­‐dac-­‐solutions.html
• DAC Chips/Shields

EE 260 Lecture 5: Interfacing Circuits


PWM Types
• Unipolar


 +5v
100% = full speed

 50% = half speed

 0
t 0% = stop

• Bipolar
+12v 100% = full positive
0
t 50% = stop
–12v 0% = full negative

EE 260 Lecture 5: Interfacing Circuits


PWM: Bipolar
• It is common to use DC motors going either or
both directions!
• It is common to use the DC motors in positioning!
• Requires a closed-loop controller !
• Requires a position sensor!
• Requires that the motor be able to turn either
direction

EE 260 Lecture 5: Interfacing Circuits


Analog Out: True Analog
• R-2R Network “Flash” 8-bit convertor

EE 260 Lecture 5: Interfacing Circuits


Analog Out: True Analog
• D/A and A/D Shields!
• SPI or I2C based!
• Single or double sided
inputs or outputs!
• Does the shifting and
scaling

EE 260 Lecture 5: Interfacing Circuits


Low-Pass Filter
• Used to eliminate noise
from a circuit (high C
frequency)!
R
R
• Passes signals with
frequencies less than +
vin +
– vout
1 –
f= (Hz)
2⇡RC

EE 260 Lecture 5: Interfacing Circuits


Digital Input: TTL
• If the digital input signal is at the TTL level, then
you can just bring it in!!
• HOWEVER, if the signal is susceptible to ESD, line
spikes, lightning strikes, etc. then an optoisolator is
needed.

(e.g., automotive!
applications)

EE 260 Lecture 5: Interfacing Circuits


Pullup Resistor
+ 5v

DIO

Arduino

EE 260 Lecture 5: Interfacing Circuits


Switch Debounce Hardware
+5v +5v

R1 R

R2
C

+5v

EE 260 Lecture 5: Interfacing Circuits


CMOS vs. TTL
Arduino !
digital I/O!
pins are !
TTL!
Compatible

EE 260 Lecture 5: Interfacing Circuits


TTL to CMOS

EE 260 Lecture 5: Interfacing Circuits


Interfacing CMOS to TTL

EE 260 Lecture 5: Interfacing Circuits


TTL to RS232

• RS232 is an old serial


communication standard!
• Typical voltage values for Arduino

RS232 are ±15v, but could


be ±25v.

EE 260 Lecture 5: Interfacing Circuits


Digital Power Output: Relay
• A digitally controlled switch
+24v
+5v

1N4001

Pin BCX38B

0v
EE 260 Lecture 5: Interfacing Circuits
PWM: Unipolar
• Pin is the GPIO pin using PWM!
• The transistor is used to switch +12v
the high currents!
M
• The diode protects the power
supply from the “inductive 10k
kick.”! Pin TIP120

• This configuration is only used 0v


for motor speed control when
turning only one direction.
EE 260 Lecture 5: Interfacing Circuits
PWM: Bipolar — “H Bridge”
•Four Switches in an H!
•Motor in the Middle!
•Requires only one supply

S1 S2
+
V1
– M
S3 S4

EE 260 Lecture 5: Interfacing Circuits


PWM: Bipolar — “H Bridge”
S1 S2 S1 S2
+ +
V1
– M V1
– M
+ –
S3 S4 S3 S4

Free Running Resistive Braking

S1 S2 S1 S2
+ +
V1
– M V1
– M
+ – – +
S3 S4 S3 S4

Turn Right Turn Left


EE 260 Lecture 5: Interfacing Circuits
Linear Power Amplifier

• Power operational amplifier!


• Models depend upon expected
frequency range!
• Low Frequency!
• Audio Frequencies!
• Radio Frequencies (RF)

EE 260 Lecture 5: Interfacing Circuits

You might also like