AN897 MICROCHIP | Alldatasheet
Document overview
- Manufacturer or author: Provided By ALLDATASHEET.COM(FREE DATASHEET DOWNLOAD SITE)
- PDF pages: 16
Technical content
2004 Microchip Technology Inc. DS00897B-page 9 AN897 FIGURE 24: Measured Errors, Design # 2. Note that it was necessary to add a resistor in series with Rvar at high temperatures in order to have 5°C spacing between data points. Both Figure 23 and Figure 24 agree with the design results; the second design has much better perfor- mance. The 1% resistors in Rvar will give roughly the same error as the thermistor. The thermistor was then used to measure room tem- perature using Design # 2. The result was ADC code 281 with a gain of +1, which corresponds to 23.7°C (74.7°F). DESIGN ALTERNATIVES The references in this application note include informa- tion on other design approaches. AN685 [3] covers more traditional application circuits using thermistors. AN867 [4] shows an alternative thermistor circuit using the PGA; it has greater flexibility, but increased design cost and complexity. The following sections discuss modifications to the designs in this application note. Increased Accuracy In order to achieve greater accuracy, the analog components need to be more precise. 12-bit ADCs, (e.g., the MCP3201) will increase the resolution. A 0.1% tolerance resistor for R A will reduce the circuit error. Calibrating the thermistor [1, 2] will cancel most of its variation over process. It may be beneficial to also calibrate the circuit. This will increase firmware complexity and execution time on the microcontroller unless the corrections are included in the linear interpolation table(s). The piece-wise linear interpolation table may need more entries, especially for the first design. The calcu- lations will require more precision, which results in slower processing time. Other Gains The second design can be done with other gains. Increasing the number of gains has the drawback of needing more piece-wise linear interpolation tables, increasing the firmware size. Adding a gain(s) between +1 and +8 increases the ADC resolution. The decrease in gain accuracy (from 0.1% at G = +1 to 1% at G≥ +2) reduces the overall accuracy, especially at a gain of +2. The tradeoffs depend on the design specifics. Adding a gain between +8 and +32 improves both the accuracy and the ADC resolution at higher temperatures. The choice of +16 is a good one. Removing the gain of +32 may be attractive for designs that reach a reduced temperature range (e.g., +125°C). Changing the gain of +32 to +16, instead of removing it, is one compromise. When the gains are related by a common multiplier, the hysteresis algorithm is simplified. When G = 1, 2, 4, 8, 16, and 32, the multiplier is 2. When G = 1, 4 and 16, the multiplier is 4. The gain increases all occur at one ADC code, while the gain decreases all occur at another ADC code. Thus, the hysteresis algorithm only has to compare the ADC code to two code values and change the gain based on the result. More Input Channels When more than two inputs (including other tempera- ture sensors) need to be multiplexed into the ADC, the 6-channel MCP6S26 and the 8-channel MCP6S28 PGAs provide additional channels. The thermistor input can be used to correct other sensors, such as humidity sensors. Op Amp Buffer The MCP6SX2 PGA, shown in Figure 3, can be replaced with a unity-gain buffer; Microchip’s MCP6001 op amp would be a good choice. The advantages include simplicity and cost. The disadvantages are the inability to multiplex multiple input signals and the improvement in ADC temperature resolution due to changing the PGA’s gain. Remote Thermistor Issues Thermistors that are located remotely from the PGA (e.g., not on the same PCB) may require design changes. Possible issues include: Shielding sensor pickup wires EMI filtering and protection Wiring resistance voltage drop Mismatch between thermistor ground and PCB ground -0.5 -0.4 -0.3 -0.2 -0.1 0.0 0.1 0.2 0.3 0.4 0.5 -50 -25 0 25 50 75 100 125 150 Thermistor Temperature (°C) Measured Error (°C) Design # 2 Thermistor Emulator, Rvar
DS00897B-page 10 2004 Microchip Technology Inc. SUMMARY Two different circuit designs using the MCP6SX2 PGA and an accurate NTC thermistor have been shown. The two designs trade off simplicity, accuracy and temperature range. The first design is easier to implement, but has a smaller temperature range. It can be made more accurate, or cover a wider temperature range, with more expensive components and analog design effort. While the second design’s firmware takes more space in firmware, the analog design is very reasonable. It takes advantage of the PGA’s flexibility and digital control to reduce the analog errors and increase the temperature resolution. The MCP6SX2 PGA’s input MUX and digitally- controlled gain significantly increase the utility of these circuits. Multiple sensors and/or input signals can be processed with one PGA, reducing component count. It also makes it easier to perform temperature correc- tion on other sensors. The marginal cost of the NTC thermistor circuits is reasonable in this case. REFERENCES [1] “2322 640 5... : NTC thermistors, accuracy line,” Product Data Sheet, BC Components® , September 27, 2001 (www.bccomponents.com). [2] “Introduction to NTCs: NTC Thermistors,” Data Sheet, BC Components, March 27, 2001 (www.bccomponents.com). [3] AN685, “Thermistors in Single-Supply Temperature Sensing Circuits,” Bonnie C. Baker; Microchip Technology Inc., DS00685, 1999. [4] AN867, “Temperature Sensing with a Programmable Gain Amplifier,” Bonnie C. Baker; Microchip Technology Inc., DS00867, 2003. [5] MCP6S21/2/6/8 Data Sheet, “Single-Ended, Rail-to-Rail I/O, Low-Gain PGA,” Microchip Technology Inc., DS21117, 2003. [6] MCP6S91/2/3 Data Sheet, “Single-Ended, Rail-to-Rail I/O, Low-Gain PGA,” Microchip Technology Inc., DS21908, 2004. [7] AN248, “Interfacing MCP6S2X PGAs to PICmicro ® Microcontroller,” Ezana Haile; Microchip Technology Inc., DS00248, 2003. [8] PIC16F684 Data Sheet, “14-Pin Flash-Based, 8-Bit MOS Microcontrollers with nanoWatt Technology,” Microchip Technology Inc., DS41202, 2004. [9] AN942, “Piecewise Linear Interpolation on PIC12/14/16 Series Microcontrollers,” John Day and Steven Bible; Microchip Technology Inc., 2004. [10] “PICkit™ 1 Flash Starter Kit User’s Guide,” Microchip Technology Inc., DS40051, 2004. [11] “Signal Analysis PICtail™ Daughter Board User’s Guide,” Microchip Technology Inc., DS51476, 2004. [12] “Thermistor PGA PICtail™ Daughter Board User’s Guide,” Microchip Technology Inc., DS51517, 2004.
2004 Microchip Technology Inc. DS00897B-page 11 AN897 APPENDIX A: SET-UP OVERVIEW A.1 Thermistor PGA PICtail Daughter Board The Thermistor PGA PICtail Daughter Board contains the analog circuitry represented in Figure A-1. The thermistor converts its temperature to a resistance. The voltage divider then converts that resistance to voltage and sends it to the CH0 input of the PGA. The PGA gains and buffers this voltage and sends it off-board. Board power is applied at the +5V and GND inputs. The SPI™ bus makes it possible to control the PGA; its gain and input channel can be set as desired from the software. FIGURE A-1: Thermistor PGA PICtail™ Daughter Board Block Diagram. The test points make it easier to test key points in the circuit, change the input signals and to use this board as a stand-alone board. GND Test Point – Connected to the ground plane and is a convenient ground point for any lab equipment +5V Test Point – Allows measurement of the positive supply voltage and provides a means to power this board with a laboratory power supply CH0 Test Point – The place to measure the volt- age divider’s output (also the PGA’s CH0 input) CH1 Test Point – Makes it possible to send any desired signal to the PGA More detail on setting up this demonstration board can be found in the “Thermistor PGA PICtail™ Daughter Board User’s Guide” [12]. A.2 Associated Tools Figure A-2 shows the block diagram of the hardware and software tools that the Thermistor PGA PICtail™ Daughter Board is designed to work with. More information on these tools can be found in the “References” section. FIGURE A-2: Measurement Setup Block Diagram. Temperature CH1 Input Thermistor Voltage Divider PGA MCP6S22 Thermistor PGA PICtail™ Daughter Board VOUT SPI™ Bus CH0 Input +5V GND GND +5V Test Point Test Point Test Point Test Point PC USB Signal Analysis PICtail Daughter Board PICkit™ 1 Flash Starter Kit Thermistor PGA PICtail™ Daughter Board PICkit 1 Signal Analysis PC Program PICkit 1 Firmware PICA2Dlab.hex Firmware Hardware Software
DS00897B-page 12 2004 Microchip Technology Inc. An exploded view of how the different boards connect is shown in Figure A-3. FIGURE A-3: Board Connections. A.2.1 PC PLATFORM The Personal Computer (PC) shown in Figure A-2 needs to run on Windows ® 98 SE or later. It provides a convenient interface for the user, communicates with the other boards, and provides power through the USB connection. A.2.2 PICkit™ 1 SIGNAL ANALYSIS PC PROGRAM The PICkit™ 1 Signal Analysis PC Program programs the PIC16F684 PICmicro ® microcontroller on the Signal Analysis PICtail Daughter Board through the USB port on the PICkit 1 Flash Starter Kit. It also imports data through the same connection and displays the data in Strip Chart, histogram, FFT plot and oscilloscope plot formats. Data can be output in CSV format for importing into a spreadsheet program. A.2.3 PICkit 1 FLASH STARTER KIT The PICkit 1 Flash Starter Kit (DV164101) programs PICmicro microcontrollers. It uses the PIC16C745’s USB port to communicate with the PICkit 1 Signal Analysis PC Program. It connects to the Signal Analysis PICtail Daughter Board via a header (see Figure A-3). This board provides a single +5V supply voltage for the daughter boards. It can drive up to 5 µF on the supply; a larger capacitance may interfere with program timing. A.2.4 PICkit 1 FIRMWARE This software resides on the PICkit 1 Flash Starter Kit’s PIC16C745 microcontroller. Use version 2.0.2 or later. A.2.5 SIGNAL ANALYSIS PICtail DAUGHTER BOARD This board is Microchip Development Tool AC164120. It connects to the PICkit 1 Flash Starter Kit, which it uses for both power and as a communications link to the PC. The on-board PIC16F684 has a 10-bit ADC that converts the Thermistor PGA PICtail Daughter Board’s output voltage. The results are temporarily stored on the board’s 25LC640 serial EEPROM chips. The +5V single-supply voltage from the PICkit 1 Flash Starter Kit board is bypassed with a bulk 1 µF capacitor and local 0.1 µF capacitors for each IC. Signal Analysis PICkit™ 1 Flash Starter Kit USB Cable Expansion Header (J3) PICtail™ Daughter Board Remove PICmicro® MCU from Evaluation Socket PIC16C745 Firmware Version 2.0.2 or later Thermistor PGA PICtail™ Daughter Board
2004 Microchip Technology Inc. DS00897B-page 13 AN897 A.2.6 FIRMWARE FOR THE SIGNAL ANALYSIS PICtail DAUGHTER BOARD PICA2Dlab.hex is the standard file that supports the PICkit™ 1 Signal Analysis PC Program. The PGA and 10-bit ADC configuration are selected in the Signal Analysis PC Program and written to the PIC16F684. The PIC16F684 then sends the command(s) over the SPI bus to the PGA. Therm_PGA1.hex implements the first design. It supports the PICkit 1 Signal Analysis PC Program, but with reduced functionality; its output can be viewed on the strip chart only. The results need to be manually converted to temperatures (codes 0 to 1023 convert to 0.0°C to 102.3°C). Therm_PGA2.hex implements the second design. It supports the PICkit 1 Signal Analysis PC Program, but with reduced functionality; its output can be viewed on the strip chart only. The results need to be manually converted to temperatures (codes 0 to 1023 convert to 0.0°C to 102.3°C). A.2.7 INTERFACE DETAILS A more detailed look at how the Thermistor PGA PICtail Daughter Board interfaces with the other boards is shown in Figure A-4. FIGURE A-4: Detailed Interface Diagram. Thermistor Voltage Divider PGA MCP6S22 Thermistor PGA PICtail™ Daughter Board VOUT SPI Bus Serial EEPROM PIC16F684 ADC Signal Analysis PICtail™ Daughter Board GND +5V GND +5V PICkit™ 1 Flash Starter Kit SPI™ Bus CH1 Input CH0 Input +5V GND Test Point Test Point Test Point Test Point PIC16F745 USB to PC Temperature
DS00897B-page 14 2004 Microchip Technology Inc. APPENDIX B: THERMISTOR MODEL The nominal response of the 2322 640 55103 thermistor [1] is shown in Table B-1. TABLE B-1: NOMINAL THERMISTOR RESPONSE. The data in Table B-1 was fit to the following sets of equations. These equations make it possible to accurately interpolate values between the table entries, thus making the designs easier to evaluate. EQUATION B-1: EQUATION B-2: The piece-wise linear interpolation tables also need values outside of the valid range of Table B-1. These values are only used for convenience in setting up the interpolation tables and firmware routine; they are not based on actual data. While the above equations are not valid outside of the given ranges, they are good enough to support the interpolation algorithm. Both sets of equations are based on a min-max polynomial fit on the normalized variable z. It is more difficult to achieve an accurate fit to the data using the variables X and Y . Thermistor Temperature (°C) Thermistor Resistance (Ω ) -40 332.1 k -35 240.0 k -30 175.2 k -25 129.3 k -20 96.36 k -15 72.50 k -10 55.05 k -5 42.16 k 03 2 . 5 6 k 52 5 . 3 4 k 10 19.87 k 15 15.70 k 20 12.49 k 25 10.00 k 30 8.059 k 35 6.535 k 40 5.330 k 45 4.372 k 50 3.606 k 55 2.989 k 60 2.490 k 65 2.084 k 70 1.753 k 75 1.481 k 80 1.256 k 85 1.070 k 90 915.4 95 786.0 100 677.3 105 585.8 110 508.3 115 442.6 120 386.6 125 338.7 130 297.7 135 262.4 140 231.9 145 205.5 150 182.6 Resistance-to-Temperature Equations: X = ln(RTH / 1Ω ) z = XSC (X – XCTR ) TTH ≈ – T251 + z(A1 + z(A2 + z(A3))) where: 182.6 Ω ≤ RTH ≤ 332.1 kΩ XCTR = 8.960245 T0 = 303.960°C A1 = -0.291639 A2 = 0.010993 A3 = -0.001042 T25 = 273.150°C XSC = -0.266457 Temperature-to-Resistance Equations: z = YSC (Y – YCTR ) R TH = (1 Ω ) eX where: T25 = 273.150°C YSC = -1038.499°C YCTR = 0.003326156 °C-1 B0 = 9.101806 B1 = -3.756408 B2 = -0.141435 B3 = 0.003396 Y = TTH + T25 X ≈ B0 + z(B1 + z(B2 + z(B3))) -40°C ≤ TTH ≤ +150°C
DS00897B-page 15 2004 Microchip Technology Inc. Information contained in this publication regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WAR- RANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE . Microchip disclaims all liability arising from this information and its use. Use of Microchip’s products as critical components in life support systems is not authorized except with express written approval by Microchip. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights. Trademarks The Microchip name and logo, the Microchip logo, Accuron, dsPIC, KEE LOQ , microID, MPLAB, PIC, PICmicro, PICSTART, PRO MATE, PowerSmart, rfPIC, and SmartShunt are registered trademarks of Microchip Technology Incorporated in the U.S.A. and other countries. AmpLab, FilterLab, MXDEV, MXLAB, PICMASTER, SEEVAL, SmartSensor and The Embedded Control Solutions Company are registered trademarks of Microchip Technology Incorporated in the U.S.A. Analog-for-the-Digital Age, Application Maestro, dsPICDEM, dsPICDEM.net, dsPICworks, ECAN, ECONOMONITOR, FanSense, FlexROM, fuzzyLAB, In-Circuit Serial Programming, ICSP, ICEPIC, Migratable Memory, MPASM, MPLIB, MPLINK, MPSIM, PICkit, PICDEM, PICDEM.net, PICLAB, PICtail, PowerCal, PowerInfo, PowerMate, PowerTool, rfLAB, rfPICDEM, Select Mode, Smart Serial, SmartTel and Total Endurance are trademarks of Microchip Technology Incorporated in the U.S.A. and other countries. SQTP is a service mark of Microchip Technology Incorporated in the U.S.A. All other trademarks mentioned herein are property of their respective companies. © 2004, Microchip Technology Incorporated, Printed in the U.S.A., All Rights Reserved. Printed on recycled paper. Note the following details of the code protection feature on Microchip devices: Microchip products meet the specification contained in their particular Microchip Data Sheet. Microchip believes that its family of products is one of the most secure families of its kind on the market today, when used in the intended manner and under normal conditions. There are dishonest and possibly illegal methods used to breach the code protection feature. All of these methods, to our knowledge, require using the Microchip products in a manner outside the operating specifications contained in Microchip’s Data Sheets. Most likely, the person doing so is engaged in theft of intellectual property. Microchip is willing to work with the customer who is concerned about the integrity of their code. Neither Microchip nor any other semiconductor manufacturer can guarantee the security of their code. Code protection does not mean that we are guaranteeing the product as “unbreakable.” Code protection is constantly evolving. We at Microchip are committed to continuously improving the code protection features of our products. Attempts to break Microchip’s code protection feature may be a violation of the Digital Millennium Copyright Act. If such acts allow unauthorized access to your software or other copyrighted work, you may have a right to sue for relief under that Act. Microchip received ISO/TS-16949:2002 quality system certification for its worldwide headquarters, design and wafer fabrication facilities in Chandler and Tempe, Arizona and Mountain View, California in October 2003. The Company’s quality system processes and procedures are for its PICmicro® 8-bit MCUs, KEE LOQ ® code hopping devices, Serial EEPROMs, microperipherals, nonvolatile memory and analog products. In addition, Microchip’s quality system for the design and manufacture of development systems is ISO 9001:2000 certified.
DS00897B-page 16 2004 Microchip Technology Inc. AMERICAS Corporate Office 2355 West Chandler Blvd. Chandler, AZ 85224-6199 Tel: 480-792-7200 Fax: 480-792-7277 Technical Support: http:\\\\support.microchip.com Web Address: www.microchip.com Atlanta Alpharetta, GA Tel: 770-640-0034 Fax: 770-640-0307 Boston Westford, MA Tel: 978-692-3848 Fax: 978-692-3821 Chicago Itasca, IL Tel: 630-285-0071 Fax: 630-285-0075 Dallas Addison, TX Tel: 972-818-7423 Fax: 972-818-2924 Detroit Farmington Hills, MI Tel: 248-538-2250 Fax: 248-538-2260 Kokomo Kokomo, IN Tel: 765-864-8360 Fax: 765-864-8387 Los Angeles Mission Viejo, CA Tel: 949-462-9523 Fax: 949-462-9608 San Jose Mountain View, CA Tel: 650-215-1444 Fax: 650-961-0286 Toronto Mississauga, Ontario, Canada Tel: 905-673-0699 Fax: 905-673-6509 ASIA/PACIFIC Australia - Sydney Tel: 61-2-9868-6733 Fax: 61-2-9868-6755 China - Beijing Tel: 86-10-8528-2100 Fax: 86-10-8528-2104 China - Chengdu Tel: 86-28-8676-6200 Fax: 86-28-8676-6599 China - Fuzhou Tel: 86-591-750-3506 Fax: 86-591-750-3521 China - Hong Kong SAR Tel: 852-2401-1200 Fax: 852-2401-3431 China - Shanghai Tel: 86-21-5407-5533 Fax: 86-21-5407-5066 China - Shenyang Tel: 86-24-2334-2829 Fax: 86-24-2334-2393 China - Shenzhen Tel: 86-755-8203-2660 Fax: 86-755-8203-1760 China - Shunde Tel: 86-757-2839-5507 Fax: 86-757-2839-5571 China - Qingdao Tel: 86-532-502-7355 Fax: 86-532-502-7205 ASIA/PACIFIC India - Bangalore Tel: 91-80-2229-0061 Fax: 91-80-2229-0062 India - New Delhi Tel: 91-11-5160-8632 Fax: 91-11-5160-8632 Japan - Kanagawa Tel: 81-45-471- 6166 Fax: 81-45-471-6122 Korea - Seoul Tel: 82-2-554-7200 Fax: 82-2-558-5932 or 82-2-558-5934 Singapore Tel: 65-6334-8870 Fax: 65-6334-8850 Taiwan - Kaohsiung Tel: 886-7-536-4818 Fax: 886-7-536-4803 Taiwan - Taipei Tel: 886-2-2500-6610 Fax: 886-2-2508-0102 Taiwan - Hsinchu Tel: 886-3-572-9526 Fax: 886-3-572-6459 EUROPE Austria - Weis Tel: 43-7242-2244-399 Fax: 43-7242-2244-393 Denmark - Ballerup Tel: 45-4420-9895 Fax: 45-4420-9910 France - Massy Germany - Ismaning Tel: 49-89-627-144-0 Fax: 49-89-627-144-44 Italy - Milan Tel: 39-0331-742611 Fax: 39-0331-466781 Netherlands - Drunen Tel: 31-416-690399 Fax: 31-416-690340 England - Berkshire Tel: 44-118-921-5869 Fax: 44-118-921-5820 W ORLDWIDE SALES AND SERVICE 09/27/04