Title: CEG3480_A2 Op Amps and Analog interfacing
1CEG3480_A2 Op Amps and Analog interfacing
- Analog interfacing techniques
2Computer interfacing Introduction
- To learn how to connect the computer to various
physical devices. - Some diagrams of this manuscript are taken from
the following references - 1 S.E. Derenzo, Interfacing -- A laboratory
approach using the microcomputer for
instrumentation, data analysis and control
prentice hall. - 2 D.A. Protopapas, Microcomputer hardware
design, Prentice hall - 3 G C Loveday, Designing electronic hardware,
Addison Wesley
3Topics include
- Overall interfacing schemes
- Analog interface circuits, active filters
- Analog/digital conversions
- sensors, controllers
- Control techniques
- Advanced examples
4Overall view a typical data acquisition and
control system
Timer e.g. 8253
Digital control circuit
Sensor
Computer
filter
A/D
Sample Hold
Op-amp
D/A
Power circuit
Mechanical device
5Analog interface example1 Audio recording systems
- Audio recording systems
- Audio signal is 2020KHz
- Sampling at 40KHz, 16-bit is Hi-fi
- Stereo ADC require to sample at 80KHz.
- Calculate storage requirement for one hour?
- Audio recording standards
- Audio CD
- Mini-disk MD
- MP3
6Analog interface example2 Video recording systems
- TV signal 256x512 picture elements
- (interlaced 256x256)
- Each second has 50 frames
- 256x256x50 3.3MHz
- For RGB color, the signal is 10MHz, so the
sampling is more than 20Mhz (very high).
7Analog interface example3 Surround sound audio
systems
- A common two channels audio CD
- Calculate storage size for one hour of recording
of a CD. 44.1KHz2bytes60sec60min2
channels633.6Mbytes - Calculate the play time of a CD.
700M/(2bytes44.1KHz2channels60sec)61.4
minutes - 6 Channels Front R/L,Rear R/L, Middle, Sub
woofer - 44.1KHz,
- Calculate the sampling frequency.
8Analog interface example4 Surround sound audio
systems
- Super audio CD player by Sony
- see Sony product catogory and search for scd-1.
- 250KHz, 24-bit
- Direct Stream Digital (DSD) 1-bit with 2.8224
MHz sampling - See http//www.licensing.philips.com/sacdsystems/s
acdstandards.html
9Analog interface example5Play stations and Wii
- Play station 3, Analog hand held controller
(http//ryangenno.tripod.com/images/PlayStation3-s
ystem.gif) - Wii, http//www.onlinekosten.de/news/bilder/wii_c
ontroller.jpg - Driving wheel http//www.bizrate.com/gamecontrolle
rs/logitech-driving-force-driving-force-wheel--pid
11297651/
10Interfacing schemes
- Program I/O
- Easy to use and modified, economical, slow
- Interrupt
- More difficult to use, faster (real time sys.)
- Direct memory access
- Direct from peripheral device to memory bypassing
the CPU. Mass data transfer, very fast. E.g. Disk
drive, graphics, sound recording systems etc.
11Operational Amplifier choices (op amp)
- Why use op amp?
- What kinds of inputs/outputs do you want?
- What frequency responses do you want?
12Factors for choosing an amplifier
- Source load requirements
- DC ( static or slow changing, without decoupling
capacitors) - AC( for fast changing signal, use decoupling
capacitors) - Input range, biased absolute min, max voltage
- Output range, biased absolute min, max voltage
- Frequency range, allowed attenuation in dB
- Noise tolerance
- Power output current/output impedance.
- DC-direct current amplifier
- AC-alternating current amplifier
Op- amp
DC Source
Load
Op- amp
AC Source
Load
13Discussions what kind of amplifiers should we
use? It is an art.
- Condenser microphone(/-10mV)
- Audio amplifier from MP3 player to speaker
- Ultrasonic sensors (/-1mV) to ADC (analog to
digital converter) (0-5V) - Accelerometers (/-5V), or (/-500mV)
- Temperature sensors to ADC (0?10mv)
- Moving coil microphone with 50Hz noise (/-0.5mV)
14Suggestions
- Condenser microphone(/-100mV) AC,
bandwidthaudio range(20-20KHz, voltage gain
100,low power. - Moving coil microphone with 50Hz noise
(/-0.5mV) AC, bandwidthaudio range, voltage
gain 2000,low power. - Audio amplifier from MP3 player to speaker AC,
high power, voltage gain 5, power gain100,
bandwidthaudio range - Ultrasonic sensors (/-1mV) to ADC (0-5V)
DC-shift needed, voltage gain5000.
bandwidthtuned narrow band - Accelerometers (/-500mV) DC-shift needed,
voltage gain 10, - Temperature sensors to ADC (0?10mv) DC, voltage
gain100.
15Operational amplifiers (op-amps)
- ideal op-amps
- inverting amplifier
- non-inverting amplifier
- voltage follower
- current-to-voltage amplifier
- summing amplifier
- full-wave rectifier
- instrumental amplifier
16General concept about OP amps
- Controllable gain
- For DC or AC amplifier
- Not too high frequency responses
17Ideal Vs. realistic op-amp
- Ideal Realistic Rin
- A infinite ? 105-108
- Zin infinite ? 106?(bipolar input) ?
1012?(FET input) output offset exists
2 3
_
V-
6
V0A(V-V-)
LM741
V
18Inverting amplifier
- Gain(G) -R2/R1
- For min. output offset, set R3 R1 // R2
- RinR1
Virtual-ground,V2
R2
_
V1
R1
V0
A
R3
19Non-inverting amplifier
- Gain(G) ? 1 (R2/R1)
- For min. offset output , set R1//R2Rsource
- High input resistance
V1
V0
A
_
R2
V2
R1
20Differential amplifier
- V0(R2/R1)(V2-V1)
- Minimum output offset R1 //R2 R3 //R4
R2
_
R1
V1
V0
A
V2
R3
R4
21Exercise 1
- A temperature sensor has an offset of 100mV
(produces an output of 100mV at 0 C-degrees
Celsius), and the gradient is 10 mV per C. The
temperature to be measured is ranging from 0 to
50 C. - The required ADC input range is 0 to 9Volts.
- Given that the power supply is /-9V, design a
differential amplifier for this application.
22Voltage follower (Unit voltage gain, high current
gain, high input impedance)
- Gain1,
- Rinhigh
- For minimum output offset RRsource
V1
V0V1
A
_
R
23Current to voltage converter application to
photo detector no loading effect for the light
detector
- V0I R
- I should not be too large otherwise offset
voltage will be too high.
Photodiode Light detector
R
I
_
V0
A
See http//hyperphysics.phy-astr.gsu.edu/hbase/ele
ctronic/photdet.htmlc1
24Summing amplifier
- V0 (V1/R1)(V2/R2)(V3/R3)R
I1
R
V1
R1
_
V2
R2
V0
I1I2I3
V3
R3
25Op-amp characteristics
- Input and output offset voltages
- It is affected by power supply variations,
temperature, and unequal resistance paths. - Some op-amps have offset setting inputs.
- Unequal resistance paths and bias currents on
inverting and non-inverting inputs - Temperature variations -- read data sheet for
operating temperatures
26Op-amp dynamic response
- Slew rate -- the maximum rate of output change
(V/us) for a large input step change. - ?A741 slew rate0.5V/ ?s. Fast slew rate is
important in video circuits , fast data
acquisition etc. - Gain bandwidth product
- higher gain -- lower frequency response
- lower gain -- higher frequency response
27Common mode gain
- If the two inputs (V,V-) are connected together
and is given Vc, output is found to be Vo. - ideal differential amplifier only amplifies the
voltage difference between its two inputs, so Vo
should be 0. - But in practice it is not.
- This deficiency can be measured by the Common
mode gainVo/Vc.
28Diagram of gain bandwidth product, from 1
29Instrumental amplifier To make a better DC
amplifier from op-amps
Applications DSO input amplifiers, amplifiers
in medical measurement systems
Diagram of instrumental amplifier, from 1
30Instrumental amplifier
- It has all the advantages of an amplifier.
- Gain(G?)V0/(V-V-)
- (R4/R3)1(2R2/R1) (typically 10 to 1000)
- Even VV- Vc , there is a slight output because
of the Common Mode GainGcV0/Vc - Therefore, V0 G?(V-V-)GcVc
- To measure this imperfection, Common Mode
rejection ratio (CMRR)G?/Gc (typically 103 to
107, or 60 to 140 dB)is used , the bigger the
better.
31Comparing amplifiers, from 1
- Op Inv. Noninv. Diff. Instu.
- Amp Amp Amp Amp Amp
- High Rin Yes No Yes No Yes
- Difftial Yes No No Yes Yes
- input
- Defined No Yes Yes Yes Yes
- gain
32Operational amplifier selection techniques and
keywords
- National semiconductor is the main manufacturer
See http//www.national.com/appinfo/milaero/analog
/highp.html - General Purpose LM741
- High Slew Rate50V/ ms -- 2000V/ ms (how fast
the output can be changed) - Follower (high speed)50MHz
- Low Supply Current 1.5mA -- 20 µA/Amp
- Low offset voltage 100 µV
- Low Noise
- Low Input Bias Current 50pA --10pA
- High Power 0.2A -- 2A
- Low Drift 2.5 mV/ _C -- 1.0 mV/ _C
- Dual/Quad
- High Power Bandwidth High Power Bandwidth
300KHz - 230Mhz
33Practical op-amp usage examples
- Example 1 Working with one power supply
- Example 2 Active filters
- Example 3 Sample and hold
- Example 4 Example 4 Voltage Comparator and
schmit trigger - Example 5 Power amplifier
34Example 1 Single power supply for op-amps
- Small systems usually have 1 power supply
- Output V0 is biased at E/2 rather than 0.
- E.g. Inverting amplifier. Gain?R2/R1
Vo
R2
E/2
E
_
V1
E/2
R1
V V-
A
Vo
R3
0-Volt
0-Volt
R20K
R20K
E Volts Power supply
E/2
35Typical AC amplifier design
Condenser microphone amplifier circuit, and the
diagram showing the output swing around the
biased 2.5V. The capacitors isolate the
stages. Condenser MIC output impedance is 75
Ohms What is the input impedance of the
amplifier?
36Example 2 Active filters (analog and using
op-amps)
- Applications accept or reject certain signals
with specific frequencies. High-pass, low-pass,
band-pass etc. E.g. - reject noise
- extract signal after demodulation
- reject unwanted side effect signals
37Types
- 2-1 Low pass
- 2-2 High pass
- 2-3 Band stop (notch) e.g. noise removal
- 2-4 Band pass
38definition of power gain in decibel (dB)
- Output power is P2, input power is P1
- Power Gain in dB10 log10 (P1/P2)
- Or
- Output voltage is V2, input voltage is V1
- Assume load R is the same, powerV2/R
- Power Gain in dB10 log10 (V12/ V22)
- Power Gain in dB20 log10 (V1/ V2)
39Important terms for filters Formulas are not
important, remember the frequency-gain curve and
concepts
- Pass band-- range of frequency that are passed
unfiltered - Stop band -- range of frequency that are
rejected. - Corner frequency -- where amplitude dropped by
2-1/20.707 -3dB - I.e. in dB 20log(0.707) -3dB
- Settling time -- time required to rise within 10
of the final value after a step input.
402-1 Low pass
- Only low frequency signal can pass
- one-pole attenuates slower 20dB/decade
- two-pole attenuates faster 40dB/decade
- Applications
- remove high freq. Noise,
- remove high freq. before sampling to avoid
aliasing noise
41Diagram for low-pass one pole filter, from
1for simplicity make R2/R11,
gain
20 dB/decade drop
- -R2/R1
- G -------------------
- 1(f/fc)21/2
-
3dB
fc
Freq.
42Formula, also
432-1aLow pass, one pole filter formulas for
simplicity make R2/R11
- -R2/R1
- G -------------------
- 1(f/fc)21/2
- Corner frequency fc1/(2?R2C)
- The gain drops 6dB/octave or 20 dB/decade
44Diagram for Low-pass two-pole filter, from 1
for simplicity make R3/(R2R1)1
40 dB/decade drop
gain
6dB
- - R3/(R2R1)
- G ------------------
- 1(f/fc)2
-
fc
Freq.
V1
452-1bLow-pass two-pole filter formulas for
simplicity make R3/(R2R1) 1
- - R3/(R2R1)
- G ------------------
- 1(f/fc)2
- Corner frequencyfc
- fc(R1//R2)/2?C1 (2 ? R3C2)-1 when gain G drops
at -6dB. - G is dropping at 40dB/decade
46Matlab, lp42.m
- lp42.m, ceg3480 matlab demo low pass filter-one
pole - clear
- f01002000
- Nlength(f)
- fc1000
- for i1N
- -----gain1 , low pass one pole , for
simplifcity make (R2/R1)1 - gv1(i)-1/sqrt(1(f(i)/fc)2)
- db10log_base10(power1/power2) or
dB20log_base10(voltage1/voltage2 - gain1_db(i)20log10(abs(gv1(i)))
-
- -----gain2 , low pass two pole , for
simplifcity make R3/(R1R2)1 - gv2(i)-1/(1(f(i)/fc)2)
- db10log_base10(power1/power2) or
dB20log_base10(voltage1/voltage2 - gain2_db(i)20log10(abs(gv2(i)))
- end
-
- figure(1)
- clf
47Plotting the comparison of the low pass filters
(one-pole, two-pole)
482-2High pass
- Only high frequency signal can pass
- one-pole attenuates slower 20dB/decade
- two-pole attenuates faster 40dB/decade
- Applications
- Remove low freq. Noise (50Hz main)
- Remove DC offset drift.
492-2aDiagram for high-pass one-pole filter, from
1For simplicity make R1R2
20 dB/decade drop
- (f/fc)
- G-------------------
- 1(f/fc)21/2
- fc1/2 ?(R1C)
gain
3dB
fc
Freq.
high freq. Cutoff unintentionally Created by
Op-amp
50High-pass one-pole filter formulas
- (f/fc)
- G-------------------
- 1(f/fc)21/2
- Corner frequency fc1/2 ?(R1C)
- At low f , Gf/fc at high f , GR2/R1?1
- Since op-amp has a certain gain-bandwidth, so at
high frequency the gain drops. So all op-amp
high-pass filters are actually band-pass.
51Matlab hp52.m
- hp52.m ceg3480 matlab demo high pass filter-one
pole - clear
- f500100100000
- Nlength(f)
- fc1000
- for i1N
- -------------------gain3 , high pass ,one
pole - gv3(i)-(f(i)/fc)/sqrt(1(f(i)/fc)2)
- db10log_base10(power1/power2) or
dB20log_base10(voltage1/voltage2 - gain3_db(i)20log10(abs(gv3(i)))
- end
-
- figure(1)
- clf
- limit_ymin(gain3_db)
- semilogx(f,gain3_db,'k-.')
- hold on
- ------------------------
- semilogx(fc,fc,0,limit_y,'g-.')
52high pass one pole filter
532-3Band stop (notch) filter
- Suppresses a narrow frequency band of signal
542-3Band pass filter
- Passes a frequency band of signal.
55Diagram for Notch filter (band-stop), from 1
56Notch filter (band-stop) formulas
- Rejects a narrow band of frequencies and passes
all others. Say reject the 60Hz main noise for
noise removal. - High Q,?Fc1(4 ? RC)-1
- Low Q, ? Fc2(? RC)-1
Voltage gain
frequency
57Example 3 Sample and hold amplifier
- For a fast changing signal, if you want to know
the voltage level of a snap shot (e.g. using a
slow AD converter to view a short pulse), you
need a sample and hold device, e.g. AD582, AD389
etc. - At Sample(S), V0V1 at Hold(H) the output is
held at the level just before switching to H. It
is like taking a photograph of a signal. - Some AD converter has this circuit incorporated
inside.
58Diagram for Sample and hold amplifier, from 1
59Example 4 Voltage Comparator with hysteresis and
schmit trigger
Comparator gives bad result Unstable region when
V1 and Vref are closed
- E.g. in IR motor speed encoder
- V1IR receiver input
V
V0
V1
comparator
Vref
0V
Better output Using Schmit trigger
V-
IR receiver Signal with noise
Schmit trigger
V
0V
V-
60Diagram for hysteresis (non-inverting schmit
trigger), see P.420, S. Franco, Design with
operational amplifiers and analog integrated
circuits, McGraw Hill.
Voltage
V0
V1
VTH
VTL
t
Output Voltage
Switch over voltage
10V -10V
VTH -VTL (Vohigh Volow)(R1/R2)2V
VTL -1V
VTH 1V
Input voltage
Vref 0
61Example 4 Schmit trigger using dual-power supply
non-inverting op amp A small amount of
hysteresis is used to stabilize the output when
V1 is near to Vref.(set R1/R20.1)
Vhigh10V
- To make Vo from low to high
- V1 VTH, at V1VTH
- (VTH-0)/R1(0-Vlow)/R2
- V1VTH -R1/R2(Vlow)1V
- V1VTH -(0.1)(-10)1V
- To make Vo from high to low
- V1
- (Vhigh-0)/R2(0-VTL)/R1
- V1
- If R2 R1, hysteresis is small.
- For schmit trigger devices R1? 0.1R2, e.g.
R11K, R210K, so hysteresis is good enough to
reject noise.
Vo
0V
Vlow-10V
The op-amp uses V,V_ power supplies.Output is
clamped to Vlow or Vhigh, setVref 0 to make
the math easier
62Example 5 Power amplifier
- Most op-amps can drive outputs with low currents,
we need transistors to raise the power to drive
heavy loads, e.g. mechanical relays, motors or
speakers. - V0V1-1.2 Volts
- TIP3055 type transistors can drive current up to
15A.
63Power amplifier, from 1
From http//www.st.com/stonline/books/pdf/docs/41
36.pdf
64From http//www.fairchildsemi.com/ds/TI/TIP41C.p
df
65Summary
- Studied
- Basic digital data acquisition systems
- The configuration of operational amplifier
circuits and their applications
66Appendix
67Appendix 1Exerciseproblem setting
- A magnetic sensor is used to detect the magnetic
flux density (in K Gauss) of an environment. The
resistance of the sensor is proportional to the
flux density detected with a gradient of 4 KO per
K Gauss, and when there is no magnetic flux the
resistance is 2K. The range of the magnetic flux
density in the environment is between 0 and 5 K
Gauss, and the flux density changes at a rate of
not more than 10 K Gauss per second. The smallest
change in flux density detectable is required to
be 5 Gauss. The system uses an Analogue-to-Digital
Converter (ADC) to convert the magnetic flux
density into digital data, and the power supply
used for this system is 5 Volt.
68Exercise Question
- Draw the circuit diagram of the bridge circuit
and the operational amplifier circuit needed to
transform the flux density detected to an output
voltage. The output voltage is proportional to
the flux density. When the flux density is 0 the
output is 0 Volt when the flux density is 5 K
Gauss the output is 5 Volts. - It is found that the temperature of the
environment affects the resistance of the
magnetic sensor at a rate of RT (in KO per degree
Celsius). Discuss how you can use two or more
sensors to reduce the effect of temperature
change. Draw the circuit of your scheme and
explain with the help of formulas of how the
system can be freed from the effect of
temperature change.
69Appendix 2, To prove
- 1/(1ja)1/(1ja)(1-ja)/(1-ja)
- (1-ja)/(12-(ja)2)(1-ja)/(1a2), since j2 -1
- 1/(1a2)(-ja)/(1a2)real imaginary
- so
- 1/(1ja)real2 imaginary21/2
- 1 /(1a2)2(-ja)/(1a2)21/2
- 1a22-(1a2)a2/1a221/2
- 12a2a4-a2-a4/1a221/2
- 1a2/1a221/2
- 1/1a21/2, proved!
70Solution for Exercise 1
- Gain Vout/Vin9V/(10mV50 C )18, set
R2/R1R4/R318 - How to solve the offset problem.
- Sensor ? V2
- Offset of 100mV at V1, 9Rb/(RaRb)100mV (make
R4 Ra) why? - Add a small variable resistor Rc between 9V Ra
for offset trimming.
9V
R2
V1
Ra
9V
_
R1
V0
A
Sensor
Rb
R3
V2
-9V
0V
R4