Next Article in Journal
Sample Entropy Improves Assessment of Postural Control in Early-Stage Multiple Sclerosis
Next Article in Special Issue
Hardware Acceleration of Digital Pulse Shape Analysis Using FPGAs
Previous Article in Journal
A Smart Cane Based on 2D LiDAR and RGB-D Camera Sensor-Realizing Navigation and Obstacle Recognition
Previous Article in Special Issue
Two Proposals of a Simple Analog Conditioning Circuit for Remote Resistive Sensors with a Three-Wire Connection
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Efficient and Accurate Analog Voltage Measurement Using a Direct Sensor-to-Digital Port Interface for Microcontrollers and Field-Programmable Gate Arrays

Department of Electrical Energy and Information Engineering “Guglielmo Marconi” (DEI), Alma Mater Studiorum–Università di Bologna, Viale del Risorgimento, 2, 40136 Bologna, Italy
Submission received: 19 December 2023 / Revised: 22 January 2024 / Accepted: 23 January 2024 / Published: 29 January 2024
(This article belongs to the Special Issue Advanced Interface Circuits for Sensor Systems (Volume II))

Abstract

:
Portable sensor systems are usually based on microcontrollers and/or Field-Programmable Gate Arrays (FPGAs) that are interfaced with sensors by means of an Analog-to-Digital converter (ADC), either integrated in the computing device or external. An alternative solution is based on the direct connection of the sensors to the digital input port of the microcontroller or FPGA. This solution is particularly interesting in the case of devices not integrating an internal ADC or featuring a small number of ADC channels. In this paper, a technique is presented to directly interface sensors with analog voltage output to the digital input port of a microcontroller or FPGA. The proposed method requires only a few passive components and is based on the measurements of the duty cycle of a digital square-wave signal. This technique was investigated by means of circuit simulations using LTSpice and was implemented in a commercial low-cost FPGA device (Gowin GW1NR-9). The duty cycle of the square-wave signal features a good linear correlation with the analog voltage to be measured. Thus, a look-up table to map the analog voltage values to the measured duty cycle is not required with benefits in terms of memory occupation. The experimental results on the FPGA device have shown that the analog voltage can be measured with a maximum accuracy of 1.09 mV and a sampling rate of 9.75 Hz. The sampling rate can be increased to 31.35 Hz and 128.31 Hz with an accuracy of 1.61 mV and 2.68 mV, respectively.

Graphical Abstract

1. Introduction

Portable and wearable systems for sensing applications have grown many fold in recent years. These systems are usually based on microcontrollers and/or Field Programmable Gate Arrays (FPGAs) and are powered by batteries [1] or scavenge energy from natural sources [2]. The sensing applications cover a wide range of fields, such as environmental monitoring [3,4,5], food screening for quality analysis and safety [6,7,8], biological measurements for human body composition determination and health monitoring [9,10,11], bacterial detection [12,13,14], chemical analysis [15,16,17], health monitoring, and data collection on civil infrastructures [18,19,20].
Sensors are used to measure a physical quantity by a transduction mechanism that outputs an electrical quantity (such as resistance, capacitance, inductance, voltage, or current). Such electrical output is usually converted to an analog voltage and acquired by the sensor system with an Analog-to-Digital Converter (ADC). To guarantee high accuracy in the measured analog voltage, the ADC must be carefully calibrated and a front-end analog interface must be designed for signal conditioning. Xie and Wang, in 2023, presented a digital calibration method for a 10 bit successive approximation register (SAR) ADC that achieves a SNR of 66.9 dB, a power consumption of 70 μW, and a sampling rate of 50 kHz [21]. An ultrafast and low-cost pipelined ADC testing and calibration method was proposed by Chen et al. in 2019 [22]. The proposed technique was implemented on a chip fabricated in 40 nm technology with a power consumption of 10.71 mW and a sampling rate of 125 MHz. Li et al., in 2019, presented a linearity test and calibration method that can be applied to all types of ADCs [23]. A self-testing platform with digital calibration technique for SAR ADCs was proposed by Juan et al. in 2016 that improves SNR with a sampling frequency of 18.75 kHz [24]. Hernández-Gutiérrez et al., in 2023, presented a low-cost embedded system for high-energy radiation detection applications that is able to detect alfa particles and send the nuclear detection events to a server in the cloud [25]. The system is based on an ARM Cortex M4 microcontroller (STM32F407, ST Microelectronics, Geneva, Switzerland) and features an analog circuit for the amplification of the detected photocurrent. A delta-sigma ADC for signal conditioning of automotive piezo-resistive pressure sensors was proposed by Rikan et al. in 2018 [26]. A chip was fabricated through a 0.18 µm CMOS process and achieved over 80 dB SNR with a 2.5 MHz sampling frequency and a power consumption of 646 µW.
A research line in the field of sensor data acquisition is devoted to the study of techniques to directly interface the sensor with the digital port of a microcontroller or FPGA without the use of an ADC. These techniques exploit the fact that the digital input pins of a microcontroller or FPGA integrate a Schmitt trigger circuit to remove the noise present on the input signals, thus the sensor can be interfaced to the digital input port using only a few passive components, without the use of an ADC and analog components for signal processing and filtering. This provides advantages in terms of lower cost, area occupation, and power consumption that are of major interest in the case of battery-operated sensor nodes. Many works from literature cover the case of interfacing with resistive, capacitive, and inductive sensors. Reverter, in 2020, proposed a microcontroller-based interface circuit for non-linear resistive sensors [27]. The same author, in 2022, proposed a direct approach to connect three-wire [28] and four-wire [29] resistive sensors to the digital port of a microcontroller. A technique to directly connect a capacitively coupled resistive sensor with a microcontroller was presented by Areekath et al. in 2020 [30]. Measurement methods for capacitive sensors [31] and lossy capacitive relative humidity sensors [32] based on a direct sensor-to-microcontroller interface circuit were proposed by Czaja in 2020 and 2021. A new type of direct interface circuit for capacitive sensors that is simple in terms of hardware was presented by Hidalgo-López and Castellanos-Ramos in 2022 [33]. A microcontroller-based interface circuit for inductive sensors with variable self-inductance was presented by Kokolanski et al. in 2015 [34]. The same research group, in 2019, proposed a direct interface circuit for differential inductive sensors achieving nonlinearity errors smaller than 1% and an overall measuring time of a few milliseconds [35]. A resolution enhancement method for direct interfacing of inductive sensors was proposed by Asif et al. in 2018 [36].
In the case of sensors featuring an analog output voltage, works from the literature also present the sensor direct interface. Peter et al. in 1998 presented a technique to measure an analog voltage with a microcontroller without an integrated ADC [37]. The proposed method requires the presence of an analog comparator (either integrated in the microcontroller or external) and was validated on a Microchip PIC16 microcontroller featuring an integrated analog comparator. This technique was implemented in different microcontrollers and FPGAs. Soldera et al., in 2005, presented the implementation on the HC9S08Rx microcontroller family (NXP Semiconductors, Eindhoven, Netherlands) of a 10 bit first-order continuous-time delta-sigma ADC using an integrated analog comparator [38]. Weber and Windish, in 2007, presented the implementation on a MSP430 microcontroller (Texas Instruments, Dallas, TX, USA) for the measurement of an analog voltage for industrial applications using an external delta-sigma modulator AD7400 (Analog Devices, Wilmington, MA, USA) [39]. In 2011, the technique was implemented on a Altera Cyclone IV FPGA device with an integrated analog comparator and support for low voltage differential signals (LVDSs) [40]. A significant improvement over the previous designs was proposed by Bengtsson in 2012 [41]. In this case, the property in which digital input pins of a microcontroller or FPGA behave like a Schmitt trigger circuit was exploited to remove the need for an analog comparator. The proposed technique was tested on a Microchip PIC18F458 microcontroller (Microchip Technology, Chandler, AZ, USA), and the results showed that an analog voltage can be determined with a resolution equivalent to a 12 bit ADC and a sampling rate of 65 Hz. The main drawbacks of the proposed method are the limited bandwidth and the high cost in terms of memory occupation. In fact, before the measurement, the capacitor must be charged to the analog voltage to be estimated, and this requires a significant amount of time, with a negative impact on the sampling rate. Moreover, the characteristic exploited to estimate the analog voltage is significantly non-linear. Thus, to guarantee the 12 bit ADC accuracy, a look-up table (LUT) must be used to map the analog voltage values to the measurements carried out with the microcontroller counter, and this results in high memory occupation that can be unacceptable, in particular in the case of a low-cost device featuring small on-chip memory.
In this paper, a technique is presented for the measurement of an analog voltage without an ADC that can be implemented on low-cost microcontrollers and FPGAs. While most microcontrollers, nowadays, integrate an internal ADC, some devices feature a low number of ADC channels. For example, the RP2040 is a 32 bit dual ARM Cortex-M0+ microcontroller present in the Raspberry Pi Pico development board that features only a four-channel 12 bit ADC [42]. In such situations, the proposed technique can be used if the project needs a number of ADC channels higher than that available. In the case of FPGAs, some low-cost devices do not even feature an integrated ADC. The proposed technique uses the same external circuit of the work of Bengtsson [41] but improves it by providing a much more linear characteristic to estimate the analog voltage and removing the initial capacitance charge step that negatively affects the sampling rate. The feasibility and performance of the proposed technique were evaluated by means of LTSpice simulations and tested on a low-cost commercial FPGA. In Section 2, the working principle of the proposed technique is discussed. In Section 3, the results of LTSpice simulations are presented to validate the feasibility of the proposed technique and estimate the maximum performance in terms of accuracy and sampling rate. In Section 4, the implementation of the proposed technique on a commercial low-cost FPGA device is presented, and in Section 5, the results of measurements obtained with the FPGA device are discussed. In Section 6, the performance of the proposed technique is compared with similar techniques from literature and a 12 bit ADC integrated within a low-cost microcontroller. Finally, concluding remarks are presented in Section 7.

2. Measurement Technique

A measurement technique to estimate an analog voltage without the use of an ADC is presented. First, in Section 2.1, the working principle of the proposed technique is discussed. Then, in Section 2.2, the parameters of the digital interface are measured and presented for different commercial devices (microcontrollers and FPGAs). Finally, in Section 2.3, circuits are presented that can be used to change the values of the digital interface parameters.

2.1. Working Principle

The schematic of the circuit used to implement the proposed technique is shown in Figure 1, where Van represents the analog voltage to be measured. The circuit is composed of three passive components, two resistances, R1 and R2, a capacitance, C, and a computing device (microcontroller or FPGA). The Schmitt trigger circuit (with thresholds VH and VL) and the digital not gate (implemented in the programmable logic in a FPGA or in software in a microcontroller) are both integrated into the computing device. The working principle of the circuit presented in Figure 1 is shown in Figure 2, where the waveforms of the voltages V1 and V2 are plotted vs time. The circuit works as an astable multivibrator: when the voltage V1 increases over VH, the output voltage V2 switches from VDD to 0 and the capacitance C discharges; thus, V1 decreases with time. When the voltage V1 decreases under VL, the output voltage V2 switches from 0 to VDD and the capacitance C charges; thus, V1 increases with time. The output voltage V2 is a pulse width modulated (PWM) signal, with tH being the time when V2 = VDD and tL being the time when V2 = 0.
When V1 increases over VH and V2 switches from VDD to 0, the circuit is modeled with the following equations:
C d V 1 d t = V 1 R 1 + V a n V 1 R 2 = R 1 + R 2 R 1 R 2 V 1 + V a n R 2
Assuming the analog voltage Van is constant during the measurement, the differential Equation (1) can be integrated with the initial condition V1(0) = VH, and V1(t) can be calculated as
V 1 ( t ) = R 1 R 1 + R 2 V a n + ( V H R 1 R 1 + R 2 V a n ) e R 1 + R 2 R 1 R 2 C t
Now, imposing the condition V1(tL) = VL, the time interval tL can be calculated as
t L = R 1 R 2 C R 1 + R 2 log V H R 1 R 1 + R 2 V a n V L R 1 R 1 + R 2 V a n
As can be seen in Equation (2), the voltage V1 is VH at the beginning of the capacitor discharge, and it asymptotically converges to Van∙R1/(R1 + R2) as time → +∞. Thus, the following constraint must be valid:
V L > R 1 R 1 + R 2 V a n
This constraint must be valid for all analog voltages Van in the range 0–VDD, and thus,
V L > V L , i n f = R 1 R 1 + R 2 V D D
When V1 decreases under VL and V2 switches from 0 to VDD, the circuit is modeled with the following equations:
C d V 1 d t = V D D V 1 R 1 + V a n V 1 R 2 = R 1 + R 2 R 1 R 2 V 1 + V a n R 2 + V D D R 1
Assuming the analog voltage Van is constant during the measurement, the differential Equation (6) can be integrated with the initial condition V1(0) = VL, and V1(t) can be calculated as
V 1 ( t ) = R 1 R 1 + R 2 V a n + R 2 R 1 + R 2 V D D + ( V L R 1 R 1 + R 2 V a n R 2 R 1 + R 2 V D D ) e R 1 + R 2 R 1 R 2 C t
Now, imposing the condition V1(tH) = VH, the time interval tH can be calculated as
t H = R 1 R 2 C R 1 + R 2 log V L R 1 R 1 + R 2 V a n R 2 R 1 + R 2 V D D V H R 1 R 1 + R 2 V a n R 2 R 1 + R 2 V D D
As can be seen in Equation (7), the voltage V1 is VL at the beginning of the capacitor charge and it asymptotically converges to Van∙R1/(R1 + R2) + VDD∙R2/(R1 + R2) as time → +∞. Thus, the following constraint must be valid:
V H < R 1 R 1 + R 2 V a n + R 2 R 1 + R 2 V D D
This constraint must be valid for all analog voltages Van in the range 0–VDD, and thus,
V H < V H , s u p = R 2 R 1 + R 2 V D D
As can be seen from Equations (3) and (8), the time intervals tL and tH are non-linear functions of the analog voltage Van, the digital interface parameters VL and VH, and the circuit components (R1, R2 and C). Moreover, since the circuit of Figure 1 must work as an astable multivibrator, the conditions defined in Equations (5) and (10) must be valid.

2.2. Digital Interface Parameters in Commercial Devices

Since the time intervals tL and tH are functions of the digital interface parameters VL and VH, the values of such parameters were measured for different commercial microcontrollers and FPGAs. The measurements were carried out using a Nucleo L073RZ development board (ST Microelectronics, Geneva, Switzerland) that embeds on board the STM32L073RZT6 microcontroller with an integrated 12 bit DAC (measurement unit, MU). The microcontroller was programmed to generate a triangular voltage signal on the DAC output (0–3.3 V, with steps of 0.806 mV and an inter-steps delay of 100 ms), and this voltage signal was provided to the digital input pin of the device under testing (DUT). The digital value read by the DUT is replicated on a digital output pin that is given as input to a digital input pin of the MU. For each DAC voltage step, the value of the analog voltage and the digital value read by the MU are sent to a laptop PC using UART, and the values of the digital interface parameters are calculated. For each DUT, five different digital input pins were tested and each measurement was carried out in triplicate.
The measured values of VL and VH for different microcontrollers and FPGAs are reported in Table 1. For each device, the reported data are the average values of VH and VL, Vt = (VH + VL)/2, ΔV = VHVL, and the coefficient of variation of ΔV (CVΔV) is defined as the ratio between the standard deviation and the mean value of ΔV.
The results of Table 1 show that the digital interface parameters are strongly dependent on the technology, with different devices characterized by significantly different values of VL and VH. Regarding the intra-device variability of the digital interface parameters, the results have shown that the parameters VL and VH for different input pins of the same device follow a Gaussian distribution with differences that can be up to 7.5% of the average values of the interface parameters. Thus, for accurate measurements, the selected pin must be calibrated by measuring the specific values of the parameters VL and VH. From preliminary simulations, it was also assessed that the interface parameters are affected by the power supply voltage and temperature. Then, the system must feature voltage regulators to provide a stable power supply and capacitors close to the power supply pins to decouple the high-frequency noise generated by the internal circuitry. Regarding the variation with temperature, VL and VH decreases linearly with increasing temperature values, with an average change rate of 1.24 mV/°C in the case of VH and 0.36 mV/°C in the case of VL. Thus, if measurements are carried out in the presence of significant temperature fluctuations (>5 °C), a temperature sensor can be used to compensate for the variation of the interface parameters with temperature.

2.3. Circuits to Change the Digital Interface Parameters

The data reported in Table 1 show that different devices are characterized by different values for the digital interface parameters. In particular, the FPGA from the Basys 3 development board [45] is characterized by a small value of ΔV (about 52 mV) that cannot be compatible with accurate Van measurements if the signal-to-noise ratio (SNR) is not sufficiently high. Similarly, the parameter Vt can assume values significantly different from VDD/2 = 1.65 V, and this, as will be explained in Section 3, results in lower accuracy of the measured Van value. To solve these problems, a couple of circuits were proposed that can change the values of parameters Vt and ΔV at the cost of a limited increase of the interface circuit complexity.
The first circuit, presented in Figure 3, can be used to change the digital interface parameters in the case the value of Vt is lower than VDD/2. The operational amplifier working in voltage follower mode is used to provide a high input impedance for the voltage signal V1. Indicating that when VL and VH are the digital interface parameters of the device (at node 3) and when VL* and VH* are the digital interface parameters at node 1, it is
V L * = ( 1 + R A R B + R A R C ) V L R A R B V D D
V H * = ( 1 + R A R B + R A R C ) V H
Thus, the values of Vt* and ΔV* can be calculated as
V t * = V H * + V L * 2 = ( 1 + R A R B + R A R C ) V t R A R B V D D 2
Δ V * = V H * V L * = ( 1 + R A R B + R A R C ) Δ V + R A R B V D D
By choosing appropriate values of RA, RB, and RC, the selected values of VL*, VH*, Vt*, and ΔV* can be obtained.
Similarly, in the case of a device characterized by Vt > VDD/2, the digital interface parameters can be changed using the circuit of Figure 4. Indicating that when VL and VH are the digital interface parameters of the device (at node 3) and when VL* and VH* are the digital interface parameters at node 1, they are:
V L * = ( 1 + R A R B + R A R C ) V L ( R A R B + R A R C ) V D D
V H * = ( 1 + R A R B + R A R C ) V H R A R C V D D
Thus, the values of Vt* and ΔV* can be calculated as:
V t * = V H * + V L * 2 = ( 1 + R A R B + R A R C ) V t R A R C V D D R A R B V D D 2
Δ V * = V H * V L * = ( 1 + R A R B + R A R C ) Δ V + R A R B V D D
Additionally, in this case, by choosing appropriate values of RA, RB, and RC, the selected values of VL*, VH*, Vt*, and ΔV* can be obtained.
Simulations were carried out to evaluate the impact of the accuracy of the resistors RA, RB, and RC on the accuracy of the parameters VL* and VH*. The results have shown that, in the presence of 10% variations in RA, RB, and RC, the corresponding variations in VL* and VH* are 2.72% and 4.44% for variations in RA, 2.11% and 0.7% for variations in RB, 4.71% and 3.52% for variations in RC.

3. Circuit Simulations

To test the feasibility and performance of the proposed technique to estimate the value of analog voltages without an ADC, circuit simulations were carried out using the software LTSpice XVII (Analog Devices, Wilmington, MA, USA) [48]. The circuit presented in Figure 1 was simulated by modeling the digital interface of the DUT using a Schmitt trigger circuit with suitable values of VL and VH. Initially, the case study of a digital interface characterized by Vt = 1.65 V, ΔV = 0.5 V, VL = 1.4 V, and VH = 1.9 V is considered, and the results are presented in Section 3.1. Next, the case study of digital interfaces characterized by Vt = 1.65 V and multiple values of ΔV is considered and the results are presented in Section 3.2. Then, the case study of digital interfaces characterized by ΔV = 0.5 V and multiple values of Vt is considered, and the results are presented in Section 3.3. Finally, the maximum performance and accuracy of the proposed technique are estimated in Section 3.4.

3.1. Digital Interface with Vt = 1.65 V and ΔV = 0.5 V

In this section, the circuit of Figure 1 is simulated in the case where the digital interface is characterized by the parameters Vt = 1.65 V, ΔV = 0.5 V, VL = 1.4 V, and VH = 1.9 V. Four different parameters of the output signal V2 are considered: the period T = tH + tL, the time interval tH when V2 = VDD, the time interval tL when V2 = 0, and the duty cycle (DC), defined as
D C = 100 t H t H + t L
Simulations were carried out with VDD = 3.3 V, R1 = 10 kΩ, and different values of the capacitance C (320 nF, 150 nF, 60 nF, 47 nF, 32 nF, 20 nF, 14 nF, 9 nF, 5 nF, 2 nF, and 1 nF). Since the value of the capacitance C affects the switching frequency of the signal V2 but does not affect the linearity of the achieved characteristics, the results of the simulations are reported for the case C = 60 nF. Under these conditions, the resistance R2 must comply with the constraints defined by Equations (5) and (10), and thus,
R 2 > R 1 V D D V L V L = 13.57   k Ω
R 2 > R 1 V H V D D V H = 13.57   k Ω
Since Vt = VDD/2 = 1.65 V, Equations (20) and (21) provide the same constraint R2 > 13.57 kΩ. Simulations were carried out for different values of R2, and the results are reported in Figure 5. As can be seen, the period of V2, shown in Figure 5a, is a non-monotonous function of Van, and thus, it cannot be used to estimate the value of the analog voltage. The time intervals tH and tL, shown in Figure 5b and c, respectively, are monotonous with Van but, as also presented in Equations (3) and (8), are nonlinear functions of Van. The exploitation of tH and tL to estimate Van, albeit feasible, must use a look-up table to map the values of Van to the measured values of tH and tL with significant use of the device memory. Moreover, the resolution of the estimated Van is not uniform in the analog voltage range (0–3.3 V) but is higher for low values of Van in the case of tH and high values of Van in the case of tL. In the case of the duty cycle, shown in Figure 5d, the value is decreasing with Van, and the relation between the duty cycle and Van is linear; thus, the analog voltage Van can be estimated from the measured duty cycle without the need to use a look-up table to map the values of Van to the duty cycle. Moreover, the duty-cycle range increases for decreasing values of R2. This is clearly shown in Figure 6, where the maximum and minimum values of the duty cycle (achieved for Van = 0 and Van = 3.3 V, respectively) are plotted vs. R2. The maximum duty cycle increases and the minimum duty cycle decreases, in particular, when R2 approaches the lower limit defined by the constraints of Equations (20) and (21). The relation between the duty cycle and R2 for different values of Van can be explained by considering the charging and discharging times of the capacitor C, as shown in Figure 7.
In Figure 7a, the voltage V1 is plotted vs. time in the case Van = 0 for four different values of R2; while the discharging time tL is marginally affected by R2, the charging time tH strongly increases with the decrease of R2 (thus increasing the maximum value of the duty cycle). In Figure 7b, the voltage V1 is plotted vs. time in the case Van = VDD/2 = 1.65 V for four different values of R2; in this case, both the charging time tH and the discharging time tL are marginally affected by R2 and the value of the duty cycle is close to 50%. In Figure 7c, the voltage V1 is plotted vs. time in the case Van = VDD = 3.3 V for four different values of R2; while the charging time tH is marginally affected by R2, the discharging time tL strongly increases with the decrease of R2 (thus decreasing the minimum value of the duty cycle).
While the duty-cycle range (and thus the sensitivity of Van) increases for lower values of R2, the linearity of the relation between the duty cycle and Van decreases as well. This is shown in Figure 8, where the absolute value of the error in the estimated Van (|ΔVan,lin|), the difference between Van and the value estimated from the duty cycle using the linear regression line, is plotted vs. Van for different values of the resistance R2. As can be seen, the increased linearity achieved for higher values of R2 results in a lower error in the estimated value of Van. In particular, for R2 = 120 kΩ, the estimated error |ΔVan,lin| is lower than 1 mV and comparable to the resolution of a 12 bit ADC with a 0–3.3 V input range.

3.2. Digital Interface with Vt = 1.65 V and ΔV Variable

In this section, the circuit of Figure 1 is simulated in the case where the digital interface is characterized by the parameters Vt = 1.65 V and four different values of ΔV (0.5 V, 1.2 V, 2.0 V, 2.8 V). The simulations were carried out with values of R2 that results in comparable values of the duty-cycle range for Van values in the range 0–3.3 V. In particular, R2 = 20 kΩ in the case ΔV = 0.5 V (DCmin = 23.7%, DCmax = 76.3%), R2 = 26 kΩ in the case ΔV = 1.2 V (DCmin = 24.8%, DCmax = 75.1%), R2 = 43 kΩ in the case ΔV = 2.0 V (DCmin = 24.6%, DCmax = 75.4%), and R2 = 123 kΩ in the case ΔV = 2.8 V (DCmin = 25.5%, DCmax = 74.5%). The results of the simulations are presented in Figure 9, where the duty cycle is plotted vs. Van. As can be seen, in the cases ΔV = 0.5 V and ΔV = 1.2 V the duty cycle is a quasi-linear function of the analog voltage Van, while for higher values of ΔV, significant deviation from the linear response is present. The analog voltage Van was estimated from the value of the duty cycle using the linear regression line fitting the curves presented in Figure 9, and the absolute value of the error in the estimated Van (|ΔVan,lin|) is plotted vs. Van for the four different values of ΔV.
The results, presented in Figure 10, show how smaller values of ΔV are characterized by a better linear response of the relation between the duty cycle and Van and lower values of |ΔVan,lin|. Thus, to achieve good accuracy in the estimation of Van, a suitable value of ΔV must be considered that must be not too high to provide a quasi-linear response but also not too low to guarantee a reliable operation of the circuit depending on the signal-to-noise ratio (SNR).

3.3. Digital Interface with Vt Variable and ΔV = 0.5 V

In this section, the circuit of Figure 1 is simulated in the case where the digital interface is characterized by five different values of Vt (1.15 V, 1.40 V, 1.65 V, 1.90 V, and 2.15 V) and ΔV = 0.5 V. The digital interface parameters are, respectively, VL = 0.90 V and VH = 1.40 V for Vt = 1.15 V, VL = 1.15 V, and VH = 1.65 V for Vt = 1.40 V, VL = 1.40 V, and VH = 1.90 V for Vt = 1.65 V, VL = 1.65 V, and VH = 2.15 V for Vt = 1.90 V, VL = 1.90 V, and VH = 2.40 V for Vt = 2.15 V. The simulations were carried out with R2 = 20 kΩ for Vt = 1.65 V, R2 = 28 kΩ for Vt = 1.40 V and Vt = 1.90 V, and R2 = 40 kΩ for Vt = 1.15 V and Vt = 2.15 V. The results of the simulations are presented in Figure 11. As can be seen, the case Vt = 1.65 V is characterized by the highest range of the duty cycle and, thus, the highest sensitivity in the estimation of Van. The reason for such behavior can be explained by considering the constraint conditions defined by Equations (5) and (10): it is VL,inf = 1.1 V and VH,sup = 2.2 V for R2 = 20 kΩ, VL,inf = 0.87 V and VH,sup = 2.43 V for R2 = 28 kΩ, and VL,inf = 0.66 V and VH,sup = 2.64 V for R2 = 40 kΩ. In the case of Vt = VDD/2 = 1.65 V, the digital interface parameters are symmetrical about VDD/2, that is, VLVL,inf = VH,supVH = 0.3 V. This results in a wide range of the duty cycle that is symmetrical about 50%. In the case of Vt = 1.15 V, instead, it is VLVL,inf = 0.24 V and VH,supVH = 1.24 V, thus the duty-cycle minimum value is comparable to the case Vt = 1.65 V, while the duty-cycle maximum value is much lower, resulting in a reduced duty-cycle range. Similarly, in the case of Vt = 2.15 V, instead, it is VLVL,inf = 1.24 V and VH,supVH = 0.24 V; thus, the duty-cycle maximum value is comparable to the case Vt = 1.65 V, while the duty-cycle minimum value is much higher, resulting in a reduced duty-cycle range.
The analog voltage Van was estimated from the value of the duty cycle using the linear regression line fitting the curves presented in Figure 11, and the absolute value of the error in the estimated Van (|ΔVan,lin|) is plotted vs. Van for the five different values of Vt. The results presented in Figure 12 show that the case Vt = 1.65 V is characterized by a higher duty-cycle range and better linear response of the relation between the duty cycle and Van, thus resulting in a lower error in the estimated value of Van. This shows how Vt = VDD/2 is the best condition that results in the maximization of the accuracy in the estimated analog voltage Van.

3.4. Maximum Performance of the Proposed Method

In this section, the maximum performance of the proposed technique to estimate an analog voltage Van without the use of an ADC was evaluated. The performance was calculated in the ideal case of absence of noise, considering only the uncertainty in tH and tL due to the finite clock frequency. A case study is considered where the clock frequency of the device that implements the technique is set to 27 MHz (i.e., period of T = 37.037 ns) and tH and tL are measured using a 16 bit counter (i.e., maximum time interval 2.427 ms). Indicating that when NH and NL are the number of clock counts to measure tH and tL, respectively, the duty cycle of the signal V2 can be expressed as
D C = 100 N H T N H T + N L T = 100 N H N H + N L
Considering the error propagation in a quotient, the error in the measured duty cycle is
Δ D C = 100 Δ ( N H N H + N L ) = 100 [ Δ N H N H + N L + N H ( N H + N L ) 2 Δ ( N H + N L ) ]
Since, in absence of noise, it is ΔNH = ΔNL = 1 and Δ(NH + NL) = ΔNH + ΔNL = 2, the worst case (maximum ΔDC) is obtained when NHNH + NL (high values of duty cycle). It is
Δ D C max 300 N H + N L = 300 f c l o c k f P W M
where fclock is the frequency of the clock signal (27 MHz) and fPWM is the frequency of the signal V2. The maximum error of the measured duty cycle (ΔDCmax) was calculated using Equation (24) and the error of Van due to the limited clock frequency and counter resolution (|ΔVan,clock|) estimated by considering the relation between the duty cycle and Van presented in Figure 5d, thus not considering the uncertainty due to the deviation of the characteristic from the regression line. The results are presented in Table 2 for different values of the resistance R2 and the capacitance C. In Table 3, the maximum sampling rate is presented for the same values of the resistance R2 and the capacitance C. As can be seen, the maximum error |ΔVan,clock| decreases with the increase of C, since higher values of the capacitance result in longer measured times, thus higher resolution due to the counter, and with the decrease of R2, since this results in a higher range of the duty cycle and, thus, higher resolution of the measured duty cycle. At the same time, however, lower values of the capacitance C allow a much higher sampling frequency. Thus, in a noisy environment, with low SNR values, taking measurements with a low value of C allows to take advantage of the higher sampling frequency by averaging the measurements on a large number of samples, thus reducing the uncertainty due to noise.
By neglecting the error of Van due to the nonlinearity of the relation between Van and the duty cycle, for example, by mapping the values using a LUT on the device memory, an error for Van of approximately 0.67 mV (lower than a 12 bit ADC) can be achieved with a maximum sampling frequency of 863 Hz that is more than 10 times higher than the sample frequency reported in [41] (65 Hz). The maximum error for Van accounting also the error from linear modeling is obtained by adding |ΔVan,clock| with the error for Van due to modeling with the linear regression line (|ΔVan,lin|, i.e., data presented in Figure 8) and the results are presented in Table 4. In this case the value of Van is estimated from the measured duty cycle using a linear function, thus without a LUT to map the values of Van to the values of duty cycle. The minimum error for Van that can be achieved is 1.33 mV (close to the resolution of a 12 bit ADC) with a sampling frequency of 497 Hz.

4. Implementation in a FPGA Device

The proposed technique to estimate an analog voltage without the use of an ADC was implemented in a commercial FPGA, Gowin GW1NR-9 (Gowin Semiconductor, Guangzhou, China), integrated on a Tang nano 9k development board (Sipeed, Shenzhen, China) [47]. The Gowin GW1NR-9 is a low-cost FPGA that does not integrate an internal ADC for analog voltage measurements.
The schematic of the digital circuit, designed in Verilog and implemented in the FPGA, is presented in Figure 13. The digital input V1 and digital output V2 are interfaced with the RC circuit as presented in Figure 1. The clock signal clk (27 MHz) is generated using the 27 MHz crystal oscillator present on the Tang nano 9k development board. The UART_RX and UART_TX signals are interfaced with the USB-UART connector of the development board to allow UART communication (baud rate 115200) with a PC using ad-hoc developed LabVIEW programs (National Instruments).
The working principle of the designed digital circuit is defined by the following steps:
(1)
An 8 bit command is sent from the PC to the FPGA using UART to request the value of the duty cycle of signal V2.
(2)
The FPGA module ‘count periods’ calculates the length of time signal V2 is high (tH) and low (tL) and stores these data in two 16 bit registers.
(3)
The FPGA module ‘division calculation’ calculates the duty cycle of signal V2 from the 16 bit registers thigh and tlow and stores the result in the 32 bit register division_result.
(4)
The measured duty cycle is sent from the FPGA to the PC using UART with four 8 bit data transfers.
Simulations of the Verilog code were carried out using the Icarus Verilog simulator [49] under Windows in the case of a V2 signal of frequency 1 kHz and a duty cycle of 30%. The waveforms of the signals are presented in Figure 14. The time intervals when V2 = VDD (tH) and V2 = 0 (tL) are measured by the ‘count periods’ module using a 16 bit counter and stored inside two 16 bit registers (thigh and tlow). After the two time intervals are measured, a pulse is generated on the start_division_signal to trigger the duty-cycle calculation. This is carried out by the ‘division calculation’ module that accepts as input the 16 bit data thigh and tlow and generates a 32 bit signal division_result that is proportional to the duty cycle. In particular, division_result is calculated as the binary division between two 32 bit registers: A, with the most significant 16 bits equal to thigh and the least significant 16 bits equal to 0, and B, with the most significant 16 bits equal to 0 and the least significant 16 bits equal to thigh + tlow. After the binary division, carried out using the Verilog implementation presented in [50], the division result is stored in the 32 bit register division_result, a pulse is generated on the signal division_completed, and the duty cycle can be calculated using the formula
D C = 100 d i v i s i o n _ r e s u l t 2 16
The ‘UART controller’, ‘UART TX’, and ‘UART RX’ modules are used for the communication between the PC and the FPGA device. When the 8 bit decimal code 10 is received, the 32 bit register division_result is transferred to the PC with four 8 bit data transfer. The Verilog code of the proposed implementation on FPGA is available in the Supplementary Materials.

5. Experimental Results

The measurement technique, implemented on the Gowin GW1NR-9 FPGA device [51] integrated in the Tang Nano 9k development board [47], was tested using the measurement setup shown in Figure 15. After the place-and-route step, the FPGA resources used were 498/8640 of the programmable LUTs and ALUs (5%), 369/6693 of the registers (5%), 329/4320 of the configurable logic slice (7%), and 5 I/O ports. The analog voltage Van to be measured is generated using the 12 bit DAC integrated in the STM32 microcontroller present on the Nucleo-L073RZ development board. A Laptop PC is used to communicate with the microcontroller board and the FPGA board using the USB-UART interface. The PC sends a control message to the Nucleo-L073RZ board to set the value of the analog voltage Van at the output of the 12 bit DAC. Similarly, the PC sends a control message to the FPGA board (Tang nano 9k) to request the measured value of the duty cycle of the signal V2. The circuit composed of the resistances R1 and R2 and the capacitance C was implemented using discrete components mounted on a solderless breadboard.
First of all, the noise level of the circuit was evaluated by measuring the analog voltage Van using the 12 bit ADC integrated in the STM32 microcontroller. Seven different Van values were set with the 12-bit DAC: 0.419 V, 0.832 V, 1.244 V, 1.656 V, 2.068 V, 2.481 V, and 2.894 V.
For each Van value, 10,000 acquisitions were made using the 12 bit ADC and the statistical distribution of the acquired analog voltages evaluated. The average standard deviation (σ) of the analog voltage distribution was 4.442 mV. Thus, considering an uncertainty of ±2σ, the maximum error in the acquired analog voltage was 17.768 mV (confidence level 95%). This is significantly higher than the 12 bit ADC resolution (0.806 mV). The accuracy of the measured analog voltage Van can be increased by averaging different measurements. Indicating that when N is the number of measurements used to estimate Van, the standard deviation of the distribution of the analog voltage with N measurements is
σ N = σ N
To obtain the reading uncertainty typical of a 12 bit ADC (0.806 mV), it should be σN = 0.2015 mV and, given σ = 4.442 mV, the number of measurements N should be 486. Thus, under the current noise level, the original 1 MHz ADC sampling rate must be reduced to approximately 2057 Hz to guarantee a measurement uncertainty of 0.806 mV for the analog voltage Van.
Using the measurement setup presented in Figure 15, the resistance R1 was set to 10 kΩ and 10 different values of the resistance R2 were tested (15 kΩ, 16.3 kΩ, 18 kΩ, 22 kΩ, 27 kΩ, 32 kΩ, 38.8 kΩ, 47 kΩ, 67.8 kΩ, and 81.7 kΩ). For each value of the resistance R2, 10 different values of the capacitance C were tested (1 nF, 2 nF, 4.9 nF, 9 nF, 14 nF, 20 nF, 32 nF, 47 nF, 62 nF, 106 nF). Each measurement was carried out on 83 different Van values distributed on the 0–3.3 V range (steps of 39.759 mV), and, for each Van value, 1000 acquisitions were carried out to evaluate the average value and the standard deviation of the estimated Van. The results showed no significant difference in the standard deviation of the estimated Van for different values of the capacitance C. This can be explained by the high levels of noise introduced by the circuit implementation on a solderless breadboard with fly wires. Thus, in the following, the experiments are presented for the capacitance C = 1 nF since this results in the highest sampling rate and allows averaging of the measured signal on a larger number of samples to reduce the error. In Figure 16, the measured duty cycle plotted vs. the analog voltage Van is presented for different values of R2 and C = 1 nF.
As can be seen, the duty cycle presents a very good linear relationship with the analog voltage Van in the range 0.12–3.22 V. The saturation of the characteristic outside this range was observed also in the measurements of Van using the microcontroller integrated 12 bit ADC and can be explained by a saturation of the output of the 12 bit DAC used to generate Van. Thus, in the following, the performance of the technique deployed on the FPGA device was evaluated in the Van range 0.12–3.22 V. For each value of the resistance R2, the linear regression equation that best fits the characteristic duty cycle Van was calculated offline using a PC. The calculated slope and offset of the linear regression line were stored in the FPGA memory and used to estimate the value of the analog voltage Van. The maximum deviation to the real value of Van (|ΔVan|) was also evaluated. The measured standard deviation (σ) of the estimated Van was considered for the determination of the number of measurements (N) needed to obtain the reported accuracy in the Van estimation, and this value was used to calculate the maximum sampling rate (SRmax). The results are reported in Table 5. As can be seen, the uncertainty in the analog voltage estimation (|ΔVan|) presents a minimum for R2 = 32 kΩ. This is the result of two different effects: (a) lower values of R2 are characterized by a higher range of the duty cycle and, thus, higher sensitivity in the Van estimation (this is confirmed by the higher standard deviation σ in the case of higher values of R2) and (b) higher values of R2 result in stronger linearity of the duty-cycle Van characteristic, thus lower error in the estimation of Van using the linear regression line. In the end, the highest accuracy in the Van estimation (1.09 mV) is obtained for R2 = 32 kΩ with a maximum sampling rate of 9.75 Hz. Under these conditions, the analog voltage is measured with an effective number of bits ENOB = 10.82, a signal-to-noise ratio SNR = 66.9 dB, a differential nonlinearity DNL = 0.12 LSB, and an integral nonlinearity INL = 0.72 LSB. The maximum sampling rate can be increased to 31.35 Hz and 128.31 Hz with a limited reduction in the estimated Van accuracy (maximum errors of 1.61 mV and 2.68 mV, respectively). This was achieved using a solderless breadboard implementation with fly wires. The implementation on a custom designed electronic board integrating the FPGA and the measurement circuit is expected to significantly reduce the noise level and thus improve the measurement accuracy.

6. Comparison with the State of the Art

The performance of the proposed technique for analog voltage measurement without an ADC was compared to similar techniques from the literature, as well as a 12 bit ADC integrated in a low-cost microcontroller, and the results are presented in Table 6.
The Nucleo-L073RZ is a development platform with onboard the microcontroller STM32L073RZT6 by ST-Microelectronics that integrates a 12 bit ADC [43]. This is a very popular platform for the development of portable battery-operated sensor systems due to the low power consumption. The internal 12 bit ADC works in the range 0–3.3 V with a maximum error (in the ideal case of absence of noise) of 0.806 mV and a sampling rate of 1 MHz.
The technique proposed by Peter et al. in 1998, implemented on the PIC16C6XX series of microcontrollers, presents a 10 bit delta-sigma ADC using the analog comparator integrated in the microcontroller and a digital filter [37]. The measured analog voltages are in the range 0–5 V, the reported effective resolution is 8 bit (maximum error 19.53 mV), and a single measurement takes 20.48 ms (maximum sample rate 48.83 Hz).
The work by Soldera et al. also implements a 10 bit delta-sigma ADC on the HC9S08Rx family of microcontrollers working at 8 MHz and exploits the analog comparator integrated in the microcontroller for the analog voltage measurements in the range 0–3.3 V [38]. The reported maximum error is 3.22 mV with a sampling rate of 125 Hz.
The technique presented by Weber and Windish in 2007 implements an analog voltage measurement without an ADC using the microcontroller MSP430F2274 (Texas Instruments) [39]. The proposed implementation is suited for the measurement of control signals in an industrial environment (0–10 V, 0–20 mA) and uses an external AD7400 delta-sigma modulator (Analog Devices). No data are reported about the measurement accuracy and sampling rate.
A delta-sigma modulator for analog voltage measurements was also proposed in 2011 with an implementation on an Altera Cyclone IV FPGA device [40]. The reported sampling rate is very high (500 kHz), with a maximum error for the measured voltage of 3.22 mV. However, the proposed technique exploits the Low Voltage Differential Signaling (LVDS) receiver integrated in the FPGA and, thus, can be implemented only on devices with this feature.
Another delta-sigma modulator on FPGA is presented by Lattice Semiconductor and implemented using a LVDS receiver or an external analog comparator for the FPGA devices that lack this feature [52]. The range of the analog voltage is 0–3.3 V, and the reported maximum error is 12.88 mV with a sampling rate of 7.63 kHz.
Differently from the previous implementations presented in [37,38,39,40,52] that use an analog comparator, either integrated in the device or external, the works proposed by Bengtsson in 2012 exploit the Schmitt trigger circuit of the digital input port of a PIC18F458 microcontroller for the voltage measurements [41]. The measurement range is 0–5 V, with a reported maximum error of 1.22 mV and a sampling frequency of 65 Hz. To achieve this measurement accuracy, a LUT, stored in the microcontroller memory, is used to map the time periods measured with the internal counter to the analog voltage values.
The presented work implements an analog voltage measurement without an ADC in a low-cost FPGA device (Gowin GW1NR-9). The novelty of the proposed solution lies in the exploitation of the Schmitt trigger circuit of the digital input pin of a microcontroller or FPGA combined with the estimation of the analog voltage from the duty cycle of a square-wave signal. The exploitation of the Schmitt trigger circuit of the digital input pin allows avoidance of the use of an analog comparator while the property of the duty cycle of the monitored waveform signal to feature a good linear correlation with the analog voltage is exploited to avoid the use of a LUT, with benefits in terms of lower memory occupation. The works in [37,38,39,40,52] propose delta-sigma ADCs implemented in different microcontrollers and FPGAs that make use of an analog comparator and a reference voltage. The works in [40,52] remove the need for an analog comparator by the use of a LVDS receiver, but this high-speed differential signal technology is generally not integrated in microcontrollers and low-cost FPGAs. The work of Bengtsson [41], instead, exploits the Schmitt trigger property of the digital input pin of a microcontroller like the proposed solution, but estimates the analog voltage with a nonlinear characteristic and using a LUT to map the measured counter time to the analog voltage, with increased cost in terms of memory occupation. The proposed solution features a maximum error in absence of noise of 1.33 mV with a sampling frequency of 497 Hz. The results from experimental measurements in a noisy environment show that an accuracy close to a 12 bit ADC can be achieved with a sampling frequency of 9.75 Hz or, alternatively, a maximum error of 1.61 mV or 2.68 mV for a sampling frequency of 31.35 Hz and 128.31 Hz, respectively.

7. Conclusions

A novel technique was presented to implement a direct interface between a sensor with analog output voltage and the digital input ports of a microcontroller or Field-Programmable Gate Array (FPGA). The proposed method requires, in its simplest implementation, only a few discrete passive components (two resistors and a capacitor) and estimates the analog voltage from the duty cycle of a square-wave digital signal using a quasi-linear characteristic. Simulations using LTSpice have shown that, using a 16 bit counter, a resolution of 1.33 mV can be achieved with a maximum sampling rate of 497 Hz and without the use of look-up tables to map the analog voltages to the duty-cycle values, thus with significant reduction in memory occupation. The proposed technique was implemented in a low-cost commercial FPGA using a solderless breadboard with fly wires, and the test results showed a maximum error of 1.09 mV with a sampling rate of 9.75 Hz. The sampling rate can be increased with a limited reduction in the analog voltage estimation accuracy (31.35 Hz for a maximum error of 1.61 mV and 128.31 Hz for a maximum error of 2.68 mV). A potential issue that can impact the accuracy of the proposed technique is the variation of the interface parameters with environmental conditions (temperature and humidity) and power supply, as well as with the aging of the device. Future investigations in this research line will be aimed at evaluating these effects and proposing countermeasures to mitigate the impact on the measurement accuracy.

Supplementary Materials

The following supporting information can be downloaded at: https://0-www-mdpi-com.brum.beds.ac.uk/article/10.3390/s24030873/s1.

Funding

This research received no external funding.

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Not applicable.

Data Availability Statement

Data are contained within the article and Supplementary Materials.

Conflicts of Interest

The author declares no conflicts of interest.

References

  1. Pistoia, G. Battery Operated Devices and Systems: From Portable Electronics to Industrial Products; Elsevier: Amsterdam, The Netherlands, 2008. [Google Scholar]
  2. Grossi, M. Energy harvesting strategies for wireless sensor networks and mobile devices: A review. Electronics 2021, 10, 661. [Google Scholar] [CrossRef]
  3. Sgobba, F.; Sampaolo, A.; Patimisco, P.; Giglio, M.; Menduni, G.; Ranieri, A.C.; Hoelzl, C.; Rossmadl, H.; Brehm, C.; Mackowiak, V.; et al. Compact and portable quartz-enhanced photoacoustic spectroscopy sensor for carbon monoxide environmental monitoring in urban areas. Photoacoustics 2022, 25, 100318. [Google Scholar] [CrossRef]
  4. Salamone, F.; Masullo, M.; Sibilio, S. Wearable devices for environmental monitoring in the built environment: A systematic review. Sensors 2021, 21, 4727. [Google Scholar] [CrossRef]
  5. Singh, G.; Kim, S.; Lee, K. Development of a highly sensitive and portable particulate matter SAW sensor and interface electronics. Sens. Actuators A Phys. 2022, 343, 113641. [Google Scholar] [CrossRef]
  6. Grossi, M.; Valli, E.; Bendini, A.; Gallina Toschi, T.; Riccò, B. A Portable Battery-Operated Sensor System for Simple and Rapid Assessment of Virgin Olive Oil Quality Grade. Chemosensors 2022, 10, 102. [Google Scholar] [CrossRef]
  7. Grossi, M.; Bendini, A.; Valli, E.; Gallina Toschi, T. Field-Deployable Determinations of Peroxide Index and Total Phenolic Content in Olive Oil Using a Promising Portable Sensor System. Sensors 2023, 23, 5002. [Google Scholar] [CrossRef] [PubMed]
  8. Ghatak, B.; Banerjee, S.; Ali, S.B.; Das, N.; Tudu, B.; Pramanik, P.; Mukherji, S.; Bandyopadhyay, R. Development of a low-cost portable aroma sensing system for identifying artificially ripened mango. Sens. Actuators A Phys. 2021, 331, 112964. [Google Scholar] [CrossRef]
  9. Daou, B.; Elbadi, M.; Alkaisi, A.; Elwakil, A.S. Body Mass Composition Measurements Using a Portable Device. In Proceedings of the IEEE 4th Novel Intelligent and Leading Emerging Sciences Conference (NILE), Giza, Egypt, 22–24 October 2022; pp. 159–162. [Google Scholar]
  10. Muñoz, J.D.; Mosquera, V.H.; Rengifo, C.F. A low-cost, portable, two-dimensional bioimpedance distribution estimation system based on the AD5933 impedance converter. HardwareX 2022, 11, e00274. [Google Scholar] [CrossRef] [PubMed]
  11. Choi, A.; Kim, J.Y.; Jo, S.; Jee, J.H.; Heymsfield, S.B.; Bhagat, Y.A.; Kim, I.; Cho, J. Smartphone-Based Bioelectrical Impedance Analysis Devices for Daily Obesity Management. Sensors 2015, 15, 22151–22166. [Google Scholar] [CrossRef]
  12. Grossi, M.; Parolin, C.; Vitali, B.; Riccò, B. Computer Vision Approach for the Determination of Microbial Concentration and Growth Kinetics Using a Low Cost Sensor System. Sensors 2019, 19, 5367. [Google Scholar] [CrossRef] [PubMed]
  13. Salmeron, J.F.; Vela-Cano, M.; Falco, A.; Rivadeneyra, M.A.; Becherer, M.; Lugli, P.; Gonzalez-Lopez, J.; Rivadeneyra, A. Portable electronic system for fast detection of bacteria lactase fermentation in water samples. Sens. Actuators A Phys. 2022, 338, 113486. [Google Scholar] [CrossRef]
  14. Grossi, M.; Parolin, C.; Vitali, B.; Riccò, B. Measurement of bacterial concentration using a portable sensor system with a combined electrical-optical approach. IEEE Sens. J. 2019, 19, 10693–10700. [Google Scholar] [CrossRef]
  15. Meléndez, F.; Arroyo, P.; Gómez-Suárez, J.; Palomeque-Mangut, S.; Suárez, J.I.; Lozano, J. Portable electronic nose based on digital and analog chemical sensors for 2, 4, 6-trichloroanisole discrimination. Sensors 2022, 22, 3453. [Google Scholar] [CrossRef] [PubMed]
  16. Shi, L.; Tang, Q.; Yang, B.; Liu, W.; Li, B.; Yang, C.; Jin, Y. Portable and Label-Free Sensor Array for Discriminating Multiple Analytes via a Handheld Gas Pressure Meter. Anal. Chem. 2022, 94, 14453–14459. [Google Scholar] [CrossRef] [PubMed]
  17. Grossi, M.; Riccò, B. A portable electronic system for in-situ measurements of oil concentration in MetalWorking fluids. Sens. Actuators A Phys. 2016, 243, 7–14. [Google Scholar] [CrossRef]
  18. Sridhar, S.; Sankar, K.R.; Sreeshylam, P.; Parivallal, S.; Kesavan, K.; Murthy, S.G.N. Remote structural health monitoring of civil infrastructures-recent trends. Int. J. Comadem 2008, 11, 25. [Google Scholar]
  19. Martín, C.; Garrido, D.; Llopis, L.; Rubio, B.; Díaz, M. Facilitating the monitoring and management of structural health in civil infrastructures with an Edge/Fog/Cloud architecture. Comput. Stand. Interfaces 2022, 81, 103600. [Google Scholar] [CrossRef]
  20. Gopalakrishnan, K.; Ceylan, H.; Kim, S.; Yang, S. Wireless MEMS for Transportation Infrastructure Health Monitoring. In Wireless MEMS Networks and Applications; Woodhead Publishing: Sawston, UK, 2017; pp. 53–76. [Google Scholar]
  21. Xie, S.; Wang, Y. A Data Weight Averaging-Inspired Digital Calibration Method for a 10-Bit Noise-Shaping Successive Approximation Register. Electronics 2023, 12, 3046. [Google Scholar] [CrossRef]
  22. Chen, T.; Park, C.; Chaganti, S.K.; Silva-Martinez, J.; Geiger, R.L.; Chen, D. An ultrafast multibit/stage pipelined ADC testing and calibration method. IEEE Trans. Instrum. Meas. 2019, 69, 729–738. [Google Scholar] [CrossRef]
  23. Li, T.; Zhang, Y.; Ni, Y. An Ultra-fast ADC Linearity Test and Calibration Method. In Proceedings of the IEEE 13th International Conference on Anti-Counterfeiting, Security, and Identification (ASID), Xiamen, China, 25–27 October 2019; pp. 282–285. [Google Scholar]
  24. Juan, Y.H.; Huang, H.Y.; Lee, S.Y.; Lai, S.C.; Juang, W.H.; Luo, C.H. A self-testing platform with a foreground digital calibration technique for SAR ADCs. Appl. Sci. 2016, 6, 217. [Google Scholar] [CrossRef]
  25. Hernández-Gutiérrez, C.A.; Delgado-del-Carpio, M.; Zebadúa-Chavarría, L.A.; Hernández-de-León, H.R.; Escobar-Gómez, E.N.; Quevedo-López, M. IoT-Enabled System for Detection, Monitoring, and Tracking of Nuclear Materials. Electronics 2023, 12, 3042. [Google Scholar] [CrossRef]
  26. Samadpoor Rikan, B.; Kim, S.Y.; Ahmad, N.; Abbasizadeh, H.; Riaz Ur Rehman, M.; Shehzad, K.; Hejazi, A.; Rad, R.E.; Verma, D.; Lee, K.Y. A sigma-delta ADC for signal conditioning IC of automotive piezo-resistive pressure sensors with over 80 dB SNR. Sensors 2018, 18, 4199. [Google Scholar] [CrossRef] [PubMed]
  27. Reverter, F. A microcontroller-based interface circuit for non-linear resistive sensors. Meas. Sci. Technol. 2020, 32, 027001. [Google Scholar] [CrossRef]
  28. Reverter, F. A microcontroller-based interface circuit for three-wire connected resistive sensors. IEEE Trans. Instrum. Meas. 2022, 71, 1–4. [Google Scholar] [CrossRef]
  29. Reverter, F. A direct approach for interfacing four-wire resistive sensors to microcontrollers. Meas. Sci. Technol. 2022, 34, 037001. [Google Scholar] [CrossRef]
  30. Areekath, L.; George, B.; Reverter, F. Analysis of a direct microcontroller interface for capacitively coupled resistive sensors. IEEE Trans. Instrum. Meas. 2020, 70, 1–10. [Google Scholar] [CrossRef]
  31. Czaja, Z. A measurement method for capacitive sensors based on a versatile direct sensor-to-microcontroller interface circuit. Measurement 2020, 155, 107547. [Google Scholar] [CrossRef]
  32. Czaja, Z. A measurement method for lossy capacitive relative humidity sensors based on a direct sensor-to-microcontroller interface circuit. Measurement 2021, 170, 108702. [Google Scholar] [CrossRef]
  33. Hidalgo-Lopez, J.A.; Castellanos-Ramos, J. Simplifying capacitive sensor readout using a new direct interface circuit. IEEE Trans. Instrum. Meas. 2022, 72, 2000910. [Google Scholar] [CrossRef]
  34. Kokolanski, Z.; Jordana, J.; Gasulla, M.; Dimcev, V.; Reverter, F. Direct inductive sensor-to-microcontroller interface circuit. Sens. Actuators A Phys. 2015, 224, 185–191. [Google Scholar] [CrossRef]
  35. Kokolanski, Z.; Gasulla, M.; Reverter, F. Differential Inductive Sensor-to-Microcontroller Interface Circuit. In Proceedings of the IEEE International Instrumentation and Measurement Technology Conference (I2MTC), Auckland, New Zealand, 20–23 May 2019; pp. 1–5. [Google Scholar]
  36. Asif, A.; Ali, A.; Abdin, M.Z.U. Resolution enhancement in directly interfaced system for inductive sensors. IEEE Trans. Instrum. Meas. 2018, 68, 4104–4111. [Google Scholar] [CrossRef]
  37. Peter, D.; Baker, B.C.; Butler, D.; Darmawaskita, H. Make a Delta-Sigma Converter Using a Microcontroller’s Analog Comparator Module; Microchip Technology Inc.: Chandler, AZ, USA, 1998. [Google Scholar]
  38. Soldera, J.D.B.; Espindola, M.; Olmos, A. Implementing a 10-Bit Sigma-Delta Analog-to-Digital Converter Using the HC9S08Rx MCU Family Analog Comparator. Free. Semicond. 2005, 1–22. Available online: https://www.nxp.com/docs/en/application-note/AN2688.pdf (accessed on 20 November 2023).
  39. Weber, P.; Windish, C. Build a complete industrial-ADC interface using a microcontroller and a sigma-delta modulator. EDN 2007, 52, 63. [Google Scholar]
  40. Integrated ADC for Altera Cyclone-IV Devices, Missing Link Electronics, Technical Brief. 2011. Available online: https://www.missinglinkelectronics.com/wp-content/uploads/2012/08/MLE-TB20110419.pdf (accessed on 20 November 2023).
  41. Bengtsson, L. Direct analog-to-microcontroller interfacing. Sens. Actuators A Phys. 2012, 179, 105–113. [Google Scholar] [CrossRef]
  42. Raspberry Pi Pico Development Board. Available online: https://www.raspberrypi.com/products/raspberry-pi-pico/ (accessed on 20 November 2023).
  43. Nucleo L073RZ Development Board. Available online: https://www.st.com/en/evaluation-tools/nucleo-l073rz.html (accessed on 20 November 2023).
  44. Arduino Due Development Board. Available online: https://docs.arduino.cc/hardware/due (accessed on 20 November 2023).
  45. Basys 3 Artix-7 FPGA Development Board. Available online: https://digilent.com/shop/basys-3-artix-7-fpga-trainer-board-recommended-for-introductory-users/ (accessed on 20 November 2023).
  46. Zybo Zync-7000 FPGA Development Board. Available online: https://digilent.com/reference/programmable-logic/zybo/start (accessed on 20 November 2023).
  47. Tang Nano 9k FPGA Development Board. Available online: https://wiki.sipeed.com/hardware/en/tang/Tang-Nano-9K/Nano-9K.html (accessed on 20 November 2023).
  48. LTSpice Circuit Simulator. Available online: https://www.analog.com/en/design-center/design-tools-and-calculators/ltspice-simulator.html (accessed on 4 January 2024).
  49. Icarus Verilog Simulator. Available online: https://bleyer.org/icarus/ (accessed on 20 November 2023).
  50. Verilog Implementation of the Circuit for Binary Division. Available online: https://projectf.io/posts/division-in-verilog/ (accessed on 20 November 2023).
  51. Gowin GW1NR Series Data Sheet. Available online: https://cdn.gowinsemi.com.cn/DS117E.pdf (accessed on 4 January 2024).
  52. Reference Design: Simple Sigma-Delta ADC, FPGA-RD-02047-1.6, Lattice Semiconductor. Available online: https://www.latticesemi.com/products/designsoftwareandip/intellectualproperty/referencedesigns/referencedesign03/simplesigmadeltaadc (accessed on 6 January 2024).
Figure 1. Schematic of the circuit used to implement the proposed technique for analog voltage measurements without an ADC.
Figure 1. Schematic of the circuit used to implement the proposed technique for analog voltage measurements without an ADC.
Sensors 24 00873 g001
Figure 2. Waveforms of the voltage signals for the circuit presented in Figure 1.
Figure 2. Waveforms of the voltage signals for the circuit presented in Figure 1.
Sensors 24 00873 g002
Figure 3. Circuit for the modulation of digital interface parameters in the case of a DUT with Vt < VDD/2.
Figure 3. Circuit for the modulation of digital interface parameters in the case of a DUT with Vt < VDD/2.
Sensors 24 00873 g003
Figure 4. Circuit for the modulation of digital interface parameters in the case of a DUT with Vt > VDD/2.
Figure 4. Circuit for the modulation of digital interface parameters in the case of a DUT with Vt > VDD/2.
Sensors 24 00873 g004
Figure 5. Simulated values of period (a), tH (b), tL (c), and duty cycle (d) of the output signal V2 plotted vs. the analog voltage Van for R1 = 10 kΩ, C = 60 nF, and different values of R2.
Figure 5. Simulated values of period (a), tH (b), tL (c), and duty cycle (d) of the output signal V2 plotted vs. the analog voltage Van for R1 = 10 kΩ, C = 60 nF, and different values of R2.
Sensors 24 00873 g005
Figure 6. Minimum and maximum values of the duty cycle plotted vs. the value of the resistance R2.
Figure 6. Minimum and maximum values of the duty cycle plotted vs. the value of the resistance R2.
Sensors 24 00873 g006
Figure 7. Waveforms of the signal V1 plotted vs. time during the charging and discharging phase of the capacitor C for four different values of R2 in the case of (a) Van = 0, (b) Van = VDD/2 = 1.65 V, and (c) Van = VDD = 3.3 V.
Figure 7. Waveforms of the signal V1 plotted vs. time during the charging and discharging phase of the capacitor C for four different values of R2 in the case of (a) Van = 0, (b) Van = VDD/2 = 1.65 V, and (c) Van = VDD = 3.3 V.
Sensors 24 00873 g007
Figure 8. Absolute value of the error in the estimated Van plotted vs. the real value of Van for different values of the resistance R2.
Figure 8. Absolute value of the error in the estimated Van plotted vs. the real value of Van for different values of the resistance R2.
Sensors 24 00873 g008
Figure 9. Simulated values of the duty cycle of the output signal V2 plotted vs. the analog voltage Van in the case Vt = VDD/2 = 1.65 V and four different values of ΔV.
Figure 9. Simulated values of the duty cycle of the output signal V2 plotted vs. the analog voltage Van in the case Vt = VDD/2 = 1.65 V and four different values of ΔV.
Sensors 24 00873 g009
Figure 10. Absolute value of the error in the estimated Van plotted vs. the real value of Van for Vt = VDD/2 = 1.65 V and four different values of ΔV.
Figure 10. Absolute value of the error in the estimated Van plotted vs. the real value of Van for Vt = VDD/2 = 1.65 V and four different values of ΔV.
Sensors 24 00873 g010
Figure 11. Simulated values of the duty cycle of the output signal V2 plotted vs. the analog voltage Van in the case of five different values of Vt and ΔV = 0.5 V.
Figure 11. Simulated values of the duty cycle of the output signal V2 plotted vs. the analog voltage Van in the case of five different values of Vt and ΔV = 0.5 V.
Sensors 24 00873 g011
Figure 12. Absolute value of the error in the estimated Van plotted vs. the real value of Van for five different values of Vt and ΔV = 0.5 V.
Figure 12. Absolute value of the error in the estimated Van plotted vs. the real value of Van for five different values of Vt and ΔV = 0.5 V.
Sensors 24 00873 g012
Figure 13. Schematic of the digital circuit for the estimation of an analog voltage without the use of an ADC.
Figure 13. Schematic of the digital circuit for the estimation of an analog voltage without the use of an ADC.
Sensors 24 00873 g013
Figure 14. Simulation of the designed digital circuit for the estimation of an analog voltage without the use of an ADC.
Figure 14. Simulation of the designed digital circuit for the estimation of an analog voltage without the use of an ADC.
Sensors 24 00873 g014
Figure 15. Measurement setup used to validate the proposed technique for analog voltage measurements without the use of an ADC.
Figure 15. Measurement setup used to validate the proposed technique for analog voltage measurements without the use of an ADC.
Sensors 24 00873 g015
Figure 16. Measured duty cycle of the digital signal V2 plotted vs. the analog voltage Van for R1 = 10 kΩ, C = 1 nF, and different values of the resistance R2.
Figure 16. Measured duty cycle of the digital signal V2 plotted vs. the analog voltage Van for R1 = 10 kΩ, C = 1 nF, and different values of the resistance R2.
Sensors 24 00873 g016
Table 1. Characteristics of the digital interface parameters for different microcontrollers and FPGAs.
Table 1. Characteristics of the digital interface parameters for different microcontrollers and FPGAs.
DeviceDevice TypeDevelopment BoardRef.VH (V)VL (V)Vt (V)ΔV (mV)CVΔV
STM32L073RZT6microcontrollerNucleo-L073RZ[43]1.6441.1961.4204481.827
Atmel SAM3X8EmicrocontrollerArduino Due[44]1.4811.2721.3762094.877
XC7A35T-1CPG236CFPGABasys 3[45]1.2811.2281.254526.527
XC7Z010-1CLG400CFPGAZybo[46]1.3371.2391.288971.425
Gowin GW1NR-9FPGATang Nano 9k[47]1.7531.3871.5703671.558
Table 2. Maximum error of Van (in mV) due to the limited clock frequency and counter resolution for different values of the resistance R2 and the capacitance C. Color-map: green—10th percentile, yellow—50th percentile, and red—90th percentile.
Table 2. Maximum error of Van (in mV) due to the limited clock frequency and counter resolution for different values of the resistance R2 and the capacitance C. Color-map: green—10th percentile, yellow—50th percentile, and red—90th percentile.
R2 (kΩ)
120623527221817161514
C = 320 nF2.211.120.590.420.310.220.190.170.140.10
C = 150 nF4.712.361.250.900.670.470.410.350.290.22
C = 60 nF11.775.913.132.251.671.171.030.890.730.55
C = 47 nF15.037.543.992.882.141.491.321.130.930.70
C = 32 nF22.0911.015.864.233.142.191.931.661.371.03
C = 20 nF35.3117.729.386.765.023.513.092.662.191.64
C = 14 nF50.4425.3213.409.667.185.014.423.803.122.35
C = 9 nF78.4739.3920.8515.0311.177.796.885.914.863.66
C = 5 nF141.2570.8937.5327.0620.1014.0312.3810.638.746.58
C = 2 nF353.12177.2493.8367.6550.2635.0730.9426.5821.8616.46
C = 1 nF706.30354.53187.67135.30100.5270.1561.8953.1243.7232.92
Table 3. Maximum sampling frequency (in Hz) for different values of the resistance R2 and the capacitance C. Color-map: green—10th percentile, yellow—50th percentile, and red—90th percentile.
Table 3. Maximum sampling frequency (in Hz) for different values of the resistance R2 and the capacitance C. Color-map: green—10th percentile, yellow—50th percentile, and red—90th percentile.
R2 (kΩ)
120623527221817161514
C = 320 nF510497469441404349327300266218
C = 150 nF108910621002941863744698641568465
C = 60 nF2724265525052353215918611747160414201163
C = 47 nF3478338931973004275723762230204818121485
C = 32 nF5113497846964412404934913275300826622182
C = 20 nF8174796575157060647955855241481342603491
C = 14 nF11,67811,37910,73610,086925679797487687560864988
C = 9 nF18,16517,70116,70015,69014,39812,41211,64710,69594677759
C = 5 nF32,69831,86230,06028,24225,91622,34220,96419,25217,04213,967
C = 2 nF81,74679,65575,15470,60664,79255,85652,41348,13242,60534,919
C = 1 nF163,505159,337150,308141,203129,584111,719104,83296,19085,20769,842
Table 4. Maximum error of Van (in mV) due to the limited clock frequency, counter resolution and the linearity approximation for different values of the resistance R2 and the capacitance C. Color-map: green—10th percentile, yellow—50th percentile, and red—90th percentile.
Table 4. Maximum error of Van (in mV) due to the limited clock frequency, counter resolution and the linearity approximation for different values of the resistance R2 and the capacitance C. Color-map: green—10th percentile, yellow—50th percentile, and red—90th percentile.
R2 (kΩ)
120623527221817161514
C = 320 nF2.251.331.552.444.218.5310.8514.3319.9929.45
C = 150 nF4.752.582.212.924.578.7811.0714.5120.1429.57
C = 60 nF11.816.134.094.275.579.4811.6915.0520.5829.90
C = 47 nF15.077.764.954.906.049.8011.9815.2920.7830.05
C = 32 nF22.1311.306.826.257.0410.5012.5915.8221.2230.38
C = 20 nF35.3517.9410.348.788.9211.8113.7516.8222.0430.99
C = 14 nF50.4925.5414.3611.6811.0813.3215.0817.9622.9731.70
C = 9 nF78.5139.6121.8117.0515.0716.1017.5420.0724.7133.00
C = 5 nF141.2971.1138.4929.0824.0022.3423.0424.7928.5935.93
C = 2 nF353.16177.4694.7969.6754.1643.3841.6040.7441.7145.81
C = 1 nF706.34354.75188.63137.32104.4278.4672.5567.2863.5762.27
Table 5. Performance of the proposed technique to estimate an analog voltage implemented in a FPGA device.
Table 5. Performance of the proposed technique to estimate an analog voltage implemented in a FPGA device.
R2 (kΩ)Van| (mV)σ (mV)NSRmax (Hz)
1514.5716.18207679.37
16.37.4418.06941680.08
185.6919.82194847.50
222.6824.641352128.31
271.6130.37570831.35
321.0937.2218,6659.75
38.81.1843.9722,0748.36
471.4653.4221,5108.66
67.82.1977.1319,9019.45
81.72.6393.0220,0649.40
Table 6. Performance comparison of the proposed technique for analog voltage measurements without an ADC with similar techniques from literature and a 12 bit ADC integrated in a low-cost microcontroller.
Table 6. Performance comparison of the proposed technique for analog voltage measurements without an ADC with similar techniques from literature and a 12 bit ADC integrated in a low-cost microcontroller.
ADC
Used
Device
Type
Comparator
Used
Measurement
Range
Maximum
Error
Maximum
Sample Rate
LUT
Used
Ref.
YesμcontrollerNo0–3.3 V0.81 mV1 MHzNo[43]
NoμcontrollerYes0–5 V19.53 mV48.83 HzNo[37]
NoμcontrollerYes0–3.3 V3.22 mV125 HzNo[38]
NoμcontrollerYes0–10 VNo[39]
NoFPGAYes0–3.3 V3.22 mV500 kHzNo[40]
NoFPGAYes0–3.3 V12.88 mV7.63 kHzNo[52]
NoμcontrollerNo0–5 V1.22 mV65 HzYes[41]
NoFPGANo0–3.3 V1.33 mV497 HzNoThis work
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Grossi, M. Efficient and Accurate Analog Voltage Measurement Using a Direct Sensor-to-Digital Port Interface for Microcontrollers and Field-Programmable Gate Arrays. Sensors 2024, 24, 873. https://0-doi-org.brum.beds.ac.uk/10.3390/s24030873

AMA Style

Grossi M. Efficient and Accurate Analog Voltage Measurement Using a Direct Sensor-to-Digital Port Interface for Microcontrollers and Field-Programmable Gate Arrays. Sensors. 2024; 24(3):873. https://0-doi-org.brum.beds.ac.uk/10.3390/s24030873

Chicago/Turabian Style

Grossi, Marco. 2024. "Efficient and Accurate Analog Voltage Measurement Using a Direct Sensor-to-Digital Port Interface for Microcontrollers and Field-Programmable Gate Arrays" Sensors 24, no. 3: 873. https://0-doi-org.brum.beds.ac.uk/10.3390/s24030873

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop