You are on page 1of 32

CHAPTER 5

A NOVEL DIRECT MICROCONTROLLER INTERFACE


FOR CAPACITIVELY-COUPLED RESISTIVE SENSORS

5.1 INTRODUCTION

In chapter-4 a novel capacitance-to-pulse-width converter which is compatible with

single-element and differential capacitive sensors, and provides a linear digital output

irrespective of the sensor characteristic is presented. Unlike the capacitance-to-

frequency converter presented in chapter-3, it does not employ any complex analog

blocks, and thus realizes a capacitance measurement scheme which is simple, yet

efficient. This approach is also very useful for capacitive sensors that need sinusoidal

excitation at a specific frequency for the best performance of the sensor. However, in

certain applications, such requirements will not be present. In such cases, design

engineers will appreciate a simpler scheme like one based on the direct-microcontroller

(µC) approach, which involves just the microcontroller, the sensor, and a few passive

components, [43], [97]. This distinction of the direct-µC interface from the classical

sensor electronic interface is illustrated in Fig. 5.1.

(a)

(b)

Fig. 5.1 Block diagram representations of (a) Classical sensor electronic


interface (b) Direct µC interface [98].
As mentioned in chapter-1, in the classical scheme, the sensing element is first

connected to a signal conditioning circuit, followed by an ADC, before transferring the

data to the microcontroller. In the case of the direct-µC approach the sensing element

is directly interfaced to the microcontroller. In this chapter a novel, low-cost, low-power

direct-µC interface for capacitively-coupled resistive sensors is presented.

Capacitively-coupled resistive sensors offer an efficient way to perform non-contact

measurements. In these sensors, the measurement system accesses the sensing

resistance through the coupling capacitances that form a part of the sensor structure.

These capacitances enable non-intrusive measurement of the quantity of interest that

modulates the value of the sensing resistance. To illustrate further, consider the example

of non-contact measurement of water conductivity, which is one of the important

parameters in assessing water quality, as shown in Fig. 5. 2(a). In this, the conductivity

of a water column in an insulating tube (e. g. PVC pipe) is determined without exposing

the measurement electrodes to the water, thereby avoiding the possibility of corrosion

and formation of layers of contamination on them which can lead to errors [99]. In

Fig. 5. 2(a), the electrode, insulating pipe, and the water layer directly below the

electrode in contact with the insulation form a coupling capacitance.

Resistive sensors are a popular choice to form touchpads [100], and tactile

sensors [101]. Similarly, they are used to measure pressure [102], force [103], [104]

and temperature [105]. Conventional resistive sensing methods have the critical

requirement of direct contact of the resistive element to the measurement circuit. This

requirement limits the versatility in the range of applications, and the reliability of the

sensor. Additionally, the conventional schemes are complex, with the complexity

introduced into the circuit design by the precision sinusoidal excitation, need for several

106
ICs and components, corresponding power consumption, need for special signal

processing and associated analog blocks/digital processors to measure the quantity of

interest. Once a simple measurement scheme is available to read capacitively-coupled

resistive sensors, some of the resistive sensors [100], [101] could be converted into

capacitively-coupled ones. This will improve the reliability and the manufacturing

process. Additionally, the final assembly could be simplified as the wired connection is

no more a requirement. Hence, another possible application, apart from water

conductivity measurement, is in resistive touchpads, wherein the change in resistance

of the sensor can be measured through a capacitively-coupled arrangement. Although

the focus of the direct-µC scheme presented in this chapter is on measuring the

resistance with no direct contact between the measurement system and the resistive

sensor, in certain applications, the value of the coupling capacitance also has useful

information [106]. This has been addressed in the proposed measurement scheme

presented in this chapter.

The schemes employed so far in the existing capacitively-coupled resistive sensing

applications [28], [40], [41] have their limitations. For instance, in [28] and [41], the

circuits are relatively complex with the requirements of a precise sinusoidal excitation,

and a phase-sensitive detector. The complexity in these circuit designs can be mainly

attributed to the need to measure small resistances in the range of tens of ohms

(<100 Ω).

However, such levels of complexity cannot be justified when, for example, one aims at

scaling the circuit for an array of sensors, or while measuring higher resistance values.

In fact, in the case of the conductivity measurement of water, the resistance of seawater

107
108
(a) (b)

Fig. 5. 2 (a) Illustration of non-contact conductivity measurement of water in an insulating pipe. (b) Block diagram of the proposed
direct microcontroller interface for capacitively-coupled resistive sensor.
(55000 S/cm [42]) in an insulated cylindrical column of length 10 cm and diameter

2.5 cm is in the range of a few hundred ohms, but that of a drinking water outlet

(diameter ¼ inch or 6.35 mm pipe could be sufficient) is a few hundreds of kohm. The

conductivity of drinking (tap) water varies from 50-800 S/cm [42]. Thus, for the

capacitively-coupled measurement of higher resistances, a simpler scheme is preferred.

This would be very promising in the water quality monitoring to determine the

potability of drinking water [42] and the quality of river water [44], [45].

Direct microcontroller interfaces have been developed for the measurement of resistive

[97], [107]-[109], capacitive [23], [43] and inductive [110], [111] sensors. In such

circuits, the microcontroller excites a passive RC or RL network and then measures the

duration of the transient response to reach a predefined threshold, using the embedded

digital timer. The main advantage is that no active electronic component is used

between the sensor and the digital system, i.e. microcontroller, thus reducing the cost,

size, and power consumption of the design. However, the possibility of developing such

direct interfaces for capacitively-coupled resistive sensors has not been explored so far,

except for the preliminary study in [112].

In this chapter, a detailed study and evaluation of a simple and effective direct

microcontroller interface suitable for the measurement of the resistance and coupling

capacitance of a capacitively-coupled resistive sensor are presented. The estimated

resistance is independent of the variation in the values of the coupling capacitances, the

charging capacitor, the power supply voltage, and the preset threshold voltage.

Similarly, the measured value of the coupling capacitance is not a function of the

change in the sensor resistance. The proposed scheme is simple in design, consumes

low power, and carries out the measurement in a few milliseconds. It does not use any

109
expensive parts and can hence realize a low-cost measurement system. The details of

the proposed direct microcontroller scheme, the effect of the circuit non-idealities and

the experimental results are presented in the subsequent sections.

5. 2 DIRECT-µC INTERFACE FOR A CAPACITIVELY-COUPLED


RESISTIVE SENSOR

A block diagram of the proposed direct microcontroller scheme is shown in Fig. 5. 2(b),

where 𝑅𝑥 represents the resistive sensor element. In the example given in Fig. 5. 2(a),

𝑅𝑥 corresponds to the resistance of the water column between the electrodes.

Capacitance is formed between the electrode and the water column as it is separated by

an insulator. The same is valid when an insulated electrode is kept inside the pipe [28].

𝑅𝑥 is coupled to the measurement unit through these coupling capacitances 𝐶1 and 𝐶2 .

As illustrated, 𝑅𝑥 , 𝐶1 and 𝐶2 are in series, and the nodes ‘a’ and ‘b’ are accessible for

the direct connection to the µC. The scheme uses a reference resistor 𝑅𝑟𝑒𝑓 , and a fixed

capacitor 𝐶. As illustrated in Fig. 5. 2(b), the measurement is performed using four

digital input/output pins DIO-1, DIO-2, DIO-3, and DIO-4, an analog input pin A1, a timer

and a comparator (OC) embedded into the C.

The two terminals of 𝑅𝑟𝑒𝑓 are connected to the two digital pins DIO-1 and DIO-2. The

terminal connected to DIO-2 is also connected to node ‘a’. This node is connected to 𝐶1 .

One end of the 𝐶2 is accessible at node ‘b’. The effective capacitance 𝐶12 due to the

coupling capacitances 𝐶1 and 𝐶2 equals 𝐶12 = (𝐶1 𝐶2 ⁄(𝐶1 + 𝐶2 )). The fixed capacitor

𝐶 is connected across node ‘b’ and ground. The node ‘b’ is also connected to DIO-3 and

A1, as given in Fig. 5. 2(b). 𝐶, along with 𝑅𝑟𝑒𝑓 , and the capacitively-coupled resistive

sensor, form the RC circuit that enables the measurement of 𝑅𝑥 in this direct-µC

scheme. The operation of the scheme is explained below assuming ideal components.

110
As for the microcontroller, the digital pins in HZ state are assumed to have an infinite

input resistance, while those set as output, a zero output resistance. The non-idealities

are considered and studied later in section 5. 3.

5. 2. 1 Measurement of 𝑹𝒙

To estimate 𝑅𝑥 , in the proposed direct-µC approach, the system operates in two modes

based on if the sensing resistance 𝑅𝑥 alone is present, or if the reference resistance 𝑅𝑟𝑒𝑓

is also present. Thus, the modes are, mode - 𝑅𝑥 and mode - (𝑅𝑟𝑒𝑓 + 𝑅𝑥 ), respectively.

The measurement sequence starts with mode - 𝑅𝑥 , followed by mode - (𝑅𝑟𝑒𝑓 + 𝑅𝑥 ). To

execute this, the state of the pins DIO-1, DIO-2, and DIO-3 are set as per Table 5.1, where

LOW refers to 0 V or ground, HIGH to the dc voltage 𝑉𝐷𝐷 , and HZ indicates a high-

impedance state. DIO-3 is in HZ state during the charging and discharging cycles. A

timing diagram of the measurement process is illustrated in Fig. 5. 3. The measurement

begins when a start pulse (high to low transition) is provided at pin DIO-4. Then, the µC

sets DIO-1, DIO-2, and DIO-3 to 0 V, to discharge any residual charges that may be present

in the capacitances. This is indicated as state ‘0’ in Fig. 5. 3. Following this, DIO-2 is set

to HIGH, and DIO-1 can be set to either HIGH or HZ. This is indicated as state ‘1’ in

Fig. 5. 3. It is the charging-phase. In this phase of mode - 𝑅𝑥 , 𝑅𝑥 along with 𝐶1 , 𝐶2 , and

𝐶 constitute the RC circuit. In this condition, 𝐶 is charged to the final voltage 𝑉𝐹 given

by (5. 1). The measurement unit is in state ‘1’ for a preset time 𝑇𝐶ℎ1 . 𝑇𝐶ℎ1 >> (𝑅𝑥 𝐶𝑒𝑞 ),

where 𝐶𝑒𝑞 = 𝐶12 𝐶/(𝐶12 + 𝐶).

111
Table 5.1 States of digital pins

𝐶12
𝑉𝐹 = 𝑉𝐷𝐷 𝐶 (5. 1)
12 +𝐶

As soon as the time 𝑇𝐶ℎ1 is over, the state ‘1’ ends and the state ‘2’ begins, as in

Fig. 5. 3. In state ‘2’, DIO-2 is set to LOW, causing 𝐶 to discharge through 𝑅𝑥 as

illustrated in Fig. 5. 4(a), where 𝐼𝑑𝑐ℎ1 indicates the associated discharging current. In

state ‘2’, DIO-1 can be in either LOW or HZ states. In this discharging phase, the voltage

𝑣𝑐𝑓 across 𝐶 is fed to the input of the comparator OC via A1, and compared with a

preset DC threshold voltage 𝑉𝑇𝐿 , as illustrated in Fig. 5. 3. The time interval 𝑇1 taken

for 𝑣𝑐𝑓 to reduce from 𝑉𝐹 to 𝑉𝑇𝐿 is measured by the embedded timer, which starts

counting when the discharge begins and stops when 𝑣𝑐𝑓 = 𝑉𝑇𝐿 (via interrupt to timer

from OC output 𝑣𝑂𝐶 ). During the discharging phase in state ‘2’, (5. 2) can be written

when 𝑣𝑐𝑓 = 𝑉𝑇𝐿 . It is assumed that 𝑉𝐹 > 𝑉𝑇𝐿 , which can be ensured, in practice, by

selecting a value of 𝐶 such that 𝐶 < 𝐶12 , and setting 𝑉𝑇𝐿 < 𝑉𝐷𝐷 /2.

112
113
Fig. 5. 3 Timing diagram of the proposed direct-µC scheme. The signal ‘ Start’ indicates the output of DIO-4.
114
Fig. 5. 4 Discharge path of 𝐶 during (a) state ‘ 2’ , and (b) state ‘ 5.
𝑉𝑇𝐿 = 𝑉𝐹 𝑒 −𝑇1⁄𝑅𝑥 𝐶𝑒𝑞 (5. 2)

From (5. 2), 𝑇1 is obtained as,

𝑉
𝑇1 = 𝑅𝑥 𝐶𝑒𝑞 ln (𝑉 𝐹 ) (5. 3)
𝑇𝐿

The measurement unit is in state ‘2’ for a preset time 𝑇𝐷ℎ1 , where 𝑇𝐷ℎ1 = 𝑇𝐶ℎ1 . If 𝑅𝑥 is

computed using (5. 3), its accuracy depends on the accuracy in the measurement of 𝐶𝑒𝑞 ,

𝑉𝐹 and 𝑉𝑇𝐿 . To achieve an output independent of these parameters, another mode is

introduced, as explained next. Once state ‘2’ is completed, the C sets DIO-1, DIO-2, and

DIO-3 once again to LOW (like in state ‘0’). This is indicated as state ‘3’.

The next measurement is made in mode - (𝑅𝑟𝑒𝑓 + 𝑅𝑥 ). In this mode, the RC circuit has

both 𝑅𝑥 and 𝑅𝑟𝑒𝑓 in series. DIO-2 is set to HZ throughout this mode. DIO-1 is set to HIGH

to charge 𝐶 to 𝑉𝐹 , and LOW for it to discharge through the same path. These are

executed through the states ‘4’ and ‘5’, respectively, as illustrated in Fig. 5. 3. The

preset intervals for the states ‘4’ and ‘5’ are 𝑇𝐶ℎ2 and 𝑇𝐷ℎ2 . 𝑇𝐶ℎ2 = 𝑇𝐷ℎ2 and 𝑇𝐶ℎ2 , 𝑇𝐷ℎ2

>> [(𝑅𝑥 + 𝑅𝑟𝑒𝑓 )𝐶𝑒𝑞 ]. As in mode - 𝑅𝑥 , the time interval taken by 𝐶 to discharge from

𝑉𝐹 to 𝑉𝑇𝐿 is measured. As illustrated in Fig. 5. 4(b), the discharging current 𝐼𝑑𝑐ℎ2 flows

through 𝑅𝑥 , 𝑅𝑟𝑒𝑓 and 𝐶12 . In this condition, the expressions for 𝑉𝑇𝐿 and the

corresponding discharge time, namely 𝑇2 , are given by (5. 4) and (5. 5), respectively.

The measurement of 𝑇2 in state ‘5’ completes one cycle of the measurement of 𝑅𝑥 . In

case continuous measurements are to be made, the circuit operation enters state ‘6’ once

the discharge phase in mode - (𝑅𝑟𝑒𝑓 + 𝑅𝑥 ) is completed. This state is identical to state

‘0’ and facilitates the discharge of any residual charges.

𝑉𝑇𝐿 = 𝑉𝐶𝐹 𝑒 −𝑇2⁄(𝑅𝑟𝑒𝑓 +𝑅𝑥)𝐶𝑒𝑞 (5. 4)

115
𝑉
𝑇2 = (𝑅𝑟𝑒𝑓 + 𝑅𝑥 )𝐶𝑒𝑞 ln (𝑉𝐶𝐹) (5. 5)
𝑇𝐿

Once 𝑇1 and 𝑇2 have been measured, 𝑅𝑥 is estimated as follows. Dividing (5. 5) by

(5. 3) gives (5. 6).

𝑇2 𝑅𝑟𝑒𝑓
=1+ (5. 6)
𝑇1 𝑅𝑥

By re-arranging (5. 6), gives:

𝑅
𝑅𝑥 = (𝑇 𝑟𝑒𝑓 𝑇 (5. 7)
2−𝑇 ) 1
1

Thus, the resistance 𝑅𝑥 of the capacitively-coupled resistive sensor can be determined

in terms of the timer outputs 𝑇1 and 𝑇2 , and the known resistor 𝑅𝑟𝑒𝑓 . Since 𝑇1 and 𝑇2

are outputs from the digital timer, the final output is digital. As can be seen from (5. 7),

the output does not depend on the value of the other parameters of the system such as

𝐶1 , 𝐶2 , 𝐶, 𝑉𝐹 and 𝑉𝑇𝐿 , or any variations of those between two consecutive measurements

of 𝑅𝑥 . However, the measurement output does depend on 𝑅𝑟𝑒𝑓 . For this reason, such a

reference component should be selected with a low tolerance and a low thermal

sensitivity.

5. 2. 2 Measurement of 𝑪𝟏𝟐

In certain applications, the value of the effective coupling capacitance 𝐶12 carries useful

information. For example, in the case of resistance measurement of the water column

in pipes, the actual inner diameter of the pipe will change over long time, due to

deposition of organic/inorganic particles and microorganisms. Thus, the value of 𝑅𝑥

will be higher, for the same conductivity, compared to that measured with the original

dimensions of the pipe. In such a scenario, the measurement of the coupling capacitance

116
𝐶12 can provide information about these inner layers formed and, hence, corrective

measures can be taken. Hence, it would be beneficial if the proposed direct

microcontroller interface could be extended to determine the value of 𝐶12 . Such a

method can also be used to measure the capacitance value, in addition to the resistance

value, in lossy capacitive sensors where the resistance and capacitance are in series, in

the electrical equivalent circuit.

To measure 𝐶12 , the same two modes of operation, mode - 𝑅𝑥 and mode - (𝑅𝑟𝑒𝑓 + 𝑅𝑥 )

are used. The only difference is that in each mode an additional measurement

corresponding to a different threshold 𝑉𝑇𝐿𝑛𝑒𝑤 is made, i.e. in each mode, two

measurements are made, namely, one corresponding to 𝑉𝑇𝐿 and the other to 𝑉𝑇𝐿𝑛𝑒𝑤 ,

where 𝑉𝑇𝐿𝑛𝑒𝑤 < 𝑉𝑇𝐿 . This is illustrated in Fig. 5. 5.

In mode - 𝑅𝑥 , the two discharging times to be measured are: 𝑇1 for 𝐶 to discharge to

𝑉𝑇𝐿 , and 𝑇1𝑛𝑒𝑤 for 𝐶 to discharge to 𝑉𝑇𝐿𝑛𝑒𝑤 . To determine 𝑇1𝑛𝑒𝑤 , 𝑉𝑇𝐿 and 𝑇1 in (5. 2)

are replaced with 𝑉𝑇𝐿𝑛𝑒𝑤 and 𝑇1𝑛𝑒𝑤 , respectively:

𝑉𝑇𝐿𝑛𝑒𝑤 = 𝑉𝐹 𝑒 −𝑇1𝑛𝑒𝑤 ⁄𝑅𝑥 𝐶𝑒𝑞 (5. 8)

Dividing (5. 2) by (5. 8), taking logarithm and re-arranging, gives:

𝑉𝑇𝐿
𝑇1𝑛𝑒𝑤 − 𝑇1 = 𝑅𝑥 𝐶𝑒𝑞 ln (𝑉 ) (5. 9)
𝑇𝐿𝑛𝑒𝑤

Similarly, in mode - (𝑅𝑟𝑒𝑓 + 𝑅𝑥 ), in addition to measuring the discharging time 𝑇2 from

the decaying exponential curve given in (5. 4), 𝑇2𝑛𝑒𝑤 is measured based on (5. 10).

𝑉𝑇𝐿𝑛𝑒𝑤 = 𝑉𝐹 𝑒 −𝑇2𝑛𝑒𝑤 ⁄(𝑅𝑟𝑒𝑓 +𝑅𝑥 )𝐶𝑒𝑞 (5. 10)

Further, from (5. 4) and (5. 10), (5. 11) is arrived at, as shown below.

117
𝑉𝑇𝐿
𝑇2𝑛𝑒𝑤 − 𝑇2 = (𝑅𝑟𝑒𝑓 + 𝑅𝑥 )𝐶𝑒𝑞 ln (𝑉 ) (5. 11)
𝑇𝐿𝑛𝑒𝑤

The selection of the threshold voltages 𝑉𝑇𝐿 and 𝑉𝑇𝐿𝑛𝑒𝑤 must be done such that,

i) The difference between 𝑉𝑇𝐿 and 𝑉𝑇𝐿𝑛𝑒𝑤 is much higher than the typical noise

level in both the signal 𝑣𝑐𝑓 and the input of the comparator.

ii) The difference in the measured time coming from (5. 9) and (5. 11) is much

greater than the resolution of the timer used.

Fig. 5. 5 Timing diagram illustrating the 𝑣𝑐𝑓 and 𝑣𝑂𝐶 waveforms, in Mode-𝑅𝑥
and Mode-(𝑅𝑥 + 𝑅𝑟𝑒𝑓 ), using two threshold voltages 𝑉𝑇𝐿 and 𝑉𝑇𝐿𝑛𝑒𝑤 .

Let 𝑇1𝑛𝑒𝑤 − 𝑇1 = ∆𝑇1 and 𝑇2𝑛𝑒𝑤 − 𝑇2 = ∆𝑇2 . Then, the difference between (5. 11) and

(5. 9) gives (5. 12).

𝑉𝑇𝐿
∆𝑇2 − ∆𝑇1 = 𝑅𝑟𝑒𝑓 𝐶𝑒𝑞 ln (𝑉 ) (5. 12)
𝑇𝐿𝑛𝑒𝑤

From (5. 12),

∆𝑇2 −∆𝑇1
𝐶𝑒𝑞 = 𝑉𝑇𝐿 . (5. 13)
𝑅𝑟𝑒𝑓 ln ( )
𝑉𝑇𝐿𝑛𝑒𝑤

Thus, using the value of 𝐶𝑒𝑞 obtained from (5.13), the value of the coupling capacitance

𝐶12 can be obtained using (5. 14).


118
𝐶𝑒𝑞 𝐶
𝐶12 = 𝐶−𝐶 (5. 14)
𝑒𝑞

The above method to measure 𝐶12 is a simple, yet efficient one. According to (5. 13),

𝐶𝑒𝑞 and hence 𝐶12 depend on 𝑉𝑇𝐿 and 𝑉𝑇𝐿𝑛𝑒𝑤 . A one-time correction to reduce the effect

of the inaccuracy of 𝑉𝑇𝐿 and 𝑉𝑇𝐿𝑛𝑒𝑤 in 𝐶12 measurement is discussed in section 5. 3. 1.

5. 3 EFFECT OF NON-IDEALITIES

The important sources of error and their effects on the final output are discussed in this

section. The input offset voltage of the comparator, inaccuracies in the threshold

voltages, variations in 𝑉𝐷𝐷 , internal resistance and parasitic capacitance of digital pins,

and resolution of the timer, are considered for the analysis.

5. 3. 1 Input Offset Voltage of Comparator and Threshold Voltage

Let 𝑉𝑂𝑆 be the input offset voltage of the comparator OC. In its presence, (5. 3) and

(5. 5) become (5. 15) and (5. 16), respectively.

𝑉𝐶𝐹
𝑇1 = 𝑅𝑥 𝐶𝑒𝑞 ln (𝑉 ) (5. 15)
𝑇𝐿 ±𝑉𝑂𝑆

𝑉𝐶𝐹
𝑇2 = (𝑅𝑟𝑒𝑓 + 𝑅𝑥 )𝐶𝑒𝑞 ln (𝑉 ) (5. 16)
𝑇𝐿 ±𝑉𝑂𝑆

Dividing (5. 16) by (5. 15) gives the same equation as (5. 6), from which 𝑅𝑥 can be

obtained as in (5. 7). Thus, the presence of 𝑉𝑂𝑆 has no impact on the determination of

𝑅𝑥 using the proposed scheme.

The same analysis holds good for the effect of variation in the threshold voltage. As

can be seen in (5. 15) and (5. 16), any change in the threshold voltage comes as an

addition or subtraction of 𝑉𝑂𝑆 . Since the measurement of 𝑅𝑥 is not affected by the

119
presence of 𝑉𝑂𝑆 , the inaccuracy of the threshold voltage does not affect the accuracy of

the final output provided that it is stable within one measurement cycle.

As for the measurement of 𝐶12 , (5. 12) becomes (5. 17).

𝑉𝑇𝐿 ±𝑉𝑂𝑆
∆𝑇2 − ∆𝑇1 = 𝑅𝑟𝑒𝑓 𝐶𝑒𝑞 ln (𝑉 ) (5. 17)
𝑇𝐿𝑛𝑒𝑤±𝑉𝑂𝑆


The resulting capacitance obtained herein can be termed as 𝐶𝑒𝑞 , and is given by (5. 18).


The corresponding coupling capacitance 𝐶12 is given in (5. 19).

′ 𝐶𝑒𝑞
𝐶𝑒𝑞 = 1+𝜖 (5. 18)

′ 𝐶𝑒𝑞 𝐶
𝐶12 = 𝐶(1+𝜖)−𝐶 (5. 19)
𝑒𝑞

In (5. 18), 𝐶𝑒𝑞 is the capacitance in the absence of 𝑉𝑂𝑆 given by (5. 13), and

1± 𝑉𝑂𝑆 ⁄𝑉𝑇𝐿
𝜖 = ln [1± ]⁄ln (𝑉𝑇𝐿 ⁄𝑉𝑇𝐿𝑛𝑒𝑤 ). For a typical 𝑉𝑂𝑆 of 10 mV, and threshold
𝑉𝑂𝑆 ⁄𝑉𝑇𝐿𝑛𝑒𝑤

voltages of 𝑉𝑇𝐿 = 500 mV and 𝑉𝑇𝐿𝑛𝑒𝑤 = 300 mV, then 𝜖 =−0.02. The value of (1 + 𝜖)

can be estimated by performing a one-time measurement using a known value of 𝐶𝑒𝑞 .

′ (1
In the later measurements, the actual 𝐶𝑒𝑞 can be calculated as 𝐶𝑒𝑞 + 𝜖), and the same

can be used to estimate 𝐶12 as in (5. 14). As can be seen in (5.17), the capacitance

measurement will be affected due to drift in the input offset voltage. To keep this effect

low, IC with low offset voltage drift needs to be selected when implemented.

As mentioned above, the effect of change in the threshold voltage can be represented

as an equivalent 𝑉𝑂𝑆 . Therefore, when compensated for the effect of 𝑉𝑂𝑆 in the 𝐶12

measurement, the effect due to inaccuracy of the threshold voltages will also get

corrected.

120
5. 3. 2 Variation in the Voltage 𝑽𝑫𝑫

The dc voltage 𝑉𝐷𝐷 provided by a digital pin in HIGH state is not derived from a

precision voltage source. Hence, variations are expected in it, e.g., 𝑉𝐷𝐷 ± ∆𝑣𝑑𝑑 , where

∆𝑣𝑑𝑑 is the variation. As one cycle measurement is completed in a very short time,

∆𝑣𝑑𝑑 is assumed to remain constant during that cycle. In such a case, as 𝑉𝐶𝐹 =

(𝑉𝐷𝐷 ± ∆𝑣𝑑𝑑 )𝐶12⁄(𝐶12 + 𝐶), (5. 3) and (5. 5) become (5. 20) and (5. 21), respectively.

(𝑉𝐷𝐷 ±∆𝑣𝑑𝑑 )𝐶12


𝑇1 = 𝑅𝑥 𝐶𝑒𝑞 ln [ ] (5. 20)
𝑉𝑇𝐿 (𝐶12 +𝐶)

(𝑉𝐷𝐷 ±∆𝑣𝑑𝑑 )𝐶12


𝑇2 = (𝑅𝑟𝑒𝑓 + 𝑅𝑥 )𝐶𝑒𝑞 ln [ ] (5. 21)
𝑉𝑇𝐿 (𝐶12 +𝐶)

(𝑉𝐷𝐷 ±∆𝑣𝑑𝑑 )𝐶12


As ln [ ] is present in both the terms, (5. 6) and the final output as per (5. 7)
𝑉𝑇𝐿 (𝐶12 +𝐶)

are not affected.

As for the measurement of 𝐶12 , the variation in 𝑉𝐷𝐷 is irrelevant since the time

differences as per (5. 9), (5. 11) and 𝐶12 as per (5. 14) do not have the term 𝑉𝐷𝐷 .

5. 3. 3 Internal Resistance of the Digital Pins

Digital pins offering zero output resistance were assumed while explaining the

operation in section 5. 2. To analyze the impact of the internal resistance 𝑅𝑖 of the digital

pin in the measurement of 𝑅𝑥 and 𝐶12 , it is assumed that identical 𝑅𝑖 is present at each

digital input pin. In reality, there may be a mismatch of about a tenth of an ohm.

In the presence of 𝑅𝑖 , the discharge time constant in mode-𝑅𝑥 is modified to

𝑅𝑖 (𝑅𝑟𝑒𝑓 +𝑅𝑖 ) 𝑅𝑖 (𝑅𝑟𝑒𝑓 +𝑅𝑖 )


( + 𝑅𝑥 ) 𝐶𝑒𝑞 . However, since ≪ 𝑅𝑥 in the prototype, the effects of
𝑅𝑟𝑒𝑓 +2𝑅𝑖 𝑅𝑟𝑒𝑓 +2𝑅𝑖

𝑅𝑖 on the time measurement are expected to be negligible. In mode - (𝑅𝑟𝑒𝑓 + 𝑅𝑥 ), the

discharge time constant becomes (𝑅𝑟𝑒𝑓 + 𝑅𝑥 + 𝑅𝑖 )𝐶𝑒𝑞 . Again, since 𝑅𝑖 ≪ (𝑅𝑟𝑒𝑓 +


121
𝑅𝑥 ), it can be neglected and thus does not significantly impact the time measurement.

On the other hand, as long as the charging time is sufficiently long (at least, five times

higher) than the charging time constant, the charging phase is negligibly affected by 𝑅𝑖 .

Consequently, in the prototype developed, the measurement of 𝑅𝑥 and 𝐶12 should not

be affected by 𝑅𝑖 .

5. 3. 4 Parasitic Capacitance of the Digital pins

Each digital pin, together with the PCB trace or cable to the sensor introduces a parasitic

capacitance from the pin to ground. The capacitances 𝐶𝑠1 , 𝐶𝑠2 , and 𝐶𝑠3 , shown in

Fig. 5. 6, represent these parasitic capacitances, respectively, from node DIO-1, DIO-2,

and DIO-3 to ground. As these parasitic capacitances are in the range of a few pF, and

the output resistance of the digital pins is in the range of tens of ohms, the discharge-

time measurements in the mode-𝑅𝑥 have negligible impact due to 𝐶𝑠1 and 𝐶𝑠2 . As 𝐶𝑠3

is in parallel to 𝐶, the effective 𝐶 will become 𝐶 + 𝐶𝑠3 , and 𝐶𝑒𝑞 will get modified as

𝑠3 𝐶12 (𝐶+𝐶𝑠3 )
𝐶𝑒𝑞 = . Since 𝐶𝑒𝑞 is not present in the estimation of 𝑅𝑥 as in (5. 7), there will
𝐶12 +𝐶+𝐶𝑠3

be no effect.

In the case of mode-(𝑅𝑟𝑒𝑓 + 𝑅𝑥 ), there are two discharging events happening

simultaneously: (a) discharging of 𝐶𝑠2 through 𝑅𝑟𝑒𝑓 to ground, and (b) discharging of

𝑠3 𝑠3
𝐶𝑒𝑞 through (𝑅𝑟𝑒𝑓 + 𝑅𝑥 ). Since the time constant 𝐶𝑠2 𝑅𝑟𝑒𝑓 ≪ 𝐶𝑒𝑞 (𝑅𝑟𝑒𝑓 + 𝑅𝑥 ), it does

not affect the discharging along the main discharge path (b). To keep the effect of 𝐶𝑠3

very low, the condition 𝐶𝑠3 ≪ 𝐶 should be ensured. As 𝐶 is in nF and 𝐶𝑠3 is in pF, the

effect in 𝐶𝑒𝑞 and 𝐶12 is expected to be negligible.

122
Fig. 5. 6 The parasitic capacitances 𝐶𝑠1 , 𝐶𝑠2 , and 𝐶𝑠3 at the digital input pins.

5. 3. 5 Resolution of the Timer

The resolution of the timer embedded into the microcontroller plays an important role

in the final accuracy. In the prototype developed, the timer has a resolution of 62.5 ns,

and the time interval under measurement is in the range of a few hundred microseconds

for the 𝑅𝑥 measurement. In the case of 𝐶12 measurement, the time difference estimated

as per (5. 9), (5. 11) is in the range of tens of microseconds. Therefore, the limited

resolution of the timer will have more effect on the accuracy of the 𝐶12 measurement.

To achieve higher accuracy, a timer with a higher resolution is recommended.

5. 4 EXPERIMENTAL SETUP AND RESULTS

The hardware prototype of the proposed scheme, presented in Fig. 5. 2(b), was realized

in two steps, for the measurement of both 𝑅𝑥 and 𝐶12 . In the first step, a prototype was

developed to test the feasibility of the approach without using a microcontroller. For

123
this, a data acquisition system (DAS), namely Analog Discovery kit (14-bit resolution,

100 MS/s sampling rate) from Digilent, and a Virtual Instrument (VI), developed using

NI LabVIEW, were used. The function generator, included in the DAS, was

programmed to generate the HIGH and LOW state signals as required in the two modes

of measurement given in Table 5. 1 and Fig. 5. 3. As indicated in Table 5.1, DIO-1 can

be in HZ/high in state-1, and HZ/low in state-2. During the experimental tests, it was

kept high during state-1 and low in state-2. In this DAS, the operation of the function

generator is independent of the other operations, e.g., digitization, data transfer, etc.

Thus, the signal at node ‘b’ was digitized using the DAS and analyzed, as described

below. In the second step, a microcontroller-based prototype was developed and tested.

In this case, the two modes of measurement were realized by setting the microcontroller

pins in accordance with Table 5. 1 and Fig. 5. 3. The components used to build the

prototypes are listed in Table 5. 2. A photograph of the experimental setup is shown in

Fig. 5. 7.

Table 5. 2 Components and ICs used in the Direct-µC Interface Prototype

5. 4. 1 Measurement of 𝑹𝒙 using DAS-based Prototype

This prototype to assess the practicality of the measurement scheme, was developed in

such a way that its performance was not limited by the non-idealities of the

microcontroller. To this end, the functionality of the proposed circuit given in

Fig. 5. 2(b) was realized in hardware with the help of a data acquisition system (DAS).
124
First, the mode - 𝑅𝑥 was implemented. For this, the function generator was set to give

a square wave (with a frequency of 200 Hz, amplitude of 5 V, and an offset of 2.5 V)

emulating the function of pin DIO-1. In addition, 𝑅𝑟𝑒𝑓 was shorted with a wire in order

to measure only 𝑅𝑥 . Node ‘b’ was connected to the input of a voltage follower, built

using a very low bias current opamp (LF357), whose output was given to the DAS. The

analog channels of the DAS were used to acquire important waveforms. The

connections to the DAS were made such that channel-1 captured the signal at DIO-1,

whereas channel-2 captured 𝑣𝑐𝑓 at the output of the voltage follower. To operate in

mode - ( 𝑅𝑥 + 𝑅𝑟𝑒𝑓 ), the short across 𝑅𝑟𝑒𝑓 was removed. The developed system

enables performing mode - 𝑅𝑥 and mode - ( 𝑅𝑥 + 𝑅𝑟𝑒𝑓 ) independently and acquires

the corresponding 𝑣𝑐𝑓 waveforms.

A VI was accordingly developed, using LabVIEW, to acquire the signals from the DAS

and process them, as described further. For a chosen value of 𝑅𝑥 , the 𝑣𝑐𝑓 data during

the discharge phase was analyzed. The VI was programmed to perform an exponential

fit of the 𝑣𝑐𝑓 data and provide the parameters representing the decaying exponential

curve to compute 𝑇1 .

For this computation, 𝑉𝑇𝐿 = 300 mV. Then, the 𝑣𝑐𝑓 data corresponding to mode - ( 𝑅𝑥 +

𝑅𝑟𝑒𝑓 ) was taken and processed to compute 𝑇2 for the same 𝑉𝑇𝐿 . Once 𝑇1 and 𝑇2 were

computed, the value of 𝑅𝑥 was calculated by the VI using (5.7). This experiment was

repeated for a range of 𝑅𝑥 from 100 k to 500 k, in several steps. Later, this study

was repeated for 50 k, 700 k and 800 k and the accuracy was within the same

125
Fig. 5. 7 Photograph of the experimental set-up.

range. The coupling capacitors used in this study were 𝐶1 = 𝐶2 = 4 nF, thus resulting in

𝑉𝐶𝐹 = 3.3 V. In each measurement, the actual value of 𝑅𝑥 was measured using a 6 ½

digit multi-meter, 34410A, from Agilent Technologies. This has an accuracy of the sum

of 0.012% of the range set (1 M) and 0.001% of the reading. This was used to compute

the error introduced by the proposed method. The results are shown in Fig. 5. 8. The

maximum error (expressed as a percentage of the full scale, %FS) noted during the

experiments was 0.28%, indicating the high accuracy of the proposed approach,

although its simplicity.

As mentioned in section 5.1, for the potential tap water conductivity monitoring

example, in the conductivity range of 50-800 𝜇S/cm [42], the resistance range of the

water column of interest lies in the range between 50 kΩ and 750 kΩ; when the distance

between the electrodes is 12 cm and the inner diameter of the insulating tube is

6.35 mm. The range can vary or adjusted by adjusting the distance between the

126
electrodes. As described above, to study the performance of the proposed measurement

scheme, the value of 𝑅𝑥 was incremented in several steps within that range. For low

values of 𝑅𝑥 (say, lower than 1 k) with a coupling capacitance of 2 nF [28], the

discharge time will be very short and the resolution of the timer embedded into the

ATmega328 would not be sufficient to accurately measure it. Thus, for the proposed

design using the ATmega328, the range of 𝑅𝑥 should be such that the discharge time is

sufficiently long for the embedded timer to measure accurately. Once the range of 𝑅𝑥

was fixed, 𝑅𝑟𝑒𝑓 was chosen so that (𝑇2 − 𝑇1 ) is much longer than the timer resolution.

In addition, 𝑅𝑟𝑒𝑓 was set lower than 𝑅𝑥 , to avoid an unnecessary increase of the overall

measurement time. As there is limitation on the resolution of the inbuilt timer, it is

beneficial for the measurement system to have larger values of 𝑅𝑥 . But when dealing

with higher values of 𝑅𝑥 , it shall not be comparable to the leakage resistances (e.g.

20 MΩ) of the capacitors used. The limiting factor when using large resistors is that of

self-discharge.

Fig. 5. 8 Results from the DAS-based prototype of direct-µC interface for a range
of 𝑅𝑥 . The output and error obtained are shown.

127
128
Fig. 5. 9 𝑣𝑐𝑓 and DIO-1 waveforms recorded, using DAS, from the direct-µC interface prototype during the measurement process. States
0 to 6 correspond to 𝑅𝑥 measurement while 1’ , 2’ , 3’ , 4’ , and 5’ correspond to the cycles used for 𝐶12 measurement.
5. 4. 2 Measurement of 𝑹𝒙 using Microcontroller-based Prototype

In this experiment, instead of using the DAS and the VI as before, the scheme was

entirely realized using a microcontroller as given in Fig. 5. 2(b), supplied at 5 V. The

signal 𝑣𝑐𝑓 was given to node A1 of the microcontroller, and the built-in timer was

programmed to measure, with a timing resolution of 62.5 ns, the time intervals 𝑇1 and

𝑇2 during the corresponding states ‘2’ and ‘5’, respectively, as given in Table 5.1. The

important waveforms were recorded using the oscilloscope in Analog Discovery kit,

for the charge and discharge cycles for mode - 𝑅𝑥 followed by mode - ( 𝑅𝑥 + 𝑅𝑟𝑒𝑓 ),

as shown in Fig. 5. 9; note that states ‘1’’ to ‘5’’ in Fig. 5. 9 correspond to 𝐶12

measurement presented in sections 5. 4. 3 and 5. 4. 4. The experiment was repeated for

the same set of values of 𝑅𝑥 employed in section 5. 4. 1. The value of 𝑅𝑥 in each case,

and the corresponding error in %FS, was computed and is presented in Fig. 5. 10. The

maximum error noted during the experiments was 0.91%. The output of this

experiment, in comparison with that from section 5. 4. 1, reflects the effect of the non-

idealities of the components and ICs used in the microcontroller-based prototype.

5. 4. 3 Measurement of 𝑪𝟏𝟐 using DAS-based Prototype

This testing approach is similar to the one used to prove the feasibility to measure 𝑅𝑥 .

In this study, the signal at DIO-1 was generated using the function generator in the

Analog Discovery kit, serving as DAS. This signal and 𝑣𝑐𝑓 at node 𝑏 were recorded

using the same DAS. This data was provided to the VI developed in section 5. 4. 1, to

perform an exponential fit of the 𝑣𝑐𝑓 data and provide the parameters. It was modified

to compute the time intervals 𝑇1 and 𝑇1𝑛𝑒𝑤 for 𝑉𝑇𝐿 = 500 mV and 𝑉𝑇𝐿𝑛𝑒𝑤 = 300 mV,

respectively. Afterwards, using the same procedure, 𝑇2 and 𝑇2𝑛𝑒𝑤 were determined.

Once the time values were computed, the value of 𝐶12 was calculated by the VI using

129
(5. 14). In these tests, 𝑅𝑥 was kept constant at 100 k and 𝐶12 was varied in steps of

200 pF within the range from 1 nF to 3 nF. The actual values were measured using an

LCR meter (HP 4274A) that has an accuracy of 0.1%. The results obtained are shown

in Fig. 5. 11. The maximum error (full scale) noted from the experiments was −0.96%.

5. 4. 4 Measurement of 𝑪𝟏𝟐 using Microcontroller-based Prototype

To perform and verify the accuracy of the microcontroller-based measurement of 𝐶12 ,

as presented in section 5.2.2., the program for the prototype developed using the

ATMega328 microcontroller to test the measurement of 𝑅𝑥 was modified. A new cycle

was included in each of the modes, to measure 𝐶12 , along with 𝑅𝑥 . Thus, now there are

four time measurements, two in each of the two modes of operation. The operations of

the digital pins DIO-1, DIO-2, and DIO-3 are identical in both the cycles present in the same

mode. The only change is in the threshold (𝑉𝑇𝐿𝑛𝑒𝑤 ) used in the new cycles. The

following modes were executed: mode-𝑅𝑥 with 𝑉𝑇𝐿 = 500 mV, followed by the same

mode with 𝑉𝑇𝐿𝑛𝑒𝑤 = 300 mV, and then mode-(𝑅𝑥 + 𝑅𝑟𝑒𝑓 ) with 𝑉𝑇𝐿 = 500 mV, followed

by with 𝑉𝑇𝐿𝑛𝑒𝑤 = 300 mV, as shown in Fig. 5. 9. This was repeated for the same range

of 𝐶12 as in the DAS-based prototype. From the measured discharging times, the value

of 𝐶12 , in each case, was estimated using (5. 14). The corresponding error in each

measurement was computed, and presented in Fig. 5. 12. As can be seen, the maximum

error noted during the experiments was −2.94% (full scale). Based on the results given

in section 5. 4. 3, one can conclude that an improvement in the accuracy of the results

is possible with a higher-end microcontroller.

5. 4. 5 Noise and Resolution Study

An experimental study was conducted to evaluate the noise and resolution in the

measurements carried out by the microcontroller-based prototype. In this study, 𝑅𝑥 and

130
𝐶12 were set to 100 k and 1 nF, respectively, and 200 readings were recorded in a

continuous manner. From this data, the signal to noise ratio (SNR), standard deviation,

𝜎, effective number of bits (ENOB), and repeatability, d, were computed using the

formulae given in Table 5. 3, and presented in the same table. Accordingly, a resolution

of 8 bits is feasible for the measurement of both 𝑅𝑥 and 𝐶12 which is a remarkable value

considering the simplicity of the proposed circuit and the complexity of the sensor

circuit model.

Fig. 5. 10 Results from the microcontroller-based prototype for a range of 𝑅𝑥 .

Fig. 5. 11 Results from the DAS-based prototype for a range of 𝐶12 .

131
Fig. 5. 12 Results from the microcontroller-based prototype for the measurement
of 𝐶12 .

Table 5. 3 Noise and Resolution Study for the proposed Direct-µC Interface

Table 5. 4 Standard Deviation (SD) for a wide range of 𝑅𝑥

132
The repeatability experiment was repeated for a resistance range of 50 k to 800 k as

given in Table 5. 4. Output was recorded for a data length of hundred measurements,

for each resistor, and the corresponding standard deviation (SD) was computed. As

presented in Table 5. 4, the SD is in the range of 0.301 k to 0.305 k for all the

resistors tested.

Later, the experiment was continued for 100 k, for 12 hrs. In this, the microcontroller

was powered all the time and hundred measurements were recorded for every one hour

and the corresponding SD was computed. This data is presented in Table 5. 5. Again,

not much variation in the SD of the measured outputs is observed throughout the day.

Table 5. 5. SD for 100 k measurement at twelve intervals

5. 5 DISCUSSION

When resistance and capacitance in series to be measured, other than the conventional

bridge-based ones [103] that require manual balancing, a widely used method is

synchronous demodulation [2]. This requires precision sinewave excitation,

multipliers, low pass filters, followed by digitizer and a processor for computation. A

slightly optimized version of this mechanism is available in [113]. It is still complex,

as it requires an on-board digital signal processing engine to compute discrete Fourier

transform of the digitized signal. The demodulation approach gives high accuracy but

complex considering the number of individual units required, to implement analog

133
multiplication, and overall power consumption. A scheme based on modified Martin

oscillator is presented in [114] for impedance measurement. This requires a precision

current source. The oscillator has to be operated in four different modes, and then the

values of resistance and capacitance are computed from the four oscillator time periods

measured. This method is complex and it is a time-consuming measurement process

compared to the direct-microcontroller approach presented in this chapter. There are

several schemes available for the measurement of capacitance [38], [115] and resistance

[103], [116] but none of these are useful to measure resistance from a capacitively-

coupled resistance.

In the literature, there are direct-microcontroller interfaces for the measurement of a

single component: resistance in [97], [107]-[109], [117]-[119], capacitance in [23],

[43], and inductance in [110], [111]. In [120] both resistance and capacitance were

measured, but for a lossy capacitive sensor where resistance and capacitance are in

parallel.

The capacitively-coupled resistive sensor has not been explored so far from the

perspective of designing a direct-microcontroller interface as can be seen from the data

given in Table 5. 6. A previous work [112] by the authors deals with a suitable circuit

for such a sensor, but it was designed to measure only the resistance. In some

applications, however, the value of the capacitance that is in series with the resistive

sensor carries useful information. Therefore, it will be advantageous if the same

interface could measure both resistance and capacitance. In this context, it is for the

first time that a direct-microcontroller interface able to measure both components in a

capacitively-coupled resistive sensor has been developed and evaluated. The proposed

method of estimating the coupling capacitance 𝐶12 does not require any additional

134
hardware compared to the initial study presented in [112]. Since the direct

microcontroller interface is simple, robust, low-cost, and consumes less power [98], it

offers the opportunity to realize portable and scalable measurement systems that can be

widely used for this type of sensor.

As presented in Table 5. 6, the new scheme offers a performance which is almost on

par with the schemes (without special calibration) available to individually measure

resistance and capacitance, whilst providing a direct-microcontroller method to

measure both when connected in series. This functionality is achieved without

additional components or parts in the measurement system.

Table 5. 6. Comparison Table for the proposed Direct-µC Interface

135
5. 6 CONCLUSION

The direct microcontroller interface for capacitively-coupled resistive sensors,

presented in this chapter, measuring both the resistance and the coupling capacitance,

has been attempted for the first time. The measured resistance output is independent of

the values of the coupling capacitances, the charging capacitor, the dc excitation

voltage, and the preset threshold voltage. When a resistive sensor is coupled to the

measurement system through capacitances, one of the main challenges is to make the

resistance measurement insensitive to variations in the coupling capacitances, which is

achieved herein without using the synchronous demodulation technique adopted by

conventional approaches. The proposed circuit is simple in design and completes both

measurements in 10 ms. The feasibility study of the proposed circuit for resistance and

coupling capacitance measurements, exhibits maximum errors of 0.28% and 0.96%,

respectively, when evaluated without considering the non-idealities of the

microcontroller. In the practical setup, maximum error noted for resistance

measurement is 0.91%, and that for the coupling capacitance is 2.94%. Higher accuracy

can be achieved by selecting a microcontroller with more appropriate specifications.

The proffered scheme employs only a simple microcontroller and a few passive

components and hence can realize a low-cost, low-power measurement system. Thus,

the proposed measurement circuit offers an attractive choice for a simple, yet efficient,

interface to be widely used in non-intrusive sensing and monitoring applications based

on capacitively-coupled resistive sensors. A summary of the work done in this thesis is

presented in the next chapter.

136

You might also like