PT100 Temperature Sensor Working Principle and Application
The entire circuit is divided into two parts: one is the sensor preamplifier circuit; the other is the microcontroller A/D conversion and display, control, software nonlinear correction and other parts.
working principle:
The connection of the sensor is very simple. The 5V power supply terminal of the system is only connected to the PT100 through a 3K92 resistor. This connection usually causes serious nonlinear problems, however. With the software correction of the microcontroller as a backing, the sensor access method is simplified.
According to the parameters of PT100, its resistance value is 100 to 280.9Ω in the range of 0℃ to 500℃. According to the revelation of its series voltage division, we can use the formula: Vcc/(PT100+3K92) * PT100 = output voltage (mV) to calculate its output voltage at 100°C, see the table below:
Temperature ℃ |
PT100 resistance Ω |
Voltage across sensing mV |
0 |
100.00 |
124.38 |
1 |
100.39 |
124.8 |
50 |
119.40 |
147.79 |
100 |
138.51 |
170.64 |
150 |
157.33 |
192.93 |
200 |
175.86 |
214.68 |
250 |
194.10 |
235.90 |
300 |
212.05 |
256.59 |
350 |
229.72 |
276.79 |
400 |
247.09 |
296.48 |
450 |
264.18 |
315.69 |
500 |
280.98 |
334.42 |
The 10-bit A/D of the microcontroller has a maximum display of 1023 words at full scale. In order to obtain the A/D conversion input voltage of the microcontroller when the PT100 sensor output voltage displays 500 words, the original output voltage of the sensor must be amplified. The calculation formula is: (500/1023 * Vcc)/voltage across the sensor (mV/℃), (Vcc = system power supply = 5V), and the amplification factor can be obtained as 10.466.
Regarding the amplification factor: An enthusiastic user friend asked, according to (500/1023 * Vcc)/voltage across the sensor, the result cannot be obtained as 10.466, but the result is 11.635. In fact, the ideal value of 500 words cannot be obtained naturally from the circuit itself. The naturally derived number is just 450 words. Therefore, the value of 500℃ in the formula in actual calculation is 450 instead of 500.450/1023*5/(0.33442-0.12438)≈10.47. In fact, there are many ways to calculate it. The key is to base it on the mV/℃ of the sensor rather than the measured temperature value. Let's look at adding the nonlinear correction coefficient: 10.47*1.1117=11.639499.
The operational amplifier is divided into two stages. The post-stage amplification is fixed at 5 times (12K/3K+1=5 in the schematic diagram), and the pre-stage amplification is: 10.465922/5=2.0931844 times. In order to prevent components and other deviations during adjustment, a precision fine-tuning potentiometer is used to fine-tune the amplification factor, which can ensure a more accurate adjustment to the required amplification factor (10K/(8K2+Rw)+ in the schematic diagram) 1).
Usually, in the temperature measurement circuit, there will be a "zero adjustment" and another "full scale" potentiometer to facilitate the adjustment of the correct display of the sensor at "zero degree" and "full scale". This circuit does not use two potentiometers because as long as the "zero degree" adjustment is accurate, the correct display of the entire working range can be guaranteed, including of course the maximum display problem at full scale.
So, how is "zero degree" handled in the circuit? It just subtracts the "0 degrees" number directly from the microcontroller program. Within the entire working range, the program will automatically subtract the "zero degree" value before using it as a valid value.
When the supply voltage deviates, will it cause changes in the sensor input and affect the accuracy? After the power supply changes, the current flowing through the sensor will inevitably change, which will also cause the sensor output voltage to change. However, at the same time, the power supply of the microcontroller is also receiving this power supply change synchronously. When the microcontroller's A/D reference uses the supply voltage, it means that the measurement reference is also changing in the same direction simultaneously. Therefore, as long as the parameters are chosen appropriately, changes in system power supply within 20% will not affect the accuracy of the measurement. (Usually microcontroller systems do not allow excessive changes in power supply. This is not only a requirement in temperature measurement circuits.)
The schematic diagram of the subsequent microcontroller circuit is as follows:
The signal output from the sensor preamplifier circuit is sent to the A/D conversion input port (PB0/AN0) of the HT46R23, and the microcontroller performs various necessary processing. The first step is to perform software nonlinear correction, divide the input signal into different segments according to different temperature values, and then multiply them by different compensation coefficients according to the segments to make them close to the theoretical values. The non-linearly corrected numbers are sent for display, comparison with the control values set by the user, etc.
The nonlinear compensation coefficients of each segment are shown in the following table (only the data of the main segments are listed, not the entire table content):
Sensing voltage
Another feature of this circuit is that the user can arbitrarily set 3 over-limit control values within the working range. When the measurement display value is greater than the set value, the corresponding control port will output a high level. By using this high-level signal and connecting an external circuit with a first-level transistor to drive the relay, automatic control can be achieved. When a certain control port outputs a high level, the LED light-emitting tube connected in series with it will light up at the same time to remind the user which set value is outputting the control signal.
The 24C02 in the circuit is an electrical memory that can reliably save the control values set by the user, and the data will not be lost even if the power is lost.
There are also 3 buttons in the circuit diagram, which are the "setting", "adding number" and "subtracting number" operation buttons, which are used by the user to set over-limit values. How to use it:
Press the setting button once, and the screen will display "1--", indicating that it is now entering the first over-limit value setting. After three seconds, the screen automatically jumps to display "***" and flashes (*** represents the over-limit value stored in the original electronic memory). Then, press the addend key (or subtract key), and the lowest number on the screen will be incremented by one (or subtracted by one). If you press and hold the button for more than three seconds without releasing it, the first two digits on the screen will be quickly added (or subtracted). After adjusting the number on the screen to the required number, the over-limit value is set.
Then, press the setting key again and the screen will display "2--", indicating that it is now entering the second over-limit value setting. After three seconds, the screen automatically jumps to display "***" and flashes.... The next operation is exactly the same as the first operation for exceeding the limit value.
The setting of the third over-limit value is exactly the same as the above two.
After setting the three over-limit values, you must press the setting key one last time to exit the setting state and return to the normal working state. If you forget the last press to exit, the program will wait for 10 seconds and automatically return to normal working status.
Simple debugging method:
Sensing voltage | mV/℃ | Internal AD reading | Correction coefficient |
124.3781 | Power supply resistance=3K92±1%, power supply voltage=5.000V±1% | ||
124.8450 | 0.4670 | 1.00 | 1.0000 |
147.7942 | 0.4683 | 50.14 | 0.9972 |
170.6414 | 0.4626 | 99.06 | 1.0095 |
192.9326 | 0.4570 | 146.80 | 1.0218 |
214.6802 | 0.4515 | 193.36 | 1.0343 |
235.8961 | 0.4461 | 238.79 | 1.0469 |
256.5918 | 0.4407 | 283.11 | 1.0597 |
276.7898 | 0.4355 | 326.36 | 1.0724 |
296.4779 | 0.4302 | 368.52 | 1.0854 |
315.6891 | 0.4251 | 409.65 | 1.0985 |
334.4220 | 0.4201 | 449.76 | 1.1117 |
A 100Ω resistor can be used to simulate the resistance of the PT100 at 0°C. Connect to the sensor input and see if =000 is displayed. If it is wrong, you can adjust the trimmer potentiometer to achieve it. Then use a 281Ω resistor to simulate the resistance value of the PT100 sensor at 500°C. The display should be within 500 characters ±1 character. Finally, using a 194Ω resistor in place of the 250°C sensor resistance input, it should display 250±1. If there are no problems after the above debugging, you can connect the real PT100 sensor and put it into use. (Real sensors also have errors, which can be corrected by fine-tuning the preamplifier potentiometer.)
In actual work, the power supply voltage of the circuit is required to be 5V±5%. If the measurement display value is greater than a certain over-limit value, the corresponding control port will immediately output a high level.
If the sensor has an open circuit fault, HHH will appear on the display. If the sensor and its leads are short-circuited, LLL will appear on the display immediately. In order to prevent possible adverse consequences caused by an open circuit or short circuit in the sensor, at this time, the three control output ports will be closed first.