Next Article in Journal
Energy Efficient Bootstrapped CMOS Large RC-Load Driver Circuit for Ultra Low-Voltage VLSI
Next Article in Special Issue
Fully Integrated Solar Energy Harvester and Sensor Interface Circuits for Energy-Efficient Wireless Sensing Applications
Previous Article in Journal
Power Scalable Radio Receiver Design Based on Signal and Interference Condition
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Review

The Art of Directly Interfacing Sensors to Microcontrollers

Castelldefels School of Technology, Universitat Politècnica de Catalunya, C/Esteve Terradas, 7, Castelldefels 08860, Barcelona, Spain
J. Low Power Electron. Appl. 2012, 2(4), 265-281; https://0-doi-org.brum.beds.ac.uk/10.3390/jlpea2040265
Submission received: 24 September 2012 / Revised: 17 October 2012 / Accepted: 19 November 2012 / Published: 29 November 2012
(This article belongs to the Special Issue Energy Efficient Sensors and Applications)

Abstract

:
This paper reviews the direct connection of sensors to microcontrollers without using any analogue circuit (such as an amplifier or analogue-to-digital converter) in the signal path, thus resulting in a low-cost, lower-power sensor electronic interface. It first discusses the operating principle and explains how resistive and capacitive sensors with different topologies (i.e., single, differential and bridge type) can be directly connected to a microcontroller to build the so-called direct interface circuit. It then shows some applications of the proposed circuits using commercial devices and discusses their performance. Finally, it deals with the power consumption and proposes some design guidelines to reduce the current consumption of such circuits in active mode.

1. Introduction

Just as human beings acquire information about their environment through their senses and process such information using their brain, electronic systems perform such functions by means of sensors and processing digital devices such as microcontrollers (μC) or microprocessors (μP). Nowadays, such small but smart devices have become essential in many fields (industrial, automobiles, aircraft, medical devices, consumer electronics, home appliances, etc.) so that it is hard to imagine a society without them.
Figure 1(a) shows the classical block diagram of a sensor electronic interface [1]. First of all, the sensor transforms a signal from a given energy domain (such as thermal, magnetic, mechanical, chemical or radiant) to the electrical domain by changing—for example—its electrical resistance or capacitance. Afterwards, the signal conditioning circuit, which generally relies on operational amplifiers (OpAmp), performs some or all of the following tasks in the analogue domain: sensor output-to-voltage conversion, amplification, filtering, linearization and/or demodulation. The resulting analogue signal is then digitized via an analogue-to-digital converter (ADC). Finally, a digital system (e.g., a μC) acquires, stores, processes, controls, communicates (to other devices or systems) and/or displays the digital value with information about the measurand.
Figure 1. (a) Classical sensor electronic interface; (b) Direct interface circuit.
Figure 1. (a) Classical sensor electronic interface; (b) Direct interface circuit.
Jlpea 02 00265 g001
Nowadays, several blocks, as shown in Figure 1(a), can be embedded into the same integrated circuit (IC). There are commercially available ICs that integrate the processing digital system, the ADC and/or some signal conditioning circuit; for instance, MSC1210 from Texas Instruments (TI). There are also commercial ICs that integrate the sensor, its signal conditioning circuit and/or the ADC; for example, ADXL103 and ADXL312 accelerometers from Analog Devices; such chips are usually known as integrated smart sensors [2]. Other commercial ICs integrate the required signal conditioning circuit and the ADC to measure a specific type of sensor; for instance, ADS1232 from TI for bridge-type resistive sensors and AD7745 from Analog Devices for single and differential capacitive sensors.
For some sensors, however, the block diagram in Figure 1(a) can be simplified to that shown in Figure 1(b) [3], where the sensor is directly connected to the digital system without using either the signal conditioning circuit or the ADC; these circuits were initially proposed in application notes of μC’s manufacturers [4,5,6]. In such a circuit topology (so-called direct interface circuit), the μC appropriately excites the analogue sensor to get a signal (usually, a time-modulated signal) that can be directly measured in the digital domain, for instance, using an embedded digital timer; such output signals are also known as quasi digital since the analogue information (e.g., period or time interval) can be directly measured by a digital system. In comparison with the sensor electronic interface shown in Figure 1(a), a direct interface circuit is simpler and needs less components; actually, it just needs a common low-cost general-purpose 8-bit μC. Therefore, a direct interface circuit has advantages in terms of cost, physical space and power consumption, which is of major interest, for instance, in battery-powered measurement systems such as autonomous sensors. Furthermore, as will be shown along this paper, the performance of such circuits is quite remarkable taking into account their simplicity.
This paper reviews most of the work carried out about direct interface circuits and is organized as follows. Section 2 describes the operating principle of such circuits. Section 3 and Section 4 explain how these circuits can be used to measure different topologies of resistive and capacitive sensors, respectively, and then discuss their performance. Section 5 deals with the power consumption and proposes some design guidelines to reduce the current consumption. Finally, Section 6 takes some conclusions and forecasts the future research work about this topic.

2. Operating Principle

Two measurement methods have been proposed so far to build the direct interface circuit shown in Figure 1(b):
  • Direct interfaces based on a RC circuit [3], where the μC measures the time interval needed to charge (or discharge) a capacitance C to a given threshold voltage through a resistance R; this method has been applied to measure resistive and capacitive sensors.
  • Direct interfaces based on charge transfer [7,8], where the μC counts the number of charge-transfer cycles needed to charge a reference capacitor to a given threshold voltage via a capacitive sensor; this method has been applied only to measure capacitive sensors.
Most of the research work about direct interfaces has been focused on those based on RC circuits, whose basics are explained by means of Figure 2.
Figure 2. (a) RC circuit; (b) Charging process; (c) Discharging process.
Figure 2. (a) RC circuit; (b) Charging process; (c) Discharging process.
Jlpea 02 00265 g002
If C is initially discharged and a step of amplitude V1 is applied at the input, the output voltage is [see Figure 2(b)]:
Jlpea 02 00265 i001
and the time required to charge C from 0 to a given high threshold voltage (VTH) is:
Jlpea 02 00265 i002
which is proportional to R and C. On the other hand, if C is already charged to V1 and a step towards ground is applied at the input, the output voltage is [see Figure 2(c)]:
Jlpea 02 00265 i003
and the time needed to discharge C from V1 to a given low threshold voltage (VTL) is:
Jlpea 02 00265 i004
which again is proportional to R and C. According to (4), if C, V1 and VTL are known and Td is measured, then the resistance of the RC circuit could be estimated by R = Td/(Cln(V1/VTL)).
The RC circuit in Figure 2(a) can be directly connected to a μC using the circuit topologies shown in Figure 3(a) and Figure 4(a). In Figure 3(a), R has been replaced by Rx (i.e., a resistive sensor) and C by Cd (i.e., a capacitor whose nominal value is known), whereas in Figure 4(a), C has been replaced by Cx (i.e., a capacitive sensor) and R by Rd (i.e., a resistor whose nominal value is known). Pins 1 and P are two input/output digital port pins. Pin 1, which is in charge of monitoring the exponential charging or discharging voltage, usually includes a Schmitt trigger (ST) buffer (with two threshold voltages) and should be associated to an external interrupt or a capture module. The circuits in Figure 3(a) and Figure 4(a) can measure either the charging time or the discharging time of the RC circuit, but the measurement of the latter is more recommended since it has lower variability. This is because the discharging-time measurement uses the low threshold voltage (VTL) of the ST buffer, which is less noisy [9] than the high threshold voltage (VTH) used for the charging-time measurement.
Figure 3. (a) Basic direct interface circuit for a resistive sensor (Rx); (b) Pin configuration during the charging stage; (c) Pin configuration during the discharging stage.
Figure 3. (a) Basic direct interface circuit for a resistive sensor (Rx); (b) Pin configuration during the charging stage; (c) Pin configuration during the discharging stage.
Jlpea 02 00265 g003
Figure 4. (a) Basic direct interface circuit for a capacitive sensor (Cx); (b) Pin configuration during the charging stage; (c) Pin configuration during the discharging stage.
Figure 4. (a) Basic direct interface circuit for a capacitive sensor (Cx); (b) Pin configuration during the charging stage; (c) Pin configuration during the discharging stage.
Jlpea 02 00265 g004
The circuit in Figure 3(a), which is for the measurement of resistive sensors, involves two operation stages: charging stage, and discharging and measurement stage. During the charging stage [see Figure 3(b)], Pin 1 is set as an output providing a digital “1”, whereas Pin P is set as an input offering high impedance (HZ). Therefore, the capacitor Cd is quickly charged to the analogue output voltage (V1) corresponding to a digital “1”, which is generally equal to the supply voltage (VDD). During the discharging and measurement stage [see Figure 3(c)], Pin 1 is set as a HZ input and Pin P is set as an output providing a digital “0” and, consequently, Cd is discharged towards ground through Rx while the embedded timer measures the time interval required to do so; such a measurement is carried out using a high-frequency oscillator (with a period TS) as a reference. When the exponential discharging voltage crosses VTL, the timer is read and a digital number proportional to Rx [see Equation (4)] is achieved. The resulting waveform of the voltage across Cd is similar to that shown in Figure 2(c).
For the measurement of a capacitive sensor (Cx), it is recommended to swap the position of the resistance and the capacitance, as shown in Figure 4(a), but again two operation stages are required. During the charging stage [see Figure 4(b)], both pins are set as an output: Pin 1 provides a digital “1”, whereas Pin P provides a digital “0”. Therefore, Cx is rapidly charged to V1. During the discharging and measurement stage [see Figure 4(c)], Pin 1 is set as a HZ input and Pin P does not change its state and, consequently, Cx is discharged towards ground through the resistor Rd while the timer is running. When the voltage-threshold crossing is detected [see Figure 2(c)], the timer is read and a digital number proportional to Cx [see Equation (4)] is achieved.

3. Circuits for Resistive Sensors

The operating principle explained in Figure 3 can be applied to measure different topologies of resistive sensor. Before discussing the proposed circuit for each sensor topology, following are a few general remarks on the components required:
  • The capacitor Cd is determined by a speed-resolution trade-off [10], but for TS = 250 ns it is advisable to operate with a time constant (R·C) of about a few units of millisecond. For instance, the measurement of a resistive sensor of 1 kΩ should use a Cd of a few units of microfarad (e.g., 2.2 μF).
  • It is recommended to use an additional resistor Ri between Pin 1 and Node 1 [see Figure 3(a)], which improves the rejection of power supply noise/interference [9] but at the expense of a longer charging stage. The cut-off frequency of the low-pass filter determined by Ri and Cd (during the charging stage) should be as low as possible but with a reasonable length of the charging process (say, less than 1 ms). For example, if Cd = 2.2 μF then Ri < 100 Ω.
  • It is also advisable to use an additional resistor Rs between Node 1 and Rx in order to ensure that the discharging current is smaller than the maximum output current (Imax) sunk by a port pin even when Rx is small; accordingly, direct interface circuits could also measure low-value resistive sensors such as metal strain gauges. Assuming VDD = 5 V and Imax = 25 mA, then Rs > 200 Ω.

3.1. Single Resistive Sensor

Single resistive sensors have one sensing element whose resistance Rx ( = R0 (1 + xR)) changes with the measurand; R0 is the nominal resistance at a reference value of the measurand and xR is the relative change of resistance (i.e., ∆R/R0) due to the measurand. These sensors are commonly used to measure temperature (e.g., platinum sensors and thermistors), light (e.g., light-dependent resistors, LDR), gas (e.g., tin dioxide gas sensors) and humidity. The direct interface circuit proposed to measure such a type of sensor is shown in Figure 5(a) [11], which applies the three-signal auto-calibration technique [12] to have a measurement result insensitive to both multiplicative and additive parameters of the circuit. Accordingly, three discharging-time measurements are carried out:
  • (a) Sensor measurement, which is intended to measure Rx.
  • (b) Reference measurement, which is intended to measure a reference resistor (Rref).
  • (c) Offset measurement, which is intended to measure the offset brought about by the internal resistance (Rpin) of the port pins of the μC; such a resistance is assumed here to be the same for all the port pins but actually there is a mismatch of about a few tenths of ohm that generates offset and gain errors [11].
Figure 5. Direct interface circuit for (a) single resistive sensor; (b) differential resistive sensor; (c) bridge-type resistive sensor.
Figure 5. Direct interface circuit for (a) single resistive sensor; (b) differential resistive sensor; (c) bridge-type resistive sensor.
Jlpea 02 00265 g005
Table 1 summarizes the state of pins 2, 3 and 4 during the discharging stage and the resulting discharging time for each of the three measurements, where kR = Cd ln(V1/VTL). Using the three discharging times (Tx, Tref and Toff), the sensor resistance can be estimated by
Jlpea 02 00265 i005
which is insensitive to the tolerance and low-frequency variability of Cd, V1 and VTL.
Table 1. Pins configuration and discharging time for each of the measurements carried out by the circuit in Figure 5(a).
Table 1. Pins configuration and discharging time for each of the measurements carried out by the circuit in Figure 5(a).
MeasurementPin 2Pin 3Pin 4Discharging time
Sensor“0”HZHZTx = kR(Rs + Rx + Rpin)
ReferenceHZHZ“0”Tref = kR(Rs + Rref + Rpin)
OffsetHZ“0”HZToff = kR(Rs + Rpin)

3.2. Differential Resistive Sensor

Differential resistive sensors have two sensing elements Rx1 ( = R0 (1 + xR)) and Rx2 ( = R0 (1 − xR)) that share a terminal and undergo opposite changes, i.e., if Rx1 increases with the measurand then Rx2 decreases and vice versa. Such sensors are frequently applied to measure linear or angular position/displacement, pressure (e.g., sensors based on Bourdon tubes), liquid level (e.g., float-based sensors) and magnetic field. The direct interface circuit proposed to measure such a type of sensor is shown in Figure 5(b) [13], which also performs three discharging-time measurements:
  • (a) Sensor measurement #1, which is intended to measure Rx1.
  • (b) Sensor measurement #2, which is intended to measure Rx2.
  • (c) Offset measurement, which is intended to measure Rpin.
The state of pins 2, 3 and 4 during the discharging stage and the discharging time for each of the three measurements is summarized in Table 2. By means of these three discharging times (T1, T2 and Toff), the parameter xR of the differential sensor can be estimated by
Jlpea 02 00265 i006
Note that here it is better to estimate the measurand using xR rather than Rx1 (or Rx2), since Rx1 (or Rx2) can be altered by undesired inputs such as temperature, thus causing multiplicative errors. Unlike the measurement of single resistive sensors, xR can be estimated without using any reference resistor.
Table 2. Pins configuration and discharging time for each of the measurements carried out by the circuit in Figure 5(b).
Table 2. Pins configuration and discharging time for each of the measurements carried out by the circuit in Figure 5(b).
MeasurementPin 2Pin 3Pin 4Discharging time
Sensor #1HZ“0”HZT1 = kR(Rs + Rx1 + Rpin)
Sensor #2HZHZ“0”T2 = kR(Rs + Rx2 + Rpin)
Offset“0”HZHZToff = kR(Rs + Rpin)

3.3. Bridge-Type Resistive Sensor

Bridge-type resistive sensors have one, two or four sensing elements in a Wheatstone bridge, thus resulting in quarter-bridge, half-bridge or full-bridge sensor, respectively. These sensors are commonly used to measure weight (e.g., load cells based on metal strain gauges), pressure (e.g., sensors based on semiconductor strain gauges) and magnetic field (e.g., anisotropic (AMR) and giant (GMR) magnetoresistive sensors). The direct interface circuit proposed to measure such a type of sensor is shown in Figure 5(c) [14], which performs four discharging-time measurements (T1, T2, T3 and Toff) by applying the pins configuration indicated in Table 3. Accordingly, for a full-bridge topology with Rx1 = Rx4 = R0(1+xR) and Rx2 = Rx3 =R0(1 xR), the parameter xR of the sensor can be estimated by
Jlpea 02 00265 i007
For other bridge topologies, xR can be estimated using other time-based equations [14]. Furthermore, for sensors whose output is temperature dependent (e.g., piezoresistive pressure sensors), the result obtained from (7) can be corrected by estimating the temperature by means of the sensor itself [15].
Table 3. Pins configuration and discharging time for each of the measurements carried out by the circuit in Figure 5(c). Note that RA || RB = (RA·RB)/(RA + RB).
Table 3. Pins configuration and discharging time for each of the measurements carried out by the circuit in Figure 5(c). Note that RA || RB = (RA·RB)/(RA + RB).
MeasurementPin 2Pin 3Pin 4Pin 5Discharging time
Sensor #1HZ“0”HZHZT1 = kR[Rs + (Rx4 || (Rx1+ Rx2+ Rx3)) + Rpin]
Sensor #2HZHZ“0”HZT2 = kR[Rs + ((Rx3 + Rx4) || (Rx1+ Rx2)) + Rpin]
Sensor #3HZHZHZ“0”T3 = kR[Rs + (Rx2 || (Rx1+ Rx3+ Rx4)) + Rpin]
Offset“0”HZHZHZToff = kR(Rs + Rpin)

3.4. Applications and Results

The direct interface circuits for resistive sensors shown in Figure 5 have been applied to measure many physical and chemical quantities, for instance: temperature [11], magnetic field [14], atmospheric pressure [16,17], tactile pressure [18], gas [19] and light [20]. Table 4 summarizes the performance of such direct interface circuits in some of the previous applications using different commercial μCs.
Table 4. Applications and results of the direct interface circuits for resistive sensors shown in Figure 5.
Table 4. Applications and results of the direct interface circuits for resistive sensors shown in Figure 5.
Reference[11][13][14]
μCPIC16F873(1) at 5 V–20 MHzAVR ATtiny2313(2) at 5 V–20 MHzMSP430F123(3) at 3 V–4 MHz
Sensor Temperature sensor (Pt 1000) with a single topologyPotentiometric sensor (1 kΩ) with a differential topologyMagnetoresistive sensor (HMC1052(4)) with a full-bridge topology
Interface circuitFigure 5(a) with Rref = 1470 Ω, Rs = 330 Ω and Cd = 2.2 μFFigure 5(b) with Rs = 470 Ω, Ri = 100 Ω and Cd = 470 nFFigure 5(c) with Ri = 120 Ω and Cd = 2.2 μF
Meas. range[−45,120] °C[−100,100]%(5)[75,600] μT
Max. non-linearity error0.01% FSS0.01% FSS1.8% FSS
ENOB (for a given measuring time)11 b (5 ms) 12.5 b (50 ms)11.5 b (1 ms) 13 b (100 ms)7 b (50 ms)
(1) From Microchip. (2) From Atmel. (3) From Texas Instruments. (4) From Honeywell. (5) Such a range means that the movable common terminal of the potentiometric sensor moves from one end to the other. FSS stands for Full-Scale Span, and ENOB stands for Effective Number Of resolution Bits.
The values of non-linearity and resolution shown in Table 4 for the first two cases [11,13] are quite remarkable taking into account the simplicity of such interface circuits; actually, the results from [13] are comparable to (and even better than) those specified in [21,22], where a relaxation oscillator is used between the sensor and the μC. In these two cases [11,13], the non-linearity error is mainly due to the effects of quantization in the discharging-time measurement, whereas the resolution is determined by the effects of both quantization and noise/interference affecting the voltage-threshold crossing [see Figure 2(c)]. The experimental results for the third case in Table 4 [14], however, are not as excellent as the previous ones. On the one hand, this is due to the non-linearity of the commercial sensor tested; in other words: if the direct interface circuit in Figure 5(c) measures a bridge circuit emulated by resistors instead of such a sensor, the maximum non-linearity error of the circuit is about 0.1% FSS. On the other hand, the lower value of resolution is due to the low sensitivity of the commercial sensor. As a rule of thumb, direct interface circuits are able to detect changes of resistance of about 0.1 Ω, which is a very small value when measuring the temperature sensor [11] but not when measuring such a magnetoresistive sensor whose dynamic range is about ±6 Ω.

4. Circuits for Capacitive Sensors

Different topologies of capacitive sensor can be directly measured by a μC using the operating principle explained in Figure 4. Again, before discussing the proposed circuits, following are a few general remarks on the components required:
  • The resistor Rd is determined by a speed-resolution trade-off [10]. However, unlike Section 3, here it is advisable to operate with a shorter time constant (say, a few hundreds of microsecond); otherwise, the resulting Rd is too high and then Node 1 [see Figure 4(a)] becomes a high-impedance point too susceptible to interference. For instance, the measurement of a capacitive sensor of 150 pF should use an Rd of a few units of megaohm (e.g., 1 MΩ).
  • It is also recommended to use an additional resistor Ri between Pin 1 and Node 1 [see Figure 4(a)] to improve the rejection of power supply noise/interference [9]. The cut-off frequency of the low-pass filter determined by Ri and Cx (during the charging stage) should be as low as possible but at the same time Ri must be much smaller than Rd in order to ensure an appropriate charge of Cx. For example, if Rd = 1 MΩ then Ri < 1 kΩ.

4.1. Single Capacitive Sensor

Single capacitive sensors have one sensing element whose capacitance Cx ( = C0(1 + xC)) changes, for example, with liquid level, humidity or gas; C0 is the nominal capacitance at a reference value of the measurand and xC is the relative change of capacitance (i.e., ∆C/C0) due to the measurand. These sensors can be directly connected to a μC using the circuit shown in Figure 6(a) [23]. As in the resistive counterpart, this circuit applies the three-signal auto-calibration technique [12] and, for this reason, it carries out three discharging-time measurements:
  • (a) Sensor measurement, which is intended to measure Cx.
  • (b) Reference measurement, which is intended to measure a reference capacitor (Cref).
  • (c) Offset measurement, which is intended to measure the offset due to the parasitic capacitance (Cs) between Node 1 and ground; the parasitic capacitances of the port pins set as a HZ input are assumed negligible along this section, but their effects are carefully analyzed in [24].
Figure 6. Direct interface circuit for a (a) single capacitive sensor; (b) lossy capacitive sensor; (c) differential capacitive sensor; (d) bridge-type capacitive sensor.
Figure 6. Direct interface circuit for a (a) single capacitive sensor; (b) lossy capacitive sensor; (c) differential capacitive sensor; (d) bridge-type capacitive sensor.
Jlpea 02 00265 g006
Table 5 summarizes the state of pins 2 and 3 during the charge-discharge process and the discharging time for each of the three measurements, where kC = Rd ln(V1/VTL). Once the three discharging times (Tx, Tref and Toff) are measured, the sensor capacitance can be estimated by
Jlpea 02 00265 i008
which again is insensitive to the tolerance and low-frequency variability of Rd, V1 and VTL.
Table 5. Pins configuration and discharging time for each of the measurements carried out by the circuit in Figure 6(a).
Table 5. Pins configuration and discharging time for each of the measurements carried out by the circuit in Figure 6(a).
MeasurementPin 2Pin 3Discharging time
Sensor“0”HZTx = kC(Cx + Cs)
ReferenceHZ“0”Tref = kC(Cref + Cs)
OffsetHZHZToff = kCCs

4.2. Lossy Capacitive Sensor

Some capacitive sensors (for instance, those intended for the measurement of proximity, humidity and two-component fluids concentration) have a loss term that is usually modeled by a parasitic conductance Gx in parallel with Cx. If the circuit in Figure 6(a) uses an extra port pin [Pin 0 in Figure 6(b)] and performs an additional discharging-time measurement Tad [see Table 6, where k = ln(V1/VTL)], the two components of the sensor can be estimated by [25]:
Jlpea 02 00265 i009
Jlpea 02 00265 i010
Note that if Gx is very small then Tad is much longer than the other discharging times and, hence, Equation (9) is simplified to Equation (8).
Table 6. Pins configuration and discharging time for each of the measurements carried out by the circuit in Figure 6(b).
Table 6. Pins configuration and discharging time for each of the measurements carried out by the circuit in Figure 6(b).
MeasurementPin 0Pin 2Pin 3Discharging time
Sensor“0”“0”HZTx = k(Rd || Gx−1)(Cx + Cs)
Reference“0”HZ“0”Tref = kRd(Cref + Cs)
Offset“0”HZHZToff = kRdCs
AdditionalHZ“0”HZTad = kGx−1(Cx + Cs)

4.3. Differential Capacitive Sensor

Differential capacitive sensors have two sensing elements Cx1 ( = C0(1+ xC)) and Cx2 ( = C0(1+ xC)) that share an electrode and undergo opposite changes, i.e., if Cx1 increases with the measurand then Cx2 decreases and vice versa. Such sensors are commonly used to measure linear or angular position/displacement, acceleration, tilt and pressure. The direct interface circuit proposed to measure such a type of sensor is shown in Figure 6(c) [24], which performs the three discharging-time measurements (T1, T2 and T3) indicated in Table 7. Then, the parameter xC (which enable us to estimate the measurand better than Cx1 or Cx2) can be calculated by
Jlpea 02 00265 i011
The parameter xC could also be estimated by performing an offset measurement and applying a time-based equation similar to (6) [26], but then the result would become more sensitive to the parasitic capacitances of the port pins set as a HZ input. Anyhow, as in the resistive counterpart, the proposed circuit does not require any reference capacitor.
Table 7. Pins configuration and discharging time for each of the measurements carried out by the circuit in Figure 6(c).
Table 7. Pins configuration and discharging time for each of the measurements carried out by the circuit in Figure 6(c).
MeasurementPin 2Pin 3Discharging time
Sensor #1“0”HZT1 = kC(Cx1 + Cs)
Sensor #2HZ“0”T2 = kC(Cx2 + Cs)
Sensor #3“0”“0”T3 = kC(Cx1 + Cx2 + Cs)

4.4. Bridge-Type Capacitive Sensor

Capacitive sensors in a bridge topology are frequently applied to measure linear or angular position/displacement and pressure. These sensors can be directly connected to a μC using the interface circuit shown in Figure 6(d), which carries out the four discharging-time measurements (T1, T2, T3 and Toff) indicated in Table 8. For a full-bridge topology with Cx1 = Cx4 = C0(1+ xC) and Cx2 = Cx3 = C0(1 xC), the parameter xC can be estimated by
Jlpea 02 00265 i012
For other bridge topologies, xC can be estimated using similar time-based equations.
Table 8. Pins configuration and discharging time for each of the measurements carried out by the circuit in Figure 6(d). Note that CACB = (CA·CB)/(CA + CB).
Table 8. Pins configuration and discharging time for each of the measurements carried out by the circuit in Figure 6(d). Note that CACB = (CA·CB)/(CA + CB).
MeasurementPin 2Pin 3Pin 4Discharging time
Sensor #1“0”“0”HZT1 = kC[(Cx1Cx2) + Cx4 + Cs]
Sensor #2“0”HZ“0”T2 = kC[Cx2 + Cx4 + Cs]
Sensor #3HZ“0”“0”T3 = kC[Cx2 + (Cx3Cx4) + Cs]
OffsetHZHZHZToff = kCCs

4.5. Applications and Results

The direct interface circuits shown in Figure 6 have been applied mostly to measure capacitive relative humidity (RH) sensors [23,25,27], but also tilt sensors or accelerometers [24]. Table 9 summarizes the performance of such direct interface circuits in some of the previous applications.
Table 9. Applications and results of the direct interface circuits for capacitive sensors shown in Figure 6.
Table 9. Applications and results of the direct interface circuits for capacitive sensors shown in Figure 6.
Reference[23][24]
μCAVR ATtiny2313(1) at 5 V–20 MHz
Sensor RH sensor (HS1101(2)) with a single topologyAccelerometer (SCG10Z(3)) with a differential topology
Interface circuitFigure 6(a) with Cref = 177 pF, Rd = 1 MΩ and Ri = 1 kΩFigure 6(c) with Rd = 20 MΩ and Ri = 10 kΩ
Meas. range[10,90]%RH[−1,1] g or [−90, +90] degrees
Max. non-linearity error2.0% FSS1.1% FSS
ENOB (for a given measuring time)7.5 b (5 ms) 9 b (50 ms) 7 b (50 ms)
(1) From Atmel. (2) From Humirel. (3) From VTI Technologies.
The non-linearity and resolution values shown in Table 9 are not as good as those presented in Table 4, although they are still acceptable for many low-cost, low-power applications. Such differences between Table 4 and Table 9 are due to the higher effects of (i) the parasitic components of the μC (to be precise, the input parasitic capacitances of the port pins) and (ii) the noise/interference affecting the high-impedance node when a low-value capacitive sensor is measured; the effects of parasitic components and external interference could be higher if the sensor was remote from its electronics and, for this reason, it is highly recommended to place the μC as close as possible to the sensor. For the first application [23], the non-linearity error is mainly due to the non-linearity of the sensor; in fact, if the circuit measures capacitors instead of such a capacitive sensor, the maximum non-linearity error of the circuit is 0.1% FSS. On the other hand, a measurement of relative humidity with a resolution of 9 bits is clearly satisfactory for many applications since it means that the system is able to detect changes of 0.2% RH. The lower value of resolution for the second application in Table 9 [24] is due to the very low sensitivity of the sensor (0.105 pF/g). When the specific IC designed in [28] was used to measure the same accelerometer, the resolution was 9 bits and the non-linearity error was 1.5% FSS, which are comparable to the results shown in Table 9.

5. Current Consumption

For those applications in which the sensor is not read continuously but periodically (i.e., every TT seconds), the average current consumption of a direct interface circuit is
Jlpea 02 00265 i013
where Iact is the average current consumption in active mode (i.e., when the μC is working to perform the measurement), Tact is the time interval required to complete one measurement in active mode, N is the number of times that the measurement is repeated in active mode to average N measurements, Isleep is the current consumption of the μC in sleep (or standby) mode, Tsleep is the time interval in which the μC is in sleep mode, and TT = N·Tact + Tsleep. The value of Isleep specifically depends on the low-power features of the μC, but it is generally smaller than 1 μA (even it can be smaller than 100 nA). On the other hand, the value of Iact clearly depends on the configuration of the resources embedded into the μC during the measurement. To reduce the current consumption, it is advisable to set the CPU (Central Processing Unit) and the timer as indicated in Table 10 [29]; the rest of peripherals should be switched off. In the charging stage, the charging time should be controlled by the CPU running at low frequency (e.g., tens or hundreds of kHz); two remarks are as follows: (i) most of the current μCs have a prescaler to divide the master clock frequency, and (ii) a low-accuracy charging time (due to a low-frequency clock) is not a problem at all since the information is in the discharging time. In the discharging stage, the discharging time should be measured by the timer running at high frequency (e.g., units or tens of MHz) to have a good resolution, whereas the CPU should be off whenever this does not stop the operation of the interrupt system and the timer. In the processing stage, the CPU should run at high frequency (e.g., units or tens of MHz) to compute as fast as possible the resistance or capacitance of the sensor by means of, for example, (5) or (8).
Table 10. Proposed state (on/off) and running frequency of the CPU and the embedded timer for each stage of the measurement.
Table 10. Proposed state (on/off) and running frequency of the CPU and the embedded timer for each stage of the measurement.
StageCPUTimer
StateFrequencyStateFrequency
Chargingonlowoff-
Dischargingoff-onhigh
Processingonhighoff-
The average current consumption in active mode in measurements involving three charging stages, three discharging stages and one processing stage (as happens, for example, in the direct interface circuits shown in Figure 5(a) and Figure 6(a)) can be estimated by [29]
Jlpea 02 00265 i014
where C is the capacitance being charged [i.e., Cd in Figure 5(a) and Cx in Figure 6(a)], Tc is the time interval required to charge C, Td is the discharging time to be measured, Tp is the time interval required to process the discharging times, and Iint1, Iint2 and Iint3 are the average current consumed by the internal electronics of the μC during the charging, discharging and processing stages, respectively. Note that in Equation (14) Td is assumed to be the same for the three measurements; this assumption does not make sense in terms of the result obtained from (5) or (8), but it does in terms of current consumption analysis. According to (14), the current consumed by the internal electronics of the μC plays an important role on the overall current consumption. Furthermore, the value of Iint1, Iint2 and Iint3 clearly depends on the supply voltage (VDD) and operating frequency (fclk) of the μC. Table 11 shows, for example, some experimental values of such currents for an AVR μC running at different operating conditions when the configuration proposed in Table 10 is applied.
Table 11. Experimental values of average current consumed by the internal electronics of an AVR μC [29].
Table 11. Experimental values of average current consumed by the internal electronics of an AVR μC [29].
3 V–4 MHz5 V–20 MHz
Iint1(1) (μA)61472
Iint2(2) (mA)0.434.13
Iint3(3) (mA)1.5111.79
(1) CPU runs at fclk/256. (2) Timer runs at fclk, CPU is in idle mode. (3) CPU runs at fclk.
Direct interface circuits for capacitive sensors are expected to be less power demanding than those for resistive sensors. This is because the first two components in Equation (14), which correspond to the charging stages, are almost negligible when measuring capacitive sensors in the picofarad range or smaller. Actually, the current consumption in active mode of direct interface circuits for capacitive sensors is equal, in a first approximation, to Iint2. Experimental tests carried out at 3 V – 4 MHz show that the current consumption when measuring capacitances (177 pF) is about 2–3 smaller than that when measuring resistances (1 kΩ), as shown in Figure 7. In terms of measuring time and energy, a complete measurement of a 1-kΩ resistive sensor requires 1.6 ms and 7 μJ for Cd = 220 nF, and 5.8 ms and 27 μJ for Cd = 1 μF.
Figure 7. Theoretical and experimental values of current consumption in active mode (Iact) at 3 V – 4 MHz for (a) the circuit in Figure 5(a) when measuring a 1-kΩ resistive sensor, and (b) the circuit in Figure 6(a) when measuring a 177-pF capacitive sensor.
Figure 7. Theoretical and experimental values of current consumption in active mode (Iact) at 3 V – 4 MHz for (a) the circuit in Figure 5(a) when measuring a 1-kΩ resistive sensor, and (b) the circuit in Figure 6(a) when measuring a 177-pF capacitive sensor.
Jlpea 02 00265 g007

6. Conclusions and Outlook

Direct interface circuits are able to measure different topologies of resistive and capacitive sensors just using a common low-cost general-purpose 8-bit μC with an embedded digital timer but without any on-chip ADC, OpAmp or analogue comparator. In spite of their simplicity and low cost, these circuits perform remarkably and therefore they could be very attractive for medium-accuracy, medium-resolution applications. Note, however, that such a satisfactory performance is to be expected when measuring resistive sensors in the kiloohm range and capacitive sensors in the picofarad range. The measurement of low-value resistive sensors (say, lower than 100 Ω) is feasible, but the discharging-time measurement would suffer from a significant offset effect due to Rs, whereas the measurement of high-value resistive sensors (say, higher than 10 MΩ) could be affected by the parasitic resistance of the input port pins of the μC. On the other hand, the measurement of capacitive sensors with a nominal capacitance smaller than 1 pF seems impracticable because of the high effects of the parasitic capacitances of the input port pins of the μC. Direct interface circuits implemented with different commercial μCs from different manufacturers show similar results and, therefore, the design of such circuits does not depend on any specific device or integrated circuit from any manufacturer. A measuring time of about units or tens of millisecond can be a limitation of such circuits if the quantity to be measured changes quite fast.
The field of direct interface circuits is still under research and many interesting ideas could be developed in the near future. From the author’s point of view, future work on direct interface circuits could be focused on the following two directions:
  • (a) Applications: Many measurement systems based on resistive and capacitive sensors, but especially those intended for low-cost low-power applications, could benefit from the advantages of direct interface circuits. In fact, recently, such circuits have been proposed to measure low-power magnetic sensors for vehicle detection [30], low-power gas sensors [19] and low-cost low-power RH sensors to be integrated into RFID labels [27].
  • (b) Measurement of other types of sensor: Most of the research work done so far on direct interface circuits has been focused on measuring resistive and capacitive sensors, but the direct measurement of other types of sensor is also of interest. For instance, the measurement of voltage-output sensors [31], current-output sensors [32] and impedance sensors [33] has been proposed very recently.

References and Notes

  1. Pallàs-Areny, R.; Webster, J.G. Sensors and Signal Conditioning, 2nd ed; John Wiley & Sons: New York, NY, USA, 2001. [Google Scholar]
  2. Huising, J.H. Smart sensor systems: Why? Where? How? In Smart Sensor Systems; Meijer, G.C.M., Ed.; Wiley: Chichester, UK, 2008; pp. 1–21. [Google Scholar]
  3. Reverter, F.; Pallàs-Areny, R. Direct Sensor-to-Microcontroller Interface Circuits. Design and Characterization; Marcombo: Barcelona, Spain, 2005. [Google Scholar]
  4. Cox, D. Implementing Ohmmeter/Temperature Sensor; Microchip Technology AN512: Chandler, AZ, USA, 1994. [Google Scholar]
  5. Bierl, L. Precise Measurements with the MSP430; Texas Instruments: Dallas, TX, USA, 1996. [Google Scholar]
  6. Richey, R. Resistance and Capacitance Meter Using a PIC16C622; Microchip Technology AN611: Chandler, AZ, USA, 1997. [Google Scholar]
  7. Dietz, P.H.; Leigh, D.; Yerazunis, W.S. Wireless liquid level sensing for restaurant applications. In Proceedings of The 1st IEEE International Conference on Sensors, Orlando, FL, USA, 12–14 June 2002; pp. 715–719.
  8. Gaitán-Pitre, J.E.; Gasulla, M.; Pallàs-Areny, R. Analysis of a direct interface circuit for capacitive sensors. IEEE Trans. Instrum. Meas. 2009, 58, 2931–2937. [Google Scholar] [CrossRef]
  9. Reverter, F.; Gasulla, M.; Pallàs-Areny, R. Analysis of power-supply interference effects on direct sensor-to-microcontroller interfaces. IEEE Trans. Instrum. Meas. 2007, 56, 171–177. [Google Scholar] [CrossRef]
  10. Reverter, F.; Pallàs-Areny, R. Effective number of resolution bits in direct sensor-to-microcontroller interfaces. Meas. Sci. Technol. 2004, 15, 2157–2162. [Google Scholar] [CrossRef]
  11. Reverter, F.; Jordana, J.; Gasulla, M.; Pallàs-Areny, R. Accuracy and resolution of direct resistive sensor-to-microcontroller interfaces. Sens. Actuators A 2005, 121, 78–87. [Google Scholar] [CrossRef]
  12. Interface electronics and measurement techniques for smart sensor systems. In Smart Sensor Systems; Meijer, G.C.M (Ed.) Wiley: Chichester, UK, 2008; pp. 23–54.
  13. Reverter, F.; Casas, Ò. Interfacing differential resistive sensors to microcontrollers: a direct approach. IEEE Trans. Instrum. Meas. 2009, 58, 3405–3410. [Google Scholar] [CrossRef]
  14. Sifuentes, E.; Casas, Ò.; Reverter, F.; Pallàs-Areny, R. Direct interface circuit to linearise resistive sensor bridges. Sens. Actuators A 2008, 147, 210–215. [Google Scholar] [CrossRef]
  15. Reverter, F.; Horak, G.; Bilas, V.; Gasulla, M. Novel and low-cost temperature compensation technique for piezoresistive pressure sensors. In Proceedings of XIX IMEKO World Congress, Lisbon, Portugal, 6–11 September 2009; pp. 2084–2087.
  16. Jordana, J.; Pallàs-Areny, R. A simple, efficient interface circuit for piezoresistive pressure sensors. Sens. Actuators A 2006, 127, 69–73. [Google Scholar] [CrossRef]
  17. Yurish, S.Y. A simple and universal resistive-bridge sensors interface. Sens. Transducers J. 2011, 10, 46–59. [Google Scholar]
  18. Vidal-Verdú, F.; Oballe-Peinado, O.; Sánchez-Durán, J.A.; Castellanos-Ramos, J.; Navas-González, R. Three realizations and comparison of hardware for piezoresistive tactile sensors. Sensors 2011, 11, 3249–3266. [Google Scholar] [CrossRef]
  19. Courbat, J.; Briand, D.; Yue, L.; Raible, S.; Rooij, N.F. Drop-coated metal-oxide gas sensor on polyimide foil with reduced power consumption for wireless applications. Sens. Actuators B 2012, 161, 862–868. [Google Scholar] [CrossRef]
  20. Sifuentes, E. Autonomous Sensor for the Static Detection of Vehicles. Ph.D. Thesis, Universitat Politècnica de Catalunya, Barcelona, Spain, 2009. [Google Scholar]
  21. Mohan, N.M.; Kumar, V.J. A novel signal conditioning circuit for push-pull-type resistive transducers. Meas. Sci. Technol. 2005, 16, 1848–1852. [Google Scholar] [CrossRef]
  22. Van der Goes, F. Low-Cost Smart Sensor Interfacing. Ph.D. Thesis, Delft University of Technology, Delft, The Netherlands, 1996. [Google Scholar]
  23. Reverter, F.; Casas, Ò. Direct interface circuit for capacitive humidity sensors. Sens. Actuators A 2008, 143, 315–322. [Google Scholar] [CrossRef]
  24. Reverter, F.; Casas, Ò. Interfacing differential capacitive sensors to microcontrollers: a direct approach. IEEE Trans. Instrum. Meas. 2010, 59, 2763–2769. [Google Scholar] [CrossRef]
  25. Reverter, F.; Casas, Ò. A microcontroller-based interface circuit for lossy capacitive sensors. Meas. Sci. Technol. 2010. [Google Scholar] [CrossRef]
  26. Reverter, F.; Casas, Ò. Direct interface circuit for differential capacitive sensors. In Proceedings of IEEE International Instrumentation and Measurement Technology Conference, Victoria, Canada, 12–15 May 2008; pp. 1609–1612.
  27. Pelegrí-Sebastiá, J.; García-Breijo, E.; Ibáñez, J.; Sogorb, T.; Laguarda-Miro, N.; Garrigues, J. Low-cost capacitive humidity sensor for application within flexible RFID labels based on microcontroller systems. IEEE Trans. Instrum. Meas. 2012, 61, 545–553. [Google Scholar] [CrossRef]
  28. Bracke, W.; Merken, P.; Puers, R.; Van Hoof, C. Ultra-low-power interface chip for autonomous capacitive sensor systems. IEEE Trans. Circuits Syst. I 2007, 54, 130–140. [Google Scholar] [CrossRef]
  29. Reverter, F. Power consumption in direct interface circuits. IEEE Trans. Instrum. Meas. 2012. [Google Scholar] [CrossRef]
  30. Sifuentes, E.; Casas, Ò.; Pallàs-Areny, R. Wireless magnetic sensor node for vehicle detection with optical wake-up. IEEE Sens. J. 2011, 11, 1669–1676. [Google Scholar] [CrossRef]
  31. Bengtsson, L. Direct analog-to-microcontroller interfacing. Sens. Actuators A 2012, 179, 105–113. [Google Scholar] [CrossRef]
  32. Stojanovic, R.; Karadaglic, D. A LED-LED-based photoplethysmography sensor. Physiol. Meas. 2007, 28, N19–N27. [Google Scholar] [CrossRef]
  33. Czaja, Z.A. microcontroller system for measurement of three independent components in impedance sensors using a single square pulse. Sens. Actuators A 2012, 173, 284–292. [Google Scholar] [CrossRef]

Share and Cite

MDPI and ACS Style

Reverter, F. The Art of Directly Interfacing Sensors to Microcontrollers. J. Low Power Electron. Appl. 2012, 2, 265-281. https://0-doi-org.brum.beds.ac.uk/10.3390/jlpea2040265

AMA Style

Reverter F. The Art of Directly Interfacing Sensors to Microcontrollers. Journal of Low Power Electronics and Applications. 2012; 2(4):265-281. https://0-doi-org.brum.beds.ac.uk/10.3390/jlpea2040265

Chicago/Turabian Style

Reverter, Ferran. 2012. "The Art of Directly Interfacing Sensors to Microcontrollers" Journal of Low Power Electronics and Applications 2, no. 4: 265-281. https://0-doi-org.brum.beds.ac.uk/10.3390/jlpea2040265

Article Metrics

Back to TopTop