`Microprocessor Systems
`
`Copyright © 2003. Elsevier Science & Technology. All rights reserved.
`
`Ball, Stuart R., and Lecturer in History Stuart Ball. Analog Interfacing to Embedded Microprocessor Systems, Elsevier Science & Technology, 2003.
` ProQuest Ebook Central, http://ebookcentral.proquest.com/lib/nyli/detail.action?docID=286648.
`Created from nyli on 2019-02-04 12:11:44.
`
`GE 2019
`Vestas v. GE
`IPR2018-01015
`
`i
`
`
`
`Copyright © 2003. Elsevier Science & Technology. All rights reserved.
`
`Ball, Stuart R., and Lecturer in History Stuart Ball. Analog Interfacing to Embedded Microprocessor Systems, Elsevier Science & Technology, 2003.
` ProQuest Ebook Central, http://ebookcentral.proquest.com/lib/nyli/detail.action?docID=286648.
`Created from nyli on 2019-02-04 12:11:44.
`
`ii
`
`
`
`Analog Interfacing to Embedded
`Microprocessor Systems
`
`Stuart R. Ball
`
`AMSTERDAM (cid:129) BOSTON (cid:129) HEIDELBERG (cid:129) LONDON
`NEW YORK (cid:129) OXFORD (cid:129) PARIS (cid:129) SAN DIEGO
` SAN FRANCISCO (cid:129) SINGAPORE (cid:129) SYDNEY (cid:129) TOKYO
`Newnes is an imprint of Elsevier
`
`Copyright © 2003. Elsevier Science & Technology. All rights reserved.
`
`Ball, Stuart R., and Lecturer in History Stuart Ball. Analog Interfacing to Embedded Microprocessor Systems, Elsevier Science & Technology, 2003.
` ProQuest Ebook Central, http://ebookcentral.proquest.com/lib/nyli/detail.action?docID=286648.
`Created from nyli on 2019-02-04 12:11:44.
`
`iii
`
`
`
`Newnes is an imprint of Elsevier.
`
`Copyright # 2004, by Elsevier. All rights reserved.
`
`No part of this publication may be reproduced, stored in a retrieval system, or
`transmitted in any form or by any means, electronic, mechanical, photocopying,
`recording, or otherwise, without the prior written permission of the publisher.
`
`Recognizing the importance of preserving what has been written, Elsevier
`prints its books on acid-free paper whenever possible.
`
`Library of Congress Cataloging-in-Publication Data
`Ball, Stuart R., 1956–
`Analog interfacing to embedded microprocessor systems / Stuart R. Ball.—2nd ed.
`p.
`cm. — (Embedded technology series)
`Rev. ed. of: Analog inter-facing to embedded microprocessors. 2001.
`Includes index.
`ISBN 0-7506-7723-6
`I. Ball, Stuart R., 1956-
`1. Embedded computer systems—Design and construction.
`Analog inter-facing to embedded microprocessors. II. Title. III. Series.
`TK7895.E42B33 2003
`004.16—dc21
`
`2003044211
`
`British Library Cataloguing-in-Publication Data
`A catalogue record for this book is available from the British Library.
`
`The publisher offers special discounts on bulk orders of this book.
`For information, please contact:
`
`Manager of Special Sales
`Elsevier
`200 Wheeler Road, Sixth Floor
`Burlington, MA 01803
`Tel: 781-313-4700
`Fax: 781-313-4882
`
`For information on all Newnes publications available, contact our World Wide Web
`home page at: http://www.newnespress.com
`
`10 9 8 7 6 5 4 3 2 1
`
`Printed in the United States of America
`
`Copyright © 2003. Elsevier Science & Technology. All rights reserved.
`
`Ball, Stuart R., and Lecturer in History Stuart Ball. Analog Interfacing to Embedded Microprocessor Systems, Elsevier Science & Technology, 2003.
` ProQuest Ebook Central, http://ebookcentral.proquest.com/lib/nyli/detail.action?docID=286648.
`Created from nyli on 2019-02-04 12:11:44.
`
`iv
`
`
`
`1
`
`13
`
`v
`
`44
`
`Contents
`
`1 System Design
`
`1
`
`Dynamic Range
`Calibration
`2
`Bandwidth
`5
`Processor Throughput
`7
`Avoiding Excess Speed
`Other System Considerations
`Sample Rate and Aliasing
`
`6
`
`8
`
`11
`
`2
`
`Analog-to-Digital Converters
`
`17
`25
`26
`
`15
`ADCs
`Types of ADCs
`ADC Comparison
`Sample and Hold
`Real Parts
`29
`Microprocessor Interfacing
`Clocked Interfaces
`35
`Serial Interfaces
`36
`41
`Multichannel ADCs
`Internal Microcontroller ADCs
`Codecs
`43
`44
`Interrupt Rates
`Dual-Function Pins on Microcontrollers
`Design Checklist
`46
`
`30
`
`42
`
`Copyright © 2003. Elsevier Science & Technology. All rights reserved.
`
`Ball, Stuart R., and Lecturer in History Stuart Ball. Analog Interfacing to Embedded Microprocessor Systems, Elsevier Science & Technology, 2003.
` ProQuest Ebook Central, http://ebookcentral.proquest.com/lib/nyli/detail.action?docID=286648.
`Created from nyli on 2019-02-04 12:11:44.
`
`
`
`3 Sensors
`
`47
`
`Temperature Sensors
`Optical Sensors
`59
`CCDs
`71
`82
`Magnetic Sensors
`Motion/Acceleration Sensors
`Strain Gauges
`89
`
`86
`
`4 Time-Based Measurements
`
`47
`
`91
`
`Measuring Period versus Frequency
`Mixing
`96
`Voltage-to-Frequency Converters
`Clock Resolution and Range
`100
`Extending Accuracy with Limited Resolution
`
`94
`
`98
`
`102
`
`5 Output Control Methods
`
`107
`
`107
`108
`
`107
`Open-Loop Control
`Negative Feedback and Control
`Microprocessor-Based Systems
`On-Off Control
`109
`Overshoot
`112
`112
`Proportional Control
`Proportional, Integral, Derivative Control
`Motor Control
`127
`133
`Predictive Control
`Measuring and Analyzing Control Loops
`PID Software Examples
`138
`Things to Remember in Control Design
`
`116
`
`134
`
`143
`
`6 Solenoids, Relays, and Other Analog Outputs
`
`145
`
`145
`Solenoids
`149
`Heaters
`155
`Coolers
`157
`LEDs
`162
`DACs
`Digital Potentiometers
`Analog Switches
`166
`
`163
`
`Copyright © 2003. Elsevier Science & Technology. All rights reserved.
`
`vi
`
`Contents
`
`Ball, Stuart R., and Lecturer in History Stuart Ball. Analog Interfacing to Embedded Microprocessor Systems, Elsevier Science & Technology, 2003.
` ProQuest Ebook Central, http://ebookcentral.proquest.com/lib/nyli/detail.action?docID=286648.
`Created from nyli on 2019-02-04 12:11:44.
`
`
`
`Sensors
`
`3
`
`Sensors provide the window through which a microprocessor system can see what
`is happening in the real world. In this chapter we will take a look at various
`sensors, their applications, and how they interface to microprocessors.
`
`Temperature Sensors
`
`Temperature is one of the most common real-world characteristics that needs to
`be measured. Many industrial processes, from steel manufacturing to semicon-
`ductor fabrication, depend on temperature. Some electronics products need to
`measure their own temperature, such as computers that monitor the temperature
`of the CPU or motor controllers that must know the temperature of the power
`driver IC.
`
`Thermistors
`
`A thermistor is a temperature-sensitive resistor. Most thermistors have a negative
`temperature coefficient (NTC), meaning that the resistance goes up as the tem-
`perature goes down. Of all passive temperature measurement sensors, thermis-
`tors have the highest sensitivity (resistance change per degree of temperature
`change). Thermistors do not have a linear temperature/resistance curve.
`Thermistor characteristics are dependent on the manufacturing process and
`materials used. Often, many thermistors in a family will have similar character-
`istics and identical curves. The resistance of the thermistors may vary by 10:1 or
`100:1, but the curves are the same. Such thermistors are typically characterized
`by the manufacturer in a table that shows the ratio of resistance at a given
`
`temperature to the resistance at 25
`C. Data for a typical NTC thermistor family
`is shown in the following table.
`
`47
`
`Copyright © 2003. Elsevier Science & Technology. All rights reserved.
`
`Ball, S. R., & Ball, L. I. H. S. (2003). Analog interfacing to embedded microprocessor systems. Retrieved from http://ebookcentral.proquest.com
`Created from nyli on 2019-02-04 12:08:43.
`
`
`
`Typical NTC Thermistor Data
`
`
`
`C
`
`Temp
` 50
` 40
` 30
` 20
` 10
`0
`10
`20
`25
`
`R/R25
`
`39.03
`21.47
`12.28
`7.28
`4.46
`2.81
`1.82
`1.21
`1
`
`Temp
`
`
`
`C
`
`30
`40
`50
`60
`70
`80
`90
`100
`110
`
`R/R25
`
`0.8276
`0.6406
`0.5758
`0.4086
`0.2954
`0.2172
`0.1622
`0.1229
`0.09446
`
`This data is for a Dale thermistor, but it is typical for NTC thermistors in
`
`general. The resistance is given as a ratio ðR=R25Þ. A thermistor from this family
`C ðR25Þ of 10,000 ohms would have a resistance of 28.1 K
`
`with a resistance at 25
`
`
`at 0
`C and a resistance of 4.086 K at 60
`C. Similarly, a thermistor with R25 of 5 K
`would have a resistance of 14,050 ohms (5000 2:81) at 0
`
`C.
`Figure 3.1 shows how this thermistor curve looks graphically. As men-
`tioned,
`the resistance/temperature curve is not
`linear. The data for this
`
`
`thermistor is given in 10
`increments. Some thermistor tables have 5
`or even
`
`1
`increments.
`In some cases, you need to know the temperature between two points on the
`table. You can estimate this by using the curve, or you can calculate the resistance
`directly. The formula for resistance looks like this:
`
`
`
`
`þ C
`¼ exp A þ B
`þ D
`Rt
`T2
`T3
`T
`R25
`Where T ¼ temperature in degrees Kelvin, and A, B, C, and D are constants
`that depend on the characteristics of the thermistor. These parameters must be
`supplied by the thermistor manufacturer.
`Thermistors have a tolerance that limits their repeatability from one sample to
`the next. This tolerance typically ranges from 1% to 10%, depending on the
`specific part used. Some thermistors are designed to be interchangeable in
`applications where it is impractical to have an adjustment. Such an application
`might include an instrument in which the user or a field engineer has to replace
`the thermistor and has no independent means to calibrate it. These thermistors
`
`are available with accuracy around 0.2
`C.
`Figure 3.2 shows a typical circuit that could be used to allow a microprocessor
`to measure temperature using a thermistor. A resistor (R1) pulls the thermistor
`
`Copyright © 2003. Elsevier Science & Technology. All rights reserved.
`
`48
`
`Analog Interfacing to Embedded Microprocessor Systems
`
`Ball, S. R., & Ball, L. I. H. S. (2003). Analog interfacing to embedded microprocessor systems. Retrieved from http://ebookcentral.proquest.com
`Created from nyli on 2019-02-04 12:08:43.
`
`
`
`RT
`R25
`
`8
`
`7
`
`6
`
`5
`
`4
`
`3
`
`2
`
`1
`
`–20
`
`–10
`
`0
`
`10
`
`20
`
`30
`
`40
`
`50
`
`60
`
`70
`
`80
`
`90
`
`100
`
`TEMP, C
`
`Figure 3.1
`Thermistor resistance/temperature curve.
`
`49
`
`+VREF
`
`R1
`RESISTOR
`
`TO ADC INPUT
`
`THERMISTOR
`
`Figure 3.2
`Thermistor circuit.
`
`Sensors
`
`Copyright © 2003. Elsevier Science & Technology. All rights reserved.
`
`Ball, S. R., & Ball, L. I. H. S. (2003). Analog interfacing to embedded microprocessor systems. Retrieved from http://ebookcentral.proquest.com
`Created from nyli on 2019-02-04 12:08:43.
`
`
`
`up to a reference voltage. This is typically the same as the ADC reference, so Vref
`would be 2.5 V if the ADC reference was 2.5 V. The thermistor/resistor combina-
`tion makes a voltage divider, and the varying thermistor resistance results in a
`varying voltage at the junction. The accuracy of this circuit is dependent on the
`thermistor tolerance, resistor tolerance, and reference accuracy.
`Because a thermistor is a resistor, passing current through it will generate heat.
`This is called self-heating. The circuit designer must ensure that the pullup
`resistor (R1 in the diagram) is large enough to prevent excessive self-heating,
`or the system will end up measuring the thermistor dissipation instead of the
`temperature of whatever the thermistor is attached to.
`The amount of power that the thermistor has to dissipate to affect the tem-
`perature is called the dissipation constant (D.C.), and is usually expressed in
`milliwatts. The D.C. varies with the package the thermistor is provided in, the
`lead gauge (if a leaded device), type of encapsulating material (if the thermistor is
`encapsulated), and other factors. The D.C. is the number of milliwatts needed to
`
`raise the thermistor temperature 1
`C above ambient. The amount of self-heating
`allowed, and therefore the size of the limiting resistor, is dependent on the
`measurement accuracy needed. A system that is only measuring with an accuracy
`of 5
`
`C can tolerate more thermistor self-heating than a system that must be
`accurate to 0.1
`
`C. The formula for calculating the amount of self-heating
`dissipation allowed for a design is:
`
`P ¼ D:C: Required accuracy; in
`
`
`
`C
`
`C, and we
`For instance, if the D.C. for our example thermistor was 2 mw/
`
`needed to measure temperature with an accuracy of 0.5
`C, then the maximum
`allowable dissipation would be:
`
`
`
`2 mw=
`
`C 0:5
`
`
`
`C ¼ 1 mw
`
`Because there are other errors and tolerances in the system, we would prob-
`ably want a little margin, so we might divide this by 2, giving 0.5 mw as the
`maximum self-heating dissipation. Note that this is the maximum self-heating
`dissipation we want to allow over the measurement temperature range. Say we
`are using our example thermistor, with an R25 of 10 K, and we want to measure
`
`
`
`temperatures from 0
`C to 25
`C. At 25
`C, the thermistor resistance is 10 K. To
`limit dissipation to 0.5 mw using a 2.5 V Vref, the pullup resistor (R1 in Figure
`3.2) can be calculated as follows:
`Thermistor dissipation ¼ 0:5 mw at 10 K
`
`50
`
`Analog Interfacing to Embedded Microprocessor Systems
`
`Copyright © 2003. Elsevier Science & Technology. All rights reserved.
`
`Ball, S. R., & Ball, L. I. H. S. (2003). Analog interfacing to embedded microprocessor systems. Retrieved from http://ebookcentral.proquest.com
`Created from nyli on 2019-02-04 12:08:43.
`
`
`
`
`Thermistor voltage drop at this dissipation : P¼ E2
`R
`Current through thermistor¼ 2:23V=10K¼ 223ma
`Voltage across pullup ¼ 2:5 2:23¼ 0:27V
`Pullup ðminimum valueÞ¼ 0:27V=223ma¼ 1210
`
`
`
`
`p
`
`ffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi
`0:0005 10;000
`
`;
`
`¼ 2:23V
`
`Now, suppose that we want to use this thermistor from 0
`C. The
`C to 50
`
`C is 5758
`. Repeating the preceding
`thermistor resistance (from the table) at 50
`calculation for this resistance results in a minimum pullup resistance of
`2725 ohms. Because the thermistor resistance is lower at higher temperatures,
`the original 1210 ohm value would cause too much dissipation at those tempera-
`tures.
`
`
`
`
`
`Scaling
`
`Sometimes it is necessary to shift an analog signal to put it in the right range for
`an A/D converter to use. Figure 3.3 shows such a situation. Here we have a
`thermistor that is interfaced to an 8-bit, 0-to-5 V A/D converter, such as that
`found on the Microchip 16C7x parts. We’ll use the same thermistor we’ve been
`using. The formula for the voltage V1 is:
`
`V1 ¼ 2:5 Rth
`Rth þ R1
`In Figure 3.3, R1 ¼ 10 K. Using this equation and the resistance/temperature
`table for the thermistor, we can calculate the value of V1 for the temperature
`range we are interested in:
`
`
`
`C
`
`Temp
` 10
`0
`10
`25
`30
`40
`50
`70
`100
`
`Rth
`
`44.6 K
`28.1 K
`18.2 K
`10 K
`8.276 K
`6.406 K
`4.08 K
`2.954 K
`1229
`
`
`V1
`
`2.04 V
`1.84 V
`1.61 V
`1.25 V
`1.13 V
`0.976 V
`0.7244 V
`0.569 V
`0.273 V
`
`and 40
`to measure temperature between 10
`Now, say that we want
`
`with an accuracy of at
`least
`three A/D steps per degree (or 0.333
`C
`
`
`
`
`
`Copyright © 2003. Elsevier Science & Technology. All rights reserved.
`
`Sensors
`
`51
`
`Ball, S. R., & Ball, L. I. H. S. (2003). Analog interfacing to embedded microprocessor systems. Retrieved from http://ebookcentral.proquest.com
`Created from nyli on 2019-02-04 12:08:43.
`
`
`
`VR, 2.5V
`
`R1
`10K
`
`THERMISTOR
`
`Rth
`
`TEMP Rth
`
` -10 44.6K
` 0 28.1K
` 10 18.2K
` 25 10k
` 40 6.406K
` 50 5.758K
` 70 2.954K
` 100 1.229K
`
`RH
`
`OP AMP
`
`RF
`
`V1
`
`V2
`
`RL
`
`VO
`TO ADC INPUT
`
`OUR APPLICATION USES ONLY
`THIS RANGE (10 TO 40 DEGREES C)
`
`30K
`
`Rth
`OHMS
`
`20K
`
`10K
`
`0
`
`10 20 30 40 50 60 70 80 90 100
`TEMP
`
`WE WANT THIS
`
`5V
`
`4V
`
`3V
`
`2V
`
`1V
`
`0V
`
`10
`
`TEMP
`
`40
`
`Figure 3.3
`Thermistor scaling.
`
`per ADC step). If we convert the range in the table to ADC values, we get
`this:
`
`10 degrees: digital word ¼ 1:61
` 256 ¼ 82
`5
`40 degrees: digital word ¼ 0:976
` 256 ¼ 49
`5
`82 49 ¼ 33 ADC counts; 40
`C 10
`C ¼ 30
`
`
`¼ 1:1 ADC steps per degree
`33 counts
`30 degrees
`
`
`
`C ðspanÞ
`
`This is less than the resolution we wanted, so we have to scale the output. This
`involves amplifying the signal so that the 10-to-40 degree range we’re interested
`in spans the ADC voltage range. In this example, the 10-to-40 span ranges from
`0.976 to 1.61 volts, a span of 0.634 V (1.61 – 0.976). We could make this a 5 V
`span by multiplying it by 5 V/0.634 V, or 7.88. The result of such a multiplication
`
`52
`
`Analog Interfacing to Embedded Microprocessor Systems
`
`Copyright © 2003. Elsevier Science & Technology. All rights reserved.
`
`Ball, S. R., & Ball, L. I. H. S. (2003). Analog interfacing to embedded microprocessor systems. Retrieved from http://ebookcentral.proquest.com
`Created from nyli on 2019-02-04 12:08:43.
`
`
`
`would be to make the 10-to-40 degree voltage range between 7.67 and 12.67
`volts. This is a 5 V span, but it is outside the 0-to-5 volt range of the ADC. What is
`needed is both multiplication and scaling, which amplifies the signal and shifts it
`down to the ADC input range.
`The schematic in Figure 3.3 shows how an opamp can be configured to per-
`form this function. We can calculate the output voltage of the opamp as follows:
`Writing equations for V2:
`
`þ Vr V2
`
`Vo V2
`¼ V2
`Rf
`Rh
`RL
`As long as the opamp is operating in the linear range, V1 ¼ V2. So we can
`rewrite the preceding equation like this:
`Vo V1
`Rf
`
`þ Vr V1
`
`Rh
`
`¼ V1
`RL
`
`If we solve this equation for Vo, we get the following:
`
`
`
`þ Rf
`Rh
`
` VrRf
`Rh
`
`
`Vo ¼ V1 1 þ Rf
`RL
`
`
`V1 1 þ Rf
`RL
`
`þ Rf
`Rh
`
`is the gain and
`
`VrRf
`Rh
`
`is the offset
`
`Now we can apply this to the thermistor we’ve been using as an example. Say
`that we want the 10-to-40 degree range to fall between 0.5 V and 4.5 V at the
`ADC. This gives a little margin to accommodate the need to use standard resistor
`values. This scaling will give an ADC range of 204 counts over a range of 30
`degrees, or 6.8 counts per degree. So the 0.634 V swing of the output must
`translate into a swing of 4.5–0.5, or 4 V. This is a gain of 4/0.634 or 6.3. We can
`write this in equation form as:
`
`6:3 ¼ 1 þ Rf
`RL
`
`þ Rf
`Rh
`
`If we just multiply V1 by 6.3, we get outputs of
`0:976 6:3 ¼ 6:14 V
`1:61 6:3 ¼ 10:143 V
`
`Copyright © 2003. Elsevier Science & Technology. All rights reserved.
`
`Sensors
`
`53
`
`Ball, S. R., & Ball, L. I. H. S. (2003). Analog interfacing to embedded microprocessor systems. Retrieved from http://ebookcentral.proquest.com
`Created from nyli on 2019-02-04 12:08:43.
`
`
`
`So the span ð10:14 6:14 ¼ 4 VÞ is right, but now we need the offset. The
`offset is found by subtracting either of these voltages from the corresponding
`desired voltage:
`
`6:14 0:5 ¼ 5:64 V; or 10:14 4:5 ¼ 5:64 V
`
`(Both have to give the same result or something is wrong in the earlier
`calculations.)
`The offset is given by Vr Rf/Rh, so we can write another equation:
`
`5:64 ¼ Vr Rf
`
`Rh
`
`Now
`we
`can
`solve
`the
`simultaneous
`equations
`for
`gain
`ð6:3 ¼ 1 þ Rh=RL þ Rf =RhÞ and offset ð5:64 ¼ VrRf =RhÞ for resistor values.
`The example circuit uses a reference voltage, Vr, of 2.5 V, as shown on the
`schematic. Note that this is the reference voltage only for the thermistor and
`opamp circuit; the ADC still uses a 5 V reference. We have two equations and
`three resistors, so we have to choose the value of one resistor. Selecting 100 K for
`Rf, we have:
`
`6:3 ¼ 1 þ 100 K
`þ 100 K
`100 K
`RL
`Rh
`Rh
`Since Vr ¼ 2:5, then the second equation is: 5:64 ¼ 250 K
`Rh
`
`5:64 ¼ Vr
`
`;
`
`Solving these simultaneous equations we get:
`Rh ¼ 44:32 K
`RL ¼ 32:85 K
`
`The next step is to choose standard resistor values; the nearest 1% values are
`44.2 K and 33.2 K. Plugging these values into the equation for Vo, we get a gain of
`6.27 and an offset of 5.65 V. We can make a chart showing the actual ADC result
`for each temperature in the range:
`
`Temp
`
`
`
`C
`
`10
`25
`30
`40
`
`54
`
`Rth
`
`18.2 K
`10 K
`8.276 K
`6.406 K
`
`Opamp Output
`
`(Decimal)
`
`4.44 V
`2.18 V
`1.44 V
`0.467 V
`
`227
`111
`74
`23
`
`Analog Interfacing to Embedded Microprocessor Systems
`
`Copyright © 2003. Elsevier Science & Technology. All rights reserved.
`
`Ball, S. R., & Ball, L. I. H. S. (2003). Analog interfacing to embedded microprocessor systems. Retrieved from http://ebookcentral.proquest.com
`Created from nyli on 2019-02-04 12:08:43.
`
`
`
`You need the chart because the thermistor isn’t linear, so the software needs to
`know what ADC value to expect for a given temperature. If this were a real
`application, we would probably calculate the chart in 1-degree increments. For
`this specific example, the opamp has to swing almost all the way between 5 V and
`ground, so it must either operate from positive and negative voltages, or else a
`single-supply, 5 V-only opamp with rail-to-rail output capability would be
`needed. The accuracy of this circuit is ð227 23Þ=30
`C ¼ 6:8 ADC steps per
`
`
`C.
`
`Tolerance Stackup
`
`In any opamp application, there are gain variations caused by the tolerances of
`the components. In the thermistor scaling application we just looked at, we
`selected standard 1% resistor values to produce the gain and scaling factors we
`wanted, then calculated the actual ADC values that would result from that circuit.
`But 1% resistors have a 1% tolerance, so they can vary by 1%. What happens in
`that case? We can calculate this for our example as follows.
`
`Result if Rh is 1% High (44.642 K Instead of 44.2 K)
`Rh ¼ 44.2 K
`ADC Result
`
`Temp
`
`Rth
`
`Vo
`
`Rh ¼ 44.64 K
`ADC Result
`
`229
`113
`75
`25
`
`Vo
`
`4.48
`2.21
`1.47
`0.50
`
`10
`25
`30
`40
`
`18.2 K
`10 K
`8.276 K
`6.406 K
`
`4.44 V
`2.18 V
`1.44 V
`0.467 V
`
`227
`111
`74
`23
`
`What happens if Rh is high by 1% ð¼ 44:64 KÞ and RL is low by 1% ð¼ 32:868Þ?
`
`Result if Rh is 1% High and RL is 1% Low
`
`Temp
`
`Rth
`
`Vo
`
`ADC Result
`
`Vo
`
`ADC Result
`
`Rh, RL normal
`
`Rh high, RL low
`
`10
`25
`30
`40
`
`18.2 K
`10 K
`8.276 K
`6.406 K
`
`4.44 V
`2.18 V
`1.44 V
`0.467 V
`
`227
`111
`74
`23
`
`4.47
`2.19
`1.45
`0.478
`
`229
`112
`74
`24
`
`In a real application, you could use a spreadsheet to calculate the effects of all the
`resistors, including the thermistor itself. In this simple application, just varying Rh
`
`Sensors
`
`55
`
`Copyright © 2003. Elsevier Science & Technology. All rights reserved.
`
`Ball, S. R., & Ball, L. I. H. S. (2003). Analog interfacing to embedded microprocessor systems. Retrieved from http://ebookcentral.proquest.com
`Created from nyli on 2019-02-04 12:08:43.
`
`
`
`C. This may or may not be a
`and RL by 1% throws the result off by 5 counts at 10
`problem, depending on the accuracy required. In a real application, you would
`probably want to use at least 0.1% resistors. This would give the following result.
`
`
`
`Result if Rh is 0.1% High, R1 and RL are 0.1% Low
`
`Temp
`
`Rth
`
`Vo
`
`ADC Result
`
`Vo
`
`ADC Result
`
`Rh, RL normal
`
`Rh high, RL low
`
`10
`25
`30
`40
`
`18.2 K
`10 K
`8.276 K
`6.406 K
`
`4.44 V
`2.18 V
`1.44 V
`0.467 V
`
`227
`111
`74
`23
`
`4.47
`2.19
`1.45
`0.478
`
`229
`112
`74
`24
`
`This is much closer to the ideal result. Other factors that would need to be
`included in a real application would be the tolerance of the voltage reference and
`the tolerance of the thermistor itself.
`Another way to get this kind of accuracy is to calibrate the system after it is
`built. In many applications, this is not an option because the circuit boards and/or
`thermistor must be field replaceable. However, in cases where the equipment is
`not field replaceable, or where the field technicians have an independent means
`to monitor the temperature, it is possible to let the software build a table of
`temperature-versus-ADC values. There must be some means to input the actual
`temperature (measured with the independent tool) so the software can construct
`the table.
`
`Resistance Temperature Detectors
`
`A resistance temperature detector (RTD) is just a wire that changes resistance
`with temperature. Typical RTD materials include copper, platinum, nickel, and
`nickel/iron alloy. An RTD element can be a wire or a film, plated or sprayed onto
`a substrate such as ceramic.
`C. A typical platinum RTD with 100
` resist-
`RTD resistance is specified at 0
`
`
`C would have a resistance of 100:39
` at 1
`C and a resistance of 119:4
`
`ance at 0
`
`at 50
`C. The tolerance of RTDs is better than thermistors. Typical tolerance for
`RTDs looks like this:
`
`
`
`. Platinum: 0.01% to 0.03%
`. Copper: 0.2%
`. Nickel and nickel/iron: 0.5%
`
`Aside from better tolerance and overall lower resistance, the interface to an
`RTD is similar to that for a thermistor.
`
`56
`
`Analog Interfacing to Embedded Microprocessor Systems
`
`Copyright © 2003. Elsevier Science & Technology. All rights reserved.
`
`Ball, S. R., & Ball, L. I. H. S. (2003). Analog interfacing to embedded microprocessor systems. Retrieved from http://ebookcentral.proquest.com
`Created from nyli on 2019-02-04 12:08:43.
`
`
`
`Thermocouples
`
`A thermocouple is made by joining two dissimilar metals. Thomas Seebeck
`discovered in 1821 that when such a junction is heated, it generates a tiny voltage.
`The amount of voltage is dependent on which two metals are joined. Three
`common thermocouple combinations are iron-constantan (Type J), copper-
`constantan (Type T), and chromel-alumel (Type K).
`The voltage produced by a thermocouple junction is very small, typically only
`
`a few millivolts. A type K thermocouple changes only about 40 mV per
`C change
`
`in temperature; to measure temperature with 0.1
`C accuracy, the measurement
`system must be able to measure a 4 mV change. Because any two dissimilar metals
`will produce a thermocouple junction when joined, the connection point of the
`thermocouple to the measurement system will also act as a thermocouple. Figure 3.4
`shows this effect, where a thermocouple is connected to a board using copper. The
`wires leading to the amplifier could be either copper wires or the copper traces
`on a PCB.
`As shown in Figure 3.4, this effect can be minimized by placing the connections
`on an isothermal block, which is a good conductor of heat. This minimizes the
`temperature difference between the connection points and minimizes the error
`introduced by the connection junctions. A common method of compensating for
`the temperature of the connection block is to place a diode or other semiconduc-
`tor on the isothermal block and measure the (temperature-sensitive) drop across
`the semiconductor junction.
`
`OUTPUT VOLTAGE
`TO ADC
`
`AMPLIFIER
`
`–
`
`+
`
`Cu
`
`Cu
`
`–+
`
`THERMOCOUPLE
`JUNCTION
`
`ISOTHERMAL
`BLOCK
`
`THERMAL
`COMPENSATION
`CIRCUIT
`
`OUTPUT VOLTAGE
`TO ADC
`
`–
`
`+
`
`Cu
`
`Cu
`
`–+
`
`ISOTHERMAL
`BLOCK
`TEMPERATURE COMPENSATION
`
`AMPLIFIER
`
`THERMOCOUPLE
`JUNCTION
`
`Figure 3.4
`Thermocouple.
`
`Sensors
`
`57
`
`Copyright © 2003. Elsevier Science & Technology. All rights reserved.
`
`Ball, S. R., & Ball, L. I. H. S. (2003). Analog interfacing to embedded microprocessor systems. Retrieved from http://ebookcentral.proquest.com
`Created from nyli on 2019-02-04 12:08:43.
`
`
`
`The amplifier used to increase the signal level from the thermocouple is
`usually an instrumentation amp. The gain required to measure a thermocouple
`is typically in the range of 100 to 300, and any noise picked up by the thermo-
`couple will be amplified by the same amount. An instrumentation amplifier
`rejects the common mode noise in the thermocouple wiring.
`Analog Devices makes a thermocouple signal conditioner, the AD594/595,
`which is specifically intended for interfacing to a thermocouple. The AD594/
`595 does not use an external semiconductor junction to compensate for connec-
`tion temperature; instead the part includes an internal junction that is expected
`to be the same temperature as the connection. Consequently, the thermocouple
`connection must be made on the PC board, close to the AD595/595 package.
`The amplified thermocouple signal may need scaling, just like a thermistor, to
`place it in a useable range for an ADC. Thermocouples are relatively linear over a
`limited range of temperatures, but if the range of measurement is wide, the
`software will need to compensate for nonlinearities. The formula for thermo-
`couple voltage is a polynomial, just like thermistor resistance formula.
`
`Solid State
`
`The simplest semiconductor temperature sensor is a PN junction, such as a signal
`diode or the base-emitter junction of a transistor. If the current through the
`forward-biased silicon PN junction is held constant, the forward drop decreases
`
`about 1.8 mv per
`C. The Maxim MAX1617 is an IC that measures temperature
`using an external transistor, such as a 2N3904, as a temperature-sensing element.
`The transistor can be a discrete part, or it can be embedded in the die of an IC to
`measure the IC temperature. The MAX1617 has a serial SMBus output.
`The LM335 (Figure 3.5) from National Semiconductor produces an output
`voltage proportional to temperature. The LM135 produces 10 mv per degree
`
`
`Kelvin. At 0
`C, the output is 2.73 V, and at 100
`C the output is 3.73 V. The
`LM335 operates with input current from 400 ma to 5 ma.
`The National LM34 and LM35 sensors operate from supply voltages between
`4 V and 20 V, and produce a voltage output that directly corresponds to voltage.
`
`The LM35 produces a voltage of 500 mv at 50
`C, with an additional 10 mv for
`
`every additional
`C increase. The LM34 is calibrated for Fahrenheit tempera-
`tures, and the LM35 for Centigrade. The outputs of the LM34/LM35 can be
`connected directly to an ADC or to a comparator.
`The National LM74 measures temperatures between 55
`C and þ150
`C and
`communicates with a microprocessor via the serial SPI/Microwire interface. The
`LM74 output is a 13-bit signed value. The part contains a temperature sensor and
`a sigma-delta converter. It is available in 3.3 V or 5 V versions and comes in an 8-
`pin SMT package. The National LM75 is similar to the LM74, but uses the I2C
`interface. The LM75 has a narrower operating temperature range: 55
`
`C to
`
`
`
`
`
`Copyright © 2003. Elsevier Science & Technology. All rights reserved.
`
`58
`
`Analog Interfacing to Embedded Microprocessor Systems
`
`Ball, S. R., & Ball, L. I. H. S. (2003). Analog interfacing to embedded microprocessor systems. Retrieved from http://ebookcentral.proquest.com
`Created from nyli on 2019-02-04 12:08:43.
`
`
`
`+V
`
`OUTPUT VOLTAGE
`
`ADJ
`
`Figure 3.5
`LM335.
`
`
`
`þ125
`C. The LM75 produces a 9-bit output and includes a comparator that can
`indicate when the temperature exceeds a limit. The limit temperature can be
`programmed via the I2C bus.
`
`Optical Sensors
`
`Slotted Switches
`
`Figure 3.6 shows a slotted optical switch. An LED is mounted in a plastic housing,
`facing a phototransistor. A gap separates the two, so if something moves into the
`gap, it blocks the light path between the LED and the phototransistor. Slotted
`switches are often used to detect motor speed by placing a slotted wheel on the
`motor shaft; as the shaft rotates, it alternately blocks and unblocks the light path.
`Another use for slotted switches is as indicators when a door or hood is open or
`closed. A flag on the door drops into the slot and blocks the light when the door is
`closed. A mechanical computer mouse uses slotted optical switches as well (an
`optical mouse uses a different method of sensing motion).
`
`Reflective Sensors
`
`Figure 3.7 shows a reflective sensor. A reflective sensor works the same way as a
`slotted switch, except that the phototransistor picks up reflected light from what-
`ever is in front of the switch. Most reflective sensors have a focal length, the
`optimum distance at which the object to be measured should be placed, typically
`between 0.1 and 0.5 inches. A typical use for a reflective sensor is to detect motor
`motion by painting or anodizing the motor shaft black, then having a strip of
`
`Sensors
`
`59
`
`Copyright © 2003. Elsevier Science & Technology. All rights reserved.
`
`Ball, S. R., & Ball, L. I. H. S. (2003). Analog interfacing to embedded microprocessor systems. Retrieved from http://ebookcentral.proquest.com
`Created from nyli on 2019-02-04 12:08:43.
`
`
`
`LED
`
`PHOTOTRANSISTOR
`
`ELECTRICAL SCHEMATIC
`
`Figure 3.6
`Slotted optical switch.
`
`MOUNTING SLOT
`
`LED
`
`REFLECTIVE
`SURFACE
`
`PHOTOTRANSISTOR
`
`ELECTRICAL SCHEMATIC
`
`Figure 3.7
`Reflective optical sensor.
`
`Copyright © 2003. Elsevier Science & Technology. All rights reserved.
`
`60
`
`Analog Interfacing to Embedded Microprocessor Systems
`
`Ball, S. R., & Ball, L. I. H. S. (2003). Analog interfacing to embedded microprocessor systems. Retrieved from http://ebookcentral.proquest.com
`Created from nyli on 2019-02-04 12:08:43.
`
`
`
`reflective material on the shaft. As the shaft rotates, the sensor sees no reflection
`from the part of the shaft that is black, then high reflection from the reflective strip.
`Both types of optical sensors have some common characteristics that must be
`taken into account when designing a system that uses them, as detailed in the
`following sections.
`
`Speed The phototransistor in any optical switch is fairly slow. This limits
`the maximum speed that can be detected. Typical numbers are 8 ms turn-on time
`and 50 ms turn-off time. This time is driven by the speed of the base-emitter
`junction.
`
`Gain The LED and phototransistor pair have a limited gain, usually less than 1.
`The amount of current generated in the phototransistor collector for a given
`current through the LED is called the current transfer ratio (CTR). A typical CTR
`for a slotted switch is 0.1. This means that 10 ma of current in the LED will result
`in 1 ma of current in the collector. The CTR is sometimes specified as a ratio, and
`some