Calibration-Less Direct Inductor-to-Microcontroller Interface

A sensor-to-microcontroller interface circuit for inductive sensors that does not require a calibration inductor is presented. Three digital ports of a microcontroller, two transistors, and an embedded timer were used to measure the charging times of the inductor through forward- and backward-flow currents using two different initial conditions. The difference between the charging times was used to estimate the sensor inductance accurately without the uncertainty due to the tolerance of threshold voltage of the input port, which delimits these time length measurements. Experimental results show that a conventional low-power microcontroller with an embedded 16 MHz clock and 22 <inline-formula> <tex-math notation="LaTeX">$\Omega $ </tex-math></inline-formula> charge resistance can be used to achieve 2 <inline-formula> <tex-math notation="LaTeX">$\mu \text{H}$ </tex-math></inline-formula> resolution and a systematic error below 2% for a measuring range from 100 <inline-formula> <tex-math notation="LaTeX">$\mu \text{H}$ </tex-math></inline-formula> to 10 mH. The advantages of the proposed technique include the reduction of cost and space as well as avoiding complex calibration processes caused by the temperature drift of the reference inductors.


I. INTRODUCTION
Inductive sensors are widely used in harsh environments owing to their immunity to humidity, oil, and dust. They are used to measure displacement [1], position [2], pressure [3], [4] or temperature [5]. Each magnitude is estimated indirectly through its associated inductance, which is conventionally measured from the frequency of an oscillator circuit [3] (inductance-to-frequency) or the voltage drop when the sensor is biased by an alternating current source [6] (inductance-to-voltage). In both cases, complex circuits must be connected to a measuring control unit, typically a microcontroller (µC), and the inductor must be charged/discharged for a large number of cycles to perform the measurements, implying a long measurement period. Direct inductive sensorto-microcontroller interfaces have been proposed to reduce implementation costs and measurement periods [7], [8], [9]. They directly connected the sensor to the digital ports of the µC, and used an embedded timer to measure one or two charging/discharging cycles of the LR circuit formed by the sensor. Fig. 1 shows the simplest direct inductorto-microcontroller interface circuit and the inductor voltage drop evolution when the output port P B is set to high level The associate editor coordinating the review of this manuscript and approving it for publication was Bo Pu .
(V OH , ''1'') charging the inductor through a resistance R. Simultaneously, the µ' embedded timer starts counting until v PA reaches V TL , the low threshold voltage of a high impedance (''HZ'') trigger Schmitt input port P A . At this point, the falling edge of the P A triggers capture of the timer counter. The resulting time period T m is then used to estimate the measured inductance L m . Unfortunately, the value of V TL is not accurately known owing to its high tolerance and temperature drift. This prevents accurate estimation of L m from (1), and a calibration process is required to avoid this uncertainty. Fig. 2 shows the circuit proposed in [8], which uses an inductor reference L ref .
Two charging times, T ref and T m , were measured, corresponding to L ref and L m . Thus, L m can now be estimated by which is independent of V TL , and V OH . This scheme uses four transistors to charge the inductors through current flows above the maximum current limit of the output port. Thus, smaller resistance values can be used for R, and longer charging times can be obtained, relaxing the resolution limit given by the timer clock frequency. A reference inductor must be selected to operate at current levels and inductances in the same range as those of the measured inductor. To achieve such performance with small devices, ferrite cores were used. However, they have limitations such as large temperature drifts and poor manufacturing tolerances, which increase the cost and error of these measuring systems. To overcome these issues, we present a new low-cost direct inductor-to-microcontroller interface that does not use any L ref but can accurately measure inductances.

II. PROPOSED MEASUREMENT TECHNIQUE
Instead of using a reference inductor to obtain an equation that eliminates the dependence on V TL , we propose another relationship that results from measuring the time length (T Bck ) required to charge L m from another initial condition (Fig. 3). We used a symmetrical circuit to allow the inductor to be biased through forward and backward current flows.
µC exploits this capability to measure the charging time in both current directions using symmetrical LR circuits, in which the starting bias current of the backward-charging stage is the endpoint of the previous stage. This circuit also improves the design trade-off between the accuracy and energy consumption of previous designs [7], [8], [9], in which the inductor is only charged through a forward bias current that must be increased to extend the charging period and improve accuracy. Because the current excursion doubles the amplitude during the backward charging stage in our proposed method, the relative error of this time measurement was halved.
A single input port (P A ) was used to detect the end of both charge stages, because the use of another input port would introduce a new unknown V TL , which does not solve the problem. Three resistances, R A1 , R A2 and R B were used to fit the transient start and end points according to the tolerance margin of V TL . They must be selected to fit the maximum value of V TL below the minimum starting point value of v PA (V 1 ) and the minimum value of V TL must be above the transient endpoint (V 0 ). Two output ports, P B and P F , control two NMOS transistors (Q B and Q F ) which set the charge and discharge sequences to perform the measurement. While the forward charge stage was performed through resistance R S1 , which was much smaller than R A1 , R A2 and R B , another resistance, R S2 , was used in the backward charge stage. To achieve symmetric charge stages, we selected the same values for R A1 and R A2 (R A1 = R A2 = R A ) as for R S1 and R S2 (R S1 = R S2 = R S ).
Initially, Q B and Q F were turned off, holding the inductor fully discharged with no current flow, and v PA was driven to the voltage power supply (V cc ). The measurement sequence started when the Q F was turned on and the inductor was forward-charged through R S1 . An embedded timer was configured to measure the forward charging time (T Frw ) until the P A toggled when v PA reached V TL . The charging stage was extended until the inductor was fully charged. After a minimum waiting time of five times the time constant of the LR circuit (>5L m /R s ), the backward-charge stage began. Then, Q F was turned off, and Q B was turned on to charge the inductor through R S2 . Because of the initial inductor current in this charging stage, the initial value of v PA (V 2 ) almost doubles from the initial value in the previous stage. Similarly, the backward charging time (T Bck ) was captured when v PA reached V TL . Finally, both transistors were turned off to discharge the inductor and restore the initial state.
v PA follows the dynamics of a first-order system, whose start and end points, under the assumption that R A , R B R S , can be approximated by where r m is the parasitic resistance of inductor. As this resistance can be significant in the measurement process when a small R S is used, r m must be estimated. This can be performed by capturing the voltage v AIN using an embedded analog-tovoltage converter immediately before starting the backward charge stage, and by calculating r m from R S v AIN /(V cc -v AIN ). A resistance R c was connected between v AIN node and analog input port (A IN ) to avoid the influence of the input port parasitic capacitance on the charging transient response.
The first-order response of v PA implies that the trace between x 1 and x 2 in Fig.3b, which delimits T Frw , is equal to the trace between x 4 and x 5 which corresponds to a part of T Bck . Consequently, the time between x 3 and x 4 can be calculated by subtracting T Frw from T Bck , which has the advantage that its limits do not depend on V TL ; thus, they can be accurately determined. We can observe this analytically from which are subtracted and the values of V 0 , V 1 and V 2 are substituted by (3)-(5) to deduce Note that this expression does not depend on V TL , nor does it depend on V cc , R A or R B . Its accuracy is limited by the assumption that R A , R B R S and the symmetry of the circuit. To reduce the dissymmetry error, inductance can be estimated by averaging the results of two consecutive measurement cycles. In the first cycle, L m is charged forward and backward through Q F and Q B , respectively. However, in the second cycle, Q B is first turned on to measure T Frw and then L m is charged through Q F for T Bck .

III. EXPERIMENTAL RESULTS
A low-power µC (MSP430FR5969) supplied by 3.0 V and an embedded 16-bit timer driven by 16 MHz quartz crystal clock (30 ppm/ • C) were used to test the proposed technique. The digital input/output ports P1.2 (TA1 CCR1 capture), P1.5 and P1.3 were selected to implement P A , P B and P F . According to the datasheet, the value of V TL for these ports ranges from 0.75 V to 1.35 V. This tolerance margin results in a measuring error of approximately ±28.5% when no inductance reference is used, and L m is calculated from (1). Three different resistance values, 100 , 47 , and 22 , were selected for R S1 and R S2 (1% tolerance). R A was selected to be at least one hundred times higher than R S (10 k , 1% tolerance) in order to prevent its influence on the inductor current charge response. A 51 k resistor was selected for R B (1% tolerance) to set the starting point of v PA in the forward charge stage (V 1 = 1.63 V) above the higher limit of V TL (1.35 V). This value also sets the endpoint of v PA (V 0 = 0.69 V) below the lower limit of V TL (0.75 V) in the worse-case scenario (R s = 22 and r m = 10 ). A 1 k resistance was selected for R C , and 50 resistances were used for R gF and R gB to limit the gate current of the NMOS transistors (NTR4170N). The forward and backward charge periods were fixed at 4 ms, and a new measurement was performed every 10 ms, discharging the inductor between two consecutive measurement cycles.
The measuring prototype was tested for ten inductors whose inductance values were logarithmically distributed from 26 µH to 46 mH. Air-core inductors were selected for the five smallest inductance values, and ferrite cores for the largest ones. For each L m value, 200 measurements were performed and each result was calculated by averaging two consecutive cycles, as explained above, to reduce the asymmetry error. The results and a comparison with a reference measurement, L ref , obtained from an LCR meter (U1733C, Agilent) are shown in Fig. 4.
The results indicate that the appropriate R S depends on the measurement range. Because the quantization error is given by (R s + r m )/ ln(2)T CLK where T CLK is the timer clock period, it decreases when smaller values are selected for R s . For a charge resistance of 22 , the quantization error was limited to 2 µH, representing a relative error of 7.6% at 26 µH. This limit was higher than the measured error (5.6%), as shown in Fig.4. b. For this measurement range, the standard deviation is given by the noise in the analogto-digital converter used to estimate r m . As the measured inductance increases, the relative deviation from the reference value decreases by up to 2%. This limit is due to resistance dissymmetry, charge resistance tolerances, approximation in calculus (R A , R B R S ) and accuracy of the LCR reference meter (1%). For higher inductances, higher values must be used for the R S to avoid long charge and discharge stages. In addition to limiting the sampling frequency, long charge cycles imply higher sensitivities of T FWD and T BCK to noise in the v PA and thus, resulting in higher standard deviations in the measurements.

IV. CONCLUSION
A low-cost direct inductor-to-microcontroller interface circuit was proposed, which does not use calibration inductors and uses fewer transistors than previous methods that have achieved similar measurement ranges and accuracies. The inductance is estimated from a simple relationship that depends only on the charge resistance R s , parasitic inductor resistance r m and measured inductor charging times through forward and backward current flows. Because it does not depend on unknown parameters, no calibration process is required and only r m must be estimated using an embedded analog-to-digital converter when low-quality factor inductors are measured. The measurement accuracy depends on the tolerance and symmetry of the resistance values, and can be improved by averaging the results of two measuring cycles in which the forward and backward charging stages are exchanged. The experimental results show that the relative error is reduced to 2% for a measuring range from 100 µH to 10 mH when conventional low-cost resistors (1% tolerance) and a 22 charge resistance were used. The measuring resolution was limited to 2 µH by the timer quantitation error, and can be improved by using smaller R s at the expense of increasing energy consumption.