AN66477 PSoC® 3, PSoC 4, and PSoC 5LP - Temperature Measurement with a Thermistor Author: Todd Dust and Archana Yarlagadda Associated Part Family: PSoC 3, PSoC 5LP, PSoC 4100, PSoC 4200 Associated Code Examples: click here. Related Application Notes: click here. To get the latest version of this application note, please visit http://www.cypress.com/AN66477. ® AN66477 describes how to measure temperature with a thermistor using PSoC 3, PSoC 4, or PSoC 5LP. This ™ application note describes the PSoC Creator Thermistor Calculator Component, which simplifies the math-intensive resistance-to-temperature conversion. Contents 1 2 3 Introduction ...............................................................1 Thermistor – Theory of Operation.............................2 Thermistor Resistance Measurement .......................3 3.1 Current Source Measurement Method .............3 3.2 Resistor Divider Method...................................4 3.3 Ratiometric Resistor Divider Method ...............5 4 Thermistor Resistance-to-Temperature Calculation .6 4.1 Thermistor Calculator Component ...................7 5 Thermistor Temperature Measurement with PSoC ..8 1 6 7 Measuring Multiple Thermistors ............................. 10 Performance Analysis ............................................ 11 7.1 Temperature Resolution ................................ 11 7.2 Temperature Accuracy .................................. 12 7.3 Summary of Errors......................................... 16 8 Summary ................................................................ 17 9 Related Application Documents ............................. 17 Document History............................................................ 18 Worldwide Sales and Design Support ............................ 19 Introduction Temperature is one of the most frequently measured environmental variables. Temperature measurement is typically done using one of four sensors: thermocouple, thermistor, diode, or resistance temperature detector (RTD). Table 1 compares the different types of temperature sensors and why you may want to use one versus another. Table 1. Comparison of RTDs, Thermocouples, Thermistors, and Diodes Parameter RTD Thermocouple Thermistor Diode Temperature range –200 to +850 –250 to +2350 –100 to +300 –50 to +150 Sensitivity at 25 °C 0.387 Ω/°C 40 µV/°C (K-type) 416 Ω/°C 250 µV /°C Accuracy High Medium to High Medium Low Linearity Good Fair Poor Good Typical cost (US $) $3–$80 $3–$15 $0.2–$10 <$0.2 Typical distance of sensing Surface mount for onboard temperature Three- and four-wire up to a few hundred meters <100 meters Surface mount for onboard temperature Leaded for <1 meter Onboard temperature Resource requirement Excitation current, amplifier, ADC, and reference resistor Amplifier, ADC, voltage reference, and another temperature sensor for cold junction Excitation current, ADC, and reference resistor Excitation current, amplifier, and ADC Response time Slow Fast Fast Slow Computational complexity (best possible accuracy) High Very high Very high Medium www.cypress.com Document No. 001-66477 Rev. *H 1 PSoC® 3, PSoC 4, and PSoC 5LP - Temperature Measurement with a Thermistor Use Table 1 to make an informed choice about the type of temperature sensor appropriate for your application. To learn more about temperature measurement using RTDs, thermocouples, or diodes, see one of the following application notes: AN70698 - PSoC® 3 and PSoC 5LP- Temperature Measurement with an RTD AN75511 - PSoC® 3 and PSoC 5LP- Temperature Measurement with a Thermocouple. AN60590 - PSoC® 3 and PSoC 5LP- Temperature Measurement with a Diode. This application note focuses on thermistors. A thermistor is a temperature-sensitive resistor whose resistance varies with temperature. This application note focuses on Negative Temperature Coefficient (NTC) thermistors and the configuration of PSoC 3, PSoC 4, or PSoC 5LP to measure the resistance of a thermistor, and convert that resistance to temperature. This application note assumes that you are familiar with developing applications using PSoC Creator for PSoC 3, PSoC 4, or PSoC 5LP. If you are new to PSoC 3, PSoC 4, or PSoC 5LP, see the introductions in the following application notes: AN54181 - Getting Started with PSoC 3 AN79953 - Getting Started with PSoC 4 AN77759 - Getting Started with PSoC 5LP If you are new to PSoC Creator, see the PSoC Creator home page. Using this Document This document describes the theory behind thermistor temperature measurement. If you are looking for code examples for thermistor temperature measurement, see CE210514, and CE210528. 2 Thermistor – Theory of Operation This application note focuses on NTC thermistors, which are used for precision temperature measurement applications. Positive temperature coefficient (PTC) thermistors are not discussed because they are not as commonly used. For NTC thermistors the resistance of the thermistor decreases as the temperature rises. The variation of resistance with temperature is nonlinear. Figure 1 shows a typical resistance versus temperature curve for an NTC thermistor. Resistance (kΩ) Figure 1. Resistance Versus Temperature for an NTC Thermistor 200 180 160 140 120 100 80 60 40 20 0 -40 -20 0 20 40 60 80 100 120 Temperature (°C) www.cypress.com Document No. 001-66477 Rev.*H 2 PSoC® 3, PSoC 4, and PSoC 5LP - Temperature Measurement with a Thermistor Because of this nonlinear response, a complex polynomial equation is required to calculate the temperature from the resistance. Equation 1 shows the Steinhart-Hart equation. This is the standard equation used for converting thermistor resistance to temperature. Equation 1 1 A B ln(RT ) C (ln(RT ))3 TK Where: TK = Temperature in Kelvin A, B, and C = Steinhart-Hart coefficients, which vary for each thermistor. RT = Thermistor resistance in ohms Equation 1 shows that the main unknown is the resistance of the thermistor. Thermistor temperature measurement requires two steps: 1. Thermistor Resistance Measurement 2. Resistance-to-Temperature Calculation The following sections describe these two tasks in detail. 3 Thermistor Resistance Measurement 3.1 Current Source Measurement Method Ohm’s Law says . To find resistance, we need to know V and I. From the equation R = V/I, it seems logical that one way to measure a thermistor’s resistance is to force a known current through a thermistor and measure the output voltage, as Figure 2 shows. Figure 2. Common-Sense Approach to Measure Thermistor Resistance This method does work, but there are four problems with the circuit shown in Figure 2. 1. The current source needs to be very accurate; any current error causes an error in the temperature reading. 2. If too much current is passed through the thermistor it can heat itself and cause temperature error; this problem is described in the Performance Analysis section. 3. The offset, gain, and integral nonlinearity (INL) error of the ADC can lead to inaccuracies in the measured resistance. 4. The voltage output directly follows the nonlinearity of the thermistor, as Figure 3 shows. www.cypress.com Document No. 001-66477 Rev.*H 3 PSoC® 3, PSoC 4, and PSoC 5LP - Temperature Measurement with a Thermistor Vtherm(V) Figure 3. Voltage to Temperature Relationship of Circuit in Figure 2 with a 25-µA Current Source 5 4.5 4 3.5 3 2.5 2 1.5 1 0.5 0 -40 -20 0 20 40 60 80 100 Temperature (°C) With this method the voltage difference between temperatures is small at high temperatures, requiring a highresolution ADC. According to the datasheet for the NCP18XH103F03RB thermistor, the resistance at 125 °C is 531.0003 Ω. At 124.9 °C, the resistance is 532.214675 Ω. Passing 25 µA through these resistances produces 13.275 mV and 13.305 mV, respectively. This is a difference of 30 µV. The LSB of the ADC must be half of this value, or 15 µV. To calculate the required resolution, divide the full-scale input range by the smallest measurement quantity. The graph in Figure 3 shows that the full-scale input is ~5 V. Therefore, 5 V/15 µV is approximately 333k steps or 18 bits. 3.2 Resistor Divider Method Figure 4 shows a method to reduce some of the errors associated with Figure 3. Figure 4. Resistor Divider Method Note: The location of the reference resistor and thermistor do not matter. The reference resistor could be on the top. The reference resistor is used to create a voltage divider with the thermistor. This method reduces the nonlinearity of the output voltage. Typically, the reference resistor is the same value as the thermistor at 25 °C. Figure 5 shows the temperature-to-voltage curve for the NCP18XH103F03RB in series with a 10-kΩ resistor and VDD set to 5 V. www.cypress.com Document No. 001-66477 Rev.*H 4 PSoC® 3, PSoC 4, and PSoC 5LP - Temperature Measurement with a Thermistor Figure 5. Voltage-to-Temperature Relationship of Circuit in Figure 4 5 Vtherm(V) 4 3 2 1 0 -40 -20 0 20 40 60 80 100 120 Temperature (°C) For 125.0 °C and 124.9 °C, the Vtherm is 4.74788 V and 4.74734 V, respectively. This is a difference of 540 µV. The required resolution of an ADC to resolve 0.1 °C at high temperatures is 14 bits—much lower than the method discussed in the previous sections. There are problems with the circuit shown in Figure 4. If there is any error in the value of the reference resistor, VDD, or GND there will be an error in the temperature conversion. In addition, the ADC gain and offset errors remain issues that must be handled. The next section shows a third method that overcomes some of these problems. 3.3 Ratiometric Resistor Divider Method Figure 6 offers another method that overcomes some of the problems mentioned previously. Figure 6. Ratiometric Resistor Divider Method The best way to remove any dependence on VDD is to measure it at VHI. The best way to remove any dependence on GND (if it is not exactly 0 V) is to measure it at Vlow. If a differential ADC is used only two ADC readings are required: the differential voltages across Rref and Rt. Using these voltage measurements, the resistance of the thermistor is calculated using Equation 2. Equation 2 As mentioned previously, the circuit in Figure 6 provides a more linear voltage-to-temperature response, thus requiring a lower-resolution ADC. Performing ratiometric measurements eliminates ADC gain errors from the calculations (see Offset Error Cancellation). This method still results in errors from self-heating and inaccurate reference resistor value. However, due to the advantages of this method and its widespread use, this method is discussed in detail in this application note. For more information on calculating errors in measuring thermistors, see Performance Analysis. www.cypress.com Document No. 001-66477 Rev.*H 5 PSoC® 3, PSoC 4, and PSoC 5LP - Temperature Measurement with a Thermistor 3.3.1 Reference Resistor Selection To achieve the maximum resolution at either extreme of temperature, the reference resistance should be close to the resistance of the thermistor at the middle of the temperature range. If you are more interested in measuring the temperature at one extreme, then the reference resistance should match the resistance of the thermistor at the temperature extreme being measured. 3.3.2 VDD or VHI Selection The thermistor and reference resistor circuit is driven with a voltage. There are four main factors in determining this voltage: 1. What voltage is available in the system? For most systems this is the VDD rail. However, PSoC 3 and PSoC 5LP have a VDAC which can be used to drive the circuit at something other than VDD. 2. To reduce the resolution requirements for the ADC VDD or VHI should be as high as possible. This way, the voltage difference between 1 °C can be as large as possible thus reducing the required resolution of the ADC. 3. VDD or VHI should also be set such that the voltage across the reference resistor and thermistor are within the ADC input range. For example, the Delta Sigma ADC in PSoC 3 and PSoC 5LP has a differential input range of ±1.024V, so VHI should be chosen such that the voltage across either the reference resistor or thermistor doesn’t exceed 1.024V. 4. If the voltage is too high more current is passed through the thermistor leading to self-heating. For details, see the Self Heating section. Designers of thermistor systems must make tradeoffs between resolution and selfheating error. One common approach to avoid self-heating is to duty-cycle the VDAC. When not measuring, turn the VDAC off, or disconnect ground. When measuring, turn it back on. In PSoC devices the VDAC can quickly be turned off. Another method is to connect the bottom of the reference resistor to a GPIO pin; set that pin to High-Z when not measuring, and set it to ‘Strong Drive Low’ when measuring. 3.3.3 Offset Error Cancellation In PSoC devices the ADC offset and signal chain offset can easily be removed through correlated double sampling (CDS). In CDS, the offset is measured and then in firmware it is subtracted from the other voltage measurements. ® See AN66444 – PSoC 3 and PSoC 5LP Correlated Double Sampling for details. For thermistor temperature measurement, the best way to measure the system offset is to short two inputs of the ADC together. 3.3.4 Gain Error Cancellation Assume that the ADC has a gain error of k. This error is reflected as multiplicative factor in the voltage measurements, VTherm and Vref. Because Equation 3 includes a ratio, the multiplicative error cancels k out. Equation 3 RTherm = k * (VHi VTherm ) * Rref k * (VTherm VLow ) Now the error depends primarily on the accuracy of the reference resistor, R ref. This method also removes any errors associated with gain drift, because the ratiometric measurement is being taken every time. 4 Thermistor Resistance-to-Temperature Calculation Now that we have a method to measure the resistance, we need to convert that resistance to temperature. As Figure 1 shows, the relationship between resistance and temperature is highly nonlinear. The most common conversion method is the Steinhart-Hart (Equation 1), reproduced below. 1 A B ln(RT ) C (ln(RT ))3 TK Some thermistor datasheets provide the three Steinhart-Hart coefficients (A, B, and C). Other datasheets provide “Temperature coefficient” (Alpha) values, “Sensitivity index” (Beta) values, or a table of resistance to temperature. Although the Alpha or Beta coefficients can determine temperature, they are limited to the temperature range for which they are specified. The Steinhart-Hart equation does not have this limitation. www.cypress.com Document No. 001-66477 Rev.*H 6 PSoC® 3, PSoC 4, and PSoC 5LP - Temperature Measurement with a Thermistor Because the parameters provided for thermistors can vary, their usage and interchangeability in an application can be complicated. To simplify the process of converting thermistor resistance to temperature, Cypress provides a Thermistor Calculator Component that calculates the required A, B, and C coefficients, based on the resistance versus temperature table or curve available in datasheets. 4.1 Thermistor Calculator Component “Thermistor_Calc”, shown in Figure 7, is a PSoC Creator Component that is software only—it has no hardware input or output. You can find it in the Cypress Component Catalog under the Thermal Management Folder. Figure 7. Thermistor Calculator Component The values entered in Figure 8 are from the datasheet for the NCP18XH103F03RB thermistor. The datasheet includes a table of resistance-to-temperature values, similar to that shown in Figure 9. Figure 9. NCP18XH103F03RB Temperature to Resistance Table The Component uses the temperature and resistance of the thermistor, calculates the Steinhart-Hart coefficients, and generates the API code required for resistance-to-temperature conversion. The Component Configuration Tool and API provide the interface to the Component. To configure the Component for your thermistor, double-click the symbol to open the Component Configuration Tool. Figure 8 shows the Component Configuration Tool. First, enter the reference resistor value, along with the three temperature points; the Component determines the proper coefficients for the Steinhart-Hart equation. Figure 8. Thermistor Calculator Component Configuration Tool www.cypress.com Document No. 001-66477 Rev.*H 7 PSoC® 3, PSoC 4, and PSoC 5LP - Temperature Measurement with a Thermistor The Component Configuration Tool also provides an Implementation option to use either an equation or a lookup table (LUT). Table 2 shows the tradeoff between the two methods. Table 2. Comparison of Equation and LUT Implementation Equation LUT Comments Calculation Resolution (±) °C 0.01°C ≤ 0.01°C Resolution shown is the resolution of calculation alone and does not consider the resolution of the ADC. Even though the resolution of the equation can be greater than ±0.01 °C, the output is limited to a resolution of ± 0.01 °C because the output is scaled by 100 and stored as an integer. The higher the resolution on the LUT, the more the memory it consumes. Calculation Speed Slow (~1 msec)* Faster (~300 usec)* Using the LUT, zero mathematical calculations need to be performed, so it is much faster at converting resistance to temperature. Memory Usage Higher Lower The memory usage of the equation method is fixed because of the use of the floating-point library. If other code already uses the floating-point library, the equation method is more efficient. The memory usage of the LUT depends on the range and accuracy chosen. Range Wider than specified Limited to specified In the equation method, the temperature can be measured outside of the range specified, at the cost of lower accuracy. With the LUT, temperature values outside the range specified are not measured. * These numbers were taken on a PSoC 3 device with master clock and bus clock at 24 MHz. For information about other Component Configuration Tool options, see the Component datasheet. 5 Thermistor Temperature Measurement with PSoC CE210514 demonstrates how to measure temperature with thermistors, using PSoC 3, PSoC 4, and PSoC 5LP. See CE210514 for details on how the example works. This section briefly describes how to configure a PSoC device to measure temperature with a thermistor. Figure 10 shows a typical PSoC Creator schematic for a PSoC 3 or PSoC 5LP thermistor temperature measurement project. Figure 10. Thermistor Temperature Measurement Circuit for PSoC 3 and PSoC 5LP www.cypress.com Document No. 001-66477 Rev.*H 8 PSoC® 3, PSoC 4, and PSoC 5LP - Temperature Measurement with a Thermistor Notice how similar this schematic is to Figure 6. The ADC measures the differential voltage across the reference resistor and the thermistor. The VDAC and Opamp are used to set the voltage at the top of the thermistor. This is useful as the voltage can be changed to best fit inside the ADC input range. Also, the VDAC or Opamp can be turned on and off, reducing self-heating. Amux channel 2 is used to measure the offset of the ADC. The two inputs are tied to the same voltage and then read. This reading returns the offset of the ADC, and this offset can then be removed from subsequent readings. This method, called correlated double sampling, is discussed in AN66444 - PSoC 3 and PSoC 5LP Correlated Double Sampling. Figure 11 shows the schematic for PSoC 4 Thermistor Temperature measurement. Figure 11. Thermistor Measurement Circuit for PSoC 4 The main difference between this project and the PSoC 3/PSoC 5LP project is that there is no DAC. The top of the divider must be connected to an external voltage. It can either be tied directly to the power supply, or it can be connected to a GPIO pin that is configured for a strong drive output. The advantage of using a GPIO pin is that the GPIO pin can be turned on and off, thus saving power and reducing self-heating. Also, PSoC 4 uses a successive approximation register (SAR) ADC instead of a delta-sigma ADC. Cypress has created a special kit for temperature sensing: the PSoC Precision Analog Temperature Sensor EBK (CY8CKIT-025). The kit provides four sensors—thermocouple, thermistor, RTD, and diode—for measuring temperature. In addition, connectors are provided to let you plug in your own thermocouple, thermistor, RTD, or diode. You can connect the EBK to the CY8CKIT-030 PSoC 3 Development Kit (DVK), or to the CY8CKIT-050 PSoC 5LP DVK. Figure 12 shows the kit. For more details on the kit, go to www.cypress.com/go/Cy8CKIT-025. Figure 12. PSoC Precision Analog Temperature Sensor EBK www.cypress.com Document No. 001-66477 Rev.*H 9 PSoC® 3, PSoC 4, and PSoC 5LP - Temperature Measurement with a Thermistor You are not required to use this kit to measure the temperature of a thermistor. The circuit required to measure temperature with a thermistor is a simple voltage divider, as Figure 6 shows. This can easily be prototyped on the CY8CKIT-001, CY8CKIT-030, CY8CKIT-050, or CY8CKIT-042 kits. 6 Measuring Multiple Thermistors It is often desirable to measure more than one thermistor with one PSoC device. There are two ways to do this: 1. Measure the thermistors in parallel, as Figure 13 shows. Figure 13. Multiple Thermistors Connected in Parallel Only one VDAC and opamp are used to drive multiple thermistors. If you need to drive thermistors at different voltages, then separate VDACs and opamps are required. Remember that the maximum number of VDACs and opamps on a single PSoC 3 or PSoC 5 LP device is four. www.cypress.com Document No. 001-66477 Rev.*H 10 PSoC® 3, PSoC 4, and PSoC 5LP - Temperature Measurement with a Thermistor 2. Connect the thermistors in series, as Figure 14 shows. Figure 14. Multiple Thermistors Connect in Series The advantage of this method is that it uses fewer pins to measure the same number of thermistors as in the parallel method. However, a disadvantage of this method is that the voltages across the thermistors and the reference resistor are smaller, and may require a higher resolution ADC to obtain the required temperature resolution. If all of the thermistors are identical (same part number), then only one Thermistor Calculator Component is needed. However, if different thermistors are used, then separate Thermistor Calculator Components need to be used. 7 Performance Analysis 7.1 Temperature Resolution This section teaches you how to determine the ADC resolution required for measuring your particular thermistor. 1. Determine your temperature resolution requirements. For example, is it 1°C, 0.1°C, or 0.01°C.? 2. Determine the maximum temperature you will measure. For example, is it 125°C or 60°C? 3. Calculate the resistance at your maximum temperature, and at the maximum temperature minus the resolution, using Equation 4 below. 4. Calculate the voltage across the thermistor at those two voltages, using Equation 5. Take the difference of those two voltages and divide the result by 2. 5. Determine the maximum voltage across the thermistor and reference resistor for your temperature range. 6. Determine the voltage range of your ADC that is capable of measuring the maximum voltage found in step 5. 7. Take the result from step 6 and divide it by the result from step 4. This will tell you how many ADC counts you need. Take the LOG of this value and divide it by the LOG of 2 to get the required ADC resolution. www.cypress.com Document No. 001-66477 Rev.*H 11 PSoC® 3, PSoC 4, and PSoC 5LP - Temperature Measurement with a Thermistor Calculating the resistance from temperature requires calculating the inverse of the Steinhart-Hart equation. This is a daunting mathematical task. It has been solved below in Equation 4. Equation 4 Where A, B, and C are the Steinhart-Hart Coefficients. T is the temperature in degrees kelvin. The Steinhart-Hart coefficients generated for your thermistor can be found in the generated .h file for the Thermistor Calculator Component. To find the voltage across the thermistor, use Equation 5, which is a standard resistor divider equation. Equation 5 The following is an example: 1. My required resolution is 0.01 °C. 2. The maximum temperature I want to measure is 125 °C. 3. Using Equation 4, the resistance at 125 °C is 531.0003 Ω, and the resistance at 124.99 °C is 531.1214 Ω. 4. Using Equation 5, the voltages across those resistances are 80.676 mV and 80.694 mV. This assumes a Vbias of 1.6 V, which is what is used in CE210514. The difference between these two values is 18 µV. 18 µV / 2 = 9 µV. 5. The maximum voltage across the reference RTD occurs at -40 °C; using Equation 5 you can determine it is 1.52 V. The maximum voltage across the reference resistor occurs at 125 °C. Use Equation 5, but replace RTherm in the numerator with RRef. This yields a voltage of 1.519 V. Thus, the maximum voltage is 1.52 V 6. The delta sigma ADC in PSoC 3 and PSoC 5LP has an input voltage range of ±2.048 V. 7. 4.096 V / 9 µV = 455112 steps, or log(455112) / log(2) = ~19 bits. The delta sigma ADC in PSoC 3 and PSoC 5LP has a 20-bit resolution, so it is capable of measuring across a wide temperature range with a 0.01 °C resolution. The method described above can be used with any thermistor and any measurement device. 7.1.1 7.2 Increasing the Resolution There are several methods to increase the temperature resolution. 1. Increase the Vbias voltage. This increases the voltage delta between the resistances. 2. ADC resolution can be increased by oversampling. This is a common industry practice where multiple ADC samples are used to create a higher resolution result. To increase the resolution by 1 bit, 4 ADC samples are summed, and the result right-shifted by 1 (divided by 2). To get 2 extra bits, 4^2 ADC samples are summed and the result right-shifted by 2. To get 3 extra bits, 4^3 ADC samples are summed, and the result shifted right by 3. This can be extended to any number of extra bits. The tradeoff is conversion speed—the more extra bits required, the more samples required for each conversion, and the slower the conversion. 3. Reduce the maximum temperature measured. The higher the temperature, the smaller the difference is between resistances. Temperature Accuracy The accuracy of temperature measurement depends on the entire signal chain. In this section, we analyze the accuracy of different parts of the chain to determine total measurement accuracy. Let us break down the signal chain analysis into different sections and consider each one in detail: Signal measurement: ADC Sensor bias circuit: reference resistor Actual Sensor: Thermistor Voltage-to-temperature conversion: Thermistor Component www.cypress.com Document No. 001-66477 Rev.*H 12 PSoC® 3, PSoC 4, and PSoC 5LP - Temperature Measurement with a Thermistor 7.2.1 Signal Measurement Chain Error Due to Offset and Gain Error As discussed previously, the error due to offset is canceled through CDS, and the error due to gain is canceled due to ratiometric measurements. Error Due to ADC Integral Nonlinearity for PSoC 3 and PSoC 5LP The integral nonlinearity (INL) of the ADC appears in the measurement; you cannot eliminate it with measurement techniques or calibration. The INL for the delta sigma ADC in PSoC 3 is ±2 LSB; this equates to ±62.5 µV. This 62.5 µV can be added or subtracted from the numerator or denominator of Equation 2. The worst-case error occurs when 62.5 µV is added to both the numerator and denominator of Equation 2. Figure 15 shows the temperature error across the range of the thermistor due to INL. Figure 15: PSoC 3 and 5LP Temperature Error Due to INL 0.04 0.03 Error (°C) 0.02 0.01 0 -40 -20 0 20 40 60 80 100 120 140 -0.01 -0.02 Thermistor Temperature (°C) Note: This is the absolute worst-case error. In most cases, the INL is much less than 64 µV. Error Due to ADC Integral Nonlinearity for PSoC 4 The INL for the PSoC 4 SAR ADC in the 5V range is ±1.5LSB or ~3.6mV. Applying this to Equation 2 we can create the following graph of temperature error: Figure 16. PSoC 4 Temperature Error due to INL www.cypress.com Document No. 001-66477 Rev.*H 13 PSoC® 3, PSoC 4, and PSoC 5LP - Temperature Measurement with a Thermistor 7.2.2 Sensor Bias Circuit Reference resistance variation affects the resistance calculation of the thermistor, and therefore, the temperature measurement. Equation 2, reproduced below, shows how to calculate the thermistor resistance. Vtherm Vlow Rt Rref Vhi Vtherm Any deviation in the reference resistor value, shown as Rref_dev, results in a deviation in thermistor resistance RT_dev, as Equation 6 shows. Equation 6 Rref RT _ dev Rt R ref _ dev The reference resistor variation due to tolerance and drift is represented in Equation 7. Equation 7 Rref _ dev Rref Rref Rref _ tolerance Rref _ drift * absT 25 Where T is in °C and is the temperature of the reference resistor, not the thermistor. Consider a 10-kΩ reference resistor with 0.1% tolerance and a temperature drift of 10 ppm/°C. Because the drift of the resistor is characterized at 25 °C, it must be included in the calculation as follows: Rref _ dev @ 40 10k 10k 0.001 0.000001* (40 25) 10009.35 Rref _ dev @125 10k 10k 0.001 0.000001* (125 25) 10011 Using Equation 6 and Equation 7, we get the graph shown in Figure 17. Figure 17: Reference Resistor Temperature Error The X-axis is the temperature of the thermistor. The Y-axis is the temperature error; the different lines represent the error for the reference resistor at that temperature. The graph shows that the error introduced by the reference resistor is less than 0.05 °C To cut cost, use a 1.0% resistor. With a 1.0% resistor using the same equations, the maximum temperature error would be ~0.45 °C. www.cypress.com Document No. 001-66477 Rev.*H 14 PSoC® 3, PSoC 4, and PSoC 5LP - Temperature Measurement with a Thermistor Most of this error is caused by the initial tolerance of the reference resistor, not the temperature drift. For example, if a 1.0% reference resistor is used that has a temperature drift of 10 ppm and the initial tolerance error is calibrated out, the error due to the temperature drift will appear as Figure 18 shows. Figure 18: Temperature Error Due to Reference Resistor Temperature Drift The maximum temperature error due to the temperature drift of the reference resistor is ~.0025 °C. To achieve this, we must calibrate the initial tolerance of the reference resistor; this is demonstrated in CE210528. 7.2.3 Actual Sensor Tolerance Every sensor has inaccuracies associated with it that are independent of the measurement system. For a thermistor, the significant parameters are accuracy, interchangeability, and self-heating. Some thermistor datasheets, such as the one for NCP18XH103F03RB, combine accuracy and interchangeability into one resistance tolerance parameter. The resistance tolerance of the thermistor under consideration is 1% across the temperature range. Figure 19 shows the temperature error caused by the tolerance of the thermistor across the entire temperature range. Figure 19: Thermistor Temperature Error 0.515 0.465 0.415 0.365 Error (°C) 0.315 0.265 0.215 0.165 0.115 0.065 0.015 -40 -20 0 20 40 60 80 100 120 Thermistor Temperature (°C) www.cypress.com Document No. 001-66477 Rev.*H 15 PSoC® 3, PSoC 4, and PSoC 5LP - Temperature Measurement with a Thermistor To calculate this error, we can use Equation 8: Equation 8 Where 0.01 is the 1% tolerance of the thermistor. This new resistance must be entered back into Equation 1 to calculate the new temperature. A simple way to remove this error is to do a single-point temperature calibration. For example, if the thermistor is used to measure human body temperature (37 °C), bring the thermistor to exactly 37 °C, record the temperature reported by the thermistor and note the difference between this temperature and 37 °C. Subtract this temperature from all subsequent readings. This process is documented in CE210528. Self Heating The self-heating error in a thermistor is due to the power dissipated across the thermistor. To find the heating error, use the thermal dissipation constant C, which is the electric power required to raise the thermistor temperature by 1 °C. Equation 9. C P T T0 C = 1 mW/°C for the NCP18XH103F03RB When a reference voltage of 1.6 V is used for thermistor biasing, the power drop and therefore the temperature error is given as follows: [email protected]40 11W Terror 0.011 [email protected] 12W Terror 0.012 Because self-heating depends on the bias voltage (or current in other techniques), keep the bias voltage low to maintain self-heating within an acceptable range. 7.2.4 V o l t a g e - t o - T e m p e r a t u r e C o n ve r s i o n The calculation used to convert the resistance to temperature also has associated error. In the Thermistor Calculator Component, the error for the equation method across a temperature range of –40 °C to 125 °C is less than 0.01 °C. Because the resolution of the temperature measurement with the component is 0.01 °C, the error due to the equation is considered zero. With the LUT method, the error introduced is ±1/2 of the calculation resolution. This is added to the rest of the errors considered thus far. 7.3 Summary of Errors Table 3 summarizes all the errors and typical measured results. Table 3: Summary of Worst-Case Thermistor Errors from–40 °C to 125 °C Parameters Sensor Conditioning Thermistor Measurement chain Calculation error * Max Error (°C) Comments VDAC inaccuracy 0* It is measured Reference resistor 0.045 0.1% resistor with 10 ppm/°C Tolerance 0.45 1% tolerance thermistor Self-heating 0.012 Thermal dissipation constant = 1 mW/°C Offset 0.00 Correlated double sampling Gain error 0* Ratiometric measurement ADC INL 0.04 16-bit resolution with 2-LSB INL Equation method 0* Steinhart-Hart equation LUT method 1/2 calculation resolution Resolution options: 0.01, 0.05, 0.1, 0.5, 1, 2 Error values that are negligible for thermistor measurement are shown as ‘0’. www.cypress.com Document No. 001-66477 Rev.*H 16 PSoC® 3, PSoC 4, and PSoC 5LP - Temperature Measurement with a Thermistor The table shows that the worst-case error is due to the thermistor itself. The maximum error is for a temperature range of –40 ºC to 125 ºC. Typically, thermistors are used for a smaller range, which results in higher accuracy. 8 Summary When choosing a temperature sensor, a thermistor is one option that offers a high accuracy and low cost. In this application note, we looked specifically at negative temperature coefficient (NTC) thermistors, which are temperaturesensitive resistors. This application note demonstrated how to measure the resistance of a thermistor, and showed how to configure PSoC 3, PSoC 4 or PSoC 5LP devices. Converting from thermistor resistance to temperature is computationally complex. We showed how to use the PSoC Creator Thermistor Calculator Component to simplify the math-intensive resistance-to-temperature conversion. 9 Related Application Documents 9.1 Related Application Notes 9.2 AN70698 - PSoC® 3 and PSoC 5LP- Temperature Measurement with an RTD AN75511 - PSoC® 3 and PSoC 5LP- Temperature Measurement with a Thermocouple. AN60590 - PSoC® 3 and PSoC 5LP- Temperature Measurement with a Diode. AN54181 - Getting Started with PSoC 3 AN79953 - Getting Started with PSoC 4 AN77759 - Getting Started with PSoC 5LP. AN66444 - PSoC® 3 and PSoC 5LP Correlated Double Sampling Related Code Examples CE210514 - PSoC® 3, PSoC 4, PSoC 5LP Temperature Sensing with a Thermistor CE210528 - PSoC® 3, and PSoC 5LP Thermistor Calibration About the Authors Name: Archana Yarlagadda Title: Senior Applications Engineer Background: Archana has a Master of Science, Electrical Engineering degree from the University of Tennessee and is interested in analog and mixed-signal systems. Name: Todd Dust Title: Applications Engineer Sr Staff Background: Todd graduated from the Seattle Pacific University with a BSEE, and has been working at Cypress ever since. www.cypress.com Document No. 001-66477 Rev.*H 17 PSoC® 3, PSoC 4, and PSoC 5LP - Temperature Measurement with a Thermistor Document History Document Title: AN66477 - PSoC® 3, PSoC 4, and PSoC 5LP - Temperature Measurement with a Thermistor Document Number: 001-66477 Revision ECN Orig. of Change Submission Date Description of Change ** 3148830 YARA 01/20/2011 New application note. *A 3216577 YARA 06/06/2011 1. In the library project associated with the AN, The Thermistor_v1_0 has been changed to Thermistor_Calc_v1_0. 2. Text in the AN has been modified to support the same. 3. The Library for the component has been changed from "CY_Ref" to "CYRef" as per the change in Spec: 001-58801. *B 3453518 YARA 12/02/2011 Updated project to PSoC Creator 2.0. Minor text edits. Updated template. *C 3682100 YARA 07/17/2012 Prototype status for component Provided two APIs instead of one for facilitating calibration in project and AN Added “Appendix A” Corrected “Accuracy” selection to “Calculation Resolution” Added “Performance Analysis” Updated the thermistor datasheet based on these changes Project code presentation changed based on best practices guidelines *D 3836921 TDU 12/10/2012 Major Update Updated Flow of Document Updated content to reflect that the component is now part of Creator *E 4155350 TDU 10/11/2013 Updated attached Associated Project Updated in new template Completing Sunset Review *F 4224489 TDU 12/19/2013 Added PSoC 4 and difference performance level projects. Cleaned up accuracy calculations. *G 4498523 TDU 09/10/2014 Corrected Table 3 title (from RTD to Thermistor) Updated the hyperlink and title for AN2099. *H 5074214 TDU 01/14/2016 Updated to latest template Moved projects to Code Examples www.cypress.com Document No. 001-66477 Rev.*H 18 PSoC® 3, PSoC 4, and PSoC 5LP - Temperature Measurement with a Thermistor Worldwide Sales and Design Support Cypress maintains a worldwide network of offices, solution centers, manufacturer’s representatives, and distributors. To find the office closest to you, visit us at Cypress Locations. PSoC® Solutions Products Automotive cypress.com/go/automotive psoc.cypress.com/solutions Clocks & Buffers cypress.com/go/clocks PSoC 1 | PSoC 3 | PSoC 4 | PSoC 5LP Interface cypress.com/go/interface Cypress Developer Community Lighting & Power Control cypress.com/go/powerpsoc Memory cypress.com/go/memory PSoC cypress.com/go/psoc Touch Sensing cypress.com/go/touch USB Controllers cypress.com/go/usb Wireless/RF cypress.com/go/wireless Community | Forums | Blogs | Video | Training Technical Support cypress.com/go/support PSoC is a registered trademark and PSoC Creator is a trademark of Cypress Semiconductor Corp. All other trademarks or registered trademarks referenced herein are the property of their respective owners. Cypress Semiconductor 198 Champion Court San Jose, CA 95134-1709 Phone Fax Website : 408-943-2600 : 408-943-4730 : www.cypress.com © Cypress Semiconductor Corporation, 2011-2016. The information contained herein is subject to change without notice. Cypress Semiconductor Corporation assumes no responsibility for the use of any circuitry other than circuitry embodied in a Cypress product. Nor does it convey or imply any license under patent or other rights. Cypress products are not warranted nor intended to be used for medical, life support, life saving, critical control or safety applications, unless pursuant to an express written agreement with Cypress. Furthermore, Cypress does not authorize its products for use as critical components in life-support systems where a malfunction or failure may reasonably be expected to result in significant injury to the user. The inclusion of Cypress products in life-support systems application implies that the manufacturer assumes all risk of such use and in doing so indemnifies Cypress against all charges. This Source Code (software and/or firmware) is owned by Cypress Semiconductor Corporation (Cypress) and is protected by and subject to worldwide patent protection (United States and foreign), United States copyright laws and international treaty provisions. Cypress hereby grants to licensee a personal, non-exclusive, non-transferable license to copy, use, modify, create derivative works of, and compile the Cypress Source Code and derivative works for the sole purpose of creating custom software and or firmware in support of licensee product to be used only in conjunction with a Cypress integrated circuit as specified in the applicable agreement. Any reproduction, modification, translation, compilation, or representation of this Source Code except as specified above is prohibited without the express written permission of Cypress. Disclaimer: CYPRESS MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS MATERIAL, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Cypress reserves the right to make changes without further notice to the materials described herein. Cypress does not assume any liability arising out of the application or use of any product or circuit described herein. Cypress does not authorize its products for use as critical components in life-support systems where a malfunction or failure may reasonably be expected to result in significant injury to the user. The inclusion of Cypress’ product in a life-support systems application implies that the manufacturer assumes all risk of such use and in doing so indemnifies Cypress against all charges. Use may be limited by and subject to the applicable Cypress software license agreement. www.cypress.com Document No. 001-66477 Rev.*H 19

- Similar pages
- AN70698 PSoC® 3 PSoC 4 and PSoC 5LP Temperature Measurement with an RTD.pdf
- AN84783 - Accurate Measurement Using PSoC 3 and PSoC 5LP Delta-Sigma ADCs.pdf
- AN52678 PSoC 1 Interface with Triaxial Analog Accelerometer for Measuring Tilt.pdf
- AN75511 - PSoC 3 / PSoC 5LP - Temperature Measurement with a Thermocouple.pdf
- AN2226 PSoC 1 - Using Correlated Double Sampling to Reduce Offset, Drift, and Low Frequency Noise.pdf
- AN2017 PSoC 1 Temperature Measurement with Thermistor.pdf
- AN73468 PSoC 3 and PSoC 5LP Single-Cell Lithium-Ion (Li-ion) Battery Charger.pdf
- V - Cypress
- CE210434 - PSoC® 3 and PSoC 5LP RTD Calibration.pdf
- ETC CY8CKIT-036
- AN78920 PSoC 1 Temperature Measurement Using Diode.pdf
- AN52701 - PSoC 3 and PSoC 5LP - Getting Started with Controller Area Network.pdf
- AN60590 PSoC 3, PSoC 4, and PSoC 5LP Temperature Measurement with a Diode.pdf
- AN55102 PSoC 1 Single Cell Li-Ion Battery Charger with CY8C21x23.pdf
- AN81623 PSoC 3, PSoC 4, and PSoC 5LP Digital Design Best Practices.pdf
- AN60580 SIO Tips and Tricks in PSoC 3 / PSoC 5LP.pdf
- AN2099 - PSoC 1, PSoC 3, PSoC 4, and PSoC 5LP - Single-Pole Infinite Impulse Response (IIR) Filters.pdf
- Application Note