Smart test
Thermistor temperature detection circuit based on USB power supply
Temperature sensors are one of the most widely used sensors in the electronics industry, and their applications include calibration, security, heating, ventilation and air conditioning (HVAC), etc. Despite the wide range of applications, temperature sensors and their implementation are still extremely challenging for designers to achieve precise performance at a cost.
There are many methods of temperature detection. The common method is to use temperature sensors such as thermistors, resistance temperature detectors (RTD), thermocouples, or silicon thermometers. However, choosing the right sensor is only part of the solution. After that, the selected sensor must be connected to a signal chain that not only maintains signal integrity, but also compensates for the unique characteristics of the specific detection technology to ensure that it can provide digital temperature values.
This article introduces a USB power supply circuit solution to accomplish this task. This solution uses a negative temperature coefficient (NTC) thermistor, combined with Analog Devices' ADuC7023BCPZ62I-R7 precision analog microcontroller to monitor temperature.
NTC thermistor characteristics
Thermistor is a resistor that is very sensitive to temperature and can be divided into two types: positive temperature coefficient (PTC) thermistor and negative temperature coefficient (NTC) thermistor. Polycrystalline ceramic PTC thermistors have a high positive temperature coefficient and are often used in switching applications. NTC ceramic semiconductor thermistor has a high negative temperature coefficient, and the resistance value decreases as the temperature rises, so it is suitable for precision temperature measurement.
NTC thermistor has three working modes: resistance-temperature, voltage-current and current-time. In the operating mode that utilizes the resistance-temperature characteristics, the accuracy of the thermistor's detection results.
Resistance-The temperature circuit configures the thermistor to a "zero power" state. The "zero power" state assumes that the excitation current or excitation voltage of the device will not cause self-heating of the thermistor.
Murata Electronics’ NCP18XM472J03RB is a typical NTC thermistor with a resistance value of 4.7 kΩ. It is packaged in a 0603 package and has a highly non-linear resistance-temperature characteristic (Figure 1).
Figure 1: The resistance-temperature characteristic of a typical NTC thermistor is highly non-linear, so the designer must try to control this non-linearity within the specified temperature range. (Photo: Bonnie Baker, calculated and drawn based on the resistance value provided by Murata)
As shown in the curve in Figure 1, the resistance-temperature characteristic of the 4.7 k? thermistor is highly non-linear. The rate at which the NTC thermistor value decreases with temperature is a constant, called β (not shown in the figure). For Murata's 4.7 k? thermistor, β = 3500.
Using high-resolution analog-to-digital converter (ADC) and empirical third-order polynomial or look-up table, the non-linear response of the thermistor can be corrected in the software.
However, there is a kind of hardware technology with better effect, simpler application and lower cost. It can solve the thermistor linearization problem in the temperature range of ±25℃ just before it is applied to the ADC.
Hardware linearization solution
The simple way to achieve the initial linearization of the thermistor output is to connect the thermistor in series with a standard resistor (1%, metal film) and a voltage source. The resistance value in series determines the midpoint of the linear response interval of the thermistor circuit. According to the thermistor value (RTH) and the Steinhart-Hart equation, the temperature of the thermistor can be determined (Figure 2). It is confirmed that the Steinhart-Hart equation is a mathematical expression for determining the temperature of the NTC thermistor.
Figure 2: Voltage divider (RTH and R25) configuration can linearize the thermistor response. The linear range of ADC0 (ADC input) is about 50°C temperature range. (Photo: Bonnie Baker)
In order to determine the actual resistance value RTH of the thermal resistor, first determine the voltage divider output (VADC0), and then use VADC0 to obtain the ADC digital output decimal code DOUT, and DOUT depends on the number of ADC bits (N) and the ADC input voltage (VREF ) And ADC input voltage (VADC0). The third step of solving RTH, that is, the step is to multiply R25 (the RTH value at 25°C) by the ratio of the number of ADC codes to the decimal code of the ADC digital output. The third step of the calculation process starts from Equation 2 below.
Equation 2
One-step calculation uses the above Steinhart-Hart equation to convert the thermistor value to Kelvin temperature. The ADuC7023 precision analog microcontroller uses Equation 4 to find the sensor temperature:
Equation 4
among them:
T2 = the measured temperature of the thermistor (in K)
T1 = 298 K (25℃)
β = the thermistor β parameter at 298 K or 25°C. β = 3500
R25 = 298 K or the thermistor value at 25°C. R25 = 4.7 kΩ
RTH = the thermistor value at unknown temperature, calculated by equation 3
In Figure 2, the thermistor value (RTH) at 25°C is equal to 4.7 k?. Since the resistance of R25 is equal to the thermistor value at 25°C, the linear range of the voltage divider is centered at 25°C (Figure 3).
Figure 3: The linear response of a 4.7 k? thermistor and a 4.7 k? standard resistor in series, and the voltage across the voltage divider is 2.4 V. (Photo: Bonnie Baker, calculated and drawn based on the resistance value provided by Murata)
In Figure 3, the thermistor series circuit can achieve a linear temperature response within a limited temperature range from 0°C to +50°C. Within this range, the temperature variation error is ±1℃. The linearized resistance value (R25) should be equal to the thermistor value corresponding to the midpoint of the target temperature range.
Within the temperature range of ±25℃, the achievable accuracy of this circuit is typically 12 bits, and the nominal temperature of the thermistor is the resistance value of R25.
USB-based temperature monitor
The signal path of this circuit solution starts with a low-cost 4.7 k? thermistor, and then connects to the low-cost ADuC7023 microcontroller from Analog Devices. The microcontroller integrates four 12-bit digital-to-analog converters (DAC), a multi-channel 12-bit successive approximation register (SAR) ADC and a 1.2 V internal reference source, as well as an ARM7? core, 126 KB flash memory, 8 KB static random Access memory (SRAM) and various digital peripherals such as UART, timer, SPI and two I2C interfaces (Figure 4).
Figure 4: The temperature detection circuit uses the USB interface for power supply and the ADuC7034 microcontroller's I2C interface for digital communication. (Photo: Analog Devices)
In Figure 4, the power and ground of the circuit are both from the four-wire USB interface. Analog Devices' ADP3333ARMZ-5-R7 low-dropout linear regulator uses a 5 V USB power supply to generate a 3.3 V output. The regulated output of ADP3333 supplies power to the DVDD end of ADuC7023. The AVDD power supply of ADuC7023 needs another filter, as shown in the figure. In addition, a filter must be connected between the USB power supply and the IN pin of the linear regulator.
Temperature data exchange is also realized through the D+ and D- pins of the USB interface. The ADuC7023 can send and receive data using the I2C protocol. This application circuit uses a two-wire I2C interface to send data and receive configuration commands.
The application uses the following ADuC7023 features:
12-bit SAR ADC.
Arm ARM7TDMI with SRAM. The integrated 62 KB internal flash memory is used to run user code to configure and control the ADC, manage the communication of the USB interface, and process the ADC conversion of the thermistor.
The I2C interface is used to communicate with the host PC.
Two external switches/buttons (not shown in the figure) can force the device to enter flash boot mode: keep DOWNLOAD low and switch the RESET switch, ADuC7023 will enter boot mode instead of normal user mode. In boot mode, use the USB interface to connect to the device-related I2CWSD software tool to reprogram the internal flash memory.
VREF is the band gap reference. This reference voltage can be used as a voltage reference for other circuits in the system. The 0.1 μF capacitor connected to each pin is used for noise reduction.
ADuC7023 has a small size (5 mm × 5 mm) and adopts a 32-pin chip-scale package, so the entire circuit occupies a very small printed circuit board space, which is beneficial to save cost and space.
Although ADuC7023 has a powerful ARM7 core and high-speed SAR ADC, it can still provide a low-power solution. The typical power consumption of the whole circuit is 11 mA, the ARM7 core clock speed is up to 5 MHz, and the main ADC is used to measure the external thermistor. Between two temperature measurements, the microcontroller and/or ADC can be turned off to further save power.
layout considerations
The signal processing system shown in Figure 4 can easily lead to misunderstandings. At first glance, the system contains only three active devices, but there are some problems hidden in such a simple layout.
For example, the ADuC7023 microcontroller is a very complex analog-digital system that requires special attention to grounding rules. Although the analog domain frequency of this system seems "very slow", the on-chip sample-and-hold ADC is a high-speed multi-channel device with a sampling rate of up to 1 MS/s and a clock speed of 41.78 MHz. The clock rise and fall times of this system are only a few nanoseconds, so this application is a high-speed application.
Obviously, you need to pay special attention to mixed-signal circuits. The following four-point checklist covers the main aspects:
Use electrolytic capacitors
choose a smaller capacitor
Ground plane precautions
can choose small ferrite beads
Large electrolytic capacitors of 10 mF to 100 mF are commonly used in this circuit, and the distance from the chip is no more than 2 inches. This type of capacitor can act as a charge storage to eliminate the instantaneous charge generated by the trace inductance.
Small capacitors of 0.01 mF to 0.1 mF are commonly used in this circuit, and should be placed as close as possible to the power supply pin of the device. This type of capacitor can be used for fast and efficient grounding of high-frequency noise.
The ground plane (below the decoupling capacitor) can decouple high-frequency currents and minimize EMI/RFI radiation. Please choose a large low-impedance area as the ground plane. In order to minimize the trace inductance, the capacitor should be grounded with through holes or short traces.
In addition to the decoupling capacitor in Figure 4, the EMI/RFI protection of the USB cable also requires the use of ferrite. The ferrite bead used in this circuit is Taiyo Yuden's BK2125HS102-T, with an impedance of 1000 Ω at 100 MHz.
to sum up
Temperature sensor is one of the most widely used sensors, but its design requirements have always brought arduous challenges to designers-both to reduce cost and size, and to improve detection accuracy. Taking these requirements into account, this article introduces the realization of a USB-based low-power commercial thermistor system. The system uses Analog Devices' small 12-bit ADC and high-precision ADuC7023 microcontroller solution. This combination successfully uses resistors to correct the non-linear response of NTC thermistors, which can detect and monitor temperature.