perature coefficient and to get a voltage signal, we use the simple signal conditioning circuit in Figure 6.
This will produce a voltage U(T) equal to
and the ADC will produce an integer N according to
We get the inverse, linearizing function by solving for T:
In order to get some numbers to work with, we will assign a a typical value of 3000 K . We will also assume that we use a 16-bit ADC. Hence, expression (18) is
Figure 6. Signal conditioning for non-linear thermistor.
Ideally, we should store one LUT value for each value in the domain of N (0.65535), but we want to save memory space and decimate this table; we will estimate intermediate values by linear interpolation. According to (5), the interpolation error is proportional to the second derivative of expression (19). The second derivative corresponds to the “curviness” of the function and since we are looking for the size of the maximum interpolation error, we will focus on the segments of that has the greatest curviness. Also, we can estimate the second derivative from data by using expression (13). In Figure 7 we have plotted both expression (19) and the second derivative from expression (13). As expected, the maximum of the second derivative occurs at the points of maximum curviness.
In Figure 7 we have only plotted the temperature for N ranging from 13,602 to 57,889; this corresponds to an assumed temperature range of –10˚C to +100˚C.
From Figure 7 we can see that the maximal curviness, and hence the maximal interpolation errors, occurs at the upper end of the function. Hence, we only need to calculate expression (12) for the last N values in order to find the maximal interpolation error for any decimation factor.
Table 2 lists the values of the maximal remainder term for different degrees of decimation. The remainder term
Figure 7. The function f–1 and its second derivative.
Table 2. Maximal remainder term vs LUT decimation factor.
was calculated from expressions (12) and (13).
The values in Table 2 should be compared to the byte and word precisions in expressions (7) and (8).
If we use the restraint that, we can see from Table 2 and expression (7) that if we store LUT entries in 8-bit byte format and use a 16-bit ADC, we can decimate the LUT by a factor of 64 without reducing the overall precision; the precision of the measurement estimate is still determined by the precision of the stored LUT entries, not by the errors introduced by the linear interpolation. If we store the LUT values as 16-bit wordswe can see from Table 2 and expression (8) that a decimation factor of 8 will not affect the overall precision.
For the 8-bit case, we reduce the size of the LUT from 65 kbyte to only 1 kbyte which is a significant (and absolutely necessary) reduction of the LUT memory footprint in a small embedded system. Of the 16-bit integer produced by the ADC, we use 10 bits for LUT indexing and 6 bits for (piece-wise) linear interpolation. This is illustrated in Figure 8.
LUTs are used in a vast variety of applications [1-18] and the precision of LUT entries and the size of the LUT are crucial design factors in every digital system that relies on LUTs. Wrong or inaccurate LUT entries may cause serious malfunctions. As a matter of fact, it was a LUT error that caused the infamous malfunction of Intel’s Pentium processor in the mid 90’s .
This work has suggested a method for finding an optimal LUT size when linearizing sensor outputs in small embedded systems. The idea is to use some of the (most significant) bits from the quantizer for LUT index ing and the rest of the (least significant) bits for linear interpolation. The allocation of bits for indexing and interpolation, respectively, depends on the precision of the stored LUT values. Since interpolation inherently introduces an error due to the curviness of the mapped function, it is important to keep the LUT size large enough to make the interpolation errors insignificant. On the other hand, the LUT size must be reduced to a minimum in order to
Figure 8. LUT indexing and piece-wise linear interpolation.
minimize the LUT memory footprint, which is absolutely crucial in small embedded systems. This work has presented a theory for finding the optimal LUT size and demonstrated its use by a case study.
The work is limited to the case were LUT entries are stored as integers since this is typically the case in small (8-bit) microcontrollers; the controller linearizes the sensor signal only, it does not estimate the original sample value. We have argued that the interpolation error should be much less than the precision of the LUT entries. If the LUT entries are stored with m bits resolution we can estimate their precision to be 2–m and if we use expressions (12) and (13) to estimate the interpolation error, we get the following general condition for determining the LUT size:
- W. Gawronski, F. Baher and E. Gama, “Track-LevelCompensation Look-Up Table Improves Antenna Poiting Precision,” 2006. http://ipnpr.jpl.nasa.gov/progress_report/42-164/164E.pdf
- R. A. Barlow, P. Bobbio, E. Carlier, G. Gräwer, N. Voumard and R. Gjelsvik, “The Beam Energy Tracking System of the LHC Beam Dumping System”, The 10th International Conferences on Accelerators & Large Experiment Physics Control Systems, Geneva, 10-14 October, 2005, p. 02.056-4.
- P. Gaydecki, “New Real-Time Algorithms for Arbitrary, High Precision Function Generation with Applications to Acoustic Transducer Excitation,” Journal of Physics: Conference Series, Vol. 178, 2009, pp. 12-15. doi:10.1088/1742-6596/178/1/012015
- P. Hung, H. Fahmy, O. Mencer and M. J. Flynn, “Fast Division with a Small Lookup Table,” 2002. http://arith.stanford.edu/~hung/papers/asilomar.pdf
- M. D. Ercegovac, T. Lang, J.-M. Muller and A. Tisserand, “Reciprocation, Square Root, Inverse Square Root and Some Elementary Functions Using Small Multipliers,” IEEE Transactions on Computers, Vol. 49, No. 7, 2000, pp. 628-637.
- H. Hassler and N. Takagi, “Functions Evaluation by Table Look-up and Addition.” Proceedings of the 12th IEEE Symposium Computer Arithmetic, Bath, 19-21 July 1995, pp. 10-16. doi:10.1109/ARITH.1995.465382
- W. F. Wong and E. Goto, “Fast Evaluation of the Elementary Functions in Single Precision,” IEEE Transactions on Computers, Vol. 44, No. 3, 1995, pp. 453-457. doi:10.1109/12.372037
- E. Balestrieri, P. Daponte and S. Rapuano, “A State of the Art on ADC Error Compensation Methods,” IEEE Transactions on Instrumentation and Measurement, Vol. 54, No. 4, 2005, pp. 1388-1394. doi:10.1109/TIM.2005.851083
- A. C. Dent and C. F. N. Cowan, “Linearization of Analog-to-Digital Converters,” IEEE Transactions on Circuits and Systems, Vol. 37, No. 6, 1990, pp. 729-737. doi:10.1109/31.55031
- M. Frey and H.-A. Loeliger, “On Flash A/D Converters with Low-Precision Comparators,” Proceedings of IEEE International Symposium on Circuits and Systems, Greece, 21-24 May 2006, pp. 3926-3929.
- S. A. Jawed, “Analog-to-Digital Converter Design for Non-Uniform Quantization,” Master Thesis, University of Linköping, Linköping, 2004. http://liu.diva-portal.org/smash/get/diva2:19990/FULLTEXT01
- M. Pascale, “Microcontrollers CORDIC Methods”, 2004. http://www.drdobbs.com/184404244
- S. L. Gaverick, K. Fujino, D. T. McGrath and R. D. Baertsch, “A Programmable Mixed-Signal ASIC for Power Metering,” IEEE Journal of Solid-State Circuits, Vol. 26, No. 12, 1991, pp. 2008-2016. doi:10.1109/4.104195
- E. Laulainen, L. Koskinen, M. Kosunen and K. Halonen, “Compass Tilt Compensation Algorithm Using CORDIC,” Proceedings of the 2008 IEEE International Symposium on Circuits and Systems, Vol. 1-10, 2008, pp 1188-1191.
- M. Beckman and L. Chioye, “Precision Thermocouple Measurement with the ADS1118,” Texas Instruments, 2011. http://www.ti.com/lit/an/sbaa189/ sbaa189.pdf
- J. Julicher, “Simplified Thermocoupld Interfaces and PIC micro MCUs,” Microchip Technology, 2002.
- Mathworks, “Look-up Tables and Polynomials,” 2000. http://radio.feld.cvut.cz/matlab/toolbox/rtw/rtw_ug/opt_mod4.html
- B. C. Baker, “Precision Temperature-Sensing with RTD Circuits,” 2008. http://ww1.microchip.com/downloads/en/appnotes/00687c.pdf
- J. Day and S. Bible, “Piecewise Linear Interpolation on PIC12/14/16 Series Microcontrollers,” 2004. http://ww1.microchip.com/downloads/en/AppNotes/00942A.pdf
- J. M. D. Pereira, P. M. B. S. Girão and O. Postolache, “Fitting Transducer Characteristics to Measured Data,” IEEE Instrumentation & Measurement Magazine, Vol. 4, No. 4, 2001, pp. 26-39.
- H. Erdem, “Implementation of Software-Based Sensor Linearization Algorithms on Low-Cost Microcontrollers,” ISA Transactions, Vol. 49, No. 4, 2010, pp. 552-558. doi:10.1016/j.isatra.2010.04.004
- P. Hille, R. Höhler and H. Strack, “A Linearisation and Compensation Method for Integrated Sensors,” Sensors and Actuators A, Vol. 44, No. 2, 1994, pp. 95-102. doi:10.1016/0924-4247(94)00795-0
- “PIC32MX1XX/2XX Data Sheet,” Microchip Technology Inc., 2011. http://ww1.microchip.com/downloads/en/DeviceDoc/61168D.pdf
- K. Post, “Interpolated Table Lookups Using SSE2 (1/2),” 2010. http://rawstudio.org/blog/?p=457
- G. Bucci, M. Faccio and C. Landi “New ADC with Piecewise Linear Characteristic: Case Study—Implementation of a Smart Humidity Sensor,” IEEE Transactions on Instrumentation and Measurements, Vol. 49, No. 6, 2000, pp. 1154-1166.
- S. Khan, A. H. M. Z. Alam, S. M. Ahmmad, I. B. Tijani, M. A. Hasan, L. W. Adetunji, S. F. Abdulazeez, S. H. M. Zaini, S. A. Othman and S. S. Khan, “On the Issue of Linearizing a Sensor Characteristic over a Wider Response Range”, Proceedings of the International Conference on Computer and Communication Engineering, Kuala Lumpur, 13-15 May 2008, pp. 72-76.
- Microchip, “Temperature Sensor Design Guide”, Microchip Inc., 2009. http://ww1.microchip.com/downloads/en/DeviceDoc/21895d.pdf
- B. Trump, “Analog Linearization of Resistance Temperature Detectors,” Analog Application Journal, Vol. 4Q, 2011, pp. 21-24.
- J. E. Brignell, “Software Techniques for Sensor Compensation,” Sensors and Actuators A, Vol. 25, No. 1-3, 1991, pp. 29-35.
- B. Stringham, J. Leonard and S. Yakimchuk, “A Universal Sensor Linearizing Circuit,” Computers and Electronics in Agriculture, Vol. 4, No. 1, 1989, pp. 81-84. doi:10.1016/0168-1699(89)90016-1
- D. K. Anvekar and B. S. Sonde, “Transducer Output Signal Processing Using Dual and Triple Microprocessor Systems,” IEEE Transactions on Instrumentation and Measurement, Vol. 38, No. 3, 1989, pp. 834-836. doi:10.1109/19.32204
- A. Flammini, D. Marioli and A. Taroni, “Transducer Output Signal Processing Using an Optimal Look-up Table in Microcontroller-Based Systems,” Electronics Letters, Vol. 33, No. 14, 1997, pp. 1197-1198. doi:10.1049/el:19970809
- A. Flammini, D. Marioli and A. Taroni, “Application of an Optimal Look-up Table to Sensor Data Processing,” IEEE Transactions on Instrumentation and Measurement, Vol. 48, No. 4, 1999, pp. 813-816. doi:10.1109/19.779179
- P. N. Mahana and F. N. Trofimenkoff, “Transducer Output Signal Processing Using an 8-Bit Microcontroller,” IEEE Transactions on Instrumentation and Measurement, Vol. 35, No. 2, 1986, pp. 182-186.
- “Sensors, Excitation and Linearization,” 2007. http://media.wiley.com/product_data/excerpt/33/07803601/0780360133-2.pdf
- Microchip, “PIC18FXX8 Data Sheet,” Microchip Inc., 2003. http://www.micrchip.com/wwwproducts/Devices.aspx?dDocName=en010301
- S. Y. C. Catunda, O. R. Saavedra, J. V. FonsecaNeto and R. A. Morais, “Look-up Table and Breakpoints Determination for Piecwise Linear Approximation Functions Using Evolutionary Computation,” IMTC 2003, Instrumentation and Measurement Technology Conference, Vail, 20-22 May 2003, pp. 435-440.
- L. Råde and B. Westergren, “Mathematics Handbook for Science and Engineering”, 3rd Edition, Studentlitteratur, Lund, 1995.
- P. Pohl, G. Eriksson and G. Dahlquist,“Numeriska Metoder,” 5th Edition, ILiber Tryck, Stockholm, 1982.
- E. O. Doeblin, “Measurement Systems—Application and Design,” 4th Edition, McGraw-Hill, Singapore, 1990.
- B. Cipra, “How Number-Theory Got the Best of the Pentium Chip,” Science, Vol. 267, No. 5295, 1995, p. 175. doi:10.1126/science.267.5195.175