MartinFowler

CN0319

14-bit, 4-20mA loop-powered thermocouple temperature measurement system using ARM Cortex-M3

 
Overview

Circuit functions and advantages

The circuit shown in Figure 1 is a complete loop-powered thermocouple temperature measurement system that uses the PWM function of a precision analog microcontroller to control a 4mA to 20mA output current.

Figure 1. ADuCM360 controls a 4 mA to 20mA loop-based temperature monitoring circuit (schematic diagram: all connections and decoupling not shown)

 

This circuit integrates most of the circuit functions on the precision analog microcontroller ADuCM360 , including a dual-channel 24-bit Σ-Δ ADC, an ARM Cortex™-M3 processor core, and a 4-channel controller for controlling loop voltages up to 28 V. The PWM/DAC feature of the mA to 20 mA loop provides a low-cost temperature monitoring solution.

In it, the ADuCM360 is connected to a T-type thermocouple and a 100Ω platinum resistance temperature detector (RTD). RTD is used for cold junction compensation. A low-power Cortex-M3 core converts ADC readings into temperature values. The supported T-type thermocouple temperature range is −200°C to +350°C, and the output current range corresponding to this temperature range is 4mA to 20mA.

This circuit is similar to the circuit described in circuit note CN-0300 , but this circuit has the advantage of driving a 4mA to 20mA loop with higher resolution PWM. PWM based output provides 14-bit resolution. For more information on interfacing temperature sensors to ADCs, as well as linearization techniques for RTD measurements, see Circuit Note CN-0300 and Application Note AN-0970 .

Circuit description

The circuit is powered by the ADP1720 linear regulator , which regulates the loop power supply to 3.3 V, providing power for the ADuCM360 , operational amplifier OP193 , and optional reference voltage source ADR3412 .


temperature monitor

This part of the circuit is similar to the temperature monitor circuit described in CN-0300 , using the following features of the ADuCM360:

  • The 24-bit Σ-Δ ADC has a built-in PGA and a gain of 32 is set in the software for the thermocouple and RTD. ADC1 continuously switches between thermocouple and RTD voltage sampling.
  • A programmable excitation current source drives a controlled current through the RTD. The dual-channel current source is configurable in steps from 0µA to 2mA. This example uses a 200µA setting to minimize errors caused by RTD self-heating effects.
  • The ADC in ADuCM360 has a built-in 1.2V reference voltage source. The internal reference voltage source is highly accurate and suitable for measuring thermocouple voltages.
  • External voltage reference source for the ADC in the ADuCM360. When measuring RTD resistance, we use a ratiometric setup with an external reference resistor (R REF ) connected to the external VREF+ and VREF− pins. Since the reference in this circuit is high impedance, the on-chip reference input buffer needs to be enabled. An on-chip reference buffer means no external buffers are required to minimize input leakage effects.
  • Bias voltage generator (VBIAS). The VBIAS function sets the thermocouple common-mode voltage to AVDD_REG/2 (900 mV). Again, this eliminates the need for external resistors to set the thermocouple common-mode voltage.
  • ARM Cortex-M3 core. The powerful 32-bit ARM core integrates 126 KB of flash and 8 KB of SRAM memory to run user code, configure and control the ADC, and use the ADC to convert thermocouple and RTD inputs into final temperature values. It also controls the PWM output, driving a 4 mA to 20 mA loop. For additional debugging purposes, it can also control communication on the UART/USB interface.


communication

  • The 16-bit PWM output is externally buffered using the OP193 and controls the external NPN transistor BC548. By controlling the V BE voltage of this transistor, the current through the 47.5Ω load resistor can be set to the desired value. This provides better than ±0.5°C accuracy for 4 mA to 20 mA output (–200°C to +350°C, refer to test results).
  • An internal DAC is used to provide a 1.2 V reference voltage to the OP193. Alternatively, the ADR3412 1.2 V precision voltage reference can be used for greater accuracy over temperature. The external reference consumes similar power as the internal DAC (~50 μA). See the "Power Consumption Measurement Test" section.

The 4 mA to 20 mA loop is controlled by the ADuCM360 on-chip 16-bit PWM (Pulse Width Modulation). The duty cycle of the PWM is software configurable to control the voltage across the 47.5 ΩR LOOP resistor, thereby setting the loop current. Please note that the top of R LOOP is connected to the ground of the ADuCM360. The bottom end of R LOOP is connected to the loop ground. For this reason, the output current of the ADuCM360, ADP1720, ADR3412, and OP193, plus the current set by the filtered PWM output, flows through R LOOP .

The junction voltage of R1 and R2 can be expressed as:

V R12 = (V RLOOP + V REF ) × R2/(R1 + R2) − V RLOOP

After the loop is established:

V IN = V R12

Since R1 = R2:

V IN = (V RLOOP + V REF )/2 − V RLOOP = V REF /2 − V RLOOP /2
V RLOOP = V REF − 2V IN

Full-scale current flows when V IN = 0, where VRLOOP = V REF . Therefore, the full-scale current is V REF R LOOP , or ≈24 mA. When V IN = V REF /2, no current flows.

The OP193 amplifier impedance at V IN is very high and will not load the PWM filtered output. The amplifier output changes only slightly, about 0.7 V.

Performance at the range boundaries (0 mA to 4 mA and 20 mA to 24 mA) is not critical, so op amp performance at the supply rails is not critical.

The absolute values ​​of R1 and R2 are not important. However, the matching of R1 and R2 is important.

ADC1 is used for temperature measurement, so this circuit note applies directly to the ADuCM361 which has only one ADC . The EVAL-CN0319-EB1Z evaluation board includes a voltage measurement option labeled VR12 points using the ADC0 input channel on the ADuCM360. This ADC measurement can be used as feedback to the PWM control software to adjust the 4 mA to 20 mA current setting.


Programming, debugging and testing

  • The UART is used as a communication interface with the PC host. This is used to program the on-chip flash memory. It also serves as a debug port for calibrating the filtered PWM output.
  • Two external switches are used to force the device into flash boot mode. By holding SD low while toggling the RESET button, the ADuCM360 will enter boot mode instead of normal user mode. In boot mode, the internal flash memory can be reprogrammed via the UART interface.


Code description

The source code link used to test the circuit is in the CN-0319 Design Support package: http://www.analog.com/CN0319-DesignSupport The source code used to test this circuit can be downloaded from the ADuCM360 and ADuCM361 product pages (zip compressed file ). The source code uses the function library provided with the sample code.

Figure 2 shows the list of source files used in the project when viewed with the KeilμVision4 tool.

Figure 2. Source files viewed in Keil μVision4

 


temperature monitor

ADC1 is used for temperature measurement on thermocouples and RTDs. The code in this section is copied from circuit note CN-0300. See this circuit note for details.


communication part

The PWM filter output needs to be adjusted to ensure a 4mA output at minimum temperature and a 20mA output at maximum temperature. Provides a calibration routine that can be easily included or removed using the #defineCalibratePWM parameter.

To calibrate the PWM, the interface board (USB-SWD/UART) must be connected to J1 and the USB port on the PC. You can use a COM port viewing program such as "HyperTerminal" to view the calibration menu and perform the calibration procedure step by step.

When calibrating PWM, the VLOOP+ and VLOOP– outputs should be connected to an accurate ammeter. The first part of the PWM calibration procedure adjusts the DAC to set the 20mA output, and the second part adjusts the PWM to set the 20mA output. The PWM code used to set the 4mA and 20mA outputs is stored in flash memory.

The UART is configured for baud rate 19200, 8 data bits, no polarity, and no flow control. If this circuit is directly connected to a PC, you can use a communication port viewing program such as HyperTerminal or CoolTerm to view the results sent by the program to the UART, as shown in Figure 3.

To enter the characters required for the calibration procedure, type the required characters into the viewing terminal and the ADuCM360UART port will receive the characters.

Figure 3. HyperTerminal output when calibrating PWM

 

After calibration, the demo code turns off the UART clock, further saving power.

The calibration coefficients are saved in flash memory, so the calibration routine does not have to be run every time the board is powered up unless the VLOOP level changes.

The code flow chart is shown in Figure 4.

Figure 4. Code flow chart

 

参考设计图片
×

Blockdiagram

 
 
Search Datasheet?

Supported by EEWorld Datasheet

Forum More
Update:2025-06-20 17:40:23

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
community

Robot
development
community

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号