1. Introduction
In the society of the 21st century, almost everything (e.g., home appliances, mobile phones, cars, buildings, and cities) is becoming “smart” thanks to the proliferation of information and communication technology and the deployment of technologies, such as wireless sensor networks and the Internet of things. To become smart, it is essential, in the first place, to monitor through sensors what is happening in and/or around the smart thing. The data collected is processed and then a smart decision is taken with the aim of improving the safety, efficiency, sustainability, mobility, etc. of the smart thing and, hence, the people’s quality of life.
Sensors are electronic devices that provide an output signal in the electrical domain (e.g., resistance, capacitance, voltage, or current) with information about the measurand. However, such an electrical signal is generally of low amplitude and carries some noise and, therefore, an electronic interface is required between the sensor and the processing digital system so as to correctly extract the information of interest. A classical block diagram of an electronic sensor interface is shown in
Figure 1a. The sensor output signal is first processed in the analog domain by a signal conditioning circuit that generally relies on operational amplifiers. The main functions of this block are level shifting and amplification so as to match the sensor output span to the input span of the ensuing analog-to-digital converter (ADC) and, hence, to make good use of the ADC dynamic range. Other common tasks of the signal conditioning circuit are: sensor output-to-voltage conversion, filtering, linearization, and/or demodulation. The resulting analog signal is then digitized via the ADC. Finally, a digital system acquires, stores, processes, controls, communicates (to other devices or systems) and/or displays the digital value with information about the measurand. Nowadays, the most popular digital systems are microcontrollers (μC) and field-programmable gate arrays (FPGA).
An alternative approach to reading some sensors (e.g., resistive [
1,
2,
3,
4], capacitive [
5,
6,
7,
8], inductive [
9,
10], and voltage-output [
11,
12] sensors) is shown in
Figure 1b. This circuit topology is known as a direct interface circuit (DIC) since the sensor is directly connected to the digital system without using either the signal conditioning circuit or the ADC, thus resulting in a direct sensor-to-μC [
13] or to-FPGA interface circuit [
14,
15]. In this topology, the digital system excites the sensor to obtain a time-modulated signal that is directly measured in the digital domain through a digital timer embedded into the digital system. In comparison with the sensor electronic interface shown in
Figure 1a, a DIC is simpler and needs fewer components. Actually, it can be implemented with a common general-purpose 8-bit μC which is a low-cost (say,
$1) and low-power (say, about 1 mA in active mode and less than 1 μA in power-down mode [
16]) device. Modern μCs may also incorporate into the same chip an ADC that facilitates the design of the topology shown in
Figure 1a, but an ADC demands more power than a digital timer. Therefore, a DIC based on a time-to-digital conversion [
17,
18] offers advantages in terms of cost, physical space, and power consumption, which is of major interest, for example, in autonomous sensors powered by either batteries or energy harvesters. Furthermore, the performance of such circuits, in terms of accuracy and resolution, is quite remarkable taking into account their simplicity, for instance: a non-linearity error of 0.01% full-scale span (FSS) and a resolution of 13 bits when measuring resistive sensors in the kilo-Ohm range [
1], and 0.1% FSS and nine bits when measuring capacitive sensors in the picofarad range [
5].
Although the performance and feasibility of DICs have been extensively analyzed and proved in the literature, these have been evaluated and then applied to measure static or quasi-static signals, i.e., slowly-varying magnitudes, such as temperature [
1], relative humidity [
5], or respiratory rate [
19]. The analysis of the limitations and trade-offs of DICs when measuring sensors subjected to dynamic changes (e.g., vibrations, pulse rate, or alternating magnetic fields) have not been assessed so far. It has been widely thought that DICs were not able to measure such dynamic signals since they rely on measuring the charging or discharging time of an RC circuit, which can be quite long (say, units or tens of millisecond) if a high or medium resolution is required. This paper goes beyond these approaches and explores the feasibility of DICs to measure a resistive sensor with dynamic changes of resistance.
The paper is organized as follows.
Section 2 qualitatively describes the operating principle of the DIC when measuring a resistive sensor.
Section 3 theoretically analyzes the limitations and trade-offs of DICs in dynamic measurements.
Section 4 describes the setup and the measurement method.
Section 5 shows the experimental results and discusses them. Finally,
Section 6 draws the main conclusions.
2. Operating Principle
The basic topology of a μC-based DIC for the measurement of a resistive sensor (
Rx) is shown in
Figure 2a [
13], where
C is a capacitor to build an RC circuit, P1 and P2 are two input/output digital ports, and
VCC is the supply voltage of the μC. The DIC estimates the value of
Rx by measuring, through an embedded digital timer, the time interval needed to discharge
C through
Rx from
VCC to a certain threshold voltage. In order to reduce the uncertainty of the time-interval measurement, it is advisable to employ a port P1 associated to a capture module (or an external interrupt) having a Schmitt trigger (ST) buffer with a low (
VTL) and a high threshold voltage (
VTH). The measurement of the discharging time of the RC circuit to extract the value of
Rx is preferable than that of the charging time since the former uses
VTL as a threshold voltage, which is less noisy than
VTH [
13].
The algorithm carried out by the µC to obtain a digital value proportional to
Rx involves two operating stages: (a) charging, and (b) discharging and time measurement, as shown in
Figure 2b. In the first stage, P1 is set as an output providing a digital “1”, while P2 is set as an input offering high impedance (HZ). Consequently, P1 generates a step pulse from 0 to
VCC (i.e., from “0” to “1” in the digital domain) and, therefore,
C is charged towards
VCC through
RP with a time constant
τc =
RPC, where
RP represents the equivalent internal resistance of P1;
RP is about tens of ohms [
1], which is small enough to have a fast charge. This charging stage must last at least 5
τc so as to ensure that the voltage across
C (
vc(
t) in
Figure 2b) has reached
VCC. In the second stage, P2 is set as an output providing a digital “0”, while P1 is set in HZ waiting for the threshold-voltage crossing. In such conditions,
C is discharged towards ground through
Rx +
RN with a time constant
τd = (
Rx +
RN)
C, where
RN represents the equivalent internal resistance of P2. In the meantime, the embedded timer measures the time interval required to do so. When
vc(
t) reaches
VTL, the ST buffer is triggered and the timer stops. The charging and discharging times are, respectively, equal to:
From Equation (1b), if
C,
VCC,
VTL, and
RN are assumed constant, then
Td is proportional to
Rx. The effects of the tolerance and low-frequency variability of these parameters can be compensated by adding reference components in the DIC and then applying auto-calibration techniques, as explained elsewhere [
1,
13]. In summary, the DIC first performs a resistance-to-time conversion and, then, a time-to-digital conversion, thus resulting in a digital number proportional to
Td and, hence, to
Rx.
4. Materials and Method
The DIC shown in
Figure 2a has been implemented using a commercial 8-bit μC (ATmega328, Atmel, San Jose, CA, USA) running at 16 MHz and powered at +5 V. This supply voltage was provided by an independent voltage regulator (LM2940) to reduce the power supply noise/interference that may generate trigger noise affecting the discharging-time measurement [
1]. The tasks of P1 and P2 in
Figure 2a were carried out by P
D2 and P
B3, respectively. An embedded 16-bit digital timer was employed to measure the discharging time with
T0 = 62.5 ns. The central processing unit (CPU) of the μC was placed in sleep mode (but the timer and the interrupt system kept working) during the discharging-time measurement to decrease the internal trigger noise generated by the CPU itself. The μC was programmed to acquire and save (in RAM) 250 samples of
Td corresponding to 250 samples of
Rx. These samples were then sent via USB to a personal computer controlled by a LabVIEW program. The values of
Td were then converted into
Rx through Equation (1b), and assuming the values of
VCC,
VTL,
RP, and
RN as indicated before in
Section 3.4The sensor under test was a magnetoresistive sensor (TMR2503, MDT, Jiangsu, China) exposed to an alternating magnetic field,
B(
t), that was generated by an inductor of 3.3 mH excited by a waveform generator (33500B, Keysight Technologies, Santa Rosa, CA, USA), as shown in
Figure 5. The sensor was placed near the inductor with its surface perpendicular to the generated magnetic field. The TMR2503 has four magnetoresistances connected in a Wheatstone bridge topology, but only a single equivalent resistance of the sensor was measured. To be precise, the equivalent resistance was one of the magnetoresistances (
R4) in parallel with the series combination of the other three (
R1,
R2, and
R3), as shown in
Figure 5 in the dashed-line box. This equivalent resistance can be considered proportional to the magnetic field if the relative variation of resistance is much smaller than one [
3].
Two preliminary tests on the TMR2503 were initially conducted. The first test was intended to obtain the transfer curve (i.e., Rx versus B) of the sensor. To do so, the inductor was excited by a DC voltage source (2230G-30-1, Keithley Instruments, Cleveland, OH, USA) to generate a DC magnetic field that was measured by a magnetometer (Mag-01H, Bartington Instruments, Witney, UK), and the sensor equivalent resistance was measured by a digital multimeter (2110, Keithley Instruments, Cleveland, OH, USA). The second test was intended to monitor the sensor output signal through a classical read-out circuit when a sinusoidal magnetic field of 1 kHz was applied. In such a case, the sensor was supplied at 5 V and its differential output voltage was amplified by an instrumentation amplifier (AD620, Analog Devices, Norwood, MA, USA) with a gain of 100. The output signal of the amplifier was acquired by a digital oscilloscope (DSOX2014A, Keysight Technologies, Santa Rosa, CA, USA).
The dynamic performance of the DIC was then tested using the measurement set-up shown in
Figure 5, which enables to change the frequency, amplitude, and waveform of
B(
t) and that of
Rx(
t). Three different experiments were carried out:
- (a)
Experiment A, which was intended to observe the effects of frequency. The frequency of B(t) was varied from 10 Hz to the Nyquist frequency, the amplitude was the maximum (corresponding to a peak-to-peak amplitude of 20 V from the generator), and the waveform was sinusoidal. Three different values of C were tested: 100 nF, 330 nF, and 680 nF.
- (b)
Experiment B, which was intended to observe the effects of amplitude. The frequency of
B(
t) was constant, the amplitude had three different levels (corresponding to a peak-to-peak amplitude of 5, 10, and 20 V from the generator), and the waveform was sinusoidal. A frequency of 1 kHz and a capacitor of 100 nF were selected. As shown later after presenting the results of Experiment A, this is the highest frequency that can be tested without the effects of the inherent LPF; note, from
Table 1, that
fs ≈ 10
f when
C = 100 nF and, hence, the attenuation factor is 0.1 dB. A higher frequency value could be tested using a smaller value of
C, but then the resolution would be smaller than eight bits, which is usually considered as the minimum value in electronic instrumentation.
- (c)
Experiment C, which was intended to observe the effects of the waveform. The inductor was excited with a narrowband signal with different amplitudes and frequency components. To be precise, the excitation signal emulated an electrocardiogram (ECG) signal with a fundamental frequency of 1.5 Hz that corresponds to a heart rate of 90 beats per minute. ECG monitoring requires a read-out circuit whose bandwidth should be no less than 40 Hz [
24]. In order to have such a bandwidth and also optimize the performance of the DIC in terms of resolution, a capacitor of 4.7 μF was selected. This capacitor provides, from Equation (3), a sampling frequency of around 200 Sa/s and, from Equation (8), a 3-dB cut-off frequency of 90 Hz. The ECG signal applied to the inductor was also monitored by the digital oscilloscope.
5. Experimental Results and Discussion
Figure 6 shows the results obtained in the preliminary tests of the magnetoresistive sensor. On the one hand,
Figure 6a shows the transfer curve of the sensor for a DC magnetic field ranging from −30 μT to +30 μT. According to these experimental results, we can confirm that the sensor equivalent resistance linearly changes with the magnetic field applied. On the other hand,
Figure 6b shows the output signal in the time domain when the sensor (subjected to a sinusoidal magnetic field of 1 kHz) was measured by a classical read-out circuit. The resulting signal was also sinusoidal with the same frequency as that of the magnetic field applied, as expected, and without experiencing any kind of saturation problems.
The results obtained in the experiment A are represented in
Figure 7, where the y-axis shows the value of Δ
Rx normalized to that obtained at 10 Hz and expressed in dB. The results in
Figure 7 show that the measurement suffers from a LPF behavior that limits the bandwidth of the dynamic signal to be sensed, as suggested before in
Section 3.2. The theoretical frequency response predicted by Equation (8) is also represented (as a solid line) in
Figure 7, which shows good agreement with the experimental data. As
C increased, both
fs and the bandwidth decreased, as predicted before by Equation (3) and
Figure 4, respectively. According to
Figure 7, if the DIC has to measure, for instance, resistance variations at 1 kHz, it is advisable to employ a capacitor of 100 nF, which limits the resolution to around eight bits. Resistance variations at frequencies higher than 1 kHz would require a lower value of
C in order to avoid the effects of the inherent LFP, but then the resolution would be lower than eight bits.
Figure 8 shows the results achieved in the experiment B. First of all, the frequency of 1 kHz under test was located in the pass band of the LPF, as shown in
Figure 7 for
C = 100 nF. Second of all, the experimental value of
fs was 10.2 kSa/s, which was high enough to measure a signal of 1 kHz; in other words: around 10 samples per period were taken. The three levels of the magnetic field applied to the sensor (represented in
Figure 8 as “Mag1”, “Mag2”, and “Mag3”, being Mag1 > Mag2 > Mag3) caused a Δ
Rx of 120 Ω, 66 Ω, and 36 Ω, respectively. If Mag1 is assumed to be the maximum magnetic field under measurement, then Δ
r = 577 mΩ, as reported before in
Table 1, which generates quantization effects that are more evident when measuring low-amplitude signals. This is shown, for instance, in
Figure 8 for the Mag3 case, where two consecutive samples taken close to the maximum of the sinusoidal signal have the same measurement result; in other words: the DIC was not able to detect the resistance change between these two samples. For this reason, the “sinusoidal” signal reconstructed from the samples was more distorted for Mag3 than for Mag1.
The results from the experiment C are shown in
Figure 9. The ECG signal was acquired by the oscilloscope operating at 250 Sa/s (upper trace in
Figure 9) and by the DIC at 200 Sa/s (bottom trace in
Figure 9). The signal reconstructed from the samples acquired by the DIC was very similar to the original one monitored by the oscilloscope. For the highest amplitudes (QRS complex of the ECG [
25]), the shape of the reconstructed wave was well preserved and, hence, it was possible to estimate the fundamental frequency (i.e., 1.5 Hz) of this periodic signal. However, for low amplitudes (e.g., T and P wave of the ECG), the reconstruction of the signal was slightly distorted, as also observed before in
Figure 8 for the Mag3 case. The results in
Figure 9 demonstrate that a DIC can not only measure dynamic signals with a sinusoidal behavior, but also more complex signals with a limited bandwidth.