Serial Look Up Tables for Sensors Save Space and Improve Accuracy

By Jon Gabay

Contributed By Electronic Products

Analog transducers and sensors do a good job of translating a real world physical condition into an electronic signal that we can measure and use. In addition, while there are a multitude of low cost temperature, pressure, light level sensors, accelerometers and magnetism transducers that are consistent and reliable, unfortunately their response is not linear. The main errors in most measurement systems are related to the transducer’s offset, gain and non-linearities, and for that reason, the process of sensor linearization is a crucial step in the design of an embedded measurement system.

More costly sensor systems incorporate circuitry to correct for offsets, maximize range, and linearize transducer response. Nevertheless, when cost and space are a sensitive concern, engineers can get the same benefits as the higher priced systems by designing our own corrective measures.

This article examines the use of non-volatile serial memories as look up tables for correcting and linearizing analog information from lower cost transducers. It looks at addressing schemes, architectural implementations, protocols, overhead, and software architectures that seamlessly acquire valid sensor information.

How it’s done

Systems using transducers such as force, temperature, and magnetic field can benefit greatly by a well-characterized look up table. The process is simple. Using analog front-end stages, the sensor is biased to be brought into usable range for the embedded controller’s A/D stage (Fig. 1). This can include filtering, voltage offsets, and gain stages, which maximize the usable dynamic range of the A/D.

The analog front end biases and offsets the sensor

Figure 1: The analog front end biases and offsets the sensor, and gain maximizes the A/D range. Then, the A/D value read in acts as the address byte to the look up table to access the corrected value.

The read in value is then applied as the address to the Look-Up Table. If a memory chip holds look up tables for more than one sensor, then a paged approach can be used to access each sensor’s correction data.

Take a typical analog sensor such as the Interlink 30-61710 Force Sensing Resistor (FSR). An FSR is a robust polymer thick film (PTF) device that exhibits a decrease in resistance with increase in force applied to the surface of the sensor. The resistive response, the result of applied force, does not track linearly in output voltage (Fig. 2). Instead, there is a sharp slope, and then a steady asymptotic like rise depending on the biasing applied to the terminals. A look up table could provide a more normalized value.

A simple correction can compensate

Figure 2: A simple correction can compensate for elbow sections of a characteristic curve to provide a more normalized range.

An even more exotic correction would be for a sensor curve like that found in the Honeywell SS49 linear magnetic field sensor. Its radiometric sense pattern can exhibit different slopes at different supply voltages (Fig. 3). A positive offset is required here to detect north and south poles. This is a perfect example as to where a look up table can transform a transducer value to indicate pole and magnitude.

Slopes at different supply voltages

Figure 3: This linear magnetic sensor has a zero point in the relative center point of its detection range. Here, a look up table can normalize and present a pole and magnitude value for direct use in a signal processing algorithm.

The sensor data must be either entered in tabular form or extracted from a test fixture. If the manufacturer’s specs are accurate, you can rely on a generic correction table to improve precision. If you need ultimate accuracy, then a characterization stage during the manufacturing process would exactly characterize each sensor and pair it with the data set in its local serial memory. An algorithm can even update the contents of the EEPROM as time elapses to compensate for age related drift.

Size and speed

As sensors shrink in size and are utilized in remote locations, board space is a key concern. A parallel-access ROM that can return a value in a single memory cycle is much faster than the serial protocols engineers have available for non-volatile memory applications. However, while a parallel ROM is the fastest way to obtain data, it requires too many address and data lines to fit in many small designs. It may also take up too much valuable processor ROM, or, on the processor, it may be too hard to update.

Here is where serial can shine. A single, 2- or 3-wire protocol like Microwire, I²C and SPI, can tunnel into the heart of a good-sized memory array, typically in a reasonably small 8-pin package (some can be as small as 3-pin parts). What is nice is that in most microcontrollers these protocols are usually implemented in hardware so software overhead is minimal.

Perhaps the smallest example of this is the 3-pin Microchip 11AA020T-I/TT, which uses the company’s UNI/O single wire protocol. While this part can run on 5 V, it can also run down to 1.8 V making it suitable for coin-cell-powered designs.

As a master/slave driven protocol it shares the up to 100 Kbit/sec communication line with other peripheral elements (Fig. 4). By using a self-clocking code, in this case Manchester Encoding, UNI/O clocks in a start header, a device address, family code and device code. It also uses an acknowledge sequence to assure devices are receiving and decoding data correctly as well as clocking in data from addressed devices.

The one-wire UNI/O bus

Figure 4: The one-wire UNI/O bus chains to a variety of signal conditioning stages and makes possible a complete serial look up table in a 3-pin SOT-23 package.

While UNI/O is a proprietary protocol to Microchip, a designer could implement a bit banged interface for non-Microchip controllers to take advantage of the UNI/O devices. Otherwise, I²C may be an option.

I²C and SPI alternatives

A widely adopted standard like I²C means that there is a better chance that your parts will play nicely together. Companies work hard to assure compliance with industry standards so odds are you will be getting a well-engineered solution. Hardware support for I²C inside your micro will mean less of a requirement for code development and test.

True, I²C is a 2-wire protocol, not a one wire, but very small footprints for serial EEPROM are available for these as well. Take, as an example, the Freemont Micro Devices FT24C02A-5PR-T TSOT23-5 5-pin part. Like the Microchip part, this 2Kx8 is all that is needed to provide a full 256-byte look up for an 8-bit A/D converter. The faster 1 MHz speed is a particularly nice feature since most I²C parts top out at around 400 KHz.

For more than one sensor, a deeper part like the 8K (1Kx8) ROHM BU9889GUL-WE2 can store look up data for four 8-bit sensors or lookup data for a single 10-bit A/D converter. Up to 64K (8Kx8) I²C parts are readily available, such as the STMicroelectronics M24C64-FCS6TP/K. This EEPROM can handle a single 16-bit sensor, two 12-bit sensors, four 10-bit sensors, or eight 8-bit sensors from a single 5-pin WLCSP package.

So far, we have discussed using EEPROM as the non-volatile medium. EEPROM has advantages in that it is byte addressable so in a single cycle you have your result. However, densities are more limited with EEPROM compared to Flash. For higher densities, Flash technology coupled with the SPI protocol is the way to go.

A good example is the Winbond W25Q80BVSNIG SPI serial Flash. While the larger 8-pin packages are not as small as the 5- or 6-pin parts discussed so far, the high density (8 Mbit/1 Mbyte organized by 4K pages of 256 bytes) and 104 MHz bit rate let this part hold more than just multiple look up tables. Shadow code, run time code that will be cached, graphics pages, and more can co-exist with lookup data.

Because of the page access functionality, a block of SRAM inside your micro may have to be devoted to cache the pages of data you are looking for. This may make the process a little more intensive than a direct look up like we have with the byte addressable I²C parts. Still, the available densities and speeds make these parts worth looking at. For example, you can use this approach to take advantage of parts up to 1 Gbit in density like the 108 MHz 24-pin BGA Micron N25Q00AA13G1240E SPI serial Flash.


Serial non-volatile memories provide vital functionality for modern system designers. While digital in nature, their use as look up tables for sensor systems can improve sensor accuracy and save space. As a re-programmable resource, they can be used to compensate for drift in time or other known sensor degrading factors to increase sensor lifetime while preserving accuracy. They can even be powered down completely when not needed to save energy in a battery-powered application.

Disclaimer: The opinions, beliefs, and viewpoints expressed by the various authors and/or forum participants on this website do not necessarily reflect the opinions, beliefs, and viewpoints of Digi-Key Electronics or official policies of Digi-Key Electronics.

About this author

Jon Gabay

About this publisher

Electronic Products

Electronic Products magazine and serves engineers and engineering managers responsible for designing electronic equipment and systems.