CN0319: 14-Bit, 4-20 mA, Loop Powered, Ther mocouple Temperature Measurement System Using ARM Cortex-M3 PDF

Circuit Note
CN-0319
Devices Connected/Referenced
Circuits from the Lab® reference designs 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/CN0319.
ADuCM360
Precision Analog Microcontroller with
Dual Σ-Δ ADCs, ARM Cortex-M3
ADuCM361
Precision Analog Microcontroller with
Single Σ-Δ ADC, ARM Cortex-M3
ADP1720
50 mA, High Voltage, Micropower
Linear Regulator
OP193
Precision, Micropower Single
Operational Amplifier
ADR3412
Micro-Power, High-Accuracy 1.2 V
Voltage Reference
14-Bit, 4-20 mA, Loop Powered, Thermocouple Temperature Measurement
System Using ARM Cortex-M3
EVALUATION AND DESIGN SUPPORT
CIRCUIT FUNCTION AND BENEFITS
Circuit Evaluation Boards
CN-0319 Circuit Evaluation Board (EVAL-CN0319-EB1Z)
Design and Integration Files
Schematics, Layout Files, Bill of Materials
The circuit shown in Figure 1 is a complete loop powered
thermocouple temperature measurement system where the 4 mAto-20 mA output current is controlled using the PWM function of
a precision analog microcontroller.
3.3V
ADP1720-3.3
BEAD
OUT
1.6Ω
10µF
10µF
3.3V
IN
4V TO 28V
10µF
GND
0.1µF
0.1µF
ADR3412
IOVDD
IEXC
RTD
AVDD
OPTIONAL
DAC
VREF = 1.2V
10Ω
0.01µF
10Ω
AIN0
R1
100kΩ
ADuCM360
AIN1
0.01µF
VREF +
RREF
5.62kΩ
(0.1%)
VREF –
10kΩ
THERMOCOUPLE
JUNCTION
PWM
47kΩ
VIN
0.1µF
VR12
DVDD
VLOOP+
0.1µF
OP193
10kΩ
BC548
AIN2
DGND
10nF
10kΩ
47kΩ
VRLOOP
AIN3
RLOOP
47.5Ω
VLOOP–
R2
100kΩ
10nF
AIN7
11386-001
AGND
Figure 1. ADuCM360 Controlling 4 mA-to-20 mA Loop-Based Temperature Monitor Circuit.
(Simplified Schematic: All Connections and Decoupling Not Shown)
Rev. C
Circuits from the Lab® reference designs 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
toanycausewhatsoeverconnectedtotheuseofanyCircuitsfromtheLabcircuits. (Continuedonlastpage)
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 ©2013–2014 Analog Devices, Inc. All rights reserved.
CN-0319
Circuit Note
This circuit provides a low cost solution to temperature monitoring
because most of the circuit functionality is integrated into the
ADuCM360 precision analog microcontroller, including dual
24-bit Σ-Δ ADCs, the ARM Cortex™-M3 processor core, and
the PWM/DAC features for controlling the 4 mA-to-20 mA
loop for loop voltages up to 28 V.
•
•
The ADuCM360 is connected to a Type T thermocouple and a
100 Ω platinum resistance temperature detector (RTD). The
RTD is used for cold junction compensation. The low power
Cortex-M3 core converts the ADC readings to a temperature
value. The Type T thermocouple temperature range supported is
−200°C to +350°C, and this temperature range is converted to
an output current range of 4 mA to 20 mA.
This circuit is similar to the circuit in Circuit Note CN-0300
with the additional benefit of the higher resolution of the PWM
driving the 4 mA-to-20 mA loop. The PWM-based output
provides 14 bits of resolution. For details on the temperature
sensor interface to the ADC and on linearization techniques for
the RTD measurements, see Circuit Note CN-0300 and the
AN-0970 Application Note.
CIRCUIT DESCRIPTION
The circuit is powered via the ADP1720 linear regulator, which
regulates the loop + supply to 3.3 V for the ADuCM360, the
OP193 op amp, and the optional ADR3412 reference.
Communication
•
•
Temperature Monitor
This part of the circuit is similar to the temperature monitor
circuit described in CN-0300. The following features of the
ADuCM360 are used:
•
•
•
•
The 24-bit Σ-Δ ADC with a PGA set for a gain of 32 in the
software for the thermocouple and the RTD. ADC1 switches
continuously between sampling the thermocouple and the
RTD voltages.
Programmable excitation current sources force a controlled
current through the RTD. The dual current sources are
configurable in steps from 0 µA to 2 mA. For this example,
a 200 µA setting is used to minimize the error introduced
by the RTD self-heating.
An internal 1.2 V reference is provided for the ADC in the
ADuCM360. When measuring the thermocouple voltage,
the internal voltage reference is used due to its precision.
An external voltage reference for the ADC in the ADuCM360.
When measuring the RTD resistance, a ratiometric setup
was used where an external reference resistor (RREF) was
connected across the external VREF+ and VREF− pins. The
on-chip reference input buffer is enabled because the reference
source in this circuit is high impedance. The on-chip reference
buffer means no external buffer is required to minimize input
leakage effects.
A bias voltage generator (VBIAS). The VBIAS function is
used to set the thermocouple common-mode voltage to
AVDD_REG/2 (900 mV). Again, this removes the need for
external resistors to set the thermocouple common-mode
voltage.
The ARM Cortex-M3 core. The powerful 32-bit ARM core
with integrated 126 kB flash and 8 kB SRAM memory runs
the user code that configures and controls the ADCs and
converts the ADC conversions from the thermocouple and
RTD inputs to a final temperature value. It also controls the
PWM output driving the 4mA to 20 mA loop. For extra
debug purposes, it also controls the communications over
the UART/USB interface.
The 16-bit PWM output is externally buffered using
OP193, and is controlling an external NPN transistor,
BC548. By controlling the VBE voltage of this transistor, the
current passing through a 47.5 Ω load resistor can be set to
the desired value. This provides better then ±0.5°C
accuracy (between –200°C to +350°C) on the 4 mA-to-20
mA output (see test results).
The internal DAC is used to provide the 1.2 V reference to
the OP193. Alternatively, the ADR3412, a 1.2 V precision
reference could be used, for higher precision over
temperature. This external reference consumes similar
power than the internal DAC (~50 µA). See current
consumption measurement tests section.
The 4 mA-20 mA loop is controlled by the ADuCM360 on-chip
16-bit PWM (pulse width modulator). The duty cycle of the
PWM is configured in software to control the voltage across the
47.5 Ω RLOOP resistor, which in turn sets the loop current. Note
the top of RLOOP connects to the ADuCM360 ground. The
bottom of RLOOP connects to the loop ground. Because of this,
the current due to the ADuCM360, ADP1720, ADR3412 and
OP193, plus the current set by the filtered PWM output, flows
across RLOOP.
The voltage at the junction of R1 and R2 can be expressed:
VR12 = (VRLOOP + VREF) × R2/(R1 + R2) − VRLOOP
After the loop settles:
VIN = VR12
Since R1 = R2:
VIN = (VRLOOP + VREF)/2 − VRLOOP = VREF/2 − VRLOOP /2
VRLOOP = VREF − 2VIN
Full-scale current will flow when VIN = 0, at which point
VRLOOP = VREF. Hence, full-scale current is VREF/RLOOP, or ≈24 mA.
When VIN = VREF/2, no current will flow.
The OP193 amplifier impedance at VIN is high and will not load
the PWM filtered output. The amplifier output varies only a
small amount of about 0.7 V.
Rev. C | Page 2 of 7
Circuit Note
CN-0319
Performance at the range extremes, 0 mA to 4 mA, and 20 mA
to 24 mA, is not critical; therefore, the op amp does not require
good performance at the supply rails.
•
Absolute values of R1 and R2 are not critical. However, note
that matching of R1 and R2 is important.
ADC1 is used for temperature measurements, therefore this
circuit note is directly applicable to the ADuCM361 which has
only one ADC. The EVAL-CN0319-EB1Z board includes the
option for measuring the voltage at the point marked VR12 by
using an input channel of ADC0 on the ADuCM360. This ADC
measurement can be used as feedback for the PWM control
software to adjust the 4 mA-to-20 mA current setting.
Programming, Debugging, and Testing
The UART is used as the communication interface to the host
PC. This is used to program the on-chip flash. It is also used as
a debug port and for calibrating the filtered PWM output.
Code Description
The link to the source code used to test the circuit can be found in
the CN-0319 Design Support Package at
http://www.analog.com/CN0319-DesignSupport
The source code uses the function libraries provided with the
example code.
Figure 2 shows the list of source files used in the project when
viewed with the Keil µVision4 tools.
11386-002
•
Two external switches are used to force the part into its
flash boot mode. By holding SD low and toggling the
RESET button, the ADuCM360 enters boot mode instead
of normal user mode. In boot mode, the internal flash can
be reprogrammed through the UART interface.
Figure 2. Source Files Viewed with Keil µVision4.
Rev. C | Page 3 of 7
CN-0319
Circuit Note
Temperature Monitor
ADC1 is used for temperature measurements on the thermocouple
and on the RTD. This section of the code is copied from Circuit
Note CN-0300. Refer to this circuit note for more details.
Communication Section
The PWM filtered output needs to be adjusted in order to
ensure 4 mA at minimum temperature and 20 mA at maximum
temperature. A calibration routine is provided, it can be
included or removed easily using the #define CalibratePWM
parameter.
The UART is configured for a baud rate of 19200, 8 data bits, no
parity, and no flow control. If the circuit is connected directly to
a PC, a communication port viewing application, such as
HyperTerminal or CoolTerm, can be used to view the results
sent by the program to the UART, as shown in Figure 3.
To enter the characters required by the calibration routines,
type the required character in the viewing terminal and this
character will be received by the ADuCM360 UART port.
11386-003
To calibrate the PWM, the interface board (USB-SWD/UART)
must be connected to J1 and to the USB port on a PC. A COM
port viewer program, such as HyperTerminal, can be used to
view the calibration menus and step through the calibration
routines.
When calibrating the PWM, connect the VLOOP+ and
VLOOP– outputs to an accurate current meter. The first part of
the PWM calibration routine adjusts the DAC to set a 4 mA
output, and the second part of the PWM calibration routine
adjusts the PWM to set a 20 mA output. The PWM code used
to set a 4 mA and 20 mA output is stored to flash.
Figure 3. Output of HyperTerminal when Calibrating the PWM
Rev. C | Page 4 of 7
Circuit Note
CN-0319
0.2
Calibration coefficients are saved in Flash, therefore it is not
necessary to run calibration each time the board is powered
unless VLOOP level is changed.
0.1
DNL (LSB)
After calibration, the demo code switches off the UART clock
for further power saving.
A code flowchart is shown in Figure 4.
START
0
–0.1
11386-005
–0.2
SYSTEM, ADC AND
PWM INITIALIZATION
–0.3
4
CALIBRATION
TYPE?
MANUAL
CALIBRATION
8
12
16
20
OUTPUT CURRENT (mA)
Figure 5. Typical DNL Performance of Circuit
Temperature-to-Current Output
The setup shown in Figure 6 was used to test the
communication section of the circuit.
DEFAULT OR STORED
CALIBRATION VALUES
WHILE (1)
UART INTERFACE
+
11386-004
4mA TO 20mA
LOOP CONTROL
VIA PWM
–
INTERFACE
TEMPERATURE TO
CURRENT CALCULATION
GPIB
Figure 4. Code Flowchart
POWER SUPPLY
CURRENT METER
11386-006
TEMPERATURE ACQUISITION
Figure 6. Measurement Setup
COMMON VARIATIONS
The PC sends temperature values to the ADuCM360 via UART,
and the ADuCM360 adjusts the PWM output accordingly. The
current in the loop is measured and recorded.
This circuit includes the footprint for HART communication
and for an external reference.
CIRCUIT EVALUATION AND TEST
This document does not cover the temperature sensing section
as this is already covered in CN-0300. The focus is in the
performance of the temperature-to-current output.
PWM Differential Nonlinearity (DNL)
The filtered PWM output DNL was first measured. The DNL
graph in Figure 5 shows a better than 0.3 LSB typical performance
in the critical 4 mA-to-20 mA range. These tests were conducted
with a second order filter on the PWM output. Two 47 kΩ resistors
and two 100 nF capacitors were used as shown in Figure 1.
A 1°C temperature increase corresponds to
(20 mA – 4 mA)/550 = 0.029029 mA.
Table 1. Temperature and Expected Current
Temperature in °C
−200°C
−199°C
…
+349°C
+350°C
Expected current in mA
4 mA
4 mA + 0.029029 mA
20 mA − 0.029029 mA
20 mA
The error in the current loop measured in CN-0300 (DAC
controlled) and in CN-0319 (PWM controlled) is shown in
Figure 7.
Rev. C | Page 5 of 7
CN-0319
Circuit Note
Table 2. Typical IDD Values for Components of Temperature
Monitor Circuit
0.5
PWM
OUTPUT ERROR (%FS)
0
–0.5
DAC WITH FEEDBACK
–1.0
–1.5
–2.5
–200
11386-007
–2.0
–100
0
100
200
300
TEMPERATURE (°C)
Figure 7. Error in Current Loop vs. Temperature Readings for DAC Control
(CN-0300) and PWM Control (CN-0319).
These results show that after calibration, the accuracy of the
PWM-controlled loop without feedback is better than with the
DAC-controlled loop with feedback.
For higher accuracy, the feedback loop could be added. This would
require using an ADuCM360 with the second ADC enabled to
monitor the loop. This would increase current consumption
(ADC0 on), and slow down the response time of the loop.
The update rate of the current loop depends on the CPU and
ADC configuration. In the example code, the CPU speed is set
to 1 MHz and the ADC frequency at 5 Hz. The ADC converts a
number of samples on the RTD and on the thermocouple,
before averaging the result. The number of samples is defined
by the parameter SAMPLEN0. It is set to 8 by default in the
example code. This gives a current loop update rate of 740 ms.
For faster response time of the loop, SAMPLEN0 can be reduced.
Current Consumption Measurement Tests
When operating normally, the entire circuit consumes 2 mA
typically. When held in a reset state, the entire circuit consumes
less than 550 µA.
To facilitate low power operation, the ADuCM360/ADuCM361
core operating speed can be reduced by programming the
internal CLKSYSDIV register that enable the low power systems
which giving system clock is 8 MHz. Also programming the
CLKCON0 register allows the core frequency of 16 MHz to be
divided in binary multiples of 2 to 128. In this example code , a
clock divide value of 8 is used, giving a core speed of 1 MHz.
Component
IDD Value at
25°C
ADuCM360/ADuCM361
ADC1 On, Gain = 32, FADC = 5 Hz
CPU speed = 1 MHz
PWM On. 240 Hz
External reference generated by DAC.
Excitation current value to this figure.
Typical value is 200 µA.
All other peripherals off.
ADP1720, 3.3 V Output Linear Regulator
OP193, Low Power Op Amp
Remaining Circuitry
Total Current Less Excitation Current
1.80 mA
~100 µA
15 µA
50 µA
2.0 mA
For more details on the current consumption figures for the
ADuCM360, see the AN-1111 Application Note.
LEARN MORE
CN-0319 Design Support Package:
http://www.analog.com/CN0319-DesignSupport
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, Options for Minimizing Power Consumption
When Using the ADuCM360/ADuCM361, AN-1111
Application Note, Analog Devices.
Looney, Mike. RTD Interfacing and Linearization Using an
ADuC706x Microcontroller. AN-0970 Application Note.
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.
User Guide UG-457, ADuCM360 Development Systems
Getting Started
The primary ADC is enabled with a gain of 32. The PWM and
DAC are also enabled for communication on the loop.
All unused peripherals are disabled in order to minimize
current consumption.
Table 2 gives a breakdown of the IDD current consumption for
the entire circuit.
Rev. C | Page 6 of 7
Circuit Note
CN-0319
Data Sheets and Evaluation Boards
ADuCM360 Datasheet
ADuCM361 Datasheet
ADP1720 Datasheet
OP193 Datasheet
ADR3412 Datasheet
REVISION HISTORY
3/14—Rev. B to Rev. C
Change to Communication Section ............................................... 4
12/13—Rev. A to Rev. B
Changes to Code Description Section............................................ 3
8/13—Rev. 0 to Rev. A
Changes to Title ................................................................................. 1
5/13—Revision 0: Initial Version
(Continued from first page) Circuits from the Lab reference designs 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 reference designs 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 reference designs. Information furnished by Analog Devices is believed to be accurate and reliable. However, Circuits from the
Lab reference designs 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 reference designs at any time without notice but is under no obligation to do so.
©2013–2014 Analog Devices, Inc. All rights reserved. Trademarks and
registered trademarks are the property of their respective owners.
CN11386-0-3/14(C)
Rev. C | Page 7 of 7
Similar pages