MartinFowler

CN0300

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

 
Overview

Circuit functions and advantages

This circuit uses the ADuCM360 precision analog microcontroller in a precision thermocouple temperature monitoring application and controls the output current from 4 mA to 20 mA accordingly. ADuCM360 integrates dual-channel 24-bit Σ-Δ analog-to-digital converter (ADC), dual-channel programmable current source, 12-bit analog-to-analog converter (DAC), 1.2 V built-in reference voltage source and ARM Cortex-M3 core, 126 KB Flash memory, 8 KB SRAM and various digital peripherals such as UART, timers, SPI and I 2 C interface.

In this circuit, 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 actual temperature values. The supported T-type temperature range is −200°C to +350°C, and the corresponding output current range for this temperature range is 4 mA to 20 mA.

Figure 1. ADuCM360 with thermocouple interface used as a temperature monitor controller (schematic diagram, all connections not shown)

 

Circuit description

The following features of the ADuCM360 are used in this application : 

  • The 12-bit DAC output and its flexible on-chip output buffer are used to control the external NPN transistor BC548. By controlling the V BE voltage of this transistor, the current through the 47Ω load resistor can be set to the desired value.
  • The DAC is 12-bit monotonic, but its output accuracy is usually around 3 LSB. Additionally, bipolar transistors introduce linearity errors. To improve the accuracy of the DAC output and eliminate offset and gain endpoint errors, ADC0 measures the feedback voltage, which reflects the voltage across the load resistor (R LOAD ). Based on this ADC0 reading, the DAC output will be corrected by the source code. This provides ±0.5°C accuracy for outputs from 4 mA to 20 mA.
  • 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 2 mA. This example uses a 200µA setting to minimize errors caused by RTD self-heating effects.
  • The ADC in the ADuCM360 has a built-in 1.2 V 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 the RTD resistance f, 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/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 KBSRAM 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 can also utilize closed-loop feedback control from the AIN9 voltage level and continuously monitor the DAC output. For additional debugging purposes, it can also control communication on the UART/USB interface.
  • 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 DAC and ADC.
  • 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.
  • The J1 connector is an 8-pin dual in-line connector that interfaces with the USB-SWD/UART board included with the CN0300 support hardware. This application circuit board can be programmed and debugged with the J-Link-Lite board. See Figure 3.

Thermocouples and RTDs produce very small signals, so a programmable gain amplifier (PGA) is required to amplify these signals.

The thermocouple used in this application is a T-type (copper-constantan) with a temperature range of −200°C to +350°C and a sensitivity of approximately 40ΩV/°C, which means that the ADC operates in bipolar mode and 32x The PGA gain setting can cover the entire temperature range of the thermocouple.

RTD is used for cold junction compensation. The RTD used in this circuit is a 100Ω platinum RTD, model number Enercorp PCS 1.1503.1. It comes in a 0805 surface mount package and has a temperature change rate of 0.385 Ω/°C.

Note that the reference resistor R REF must be a precision 5.6 kΩ (±0.1%) resistor.

This circuit must be built on a multilayer circuit board (PCB) with a large ground plane. For optimal performance, proper layout, grounding, and decoupling techniques must be used (refer to Tutorial MT-031 - "Grounding Data Converters and Solving the Mysteries of AGND and DGND" , Tutorial MT-101 - " Decoupling Techniques" and ADuCM360TCZ evaluation board layout).

The PCB used to evaluate this circuit is shown in Figure 2.

Figure 2. EVAL-CN0300-EB1Z board used in this circuit

 

Figure 3. EVAL-CN0300-EB1Z board connected to USB-SWD/UART board and SEGGER J-Link-Lite board

 

ADI's J-Link OB emulator (USB-SWD/UART-EMUZ) supports:

  • When plugged into a PC USB port, it can also be used to connect to a COM port (virtual serial port) on the PC. This is required to run the calibration procedure.
  • Provides SW (serial wire) debugging and programming capabilities for the ADuCM360.
  • This USB port can be used to program the device via a UART-based downloader. Code description
  • Figure 4 shows a top view of the emulator board. The J2 connector plugs into the EVAL-CN0300-EB1Z board. The J2 connector pinout is shown in Figure 5

Figure 4. Top view of Analog Devices’ J-Link OB emulator
Figure 5.J2 connector

 

For downloading and debugging, LK1, LK2, LK4 and LK6 must be inserted. LK3 and LK5 are used for communication via UART. The software required for J-Link OB is included in the software installation.

Please note that the J-Link OB emulator replaces the J-Link Lite and related interface boards previously shipped with the ADuCM360 development system.

For more information, see UG-457 - ADuCM360 Development System Getting Started Guide .

The source code link used to test the circuit is in the CN0300 Design Support package: http://www.analog.com/CN0300-DesignSupport . The source code uses the function library provided with the sample code. Figure 6 shows the list of source files used in the project when viewed with the Keil μVision4 tool.

Figure 6. Source files seen in μVision4

 


Calibration part of the code

The compiler #dene values ​​(calibrateADC1 and calibrateDAC) can be adjusted to enable or disable the ADC and DAC calibration procedures.

To calibrate the ADC or DAC, 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 the ADC, the source code prompts the user to connect the zero-scale and full-scale voltages to AIN2 and AIN3. Note that AIN2 is the positive input terminal. After completing the calibration procedure, the new calibration values ​​of the ADC1INTGN and ADC1OF registers are stored in the internal flash memory.

When calibrating the DAC, the VLOOP+ output should be connected through an accurate ammeter. The first part of the DAC calibration procedure calibrates the DAC to set the 4 mA output, and the second part calibrates the DAC to set the 20 mA output. The DAC code to set the 4 mA and 20 mA outputs is stored in flash memory. The voltage measured at AIN9 for the final 4 mA and 20 mA settings is also recorded and stored to flash memory. Since the voltage at AIN9 is linearly related to the current through RLOOP, these values ​​are used to calculate the DAC adjustment factor. This closed-loop approach means that all linearity errors on the DAC and transistor-based circuitry can be trimmed using the on-chip 24-bit Σ-Δ ADC.

UA RT is configured with a baud rate of 9600, 8 data bits, no polarity, and no flow control. If this circuit is directly connected to the PC, you can use a communication port viewing program such as "Hyper Terminal" to view the results sent by the program to the UA RT, as shown in Figure 7. .

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

Figure 7. “HyperTerminal” output when calibrating DAC

 


Temperature measurement part of the code

To obtain a temperature reading, the temperature of the thermocouple and RTD should be measured. The RTD temperature is converted to its equivalent thermocouple voltage using a lookup table (see ISE, Inc.'s ITS-90 table for Type T thermocouples). Adding these two voltages gives you the absolute value of the thermocouple voltage.

First, measure the voltage (V1) between the two wires of the thermocouple. The RTD voltage is measured and converted to temperature via a lookup table, and this temperature is then converted to its equivalent thermocouple voltage (V2). V1 and V2 are then added to give the overall thermocouple voltage, which is then converted into the final temperature measurement.

For thermocouples, the temperature corresponding to a fixed number of voltages is stored in an array. Temperature values ​​in between are calculated using linear interpolation of adjacent points.

Figure 8 shows the error obtained when measuring 52 thermocouple voltages over the entire thermocouple operating range using ADC1 on the ADuCM360. The worst-case total error is less than 1°C.

Figure 8. Error when measuring 52 calibration points using ADuCM360/ADuCM361 using piecewise linear approximation method

 

The RTD temperature is calculated using a lookup table and is used with RTDs in the same way as with thermocouples. Note that the polynomial that describes the relationship between RTD temperature and resistance is different from the polynomial that describes the relationship between thermocouples.

For more information on linearization and achieving optimal RTD performance, refer to the application note AN-0970, "RTD Interfacing and Linearization Using ADuC706x Microcontrollers . "


Temperature to current output portion of the code

After measuring the final temperature, set the DAC output voltage to the appropriate value to produce the desired current on RLOOP. The input temperature range should be −200°C to +350°C. The code output current is 4 mA and 20 mA for the −200°C and +350°C settings, respectively. The code implements a closed-loop scheme, as shown in Figure 7, where the feedback voltage on AIN9 is measured through ADC0, and this value is then used to compensate for the DAC output setting. The FineTuneDAC(void) function performs this correction.

For best results, the DAC should be calibrated before beginning performance testing of this circuit.

Figure 9. Closed-loop control of 4 mA to 20 mA DAC output

 

For debugging purposes, the following string is sent to the UART during normal operation (see Figure 10).

Figure 10. UART string for debugging

 

参考设计图片
×

Blockdiagram

 
 
Search Datasheet?

Supported by EEWorld Datasheet

Forum More
Update:2025-06-23 04:03:17

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号