A simple digital readout circuit for differential resistive or capacitive sensors

This paper introduces and analyzes a novel direct interface circuit (DIC) that directly connects differential resistive and capacitive sensors to digital processors (DPs), performing a magnitude-to-time-to-digital conversion of the information they provide. The simple circuit performs the readout using two passive components, the differential sensor and the DP. In some cases, the circuit may require an additional passive element. The DP only uses common digital resources such as bidirectional pins or a counter, meaning microcontrollers, FPGAs, or ASICs could all be used as DPs. Different DICs proposed in the literature for reading differential sensors require three time measurement processes to estimate the variable to be measured. The new circuit requires only one, saving time and energy dissipation and reducing the number of error sources. A design based on an FPGA has been implemented as a proof of concept. Measurement times in the order of 1.1–1.3 ms have been obtained with this configuration. Errors in the readout of a differential resistive sensor are below 0.34% in the worst case and below 0.63% for a differential capacitive sensor.


Introduction
Sensors are now ubiquitous, especially since the explosion of the Internet of Things (IoT) or Ambient Intelligence applications (AmI). As the number of sensors used in these applications increases, there is a growing demand for readout circuits that consider their requirements. The ideal solution would be that these circuits were simple (reducing their size and cost), with low power consumption (so the sensors can be included in portable devices with small batteries), and with Original content from this work may be used under the terms of the Creative Commons Attribution 4.0 licence. Any further distribution of this work must maintain attribution to the author(s) and the title of the work, journal citation and DOI. short measurement times (to meet increasing demands for speed). Moreover, IoT or AmI circuits use a digital processor (DP) as their core (either a microprocessor, an FPGA, or an ASIC) to coordinate and control information receiving, sending, and processing. Therefore, it is interesting that the DP directly acquires the sensor's information.
Some interesting types of sensors are called differential resistive or capacitive sensors (DRS or DCS). These sensors are internally formed, in turn, by two sensor elements, in which the physical magnitude to be measured is transformed into an electrical magnitude (resistance or capacitance). The operation of differential sensors is based on the fact that a variation of the physical magnitude to be measured is transformed into a variation with the same sign in an electrical magnitude in one of the two sensing elements. In contrast, in the other, a variation of the opposite sign occurs for the same electrical magnitude. Due to their construction, the DRS and DCS have three terminals, of which only one provides the information of the magnitude to be measured.
Other types of differential sensors provide a differential output. In this case, the information of the magnitude to be measured is given by the difference between the two output signals. These sensors typically have a Wheatstone bridge configuration with a variable number of sensing elements [1][2][3][4][5]. These devices have four terminals, two of which are used to connect the power supply.
This work focuses on the first type of sensor with three terminals. They are used, in the case of DCS, for measuring linear displacement and pressure differences [6], and for determining angular position [7,8] and acceleration [9,10]. DRSs are used in applications such as environmental monitoring [11], speed measurement [12], to sense linear or angular position displacement [13], and in rehabilitation devices [14]. These sensors also have inherent benefits, such as canceling the effects of temperature changes. It is, therefore, increasingly common for differential sensors to appear in IoT or AmI. This situation means that specific readout circuits for these sensors must be designed to comply with the characteristics set out above. Figure 1 shows the equivalent DRS and DCS circuits. The variables x R and x C in the figure show information about the magnitude of the physical phenomenon to be measured (x R in the case of DRS, and x C for DCS; x R and x C ∈ (−1,1)). As shown in figure 1, two possibilities relate x R and x C to the electrical circuit. In the case of the linear relationship, the elements of the differential sensor are given by where R S and C S are characteristic constant parameters of each DRS or DCS, respectively. If the relationship is hyperbolic, we have There are also sensors with two internal elements in which the electrical magnitude of one of them varies in the same way as the physical magnitude to be measured (increasing or decreasing with it). In contrast, the electrical magnitude remains constant in the other, being taken as a reference value [15]. Although these sensors cannot exactly be considered differential sensors, they can be used as those with a hyperbolic relationship.
To obtain x R , the seminal work by Owen [16] proposes using an integrator circuit built with an operational amplifier (OA), two voltage sources, four switches, and an analog comparator. Most recent proposals also use various OAs, analog comparators, switches, and passive elements [17][18][19][20][21][22]. Errors in these proposals range from 0.35%-1.18% full-scale span (FSS), while the measurement times, T M , are between 30 ms and 100 ms (in the references that provide the datum).
In the case of DCS, most proposals use different versions of a relaxation-oscillator and AC sources to find x C [23][24][25][26][27]. Errors are between 0.1% and 6.74% FSS. Only [23] reports a T M of 4.4 ms.
Except for [21,22], all proposed DRS or DCS readout circuits need to include an analog-to-digital converter (ADC) to provide the information to the DP. On the other hand [21,22], require a digital complex filter in addition to OAs and comparators.
Direct interface circuits (DICs) were introduced in [30, 31] to reduce the complexity of the readout circuits of different types of sensors. DICs do not require an intermediate signal conditioner (based on amplifiers or oscillators) or an ADC, but rather just some passive elements to connect the sensor directly to a DP. All DICs perform a magnitude-to-time-todigital conversion. This type of design is employed in [28] for DRS readout, figure 2(a). The circuit performs three charges and discharges of C and three time measurements to determine x R . All pins in figure 2(a) are configured as output pins with a logical 1 output during charging. We call V ch the maximum voltage a DP pin can reach, which, in this case, will match the maximum voltage stored in the capacitor. A discharge follows each charge. During discharging, only one pin P o , P m , or P M is with a logical 0 output. The other pins are configured as high impedance state inputs, HZ. The time interval from the discharge start until node V C in figure 2(a) reaches voltage V TL is measured for each discharge. V TL is the threshold voltage to detect a logical 0 input in pin P 1 starting from a logical 1 level. The length of the discharge steps is measured in DP clock cycles with period T CK , obtaining three values: T o , T m , and T M (the subscript indicates the pin with a logical 0 output level). Each of these times has the form where R i is the equivalent resistor through which the discharge is made, and ro is the output resistance of each pin configured as a logic 0 output. Considering (5) and the expressions (1) or (3), it is easy to find Figure 2. Scheme of the DICs proposed in the literature (a) for the readout of differential resistive sensors [28] (b) for the readout of differential capacitive sensors [29].
This method to obtain x R is simple but has some drawbacks. Three capacitor charges are required (each charge consumes energy and time). Moreover, the charges must last long enough to ensure V ch is identical at the start of the three discharges (R c is introduced primarily to improve equality between these final charge voltages [32]). Furthermore, (6) assumes that ro is the same for pins P o , P m, and P M when there may be differences between them. In [28], the authors provide x R errors of 0.42% FSS obtained after an offline calibration with T M = 1.84 ms.
A DIC for the DCS readout is shown in figure 2(b) [29]. Again, the circuit performs three charging and discharging steps to determine x C . However, a different capacitor is used in each charging and discharging step. Discharges always occur through resistor R d (this resistance does not need to be precisely known, although R d ≫ R C is essential for proper circuit operation). In this circuit, the discharge times T m , T M , and T m+M (where the subscript indicates the capacitor being discharged) take the form where C i is the equivalent capacitor through which discharge is carried out. From (7) and (2) or (4) we have The method to find x C using (8) is also simple. Still, it has the same drawbacks as discussed above for [28], reporting a maximum error of 1.1% FSS (after an offline calibration) for a single-axis accelerometer and an overall T M of around 50 ms.
This paper presents a new type of DIC that requires a single charge and discharge process to estimate x R or x C . The basic idea is to take the three necessary time measurements to get the estimates during the single discharge process (this idea was already introduced in [33] with two time measurements for a simple capacitive sensor). This procedure will reduce measurement time, power consumption, and sources of error, such as the possible differences in V ch between charging processes or the different values of ro in the different pins. Under certain conditions, the new proposal also has the advantage of the circuit topology being the same for the DRS and the DCS readouts, meaning a single implementation could interchange the sensors to be read. As the new DIC needs only a few passive components, which improve the cost and reliability of the circuit, the circuit is an exciting candidate for IoT and AmI.

New differential sensor readout circuit
The new read circuits for DRS or DCS are shown in figure 3. The circuit has a resistive branch with two resistors in series and a capacitive branch with two capacitors in series. Therefore, these branches have equivalent impedances, For DRS readout, the sensor forms the resistive branch, and known discrete capacitors form the capacitive branch. For DCS readout, the sensor comprises the capacitive branch, and known discrete resistors form the resistive branch. Circuit operation for reading the two types of sensors is described below.  and P R pins in HZ state. At the end of step 2, V J = V J,max , this being close to V ch but slightly lower due to the presence of the resistive branch. The maximum voltages for V C and V R (V C,max and V R,max ) are given by For correct circuit operation, it makes no difference which of the two voltages is higher (this will depend on x R and the values selected for C A and C B ). The only important thing is that both values are greater than V TL , so they are detected as a logical 1 when starting the discharging process (step 3 in figure 4). During discharge, the voltages in the different nodes are given by [34] With these equations, we find the instants at which V J , V C , and V R voltages reach the value V TL . If we call these instants T J , T C , and T R, respectively (as in figure 4), we find resulting The denominator on the right-hand side of (15) is known and will be denoted as k C . With this, we can rewrite (15) This is the estimating equation of x R , valid for both linearly and hyperbolically related DRS.

Differential capacitive sensor readout
For DCS readouts, the designer chooses the values for R A and R B , the selection criteria presented later. C A plays the role of the capacitor C m and C B the role of C M . The readout process is still as shown in figure 4. Hence, T J is also obtained from (12) (with the new values of R T and C T ), while T C , and T R are .
As with (15), we find The denominator on the right-hand side of this equation is known and will be denoted as k R . Thus, This is the estimating equation of x C with a linear or hyperbolic relationship.
On the other hand, proper operation of the new circuit requires V C,max, and V R,max to be greater than V TL . This implies that the following must be valid for DRS (22) or for DCS Making the right choice of R A and R B , or C A and C B ensures (21) and (23) are met. These equations constitute the circuit design rules. However, compliance with (22) and (24) limits the range of values of x R and x C , since For most DPs, V TL is less than half of V ch , so x R and x C can take any positive value but not all negative values. The experimental results section will show x R and x C ϵ (−0.2,1) in our implementation. This is sufficient for a large number of DRSs or DCSs (e.g., x R and x C are included in the range −0.2 and 0.2 in [23,24,26,35,36]). However, in applications with more negative values of x R and x C , it is necessary to modify the circuit in figure 3. Figure 5(a) shows the modified circuit to estimate x R ϵ (−1,1), and figure 5(b) for x C ϵ (−1,1). The designer chooses resistance R E and capacitance C E .

Modifying the readout circuit for an extended range of x R or x C
Assuming DRS with a linear relationship, the circuit in figure 5(a) can be used in the same way as in figure 3, considering two new resistors (framed in dashed rectangles), R ′ m and R ′ M , which would form a new fictitious differential sensor in which the magnitude to be measured would be given by x ′ R . The following relationships are therefore verified From (26)-(28), we can find the relationship between x R and x ′ R If measurements T J , T C , and T R are performed in the circuit in figure 5(a) (whose equations are still (12), (13) and (14), respectively, but with R T = R S + R E and substituting R m and R M with R ′ m and R ′ M ) x ′ R is still obtained from the right-hand side of (16). Then, as R S can be known from T J and T C and substituting its value in (29), we obtain x R as a function of time measurements and constants selected by the designer where τ RE is Following similar steps above, it is easy to show that (31) is also valid for DRS with a hyperbolic relationship.
A minimum value of R E , R E,min , ensures that x R = −1 can be measured. For example, for DRS with a linear relationship, R E,min can be found from the expression equivalent to (22) for the circuit in figure 5 resulting in According to this, R E,min depends on the chosen DP and the sensor's total resistance.
The new circuit for DCS with x C . ϵ (−1,1) is shown in figure 5(b) with two new equivalent capacitors, C ′ M and C ′ m , of a new fictitious differential sensor and a new measurement magnitude, x ′ C . If the sensor is linear, an equation equivalent to (29) is verified The following is also true where x ′ C is estimated by substituting measurements T J , T C, and T R (taken in the circuit of figure 5(b)) on the right side of (20) and τ CE is A procedure like the above provides for DCS with a hyperbolic relationship An equivalent equation to (34) also provides the minimum value of C E , C E,min , to estimate x C ϵ (−1,1) For both DRS and DCS, the cost of extending the range of x R and x C while maintaining a single charging-discharging process has been the introduction of a single additional passive component.

Errors, uncertainty, and resolution
As discussed, the new proposal eliminates some sources of error in [28] and [29]. The first one is the difference between the final voltages of each charging process. These differences are unavoidable due to noise in the circuit. In [28] and [29] an attempt is made to minimize these differences by lengthening the charging times. In the new proposals, since there is only one charging process, this is not necessary, thus reducing T M . On the other hand, ro is no longer a source of error in the new proposals since its only effect is to determine the closeness between V J,max and V DD .
However, the presence of stray capacitors is inevitable. By the very nature of these capacitors, the errors they introduce in the estimates of x R or x C are highly variable over the entire range, producing the sensation of random errors in the circuits of figures 2, 3, and 5. Beyond the careful implementation of circuit routing, little can be done to reduce these errors.
On the other hand, unlike in [28] and [29], to estimate x C in the new circuit, it is necessary to know precisely the values of the passive resistances R A and R B . Similarly, the values of the passive capacitors C A and C B must be known precisely to estimate x R . For this reason, these elements must be highprecision components that are as stable as possible against temperature variations and aging. Thus, the errors that can be introduced by variations in the values of these elements will be minimal.
The noise introduced by the power supply also affects the V TL value of an input pin, causing it to vary. This phenomenon is known as trigger uncertainty, u trigger [32], and it also affects the estimate provided by the circuits in figure 2.
In [37], it is found that, for any time measurement, u trigger is inversely proportional to the value of the voltage slope in the measurement pin when this voltage reaches the value V TL . From (11) it can be deduced that u trigger has the same form in all time measurements The product R T C T is not related to x R only when the circuits in figures 3 or 5 are used for DRS with a linear relationship.
In hyperbolic relationship, different x R or x C imply different values of R T C T , meaning u trigger (T i ) will vary with x R or x C . As u(x R ) or u(x C ) depend on these uncertainties, they will also change over the range of x R or x C .
In addition to u trigger , quantization uncertainty, u q , appears due to the measurement of the different times used in the estimates in clock cycles of the DP. This uncertainty can be ignored if all times are long enough. The designer should therefore choose sufficiently large values of C A and C B or R A and R B .
Increasing the resolution of the new circuits involves increasing the values of T J -T C, and T R -T J, which appear in (16), (20), (31), (38) and (40). This can be achieved by also increasing R T C T . However, these increases only make sense up to a specific value of R T C T for which u trigger ≫ u q , since, according to (42), any further rise in R T C T brings an increase in uncertainty (along with an increase in T M ). R E and C E should therefore be chosen to meet (34) and (41), but making them as small as possible.
However, resolution can also be improved by maintaining a constant value of R T C T and decreasing T R and T C . This can be achieved with values of R A and R B or C A and C B that provide initial values V R (0) and V C (0) as close as possible to V TL (while maintaining a logical safety margin to detect them as logical 1 inputs).

Experimental results and discussion
A commercial printed circuit board (PCB) has been selected to verify the experimental performance of the proposed circuits, namely the CMOD A7 from Digilent (Pullman, Washington). As DP, the PCB incorporates an FPGA, the Xilinx Artix 7 XC7A35T. This PCB includes a USB-UART bridge, a clock source, 512 KB SRAM, and 4 MB Quad SPI Flash. These elements provide enough resources for the CMOD A7 to be used in applications for IoT and AmI. Using an FPGA allows different tasks to be carried out in parallel with the measurement of differential sensors. The voltage supply for the I/O pins of the FPGA is 3.3 V (this is the value of V DD ), and a 50 MHz clock is generated internally. However, both the rise and fall edges of the clock have been used to detect the trigger instant. This means that a new count is obtained every 10 ns. V TL has been experimentally measured, finding a value of approximately 1.25 V.
The structure of the design programmed in the FPGA is shown in figure 6. The configuration of the pins, the 18-bit counter, and the three registers that store the time measurements depend on the Control Unit. A USB module has been introduced to communicate the results provided by the Arithmetic Unit to a laptop.
A series of 500 estimates of x R or x C has been made to present the results of this section. Various figures of merit have been derived from these measurements, characterizing the performance of the new circuits. The first one is the maximum relative error for the estimate of x j (j is R or C), defined by where x j (i) is each of the estimates of x j using (16), (20), (31) or (38), and x j,a is the actual value of x j . The second figure of merit is the systematic error for the estimate of x j wherex j is the average of all x j (i). Finally, the normalized uncertainty of the measurements, u N (x j ), has been obtained as a normalized standard deviation of the series of 500 measurements To analyze the operation of the circuit in figure 3 in a more general way, it has been decided to use precision resistors and capacitors to emulate the operation of the DRS and DCS. Therefore, a combination of precision resistors has been used to obtain an approximately constant value R S = 12.3 kΩ with x R varying over a range (−0.2, 0.96).
The capacitors are of the CG0 type to avoid thermal drift. Selecting C A = 99.73 nF and C B = 90.25 nF, V C,max in (21) is 1.73 V > V TL = 1.25 V (a large safety margin for the circuit to work correctly). The values of C A and C B were also chosen so that the results of T R -T J and T J -T C , appearing in (16), are large enough to neglect quantization errors (quantization errors less than 0.05%). As the average value of T J was 470 µs, and 103 µs for T C , then T C is significantly smaller than T J , reducing uncertainty in the estimation of x R . T dis = 0.5 ms was selected for the complete discharging of the capacitors, and T ch = 0.1 ms for charging. Thus, T M = 1.07 ms.
The results for e R (x R ), e S (x R ), and u N (x R ) are shown in figure 7. Note that errors e R and e S are shown in the left vertical  axis for all figures with information on e R , e S (expressed in %, as indicated in (43) and (44)). In contrast, the right vertical axes show u N (expressed in ‰, as indicated in (45)). The first impression when looking at figure 7 is that e R and e S grow as the absolute value of x R increases. However, this growth is minimal since the maximum e R is 0.29%, while e S is between 0.05% and 0.24%. u N shows little growth with x R , varying between 0.12% and 0.21%. In any case, given the very small value of u N relative to e S , it has practically no effect on e R .
It is also interesting to observe how e R , e S, and u N vary when x R = 0 and changes the value of R S . The results are shown in figure 8, where 12 values of R S ranging from 442.4 Ω to 23.584 kΩ have been taken. u N , e S , and e R are practically constant in all cases.
Maintaining R S = 12.3 kΩ and the values of the capacitors, R E = 7700 Ω has been chosen in the circuit in figure 5(a) to allow estimation of x R ϵ (−1,1). R E is larger than the minimum of 7.5 kΩ imposed by (34), but not much larger, to avoid unnecessarily increasing u trigger and, therefore, u N . Figure 9 shows the results of these selections. In general, there is an increase with respect to figure 7 in uncertainty (due to the rise in R T ) and e S (due to a new stray capacitor), although e R remains below 0.34 %.
The same tests carried out for DRS have been performed for DCS. In this case, R A = 25 495 Ω and R B = 16 201 Ω  have been selected for the circuit shown in figure 3 (hence V R,max = 1.28 V > V TL = 1.25 V). In this case, the safety margin is only 30 mV, which is enough to ensure the circuit works correctly. The values of R A and R B have also been chosen so that T J -T C and T R -T J , that appear in (20), are large enough to neglect the quantization errors. Discrete CG0 capacitors have been chosen to achieve approximately C S = 20 nF. With these choices, the mean value of T J was 739 µs, while for T R, it was 289 µs. As in the case of DRS, we have chosen T dis = 0.5 ms and T ch = 0.1 ms, obtaining a T M = 1.34 ms. Figure 10 shows the results. In this case, there is an erratic behavior of e S , while u N is practically constant. As e S is significantly larger than u N for many values of x C , e R also shows the same erratic behavior as e S , with a maximum of 0.32%. Figure 11 shows the results for C S , varying between 500 pF and 34.9 nF, while x C = 0. The results have peaks and troughs as in figure 10, for both e S and u N . Consequently, e R again shows erratic behavior, with a high of 0.43%.
To estimate x C ϵ (−1,1), maintaining C S = 20 nF, of the circuit in figure 5(b), C E = 22.32 nF has been used and maintained the resistance values. This value of C E is higher than the minimum imposed by (41), 12.2 nF. Figure 12 shows the results in this case. As expected, there is an increase in uncertainty (due to the rise in C T ) and e S (due to a new stray capacitor) compared to the values shown in figure 10. In the worst case in figure 12, e R is 0.63%.    [28] and [29] with this work. For the DRS, the comparison considers that in [28], x R belongs to the range (−1,1) and, therefore, must be compared with the results of the circuit in figure 5(a). In [29], x C belongs to the range (−0.07,0.07). However, the comparison is made with the circuit of figure 5(b), which can estimate the full range x C ∈ (−1,1).
The fifth column of table 1 indicates that the largest time constants of a discharge process, τ , correspond to the new proposals, which must be considered for a fair comparison. Despite this, due to the single charge cycle, T M is always lower on new DICs. Table 1 shows that this work presents the best results for T M , ENOB, and errors. It is important to note that reducing the voltage supply value implies an increase in e R and e S due to shorter measurement times. However, despite using the lower value of V DD , the new proposals keep the errors lower. Finally, it should also be noted that the errors in [28] and [29] are calculated after an offline calibration.

Conclusions
A new DIC type has been proposed for reading differential resistive and capacitive sensors (DRS and DCS, respectively). Apart from the sensors, the circuit only uses a few passive components connected to a DP that performs a magnitude-totime-to-digital conversion. The number of passive components must be increased by one, depending on the range of values of the variable measuring the physical magnitude (x R for DRS or x C for DCS). The DP only requires common digital resources such as bidirectional pins or a counter. Different DICs proposed in the literature for reading differential sensors need three charge cycles to estimate x R or x C , while the new circuit requires only one cycle. This has important consequences as it also reduces sources of error, measurement times, and energy consumption.
A design based on an FPGA has been implemented as a proof of concept. Measurement times in the order of 1.3 ms have been obtained with this configuration. In the worst case, the estimation errors were below 0.34% for the resistive case and below 0.63% for the capacitive case.
Thus, the new design is a simple, low-cost, fast, accurate, low-power circuit. All these features make it an ideal candidate for portable applications related to the IoT or AmI.

Data availability statement
All data that support the findings of this study are included within the article (and any supplementary files).

Funding Information
This work was funded by the Spanish Government under contract PID2021-125091OB-I00 and by the Departamento de Electrónica, Universidad de Málaga