Before you start building a digital temperature sensing circuit, you must take the pure mechanical aspects (not treated in this article) and the electro-thermal aspects of your design into account. To that end, there are several important questions to consider:
- What is your temperature range?
- What accuracy do you want to reach?
- Which temperature sensing device are you going to use?
- What are the tolerances on the electrical characteristics of your sensor?
- What is the minimum bit rating for the analog digital converter?
- What sensor signal sampling rate is needed?
- What are the values and tolerances of all other passives components involved in the application?
The first two questions are essential, as their answers will determine the following steps. For the purpose of this article, we are going to use a temperature range from 25oC to 150oC and will target an overall accuracy of +/- 2oC. For this temperature range and accuracy, it is difficult to choose between a thermistor, which is highly sensitive but non-linear, and a resistance temperature detector (RTD) like a platinum sensor, which is linear but less sensitive.
Each of the questions mentioned above can be extensively answered by different product specialists, but what about the combined effects of all these points? It is a general principle that accuracy is always determined by the limiting factor of a system. If you haven’t identified this limiting factor, squeezing the tolerances near zero for one or several of the remaining parameters will not improve your results much; it will prove to be quite costly with little gain in efficiency.
Depending on the commercial availability of high precision devices, you might, for example, be tempted to use very accurate thermistors, with the enticing prospect of measuring the temperature with an accuracy lower than +/- 0.2oC. However, if you use a low cost 8-bit ADC, that wouldn’t make much sense; and if your sensor has average accuracy, it’s doubtful that the cost induced by raising the bit level from 8 to 24 would be worthwhile. You can also choose a class A platinum sensor (+/- 0.15oC at 0oC), with a linear variation in the temperature function. The signal variation will be smaller than for a thermistor, however; it will need to be amplified, thus requiring more hardware and more tolerances.
Keeping this in mind, we could ask ourselves if there is an inexpensive way to globally visualize the accuracy reached once you fixed the aforementioned characteristics. You could make a guess based on your experience, select a sensor, its tolerances, the A/D converter bit rate, and the rest of the hardware, then quickly build a virtual test bench and perform a simulation to see the potential result you could obtain. If this method were fast and cheap, and if you wouldn’t be flooded with equations and computations, it would be a dream.
That's where the freeware LTspice simulation program from Linear Technology comes in.
“LTspice? Really?” you might be asking. How could an analog computation software provide useful insight on a digital application?
Well, what are the different components of our digital sensing application? The temperature sensor comes first. Whether it’s an NTC thermistor or a platinum RTD, we can easily find SPICE models of these devices. Then there is a voltage divider between the thermistor and a fixed resistor with a low voltage power supply. After possible amplification and filtering, we feed this voltage to a sample and hold device, whose output is then digitized under the form of a bit count number. A microprocessor computes back a temperature based on this bit count according to a given formula.
Each of these operations can be easily simulated by LTspice, as shown in Figure 1 (we chose here a thermistor-based circuit, but a version with an RTD wouldn’t be that different). Figure 2 reprints the direct transient simulation of the circuit, showing the temperature profile of the application (V1 is a surface temperature), the response of the sensor (with delay and gradient), and also the digitization of the signal. The lower pane of Figure 2 shows the read-out temperature deviation in time (the bit rate = 10 has been kept low and the sample time of 200 ms long in order to show the digitization).
Higher pane: external temperature V(surf) + NTCALUG temperature V(them) + digitized read-out (Ton = 200 ms, n = 10)
Lower pane: difference read-out compared to real NTCALUG temperature
The sensor (a Vishay 10 kΩ NTCALUG) and the fixed resistors are of course no problem: LTspice will realistically simulate their characteristics (including their tolerances). The sample and hold device is a standard component in the LTspice library. The digitization of the signal and the conversion from bit count to temperatures are done with analog behavior modelling voltage sources. Interestingly, the bit rating n of the ADC is now a parameter of the simulation and can be swept from 8 to 24. The sample time Ton of the sample and hold device is a parameter as well.
The first parameter we are going to fix is the sampling time at 10 ms. We are then going to determine the best bit rating by letting n sweep between 8 and 24. Computing an error function as the RMS value between the read-out temperature and the NTCALUG temperature, we see in Figure 3 that no significant error decrease is stated for n > 16, which is the bit number to be adopted.
We can also optimize the value of the serial resistor R1 as a function of the temperature variation profile.
In Figure 4, the serial resistor Rs value is swept between 3 kΩ and 7 kΩ, and the error function is minimized for a value of 4.7 kΩ.
The err function is defined in the SPICE directives of the simulation (Figure 1)
The next step is to select the tolerances of the thermistor and the fixed resistor R1, and to perform a worst-case analysis based on these tolerances. Below, three cases are presented (Figures 4 to 6). In Figure 4, a dR25/R25 = +/- 1 % NTC with a B25/85 tolerance of +/- 0.5 % is combined with 0.5 % TNPW resistors, and we achieve accuracy growing from +/- 0.4oC around 25oC to +/- 1.5oC at 100oC. The simulations are processed according to a worst-case scenario (we have the R25 and B25/85 tolerances for the NTC and the fixed resistor R1, thus 23 = 8 cases, the white curve being the nominal).
Temperature accuracy with a dR25 = +/- 1 % and dB = +/- 0.5 % NTC, and +/- 0.5 % fixed resistor
We see that the different levels are equally distributed, thus our choice for the relative tolerances is reasonable. In Figure 5 we see that we can further divide the temperature uncertainty by two if we divide all tolerances by two (for thermistor = 0.5 % on R25, 0.25 % on the B25/85, and 0.25 % on the fixed resistor). This becomes challenging on the capability level, as it is not a certainty that all manufacturers can ensure +/- 0.25 % for the B25/85.
A more common tolerance encountered for the B25/85 coefficient is, for example, +/- 1.5 %. If we perform the same simulation with the same values as in Figure 5 (that is dR25 = 0.5 % and fixed dR = 0.25 %, both of which are very low, but a tolerance on the B value of +/- 1.5 %), we get the results in Figure 6, which clearly show a case of non-optimal design at high temperatures. The different levels of the worst-case analysis are also clearly not well distributed.
Temperature accuracy with a dR25 = 0.5 % NTC (but with dB= +/- 1.5 %) and a fixed resistor tolerance of +/- 0.25 %
Thus we see that our relatively simple simulation circuit allows us to visualize the global accuracy we can expect in practice for the chosen elements of our digital temperature application. This is an ideal way to prepare for experimentation.
SPICE simulation will never replace the talent and instinct of an engineer, but it can make practical experimentation more effective. It can spare time and thus lower the final cost, while also bringing a bit of fun to your work. What’s not to like about that?
As usual, the simulation files presented in this article are available at email@example.com.