Techniques for measuring with non-linear sensors

Electronics Technical ArticlesSouth-East European INDUSTRIAL Мarket - issue 4/2006

Bonnie C. Baker, Microchip Technology Inc.

A sensor with a non-linear output need not be difficult to deal with if all that is needed is coverage of a small portion of the output range. In such a case, it is possible to set up a simple, piecewise linearisation algorithm in a microcontroller or microprocessor. If a wider part of the output range is required, analogue linearisation circuits can be used. For example, a resistor in series or parallel with a (non-linear) thermistor will linearise a portion of the output. With a thermistor, this linearised portion is usually ±25°C (10-bit accurate) around a centre-point that has been designed into the circuit. The centre-point of the thermistor response can be trimmed by changing the value of the added resistor. These circuit techniques can usually help the designer to capture a wider (but not total) range of the sensor output.

Hardware techniques such as these are sufficient for many applications, but if the design needs to make use of an even-wider part of the output range versatility can be added to the circuit by using the programmability features of a microcontroller and programmable gain amplifier (PGA).

The term “thermistor” came from the combination of the words THERMally Sensitive ResISTOR. Two types are available: negative temperature coefficient (NTC) and positive temperature coefficient (PTC). NTC types are most suitable for precision temperature measurements, while PTC components are used in switching applications. This article will discuss an NTC application.

NTC thermistors are used in three different modes, which make use of the resistance-versus-temperature, voltage-versus-current, or current-over-time characteristics of the device. Most applications use the first of these modes. Unlike the other two modes, these resistance-versus-temperature circuits depend on a “zero-power” operating condition. Zero-power implies that there is minimal self-heating of the thermistor. Figure 1 shows the resistance-versus-temperature response of a 10kO, NTC thermistor. Typically, the 25°C rating for individual thermistors is in the range from 1kO ?up to 10MO.

A thermistor is a resistive element, so current excitation is required, from either a a voltage or current reference. The performance of the thermistor in Figure 1 is reasonably repeatable as long as the power across the device is kept below the power dissipation capability of the package. If this rule is broken, the thermistor will self-heat and artificially decrease in resistance, giving an inflated temperature reading.

Figure shows the high degree of thermistor non-linearity over temperature. This can be corrected with a look-up table in the microcontroller. This will require a high-resolution converter. Alternatively, hardware linearisation techniques can be applied before digitisation.

A very simple, but effective, linearisation technique is to put a resistor in series with the thermistor and power supply, as shown in Figure 2. This circuit shows a straightforward way to excite the thermistor with a current source and measure the change in resistance.

This excitation method ensures that the thermistor current is low enough to prevent the dissipation constant of the thermistor from affecting the accuracy of the system. If the PGA is set to a gain of +1V/V or replaced by a buffer amplifier, this circuit can be used to sense a limited temperature range (approximately ±25°C). This range is not restricted by the amplifier, but by the linearity of the voltage divider formed by the thermistor|RA combination. Temperature measurements over larger ranges have voltage deltas that are too small to convert accurately into a digital word, unless a higher resolution A-D converter is used.

As an example, the temperature range of a typical thermistor from BCcomponents is -40°C to +125°C. Figure 3 shows that the differential resistance for a 10°C delta at high temperature is significantly larger than a 10°C delta at low temperatures. This variation in the ratio of resistance-to-temperature over the range of the thermistor circuit creates an awkward analogue problem.

It is clear that, in this example, 10-bit A-D conversion is inefficient over the full temperature range. It is possible to increase the resolution of the A-D converter or switch several resistors (RA) into the circuit, but both of these options add cost and complexity. A third option is to keep the components as they are in Figure 2 and use the gain programmability of the PGA.

A close inspection of the thermal response in Figure 3 shows that granularity is lost at high temperatures. If the gain of the PGA is increased at these higher temperatures, the output signal of the PGA back will be brought back into a range where the A-D converter can reliably identify temperatures.

This approach uses changes in the microcontroller code, not hardware. Therefore, adjustments to the circuit only costs the programmer’s time. Figure 5 shows the flow chart for the microcontroller’s algorithm.

The PIC16F684 firmware performs a real-time sample. The firmware reads the A-D converter value and passes it to the PGA hysteresis routine, which checks the PGA gain setting. Based on the PGA gain, the microcontroller tests for trip-points (see Figure 4) with the A-D converter value. If the A-D converter value is beyond a trip-point value, the microcontroller sets the PGA gain to the next higher or lower gain setting. On leaving the PGA hysteresis routine, the firmware checks to see if the PGA gain was changed. If there was no change, the program continues. If there was a change, the firmware re-reads the A-D converter value.

When the PGA gain and A-D converter values are known, both are passed to the piecewise linear interpolation routine (PwLI). The microcontroller references the correct look-up table, per the PGA gain setting. The PwLI routine converts the 10-bit A-D converter value into a 16-bit fixed decimal point Celsius value. The fixed decimal point format reports Celsius in tenths of a degree. Figure 6 shows the accuracy of this system.

Performing the piecewise linear interpolation in tenths of a degree provides better resolution. In the final design, the designer can elect to report in tenths of a degree or whole degrees.

Obtaining reliable data from a non-linear sensor has always been a design challenge. Linearisation may be a relatively simple task until it is necessary to tackle the wide, non-linear, response range of a sensor. The combination of a microcontroller and programmable gain amplifier can overcome the non-linearity of a thermistor across a wide temperature range. This technique works well with thermistors, but can also be used on any other sensor that displays non-linear behaviour.




Top