# Measurement Methods (Part 2)  Written by

## Measure Large Quantities of Resistive Elements Using a Minimal Number of Cables

### You now understand (from Part 1) how to measure a large number of resistive elements (e.g., fixed resistor and sensors) with a small number of cables. In this article David presents the actual results from both a simulated system as well as a real device.

• How understand the actual results from Part 1 from both a simulated system as well as a real device.

• How to use the measurement technique in a real-world application,

• What are the 3 test board results?

• How to understand value distribution?

• Microchip ATmega32 microcontroller

• FDTI Chip’s FT232 IC

• Intel’s Math Kernel Library (Intel MKL)

In Part 1 of this article series, I described a method to measure a large number of resistive elements (e.g., fixed resistor, sensor, etc.) using a very small number of cables and a lot of math. In short, a measured system consisting of resistors connected between nodes is probed by switching the nodes into different states (either to one of several excitation voltages or into a high-impedance state). Several of the resistances are of a known value. These are reference resistors. The voltage on every node is measured and recorded. Many different combinations of node states (situations) are applied and measured. From this data an overdetermined system of linear equations is compiled and solved. The solution yields the resistances of the individual elements.

You can use the method to simplify cabling. You can also apply it in niche applications (e.g., MEMS devices) where space or cabling is scarce. The maximal number of measured resistors, assuming N nodes, is:

A few of these resistors are known reference resistors.

##### SIMULATION IMPLEMENTATION & RESULTS

To test out the method, several simulations were conducted to determine how big of an error we get in various configurations. The software was written in C#, using the .NET framework. The matrix solving part uses the Math.NET Numerics library, which used the Intel Math Kernel Library (MKL) as the native provider.

All of the simulations were done using a single floating node. The simulations used randomly assigned positions of reference resistors. The values of all of the resistors were assigned randomly, within the ratio being simulated. The lowest resistance value was 100 Ω. For every combination of metrics, 400 randomly generated simulations were performed. Only the setup with the maximum error was taken into account. The parameter values used in the simulations are listed in Table 1.

Two excitation voltage sources were used. The negative was at 0.05 V and the positive was at 2.45 V, while the reference voltage was 2.5 V—as such, most of the ADC range was used. The resulting plots display the main value—the maximal relative error as a function of the factors that affect it and of all of the measured system’s parameters. The parameters include the number of nodes, the ADC resolution, signal path noise, ratio of the number of reference resistors to the total number of resistors, the lowest resistor value versus the highest value, and the amount of change nonfixed resistances undergo during the measurement cycle. Due to the large number of parameters, only simple pseudo-3-D plots were made, one for every parameter combination, with the noise value and the number of reference resistors used as x- and y-axes (see Figures 1a–1f).

The results of the simulations can be summarized into several important points: It is possible to achieve relatively high precision and accuracy, provided that low noise parts are used and other advice from the rules of thumb is followed. Lower resolution limits the minimal error that can be achieved by the setup, but it has limited effect on the error above that value. Error values of less than 0.1% are achievable. The more reference resistors, the better results. The less noise, the better results. Low change during the measurement yields better results. A high ratio of the highest resistance value to the lowest resistance value will cause large error values. The best way to see if a measured system configuration will give you the parameters you desire is to build it or at least simulate it with estimates of your acquisition system parameters. The method can be used in a practical application that falls within the limitations of the measurement, such as slowly changing temperatures measured via an array of thermistors.

Depending on the situation and requirements, a fair number of reference resistors must be used to achieve a good result. Still, even when using half the resistors as references, you still use wires more effectively. With 16 wires, you can measure 120 resistors. If you use half of them as reference resistors, you are left with measuring 60 resistors using only 16 wires. Only a few plots for some of the representative situations were shown here. All of them (over 1,000) are available on my website (www.daqq.eu).

##### HARDWARE IMPLEMENTATION

To demonstrate the feasibility of this measurement in a real-world application, I created a simple device that implements all aspects of this measurement. An ATmega32 microcontroller handles all of the hardware functionality, including the switch matrix, ADC measurement, signal conditioning, and so on. The processor acts as a simple slave, connected to a master PC. The PC sets up the measurement situations and uploads them into the device, which executes them. The results are then sent back into the PC, where they are evaluated (see Photo 1a).

The device’s GPIO pins are used as the switch matrix drivers. When used as outputs, they are effectively connected to either the GND power rail or to the 3.3-V rail. When used as analog inputs, they behave as a high-impedance input and do not affect the voltage on the formed resistive divider. The voltage on every pin is measured using the internal 10-bit ADC, while using the 3.3-V power rail as reference. The entire device connects to the computer via a USB connection, using a Future Technology Devices International (FTDI) FT232 IC. It is USB powered. Simple measured modules can be connected to the acquisition hardware, some of which are shown on Photo 1b: a thermistor demo board, with 25 thermistors, each with a 680-kΩ resistance at 25°C, and three reference resistors; one fixed value board with 25 fixed value resistors and three reference resistors; and two fixed value boards with 24 fixed value resistors, three reference resistors, and one pin header that can be fitted with any resistor.

##### MEASUREMENT DESCRIPTION & RESULTS

Three basic test boards were measured using the eight-node device. Let’s review.

Low-resistance resistors: Individual resistors had a resistance of less than 700 Ω with a constant resistance. The reference resistors are precision 300-Ω low temperature coefficient resistors, with a value error of less than 0.05%. One resistor (number 15) was a precise 100-Ω resistor, but it was considered unknown. The rest are generic 1% trough-hole components with values ranging from 100 to 680 Ω.

High-resistance resistors: Individual resistors had a resistance of greater than 50 kΩ with a constant resistance. The reference resistors are precision 137-, 56-, and 68-kΩ low-temperature coefficient resistors, with a value error of less than 0.05%. One resistor (number 15) was a precise resistor, whose value is known, but was considered unknown. On this board, 10 and 51 kΩ were used. The rest were generic 1% through-hole components with values ranging from 51 to 560 kΩ.

Thermistors: Vishay 680-kΩ SMD NTC thermistors were exposed to varying fluctuating outside temperature and were measured to determine the temperature. The nominal resistance of the individual thermistors was 680 kΩ at 25°C, with a 5% error. The reference resistors used were 330-kΩ SMD generic 1% accuracy SMD resistors.

All of the measurements were done with the same measurement system, being powered and communicating with the evaluating computer by a USB connection. All of the measurements were done with no oversampling. They used the integrated 10-bit ADC. Every measurement consisted of 248 different situations. The total time for one full set of situations to be applied, measured, and sent out was 0.75 s per measurement.

All values considered true were measured externally using a four-wire measurement by a 6.5-digit DMM. All of the error values are calculated against these values. In the fixed resistor boards, one resistor was a precision resistor, but was treated as unknown. All error values are calculated against these resistors (see Table 2). Reference resistors were not measured as other unknown resistors were. They were assumed to be of their nominal value. Table 2 Reference resistors are not measured like other unknown resistors. They are assumed to be of their nominal value.

Any difference between the true value and the one calculated from the measured data is the effect of the mathematical procedure of solving the system of linear equations with an approximation. The measured precision resistors are of more interest. Their value was considered an unknown and was measured by the system. This difference can be used to guess at the data’s reliability. If the difference is too large, the data can be assumed to not be very precise, which happened during fast temperature changes.

A total of 10,000 whole measurements were taken for the fixed value boards (which took around 2 h). A period of 24 h was measured to capture a full 24 h of temperature data and to generate a temperature plot. The resistance plots display the difference between the average value and the sample at the given time. The green line on the plots indicates the true value measured externally by a 6.5-digit multimeter. The red line indicates zero difference—the mean measured value. The thermistor measurement plot has no such lines, as the absolute temperature values are more useful by themselves.

For convenience, only a few measurements were plotted. A total of 25 resistors were measured per measurement, with three extra reference resistors over the course of four separate measurements. Plotting all of this data would require over 100 plots, which would be excessive. All of the data is available on in CSV form. In Figure 2, the 100-Ω resistor measurement showed a 2 Ω offset against the actual value of the resistor. Also present were relatively heavy slow fluctuations of the values.

These errors can be attributed to the additional parasitic resistances present (the resistance of the traces, connector resistances), switch matrix (the GPIO push-pull drivers) resistance and their changes, and possibly the change in the resistors themselves due to heating (i.e., the relatively low resistance of the resistors caused as much as 0.2 W of heat). It’s also probable driver-related temperature characteristics changed during the measurements. This can account for the relatively sudden change in the measured value. The measurement shows reasonable precision (a peak-to-peak noise of approximately 0.5 Ω, 0.5% of the value), while staying accurate enough (i.e., a 2% offset of the mean value against the true value).

The 10-kΩ resistor measurement in Figure 3a shows a 4-Ω offset against the true value of the resistor. However, relative to its true value, it is much lower than the offset of the 100-Ω resistor. There are no slow fluctuations. It is reasonable to assume that whatever caused the fluctuations in the low impedance measurement was not present in this one. There was only a very small load on the GPIO output driver. The peak-to-peak noise is 20 Ω—that is, 0.2% of the mean value. A 4-Ω (0.04% of the mean value) offset against the true value is present.

The 51-kΩ measurement shown in Figure 3b is similar to the 10-kΩ measurement. There are no slow fluctuations similar to those present in the 100 Ω measurement. An offset against the true value of –30 Ω is present. A peak-to-peak noise of 165 Ω (i.e., 0.32% of the value) was present during the measurement. The offset against the true value was at 0.06% of the mean value.

##### TEMPERATURE MEASUREMENT

The thermistor measurement was conducted outside for a period of one day (see Figure 4). The device was placed in a box that allowed direct airflow on the sensors. It was also exposed to direct sunlight, so an additional source of error was introduced.

One of the three reference resistor values was plotted as well (see Figure 1g). You can see that this value stays within a certain area, even when the resistances of the thermistor change within reason. However, fast changes will cause the value to jump out of this range, which will indicate that the calculated values are not reliable in that measurement.

##### RESULTS

The measurement results have a lower error than the error expected from the simulations. The closest simulated situation would be a 10-bit resolution simulation for eight nodes, relatively low error, a ratio of references to the total number of resistors of around 0.1, a relatively low change value (100 ppm during one full measurement cycle), and a minimum to maximum ratio of 1:5 and a noise of 1.5 LSB. The expected error based on the simulation is between 2% to 5%.

The error on the real measurements was much less than this. This can be attributed to the fact that the simulation created hundreds of situations and found the worst-case error from among them. The simulation results should be assumed to be the worst-case scenario for such a configuration, while real-world results may be better.

The static measurements—where there were only fixed resistors—had a far smaller error (i.e., around 0.5%). As for the temperature measurement, it is hard to judge the error, particularly due to the 5% initial error of the thermistors themselves. However, the measured temperatures are very similar to those that were measured by a professional weather station in my area.

##### VALUE DISTRIBUTION

Most of the measured values had a Gaussian distribution around a mean value. However, an interesting situation was observed during a few of the measurements. A few resistors stood out, such number 17 in the 51-kΩ measurement. Figure 5a shows a plot of its measured resistance against time. Unlike most resistors, where values fluctuated around a mean value, this one had three distinct areas into which most of the measurements fell. Refer to the histogram in Figure 5b. This was observed on a few of the other resistors. The reasons behind this are unknown. If this was only the effect of the ADC’s quantization getting all the way into the values, a similar effect should have been seen on other values. Most of the other resistors, however, exhibit a Gaussian distribution of values. Random or thermal changes of resistance and noise would not create three distinct areas, but rather a continuous distribution of the values. As such, this observation invites further study.

##### FUTURE IMPROVEMENTS

You can expand the method described in this article to measure not only DC resistances, but also impedances. However, this would require far more sophisticated excitation and sensing circuitry to measure both AC amplitude and phase with various frequencies. In addition, the evaluation would be more complex as it would require the use of complex numbers.

If independent arbitrary signals can be generated on nodes, it should be possible to analyze the measured system faster. This would enable you to measure capacitive and inductive sensors as well as resistive elements.

The second improvement I have in mind deals with removing the error of the measurement that is caused by the resistance values of the elements changing during the measurement. If we assume that the resistance changes linearly during the measurement time, it should be possible to incorporate this into the system of linear equations. Assuming N unknowns, it should be possible to add another set of N unknowns, with coefficients that would be a function of both time and the normal coefficients for the original unknown values. This would give more freedom to the solver and effectively create a “change” vector (i.e., a vector showing how much the values have changed during the measurement). Also, when linear change is not expected, it should be possible to use different functions of time (e.g., logarithmic, square, etc.).

The hardware side of things can be improved significantly. The current implementation uses an inexpensive general-purpose microcontroller as the entire acquisition path, switch matrix, multiplexer, and ADC. Splitting this function into different devices specifically designed for this would improve the results greatly. Also, you could integrate all of this into a single ASIC. Read Part 1 Here

REFERENCE
 Microchip Technology (formerly Atmel), “8-Bit AVR Microcontroller with 32 Kbytes In-System Programmable Flash: ATmega32,” 2503Q, 2011, www.atmel.com/images/doc2503.pdf

RESOURCE
Math.NET Initiative, www.mathdotnet.com.

SOURCES
ATmega32 Microcontroller
Microchip Technology (formerly Atmel) | www.microchip.com
Atmel | www.atmel.com
FT232 IC
FDTI Chip | www.ftdichip.com
Intel Math Kernel Library (Intel MKL)
Intel | https://software.intel.com

PUBLISHED IN CIRCUIT CELLAR MAGAZINE  • OCTOBER 2016 #315 – Get a PDF of the issue

 Keep up-to-date with our FREE Weekly Newsletter! Don't miss out on upcoming issues of Circuit Cellar. Subscribe to Circuit Cellar Magazine Note: We’ve made the May 2020 issue of Circuit Cellar available as a free sample issue. In it, you’ll find a rich variety of the kinds of articles and information that exemplify a typical issue of the current magazine. Would you like to write for Circuit Cellar? We are always accepting articles/posts from the technical community. Get in touch with us and let's discuss your ideas.  