Beruflich Dokumente
Kultur Dokumente
Contents
Introduction
Introduction ....................................................................... 1
Thermocouples Theory of Operation .............................. 2
Thermoelectric Effect ................................................... 2
Cold Junction Compensation........................................ 4
Measuring Thermo-emf ................................................ 4
Practical Thermocouple Measurements ....................... 5
Thermocouple Temperature Measurement with PSoC ..... 5
Hardware Used - CY8CKIT-025 EBK ........................... 5
PSoC Creator Schematic Description .......................... 6
Thermocouple - Voltage to Temperature Conversion ... 8
Firmware Flow .............................................................. 9
Performance Ranges ................................................. 10
Thermocouple Voltage Measurement Error................ 11
Cold Junction Compensation Voltage Error................ 11
Voltage to Temperature Conversion Error .................. 12
Summary ......................................................................... 13
Appendix A: Calibrating for Gain Drift.............................. 14
Worldwide Sales and Design Support ............................. 18
www.cypress.com
RTD
Thermocouple
Thermistor
Diode
Temperature range
(0 C)
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
$3$80
$3$15
$0.2$10
<$0.2
Typical distance of
sensing
<100 meters
On-board temperature
Excitation current,
amplifier, ADC, reference
resistor
Excitation current,
amplifier, ADC
Response time
Slow
Fast
Fast
Slow
Computational
complexity (best
possible accuracy)
High
Very high
Very high
Medium
Cypress Application
Note
AN70698
AN75511
AN66477
AN60590
Thermocouples
have
the
largest
temperature
measurement range and are one of the most rugged
temperature sensors making them the first choice for use
in industrial and corrosive environment. This application
note focuses on the K-Type thermocouple, which is a
commonly thermocouple type.
Thermocouples Theory of
Operation
Junction 2
Metal 2
Metal 2
Thermoelectric Effect
www.cypress.com
Junction 2
Metal2
Metal2
-
hot
Metal Content in
Positive Leg
Metal Content in
Negative Leg
Temp
Range (C)
Sensitivity
at 25 C
(V/C)
Tolerance (ASTM)
Temp
Range (C)
Standard
Special
93.9% Pt,
6.1% Rh
01820
8001700
0.5%
-2701000
61
-2000
1.7 C or 1%
0900
1.7 C or
0.5%
1C or
0.4%
-2101200
52
0750
2.2 C or
0.75%
1.1 C or
0.4%
95% Ni,
5% Various
elements
-2701372
41
-2000
2.2 C or
2%
01250
2.2 C or
0.75%
-2701300
-2700
2.2 C or
2%
01300
2.2 C or
0.75%
1.1 C or
0.4%
26
1.1 C or
0.4%
100% Pt
-501768
01450
1.5 C or
0.25%
0.6 C or
0.1%
100% Pt
-501768
01450
1.5 C or
0.25%
0.6 C or
0.1%
100% Cu
-270400
41
-2000
1 C or
1.5%
0350
1 C or
0.75%
www.cypress.com
0.5 C or
0.4%
+
- V1
V2 = 0 +
Alumel
Junction 2
(0C)
Alumel
Chromel
Junction 1
(Hot)
+
- V1
V2 +
Alumel
Alumel
V =V1 - V2
Measuring Thermo-emf
V =V1
60
Chromel
50
Thermoemf in mV
Junction 2
(ambient
temperature)
Junction 1
(Hot)
40
30
20
10
0
+
- V1
V2 +
Alumel
Alumel
Junction 3 +V3
-
V4 + Junction 4
Copper
-10
-300
300
600
900
Temperature in C
+
V =V1 - V2 + V3 - V4
-
Copper
1200
Junction 2
(ambient
temperature)
www.cypress.com
Copper
Junction 2
Junction 1
(Hot)
+
- V1
+
V
Junction 3
Alumel
Copper
Reference
Junction
temperature
sensor
2.
3.
4.
5.
Thermocouple Temperature
Measurement with PSoC
This application note has three example projects
(TC_HighEnd, TC_MidEnd, and TC_LowEnd) that
showcase thermocouple temperature measurement using
PSoC. The projects display thermocouple temperature on
an LCD. The signal chain for all the projects is the same.
This section describes the mid-end thermocouple
(TC_MidEnd) project in detail. Differences between the
www.cypress.com
Connection
Measurement
Thermocouple
Thermo-emf
IC voltage output
Thermistor voltage
Thermistor ref
Short
Offset
www.cypress.com
No of CPU cycles
80 element LUT +
piecewise linear
approximation
<0.2 C
8000
Polynomial
<0.07 C
www.cypress.com
After you have the final thermo-emf (VTC + Vref), use the
Thermocouple_1_GetTemperature () API to obtain
temperature. This API takes thermo-emf (in microvolts) as
input and returns temperature (in 1/100th of C).
The following code snippet shows how the two APIs are
used:
void main()
{
int32
coldJnTemp,
tcColdJnuVolt,
tcHotJnuVolt, tcuVolt, tcTemp ;
/* Measure cold junction temperature.
The function MeasureColdJnSensorTemp()
returns cold junction temperature */
coldJnTemp = MeasureColdJnSensorTemp();
/* ColdJunctionTempTomVolt() API is used
to convert temp to microvolts */
tcColdJnuVolt = Thermocouple
_1_GetVoltage (coldJnTemp);
/* FindHotJnmVolt() API finds the hot
junction voltage in millivolts */
tcHotJnuVolt = FindHotJnuVolt();
/*
Add
cold
junction
compensation
voltage to hot junction voltage */
tcuVolt = tcColdJnuVolt + tcHotJnuVolt;
/*
mVoltToTemp()
API
is
used
for
converting thermo emf to temperature */
tcTemp = Thermocouple_1_GetTemperature
(tcuVolt);
}
The datasheet associated with the component gives more
details on the thermocouple component implementation and
the number of CPU cycles taken by the APIs for different
orders of the polynomial.
Temperature error depends on several factors apart from
voltage to temperature conversion error. The thermocouple
customizer shows only the error due to voltage to
temperature conversion and does not take the other errors
into account. If your required accuracy is 2 C, make sure
the thermo-emf to temperature conversion error is less than
one-tenth of the total error budget to accommodate other
errors. The other errors are discussed in Temperature
Accuracy section.
Firmware Flow
The firmware flow for mid and low-end project is given in the
flow chart below. Firmware flowchart for high-end project is
given in appendix. An interrupt is triggered when a switch is
pressed (see Figure 9 (b) on page 7). A flag is toggled in the
interrupt service routine (ISR) changing the cold junction
temperature source between IC and thermistor. The APIs
generated by the thermocouple component are used for
converting thermocouple voltage to temperature and vice
versa.
Figure 12. Firmware Flow
Start
Is
flag = 1?
N
Use thermistor to
measure Cold
Junction(CJ) temperature
Convert CJ temperature to
CJ compensation voltage.
Is
Hot jn Voltage
< - 10mV ?
N
END
www.cypress.com
Broken Thermocouple
If the thermocouple wire breaks, the small negative bias we
apply to the negative terminal of the thermocouple
connector (see Figure 9 (a) on page 6) takes the ADC
voltage to a large negative value. Checking the
thermocouple output voltage for a large negative value (<10 mV) helps us to detect a broken thermocouple
connection. The project associated with the application note
detects a broken thermocouple connection and displays a
broken alert in the LCD if the thermocouple is broken.
Testing the Project
1. Plug the CY8CKIT-025 PSoC precision analog
temperature sensor EBK to PORT E of PSoC 3
Development Kit (DVK) CY8CKIT-030 or PSoC 5
Development Kit (DVK) CY8CKIT-050.
2.
3.
4.
Multiple Thermocouples
You can use multiple thermocouples in your design. The
number of thermocouples that you can use is limited only by
the number of GPIOs (input/output terminals) available in
PSoC.
If you are using multiple thermocouples of the same type,
one thermocouple component will be sufficient and the APIs
generated by that component can be reused for all the
thermocouples.
If you are using multiple thermocouples in your project and
have more than one thermocouple type, one component per
type should be used in your project. For instance, if your
project has three K-type thermocouples, two J-type
thermocouples, and one T-type thermocouple, you need to
use three thermocouple components, one for each type (J,
K, and T).
Performance Ranges
Thermocouple based temperature sensing market can be
categorized into three segments based on performance
specifications: High-end, mid-end, and low-end market
segments. Table 5 gives the classification.
Table 5. Thermocouple Performance Ranges
Market segment
Resolution* (C)
Accuracy* (C)
High
0.01
0.1%
Mid
0.1
0.2 0.5%
Low
>0.1C
>0.5 C
Temperature Resolution
In this section, well see how PSoC 3 and PSoC 5LP can be
used to address all the three segments.
High End
A resolution of 0.01 C in -200 C to 1370 C temperature
range requires minimum 157000 levels (18-bits).
Temperature range -200 C to 1370 C corresponds to
voltage range -5.891 mV to 54.88 mV. Temperature
resolution of 0.01 C corresponds to voltage resolution of
400 nV (sensitivity = 40 V/C). The ADC should have
400 nV voltage resolution and a minimum of 18-bits.
Using the ADC in +/-0.064 V range and 20-bit resolution
gives a voltage resolution of 122 nV. But, the noise-free
voltage resolution is much higher than the theoretical
resolution. The 20-bit ADC used in +/-0.064 V range gives a
0.01 C resolution with a few flickering digits. A firmware IIR
filter (See AN2099) is added to stabilize the reading to
0.01 C resolution
The firmware IIR filter used has an attenuation factor of 64.
From AN2099 table 1, we see that the temperature settling
time (0.1%) would be 441 cycles. For the project
(TC_HighEnd) attached to this application note, the cycle
time is about 50 ms resulting in a temperature settling time
of 22 s.
The IIR filter has a feed forward term that ensures that the
temperature settles to within 2 C in 50 ms. That is, if the
source temperature changes from 50 C to 150 C, the
temperature shown by PSoC will reach 148 C in 50 ms and
149.9 C in 22 s.
Mid End
A resolution of 0.1 C in -200 C to 1370 C temperature
range requires minimum 15700 levels (14-bits).
Temperature resolution of 0.1 C corresponds to voltage
resolution of 4 uV (sensitivity = 40 V/C). The ADC should
have 4 uV voltage resolution and a minimum of 14-bits.
Using the ADC in +/-1.024 V range and 16-bit resolution
gives a voltage resolution of 3.125 uV. A firmware IIR filter
(See AN2099) is added to stabilize the reading to 0.1 C
resolution.
The firmware IIR filter used has an attenuation factor of 32.
From AN2099 table 1, we see that the temperature settling
time (0.1%) would be 219 cycles. For the project
(TC_MidEnd) attached to this application note, the cycle
time is about 50 ms resulting in a temperature settling time
of 10 s.
The IIR filter has a feed forward term that ensures that the
temperature settles to within 2 C in 50 ms. That is, if the
source temperature changes from 50 C to 150 C, the
temperature shown by PSoC will reach 148 C in 50 ms and
149.9 C in 10 s.
www.cypress.com
10
Low End
Generally low-end thermocouple temperature sensing
devices have a resolution of 1 C. A resolution of 1 C in
-200 C to 1370 C temperature range requires minimum
1570 levels (11-bits). Resolution of 1 C corresponds to
voltage resolution of 40 uV (sensitivity = 40 V/C). The
ADC should have 40 uV resolution and a minimum of 11bits.
Using the ADC in +/-0.064 V range and 12-bit resolution
gives a voltage resolution of 31 uV. A firmware IIR filter (See
AN2099) is added to stabilize the reading to 1 C resolution.
A 16-bit ADC or higher can be used without a firmware filter.
But using 12-bit ADC allows the usage of lower cost PSoC
devices.
T e m p e r a t u r e Ac c u r a c y
Thermocouple temperature accuracy can be calculated by
calculating the effect of the individual errors that occur
during measurement and conversion. To understand the
different errors consider the equation used, thermocouple
component API, to obtain the final temperature:
Th = Thermocouple_1_mVoltToTemp(VTC+Vref)
Equation 1
where Th is the thermocouple temperature; VTC is the
thermocouple voltage measured; Vref is the cold junction
compensation voltage; Thermocouple_1_mVoltToTemp()
function performs the voltage to temperature conversion.
Vref = Thermocouple_1_ColdJunctionTempTomVolt(Tref)
Equation 2
where Tref is the cold junction temperature.
A temperature error can result from one of the factors:
1.
2.
3.
-250
-3
-100
0.2
100
0.2
250
0.5
500
0.95
1000
1.9
1300
AD C I N L
The INL of an ADC at any point is the difference between
the ideal ADC count and the actual ADC count at that point
after gain and offset corrections have been done. The
datasheet specifies the maximum INL of all points across
Process, Voltage, and Temperature (PVT). PSoC 3 ADC
has an INL of +/-32 LSb in 1.024 V mode; 32LSb
corresponds to 64 V for 20-bit resolution and 1.024 V
range. This error of 64 V corresponds to temperature error
of 1.5 C (for temperatures > -100 C).
Note that these are worst-case errors. We have used the
worst-case INL across PVT and used it for error calculation.
This is a pessimistic approach and is done to indicate the
worst-case limits due to INL. Practically, the error due to INL
will be much lower. For a typical INL of around 4 LSb, the
temperature error due to INL will be <0.2 C (for
temperatures > -100 C).
11
Error Source
Maximum
Error value
at 500C
(K-Type)
Maximum
Error Value
at 100 C
(K-type)
Maximum
Error Value
at 500C
(K-Type)
Calibrated
Gain drift
(Ambient temp =
25 C)
0 C
0 C
0C
Gain drift
(Ambient temp =
65 C)
0.95 C
0.2 C
As good as
the external
reference
drift
ADC INL**
1.5 C
1.5 C
1.5C
Same as
cold junction
temperature
error
Same as
cold
junction
temperature
error
Same as
cold
junction
temperature
error
Error due to
Thermocouple
tolerance
(Special)
1.1C
1.1 C
1.1 C
Voltage to
temperature
conversion error
0.05 C
0.05 C
0.05 C
Maximum
Error value
at 500C
(K-Type)
Maximum
Error Value
at 100 C
(K-type)
Maximum
Error Value
at 500C
(K-Type)
Calibrated
Offset Error/drift*
0 C
0 C
0C
Gain Error
0.95 C
0.2 C
As good as
the
calibration
source
www.cypress.com
Temperature Test
Temperature test results performed on the TC_MidEnd
project at different temperatures is given Table 8. The
temperature measured by thermocouple is compared to the
temperature displayed by a standard thermometer (accuracy
0.5 C). A precision temperature forcing system (air flow) is
used to set various temperatures.
The accuracy results are shown in Table 8. Column 1 shows
the temperature set on the temperature forcing system,
column 2 shows the temperature displayed by the standard
thermometer, column 3 shows the thermocouple
temperature, and column 4 shows the temperature error.
The temperature test performed on high-end project is given
in appendix.
12
Simulated
Thermo-emf
(mV)
Expected
Temperature
(C)
Obtained
Temperature
(C)
Error (C)
3.663
89.5
89.4
0.1
Temperature
Source (C)
Standard
Thermometer
(C)
Thermocouple
(C)
Temperature
Error (C)
-40
-39.5
-39.7
0.2
4.712
114.9
114.9
-20
-19.5
-19.5
9.582
235.9
235.8
0.1
-0.2
-0.7
0.5
19.58
475
4.9
0.1
25
24.8
25.2
-0.4
28.76
691.2
691.0
0.2
40
39.4
39.6
-0.2
39.54
955.7
955.4
0.3
60
59.1
59
0.1
49.816
1227
1226.6
0.4
80
78.9
78.7
0.2
100
98.8
98.2
0.6
120
118.8
118.2
0.6
Summary
Thermocouples are the sensors of choice in industrial
environment and for measuring temperatures >850 C.
Thermocouples require high-resolution ADC, and require
another temperature sensor for measuring cold junction
temperature. PSoC 3 or PSoC 5LP delta-sigma ADC and
the thermocouple component make it easy to measure
thermocouple temperature accurately.
Praveen Sekar
Title:
Applications Engineer
Background:
Contact:
pfz@cypress.com
Expected
Temperature
(C)
Obtained
Temperature
(C)
Error (C)
-4.695
-141
-141.1
0.1
-3.666
-103.7
-103.7
-2.575
-69.6
-69.5
-0.1
-1.741
-45.9
-45.7
-0.2
-0.654
-16.8
-16.7
-0.1
0.666
16.7
16.7
1.754
43.5
43.4
0.1
2.58
63.5
63.5
www.cypress.com
13
www.cypress.com
14
LM4140
5 ppm/C resistors on
prototyping space
feeding ~49 mV to port
0_7
Populate LM4140 (3 ppm/C) reference on CY8CKIT-030 (position U6). Populate R34 (0 ), C24 (1 uF) and R37
(0 ) on CY8CKIT-030. Now, the 1.024 V reference is available on pin 3[2]. It can be used as external reference as
well.
In the prototyping space, add a resistor divider from pin 3[2] to ground to reduce 1.024 V down to 48.7 mV. Choose
R1 = 20 k (0.1%, 5ppm/C drift) and R2 = 1 k (0.1%, 5 ppm/C drift)
Test Results
Table 10. Sample Test Results after Calibrating PSoC 3 Device with Agilent 34411A
Input Voltage
(uV)
Expected
Temperature (C)
Error (%)
54527
1361.43
1361.4
-0.002
45083
1099.05
1098.99
-0.006
32438
779.64
779.63
-0.001
23539
567.92
567.96
0.008
9140
224.95
224.97
0.009
2230
55.04
55.06
0.037
912
22.8
22.15
-2.859
0.12
NAN
www.cypress.com
15
Calibrate?
Y
Perform one time offset and gain
calibration and store gain and offset
calibration constants in EEPROM
Has cold jn
temp changed
by 5C ?
Y
Update gain calibration
N
Is
flag = 1?
N
Use IC to measure Cold
Junction(CJ) temperature
Use thermistor to
measure Cold
Junction(CJ) temperature
Convert CJ temperature to
CJ compensation voltage.
Is
Hot jn
Voltage < 10mV ?
N
END
www.cypress.com
16
Document History
Document Title: AN75511 - PSoC 3 / PSoC 5LP Temperature Measurement with a Thermocouple
Document Number: 001-75511
Revision
ECN
Orig. of
Change
Submission
Date
Description of Change
**
3571217
PFZ
04/03/2012
*A
3811884
PFZ
11/26/2012
Updated Associated Part Family as All PSoC 3 and PSoC 5LP parts.
Updated Related Application Notes as AN75511, AN66477, AN60590.
Updated Introduction.
3993370
TDU
05/07/2013
*C
4153444
TDU
10/10/2013
www.cypress.com
17
PSoC Solutions
Products
Automotive
cypress.com/go/automotive
psoc.cypress.com/solutions
cypress.com/go/clocks
Interface
cypress.com/go/interface
cypress.com/go/powerpsoc
cypress.com/go/plc
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
Technical Support
cypress.com/go/support
PSoC is a registered 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, 2012-2013. 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
18