CN0214: USB - Based Thermocouple Temperature Measurement System Using ARM7

Circuit Note
CN-0214
Devices Connected/Referenced
Circuits from the Lab™ reference circuits are engineered and
tested for quick and easy system integration to help solve today’s
analog, mixed-signal, and RF design challenges. For more
information and/or support, visit www.analog.com/CN0214.
ADuC7060/
ADuC7061
ARM7 Based Microcontroller with
Dual 24-Bit Σ-Δ ADCs
ADP3333
2.5 V Low Dropout Linear Regulator
ADP7102-2.5
50 mA, High Voltage, Micropower
Linear Regulator
OP193
Precision, Low Power Op Amp
USB-Based Thermocouple Temperature Measurement System Using ARM7
EVALUATION AND DESIGN SUPPORT
converter (DAC), and a 1.2 V internal reference, as well as an
ARM7 core, 32 kB flash, 4 kB SRAM, and various digital
peripherals such as UART, timers, SPI, and I2C interfaces.
Circuit Evaluation Boards
ADuC7061 Mini Kit (EVAL-ADUC7061MKZ)
Design and Integration Files
Schematics, Layout Files, Bill of Materials
In the circuit, the ADuC7060/ADuC7061 are connected to a
thermocouple and a 100 Ω platinum resistance temperature
detector (RTD). The RTD is used for cold junction compensation.
CIRCUIT FUNCTION AND BENEFITS
In the source code, an ADC sampling rate of 4 Hz is chosen.
When the ADC input programmable gain amplifier (PGA) is
configured for a gain of 32, the noise-free code resolution of the
ADuC7060/ADuC7061 is greater than 18 bits.
This circuit uses the ADuC7060/ADuC7061 precision analog
microcontroller in an accurate thermocouple temperature
monitoring application. The ADuC7060/ADuC7061 integrates
dual 24-bit sigma-delta (Σ-Δ) analog-to-digital converters (ADCs),
dual programmable current sources, a 14-bit digital-to-analog
2.5V
USB HEADER
ADP3333-2.5
BEAD
5V
IN
BEAD
10Ω
OUT
4.7µF
4.7µF
4.7µF
0.1µF
0.1µF
FT232R
D–
D+
TxD
RxD
AVDD
IEXC0
GND
SHIELD
0.1µF
BEAD
DVDD
10Ω
100Ω
PtRTD
S2
1kΩ
S1
1kΩ
RESET
NTRST/BM
ADC0
0.01µF
10Ω
ADC1
0.01µF
ADuC7060/ADuC7061
FERRITE BEADS:
1kΩ @ 100MHz
TAIYO YUDEN
BK2125HS102-T
2.5V
OP193
RREF
VREF+
5.62kΩ
0.1%
TxD
RxD
AGND DGND
09869-001
DAC0
P1.0/SIN
ADC3
THERMOCOUPLE
JUNCTION
P1.1/SOUT
VREF–
Figure 1. ADuC7060/ADuC7061 as a Temperature Monitor Controller with a Thermocouple Interface (Simplified Schematic, All Connections Not Shown)
Rev. D
Circuits from the Lab™ circuits from Analog Devices have been designed and built by Analog Devices
engineers. Standard engineering practices have been employed in the design and construction of
each circuit, and their function and performance have been tested and verified in a lab environment at
room temperature. However, you are solely responsible for testing the circuit and determining its
suitability and applicability for your use and application. Accordingly, in no event shall Analog Devices
be liable for direct, indirect, special, incidental, consequential or punitive damages due to any cause
whatsoever connected to the use of any Circuits from the Lab circuits. (Continued on last page)
One Technology Way, P.O. Box 9106, Norwood, MA 02062-9106, U.S.A.
Tel: 781.329.4700
www.analog.com
Fax: 781.461.3113 ©2011–2013 Analog Devices, Inc. All rights reserved.
CN-0214
Circuit Note
The following features of the ADuC7060/ADuC7061 are used in
this application:
•
•
•
•
•
•
•
•
Primary 24-bit Σ-Δ ADC with PGA. The PGA is set for a
gain of 32 in the software for this application. The primary
ADC was continuously switched between sampling the
thermocouple and the RTD voltages.
Programmable excitation current sources for forcing a
controlled current through the RTD. The dual current
sources are configurable in 200 µA steps from 0 µA to
2 mA. For this example, a 200 µA setting was used to
minimize the error introduced by the RTD self-heating.
Internal 1.2 V reference for the ADC in the ADuC7060/
ADuC7061. For measuring the thermocouple voltage, the
internal voltage reference was used due to its precision.
External voltage reference for the ADC in the ADuC7060/
ADuC7061. For measuring the RTD resistance, a ratiometric
setup was used where an external reference resistor (RREF) was
connected across the external VREF+ AND VREF− pins.
A 14-bit DAC. The DAC was used to set the thermocouple
common-mode voltage to 850 mV above ground.
An ARM7TDMI® core. The powerful 16-/32-bit ARM7 core
with integrated 32 kB flash and SRAM memory runs the
user code that configures and controls the ADC, processes
the ADC conversions from the RTD, and controls the
communications over the UART/USB interface.
A UART. The UART was used as the communication
interface to the host PC.
Two external switches are used to force the part into flash boot
mode. By holding S1 low and toggling S2, the ADuC7060/
ADuC7061 enters boot mode instead of normal user mode.
In boot mode, the internal flash can be reprogrammed
through the UART interface.
Both the thermocouple and the RTD generate small signals;
therefore, a PGA is required to amplify those signals. As the
auxiliary ADC on the ADuC7060/ADuC7061 does not have a
PGA, both were connected to the primary ADC and switching
between the two was done in software.
In addition to the decoupling shown in Figure 1, the USB cable
must have a ferrite bead for added electromagnetic interference
(EMI)/radio frequency interference (RFI) protection. The ferrite
bead used in this circuit was the Taiyo Yuden, #BK2125HS102-T,
which has an impedance of 1000 Ω at 100 MHz.
The circuit must be constructed on a multilayer printed circuit
board (PCB) with a large area ground plane. Proper layout,
grounding, and decoupling techniques must be used to achieve
optimum performance (see Tutorial MT-031, Grounding Data
Converters and Solving the Mystery of "AGND" and "DGND,"
Tutorial MT-101, Decoupling Techniques, the ADuC7060
Evaluation Board layout and ADuC7061 Evaluation Board layout).
The EVAL-ADuC7061MKZ PCB is shown in Figure 2.
09869-002
CIRCUIT DESCRIPTION
Figure 2. EVAL-ADuC7061MKZ Board Used for this Circuit.
Code Description
The source code used to test the circuit can be downloaded as a
zip file from www.analog.com/CN0214-SourceCode.
The UART is configured for a baud rate of 9600, eight data bits,
no parity, and no flow control. If the circuit is connected directly to
a PC, a communication port viewing application such as the
Hilgraeve HyperTerminal can be used to view the results sent
by the program to the UART, as shown in Figure 3.
The thermocouple used in this application is a Type T (copperconstantan) that has a temperature range of −200°C to +350°C.
Its sensitivity is approximately 40 µV/°C, which means that the
ADC in bipolar mode, with a PGA gain of 32, can cover the
entire temperature range of the thermocouple.
The RTD was used for cold junction compensation. The one used
in this circuit was a platinum 100 Ω RTD, Enercorp PCS 1.1503.1.
It is available in a 0805 surface-mount package. This RTD has a
temperature variation of 0.385 Ω/°C.
The USB interface to the ADuC7060/ADuC7061 is implemented
with an FT232R UART-to-USB transceiver that converts USB
signals to the UART directly.
09869-003
Note that the reference resistor, RREF, must be a precision
5.62 kΩ (±0.1%) resistor.
Figure 3. Output of HyperTerminal Communication Port Viewing Application
Rev. D | Page 2 of 5
Circuit Note
CN-0214
To get a temperature reading, the temperature of the thermocouple
and RTD must be measured. The RTD temperature is converted to
its equivalent thermocouple voltage via the lookup table provided
in the source code. These two voltages are added together to
give the absolute value at the thermocouple.
0.30
0.25
ERROR (°C)
0.20
First, measure the voltage between the two wires of the thermocouple (V1). The RTD voltage is then measured and converted
to a temperature via the lookup table. This temperature is then
converted to its equivalent thermocouple voltage (V2). V1 and
V2 are then added to give the overall thermocouple voltage, and
this value is then converted to the final temperature measurement.
0.15
0.10
0.05
Initially, this was done using a simple linear assumption that the
voltage on the thermocouple was 40 µV/°C. It can be seen from
Figure 4 that this gives an acceptable error only for a small range
around 0°C.
–0.05
–210
–140
–70
0
70
140
210
280
09869-005
0
350
TEMPERATURE (°C)
Figure 5. Error When Using Piecewise Linear Approximation Using
52 Calibration Points and Ideal Measurements
1.0
–10
0.9
0
0.8
0.7
ERROR (°C)
ERROR (°C)
–20
–40
0.6
0.5
0.4
–60
0.3
0.2
–80
–140
–70
0
70
140
210
280
350
TEMPERATURE (°C)
0
–210
09869-004
–100
–210
–140
–70
0
70
140
TEMPERATURE (°C)
Figure 4. Error When Using Simple Linear Approximation
A better way of calculating the thermocouple temperatures is to
use a sixth-order polynomial for the positive temperatures and
a seventh-order polynomial for the negative temperatures. This
requires mathematical operations that add to computational
time and code size. A suitable compromise is to calculate the
respective temperatures for a fixed number of voltages. These
temperatures are stored in an array, and values in between are
calculated using a linear interpolation between the adjacent points.
It can be seen from Figure 5 that the error is drastically reduced
using this method. Figure 5 gives the algorithm error using ideal
thermocouple voltages. Figure 6 shows the error obtained when
using ADC0 on the ADuC7060 to measure 52 thermocouple
voltages over the full thermocouple operating range. The overall
worst-case error is <1°C.
210
280
350
09869-106
0.1
Figure 6. Error When Using Piecewise Linear Approximation Using
52 Calibration Points Measured by Using ADC0 of the ADuC7060/ADuC7061
The RTD temperature is calculated using the lookup table
provided in the source code and is implemented for the RTD
the same way as for the thermocouple. Note that the RTD has a
different polynomial describing its temperatures as a function
of resistance.
For details on linearization and maximizing the performance of
the RTD, refer to Application Note AN-0970, RTD Interfacing
and Linearization Using an ADuC706x Microcontroller.
COMMON VARIATIONS
The ADP7102 regulator can be used as a newer alternate to the
ADP3333. If more GPIO pins are required on the microcontroller,
the ADuC7060, which comes in a 48-lead LFCSP or 48-lead
LQFP package, is another option. Note that the ADuC7060/
ADuC7061 can be programmed or debugged via a standard
JTAG interface.
Rev. D | Page 3 of 5
CN-0214
Circuit Note
For a standard UART-to-RS-232 interface, the FT232R transceiver
can be replaced with a device such as the ADM3202, which
requires a 3 V power supply. For a wider temperature range, a
different thermocouple can be used, such as a Type J. To minimize
the cold junction compensation error, a thermistor can be placed in
contact with the actual cold junction instead of on the PCB.
Instead of using the RTD and external reference resistor for
measuring the cold junction temperature, an external digital
temperature sensor can be used. For example, the ADT7410
can connect to the ADuC7060/ADuC7061 via the I2C interface.
For more details on cold junction compensation, see Sensor Signal
Conditioning, Analog Devices, Chapter 7, "Temperature Sensors."
source, as shown in Figure 7. To evaluate the entire range of a
Type T thermocouple, the calibrator was used to set the equivalent
thermocouple voltage at 11 points between −200°C to +350°C
for the negative and positive ranges of the Type T thermocouple
(see the ITS-90 Table for Type T Thermocouple).
To evaluate the accuracy of the lookup algorithm, 551 voltage
readings, equivalent to temperatures in the range of −200°C to
+350°C spaced at +1°C, were passed onto the temperature
calculation functions. Errors were calculated for the linear method
and the piecewise linear approximation method as can be seen
in Figure 4 and Figure 5.
RTD Measurement Test
To evaluate the RTD circuit and linearization source code, the
RTD on the PCB was replaced with an accurate, adjustable
resistance source. The instrument used was the 1433-Z decade
resistor. RTD values went from 90 Ω to 140 Ω, representing an
RTD temperature range of −25°C to +114°C. The setup circuit
is shown in Figure 8.
ADP3333-2.5
USB
HEADER
If isolation between the USB connector and this circuit is required,
add the ADuM3160/ADuM4160 isolation devices.
5V
IN
OUT
4.7µF
D+
FT232QN
GND
To test and evaluate the circuit, the thermocouple measurements
and the RTD measurements were evaluated separately.
0.1µF
SHIELD
0.1µF
4.7µF
RxD
0.1µF
1433-Z
DECADE
RESISTOR
DVDD
IEXC0
10Ω
ADC0
0.01µF
BEAD
10Ω
The basic test setup is shown in Figure 7. Note that the thermocouple is connected to J2-8 and J2-9, and J2-5 must be connected
to J2-8. The EVAL-ADuC7061MKZ board receives its power
from the USB connection to the PC.
ADC1
0.01µF
ADuC7061
OP193
VREF+
RREF
5.6kΩ
0.1%
VREF–
EVAL-ADuC7061MKZ
P1.0/SIN P1.1/SOUT
J2-9
RxD
TxD
Figure 8. Test Setup Used to Calibrate and Test the RTD Output Voltage
Range from −25°C to +114°C
J2-8
J2-5
The error results for the RTD tests are shown in Figure 9.
0
USB
CABLE
–0.01
WAVTEK 4808
MULTIFUNCTION
CALIBRATOR
–0.02
–0.03
09869-006
ERROR (°C)
PC
Figure 7. Test Setup Used to Calibrate and Test the Circuit Over Full
Thermocouple Output Voltage Range
–0.05
–0.06
–0.07
Two methods were used to evaluate the performance of the
circuit. Initially, the circuit was tested with the thermocouple
attached to the board and it was used to measure the temperature
of an ice bucket, and then the temperature of boiling water.
A Wavetek 4808 multifunction calibrator was used to fully evaluate
the error, as shown in Figure 4 and Figure 6. In this mode, the
thermocouple was replaced with the calibrator as the voltage
–0.04
–0.08
09869-009
SEE TEXT
DVDD
AVDD
TxD
Thermocouple Measurement Test
THERMOCOUPLE
JUNCTION
DVDD
BEAD 10Ω
D–
CIRCUIT EVALUATION AND TEST
AVDD
DVDD
BEAD
09869-008
When using the external reference resistor as the reference source
for the RTD measurement, it is recommended to buffer the input
to the VREF+ pin using an op amp in unity-gain mode. This
ensures that the input leakage current to the VREF+ pin does
not distort the measurement accuracy. In Figure 8, an op amp,
OP193, in unity-gain was used for this purpose. This input is
not buffered in Figure 1; however, for best results, a buffer is
required.
–0.09
–0.10
–25
–5
15
35
55
75
95
115
TEMPERATURE (°C)
Figure 9. Error in °C of RTD Measurement Using Piecewise Linearization Code
and ADC0 Measurements
Rev. D | Page 4 of 5
Circuit Note
CN-0214
LEARN MORE
REVISION HISTORY
CN0214 Design Support Package:
http://www.analog.com/CN0214-DesignSupport
8/13—Rev. C to Rev. D
Changed ADP1720-ADJ to ADP7102 ............................ Universal
Changes to Title ................................................................................. 1
ADIsimPower Design Tool.
Kester, Walt. 1999. Sensor Signal Conditioning. Analog Devices.
Chapter 7, "Temperature Sensors."
Kester, Walt. 1999. Sensor Signal Conditioning. Analog Devices.
Chapter 8, "ADCs for Signal Conditioning."
Looney, Mike. RTD Interfacing and Linearization Using an
ADuC706x Microcontroller. AN-0970 Application Note.
Analog Devices.
MT-022 Tutorial, ADC Architectures III: Sigma-Delta ADC
Basics. Analog Devices.
MT-023 Tutorial, ADC Architectures IV: Sigma-Delta ADC
Advanced Concepts and Applications. Analog Devices.
MT-031 Tutorial, Grounding Data Converters and Solving the
Mystery of "AGND" and "DGND." Analog Devices.
MT-101 Tutorial, Decoupling Techniques. Analog Devices.
ITS-90 Table for Type T Thermocouple.
Data Sheets and Evaluation Boards
ADuC7060 Data Sheet
1/13—Rev. B to Rev. C
Changes to Devices Connected/Referenced Section and Figure 1... 1
Changes to Code Description Section and Common Variations
Section ................................................................................................ 3
Changes to Thermocouple Measurement Test Section, RTD
Measurement Test Section, and Figure 8 ....................................... 4
Changes to Data Sheet and Evaluation Boards Section ............... 5
11/11—Rev. A to Rev. B
Change to Devices Connected/Referenced ................................... 1
Changes to Circuit Description....................................................... 1
Changes to Code Description ......................................................... 2
Changes to Common Variations ..................................................... 4
Changes to Circuit Evaluation and Test ......................................... 4
6/11—Rev. 0 to Rev. A
Changes to Circuit Description....................................................... 2
Changes to Circuit Evaluation and Test ......................................... 4
4/11—Revision 0: Initial Version
ADuC7061 Data Sheet
ADuC7060 Evaluation Kit
ADuC7061 Evaluation Kit
ADM3202 UART to RS-232 Transceiver Data Sheet
ADP3333 Data Sheet
ADP7102 Data Sheet
OP193 Data Sheet
(Continued from first page) Circuits from the Lab circuits are intended only for use with Analog Devices products and are the intellectual property of Analog Devices or its licensors. While you
may use the Circuits from the Lab circuits in the design of your product, no other license is granted by implication or otherwise under any patents or other intellectual property by
application or use of the Circuits from the Lab circuits. Information furnished by Analog Devices is believed to be accurate and reliable. However, Circuits from the Lab circuits are supplied
"as is" and without warranties of any kind, express, implied, or statutory including, but not limited to, any implied warranty of merchantability, noninfringement or fitness for a particular
purpose and no responsibility is assumed by Analog Devices for their use, nor for any infringements of patents or other rights of third parties that may result from their use. Analog Devices
reserves the right to change any Circuits from the Lab circuits at any time without notice but is under no obligation to do so.
©2011–2013 Analog Devices, Inc. All rights reserved. Trademarks and
registered trademarks are the property of their respective owners.
CN09869-0-8/13(D)
Rev. D | Page 5 of 5