Next Article in Journal
Machine Learning Meets Compressed Sensing in Vibration-Based Monitoring
Next Article in Special Issue
Fast Constant-Time Modular Inversion over Fp Resistant to Simple Power Analysis Attacks for IoT Applications
Previous Article in Journal
Correlation Analysis of Noise, Vibration, and Harshness in a Vehicle Using Driving Data Based on Big Data Analysis Technique
Previous Article in Special Issue
Blockchain Based Authentication and Cluster Head Selection Using DDR-LEACH in Internet of Sensor Things
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

An Ultra-Low-Cost RCL-Meter

1
CEOT—Center for Electronics, Optoelectronics and Telecommunications, University of Algarve, Campus Gambelas, 8005-139 Faro, Portugal
2
Department of Physics, University of Algarve, Campus Gambelas, 8005-139 Faro, Portugal
3
Department of Electronics and Computer Engineering, University of Algarve, Campus Gambelas, 8005-139 Faro, Portugal
*
Author to whom correspondence should be addressed.
Sensors 2022, 22(6), 2227; https://doi.org/10.3390/s22062227
Submission received: 18 January 2022 / Revised: 1 March 2022 / Accepted: 8 March 2022 / Published: 14 March 2022
(This article belongs to the Special Issue IoT Multi Sensors)

Abstract

:
An ultra-low-cost RCL meter, aimed at IoT applications, was developed, and was used to measure electrical components based on standard techniques without the need of additional electronics beyond the AVR® micro-controller hardware itself and high-level routines. The models and pseudo-routines required to measure admittance parameters are described, and a benchmark between the ATmega328P and ATmega32U4 AVR® micro-controllers was performed to validate the resistance and capacitance measurements. Both ATmega328P and ATmega32U4 micro-controllers could measure isolated resistances from 0.5 Ω to 80 MΩ and capacitances from 100 fF to 4.7 mF. Inductance measurements are estimated at between 0.2 mH to 1.5 H. The accuracy and range of the measurements of series and parallel RC networks are demonstrated. The relative accuracy (ar) and relative precision (pr) of the measurements were quantified. For the resistance measurements, typically ar, pr < 10% in the interval 100 Ω–100 MΩ. For the capacitance, measured in one of the modes (fast mode), ar < 20% and pr < 5% in the range 100 fF–10 nF, while for the other mode (transient mode), typically ar < 20% in the range 10 nF–10 mF and pr < 5% for 100 pF–10 mF. ar falls below 5% in some sub-ranges. The combination of the two capacitance modes allows for measurements in the range 100 fF–10 mF (11 orders of magnitude) with ar < 20%. Possible applications include the sensing of impedimetric sensor arrays targeted for wearable and in-body bioelectronics, smart agriculture, and smart cities, while complying with small form factor and low cost.

1. Introduction

The Internet of Things (IoT) entails a network of physical objects—‘things’—that are embedded with sensors, electronics, software, etc. for the purpose of communicating with other devices over the Internet. Caused by the sheer number of things connected in this way, these data-acquisition devices obviously need to be of low-cost and fulfill certain tasks: sensing, electronic processing and connecting to the Internet. Impedimetric sensor arrays are an emerging field of study that is concerned with sense, processing and casting the measured data to the Internet [1,2,3]. Typical applications are wearable and in-body electronics [4,5,6,7,8] and plants and smart agriculture [9,10,11,12,13]. A common aspect shared between different devices is that the electronic interfaces for detection, processing and connection to the Internet are mainly carried out by separate external systems specifically optimized for each of these functions. While designing a system with specific units may often be advantageous to enhance the overall performance of the device, it also leads to higher manufacturing cost. For example, most biosensors feature a transduction mechanism to couple the physical and/or chemical changes in the system under measurement to the electronic circuitry of the measuring device. The latter is specifically optimized for the sensing interface and is followed by an analog-to-digital conversion unit (ADC). In the most usual scenario, the end user has access to a plug-and-play instrument box. But even in this case, the transduction mechanism may require finding signal conditioning strategies in order to maximize the linear range of the analog signal and the corresponding measurement accuracy [14,15,16,17].
Furthermore, the measurement unit, which often replaces a benchtop instrument, must be designed for small form factor devices and a low power profile, while maintaining performance close to gold standard instruments. Application-specific integrated circuit (ASIC) based devices fulfill these requirements, such as the ones developed to perform online electrochemical impedance spectroscopy (EIS) for characterization of lithium-ion battery packs [18,19,20]. This technology can be extended to other applications in areas where size and power consumption are crucial. For instance, in our research we have been developing technology for using admittance spectroscopy to determine the physical state of plants [21]. However, this study relied on bulky and expensive lock-in detectors, not appropriate for an IoT implementation. A cheaper solution developed by S. Grassini is to use an Arduino-based electrochemical impedance spectroscopy (EIS) system [22] for in situ corrosion monitoring of metallic works of art [23]. The Arduino-based EIS is already a huge improvement over conventionally used RCL-bridges (resistance, capacitance, inductance) and lock-in detectors. Similarly, the ASIC-based miniaturized system for Online-EIS proposed by Manfredini [19] shows how versatile the ASIC device is, being capable of measuring not only the impedance of commercial batteries, but also capacitive and resistive sensors. The device is based on the SENSIPLUS, which is a System on a Chip (SoC) solution that uses minimal external hardware, and shows performance on a par with gold standard instruments. The Arduino has been also used as a platform to measure capacitances, as explained, for example, by Campbell [24]. It has been used to deploy a digital LCR meter [25] to measure single parameters (not combinations), although this depends on the known nominal values of external components.
The current report describes a very-low-cost solution for an admittance meter, resulting from an effort to lower the cost and the size of these instruments. Specifically, it uses a micro-controller for directly measuring admittance without the need for any additional electronic circuitry beyond the micro-controller hardware itself. The proposed implementation differs from the instruments developed by [22,24] in two main features: (i) it is based on a time-domain approach, since the measurements are performed with signal transients rather than with sinusoidal signals; (ii) it avoids the need for external circuits, since all the signal generation and detection are performed by the micro-controller. Moreover, when used in popular platforms such as Arduino, full functionality is available, from sensing to communicating, for a price that lies in the order of mere euros per unit, thus fulfilling the requirement of the Internet of Things. Additionally, it paves the way to cheaper wearable and in-body bioelectronic sensors, allowing a live feed of collected data from impedimetric sensor arrays to the IoT, constituting an all-in-one solution: Sensing, Processing and Connection to the Internet. The technique that we will describe here relies on determining the behavior after applying voltage steps, a standard technique used in circuit analysis, which can readily measure resistances and capacitances, either isolated or in series and parallel. It is based on the low-cost AVR® micro-controller series commonly used in the Arduino® platform. The accuracy and precision of the measurements are discussed based on the relative parameters of measurement uncertainty (ur), accuracy (ar) and precision (pr). All the C++ codes for Arduino and the MATLAB scripts used in this manuscript are available in the Supplementary Materials.

2. Materials and Methods

2.1. AVR® Micro-Controllers Based RCL-Meter

Two development boards manufactured by Arduino®, namely the Uno and Leonardo boards, were used to develop the ultra-low-cost RCL-meter. The Arduino® Uno board makes use of an ATmega328P micro-controller, and the Arduino® Leonardo uses an ATmega32U4. Figure 1e shows the block diagram of the proposed measurement system based exclusively on the internal circuitry of the AVR® micro-controller. Both ATmega328P [26] and ATmega32U4 [27] are low-power AVR® 8-bit micro-controllers that share similar features, namely equal clock frequency up to 16 MHz, operational voltage range between 2.7 to 5.5 V, 32 kB of flash memory (enough to store the firmware and processing code), 2 kB (ATmega328P)/2.5 kB (ATmega32U4) of static random-access memory (SRAM) (to store the main variables and acquisition samples) and an analog-to-digital unit (ADC) with 10-bit resolution, the core of the system. Both the Uno and Leonardo boards were supplied through the local-PC connection via USB interface, and the default settings were used, meaning the reference voltage (VREF) is the internal voltage source of 5 V.

2.2. Analog I/O Operation Modes

The AVR® micro-controller family provides access to several digital and analog ports with input and output (I/O) functionalities. Both digital and analog I/O ports share a common control unit design, often called “General Digital I/O” [26,27]. In this work, the digital I/O ports (PDN) are labeled by an alpha-numerical code, denoted by the letter “D” proceeded by the port bit number “N”, while the analog I/O ports (PAN) are represented by the letter “A”. The analog ports have exclusive access to the alternate functions, featuring an I/O source-measuring unit (SMU) and an analog-to-digital converter (ADC) unit. By default, PAN ports can be configured into four distinct operation modes: (mode 1) floating input; (mode 2) pull-up input; (mode 3) low voltage output; (mode 4) high voltage output. Each operation mode shares the same basic electrical structure, consisting of the supply voltage source (VS), common ground (GND), a stray capacitance (Cpin) and location of the I/O port (PAn) for the SMU and ADC unit. By default, vs. is equal to the reference voltage (VREF). Figure 1 shows the equivalent circuit that describes each analog I/O port operation mode and was adapted from references [26,27]. Operation modes 1 and 2, shown in Figure 1a,b, respectively, share the same internal circuitry components to form a high-impedance input port due to the presence of the analog input resistance (RAIN). Cpin is also included in parallel with RAIN to account for the stray capacitance. The unique difference between operation mode 1 and 2 is the state of the internal pull-up resistance (Rpu), which is connected to an internal bias voltage. In the case of operating mode 1, the Rpu is inactive, leading to a floating input configuration, while in the case of operation mode 2, the Rpu sets a SMU configuration. This aspect will be further explored to implement the RCL-meter. Operation modes 3 and 4, shown in Figure 1c,d, relate to the “General Digital I/O” functions. Operation mode 3 consists of a floating and impedance low output configuration, and the operation mode 4 consists of a voltage source (VS), thus forcing a high output configuration. In the absence of load impedance connected to PAN, the configuration of the operation mode 4 sinks current through the parallel RC network formed by the output resistance (Rout) and Cpin. Table 1 shows the typical values of the internal components of the I/O ports [26,27].
The Rpu and Cpin values listed in Table 1 are representative values. In case of the Rpu, both micro-controller datasheets [26,27] characterize the range of Rpu between 20 kΩ to 50 kΩ, and solely for the purpose of the ADC unit it refers a typical reference input resistance (RREF) value of 32 kΩ. As for the Cpin, the micro-controller datasheets [26,27] do not provide a typical value; only a conceptual component is shown in the equivalent circuits of the analog input circuitry representing the overall stray capacitance (also named Cpin). Therefore, the typical stray capacitance listed in Table 1 considers all capacitive sources in the internal analog input circuitry, such as: (i) the sampling and holder capacitance (CS/H), approximately equal to 14 pF and (ii) the input capacitance (Ci) of each I/O pin, approximately equal to 10 pF. Both CS/H and Ci are grounded; therefore, it is assumed that the parallel of both CiCS/H is the minimum value of Cpin and is approximately equal to CpinCiCS/H ≅ 24 pF.
In practical terms, the operation mode of each port available on an AVR® micro-controller must be configured according to the pseudo-code described in Figure 1 through a low-level instruction set, which is not a user-friendly environment. However, Arduino® has developed an integrated development environment (IDE) platform with support of high-level C++ functions such as pinMode() and digitalWrite(), an easy and user-friendly method to configure the ports. Figure 1 describes the C++ code required to properly configure each operation mode. In the following sections, it will be shown how the four different configurations for the ports may be used to build an RCL bridge. First, it is shown how to measure isolated resistors, capacitors and inductors, and then how to measure combinations of resistors and capacitors in series or parallel.

2.3. Recording Circuit

The recording circuit to measure resistances, capacitances and inductances, either isolated or in series and parallel is composed of the same internal components by setting two I/O ports with alternate functions, namely PA0 and PA1 ports configured for pull-up input (mode 1) and low output (mode 3), respectively, and as described in Section 2.2. Figure 1f shows the equivalent circuit resulting from the combination of the internal circuitry of each I/O port bridged by a load impedance (ZLOAD). In the following Section 2.4, Section 2.5, Section 2.6, Section 2.7 and Section 2.8, the equivalent circuit shown in Figure 1f is detailed by replacing ZLOAD with resistance, capacitance and inductance, either isolated or in series and parallel.

2.4. Measurements of an Isolated Load Resistance (R–Meter)

Considering that in the equivalent circuit shown in Figure 1f, ZLOAD is composed of an isolated load resistance (RLOAD), the pull-up resistor (Rpu) at port PA0 drives a current source that will sink through the parallel resistance path (RP) formed by the analog input resistance (RAIN) and the sum of the load and output resistances (RLOAD + Rout). Thus, for circuit analysis purposes, in Figure 2a, a reduction of the entire equivalent circuit to a voltage divider circuit is shown. In Figure 2a, the variable NA0 is introduced as the digital counterpart of the analog variable VA0, where NA0 = ⌊Nmax·(VA0/VS)⌋. The stray capacitances (Cpin) were neglected from the equivalent circuit, since on DC measurements, the capacitances behave as open circuit. In addition, to avoid interference of any stray capacitance, the procedure is to implement a reasonable delay time (say 1 ms) after setting the port PA0 to operation mode 2 (pullup input). This procedure assures that the stray capacitances are open circuit (tτ = RTCpin). Using Cpin = 25 pF and Rpu = 32 kΩ, one obtains τ < 1 µs.
In Figure 2a, VA0 is the measured voltage at port PA0 and is given by:
V A 0 = V S R p R pu + R p
where RP is given by RAIN || (RLOAD + Rout), and vs. is equal to the reference voltage source (VREF). Solving the voltage divider Equation (1), RLOAD is found as:
R LOAD = R AIN R out K ( R AIN + R out ) K R AIN , K = R pu V A 0 V S V A 0
where K is an auxiliary variable used to shorten the length of Equation (2). All the parameters described in Equation (2) are known values, and are available on the datasheet of the micro-controller. The pseudo-code for a routine to measure RLOAD is described in Figure 2b.

2.5. Measurements of an Isolated Load Capacitance (C–Meter)

Two methodologies are reported in this section: (i) fast acquisition mode, which is based on the immediate response of the CLOAD charging cycle, and (ii) transient acquisition mode, based on measuring the charging time until a threshold voltage is reached. It is essential that prior to initiating measurements of CLOAD, all capacitive components are fully discharged. A typical procedure to discharge all capacitances is achieved by configuring the operation mode of the two I/O ports in use to low output (mode 3) and waiting, for example, a period of Δt ≥ 1 ms.

2.5.1. Fast Acquisition Mode of an Isolated Load Capacitance

As an exception to all other methods presented in this manuscript, the fast acquisition mode to measure an isolated load capacitance (CLOAD) uses a different internal circuitry. Therefore, Figure 3a shows the equivalent circuit resulting from the combination of the internal circuitry of two I/O ports, PA0 and PA1, bridged by a pure load capacitance (CLOAD). Essentially, the port PA1 is set in high output (mode 4) and links the voltage source (VS) to the CLOAD terminal behaving as an input current source (iS), and the port PA0 is set to floating input (mode 1), consisting of a measuring unit that links the input current to the ground through a high impedance resistor (RAIN). Both the PA1 and PA0 ports consider the leakage current path to the ground through a stray capacitance (Cpin). However, the Cpin located at PA1 can be neglected, since the characteristic time constant (τA1) of PA1 is τA1 = RoutCpin ≅ 15 ns, and therefore, because the fastest clock cycle (τclk) of the micro-controllers in use are approximately equal to τclk 5τA1, after a single clock cycle the voltage in port PA1 (VA1) is stationary.
For circuit analysis purposes, assuming all capacitances are fully discharged at the instant t = 0, all capacitances are shorted and all currents flow through the capacitive path. In these circumstances, the circuit analysis is simpler considering that at t = 0 the current path flow exclusively through the capacitive path (CT) formed by the load (CLOAD) and stray (Cpin) capacitors in series, given by CT = CLOADCpin/(CLOAD + Cpin). This allows the reduction of the entire equivalent circuit to a voltage divider, as shown in Figure 3b, and is only valid for measuring the impulse response. Thus, VA0 must be read immediately after defining PA0 to floating input and PA1 to high output.
One approach to find the load capacitance is through the analysis of the charge level (Q) of the circuit. Since both CLOAD and Cpin are in series, the charge level must be equal in both capacitances (QLOAD = Qpin), thus allowing the expression of VA0 as:
V A 0 = V S C pin C pin + C LOAD
where the solution given by Equation (3) assumes QLOAD = CLOAD (VSVA0) and Qpin = CpinVA0. Rearranging (3), CLOAD is found as:
C LOAD = C pin V A 0 V S V A 0
The size of Cpin is made available through the datasheet of the micro-controller, and is typically 25 pF, while vs. is equal to the reference voltage source (VREF), and VA0 is the measured voltage at port PA0. Thus, all parameters are known, and CLOAD can be determined. Lastly, the fast acquisition mode methodology is limited by the size of the Cpin, such that, if VA0Nmax, the maximum range of (4) is an asymptote with CLOAD → ∞. Therefore, an approximation to determine the range of measurable CLOAD is:
C pin N max 1 C LOAD C pin ( N max 1 )
where the total range is obtained for 1 ≤ NA0 < Nmax − 1. The pseudo-code for a routine to measure CLOAD through the fast acquisition mode is described in Figure 3c.

2.5.2. Transient Acquisition Mode of an Isolated Load Capacitance

As pointed out before, the fast-acquisition mode methodology has limitations for large capacitances, thus requiring a different measurement strategy, namely monitoring the transient during the charging cycle of a CLOAD bridging the ports PA0 and PA1 in the equivalent circuit shown in Figure 1f. The stray capacitances (Cpin) are not larger than some tens of pico-Farads (pF) and can therefore be neglected.
The remaining circuit analysis is simpler and is preferably done using the impedance analysis. Figure 4a shows the impedance representation of the equivalent circuit, where Zin represents the impedance due to the pull-up resistance (Rpu) at the input port PA0, and Zout is the output impedance formed by the parallel RC network between the analog input resistance (RAIN) and the series RC network (ZLOAD + Rout). ZLOAD is the impedance representation of the load capacitance (CLOAD). Therefore, an estimation of CLOAD is obtained using the step response of the impedance divider circuit shown in Figure 4b, which is given by:
V A 0 ( t ) = V S ( 1 e t τ ) ,   τ   = R T C LOAD
where RT is the total resistance path contributing for the potential difference on the capacitance terminals given by RT = RAIN || Rpu + Rout. Thus, CLOAD can be found at any time t by rearranging Equation (6) to:
C LOAD = t R T · ln ( V S V S V A 0 ( t ) )
where t is the time since starting the charging of the capacitance. All parameters in Equation (7) are known except for the time (t). Thus, to find the CLOAD value, the elapsed time (Δt) must be determined, since t = 0 until a threshold voltage (Vth) is reached. For instance, solving Equation (6) with t = τ allows the definition of Vth = (1 − e1)VS and therefore solves Equation (7). The elegant procedure for testing Vth makes use of the built-in transistor-transistor logic (TTL) unit to monitor VA0 by setting the TTL unit high voltage threshold (VIH) to the Vth (Vth = VIH), allowing not only the avoidance of the computation of the Vth, but also the enhancement of the accuracy of the measurement. In practical terms, the elapsed time (Δt) since CLOAD initiates the charging cycle (t = 0) until the TTL unit changes to the logical state high ‘1’ (VA1VIH) must be measured, as well as proceeding to the reading of VA0 using the ADC unit (NA0). Then, CLOAD is found by replacing VA0 and t by the measured values of NA0 and Δt in Equation (7). Figure 4c depicts the voltage step response of the impedance divider circuit. The highlighted region delimited between the voltage level VIH and vs. represents the operation region where the TTL logic unit changes of logic state low ‘0’ to high ‘1’. For reference, Table 1 includes the typical values of VIH for the ATmega328P and ATmega32U4 micro-controllers.
Additionally, the transient acquisition mode methodology is limited by the characteristic time constant (τ) of the circuit, such that if τ → 0, the charging velocity (dv/dt) of the CLOAD increases to proportions where high temporal resolution is required to measure the NA0 accurately, since NA0Nmax just before the first reading is taken, causing the ADC unit to overflow. An approximation of the ranging limits of the transient acquisition mode is given by:
Δ t R T · ln ( N max ) C LOAD ( t ) Δ t R T · ln ( N max N max 1 )
where in Equation (8) the lower and upper resolution of the ADC unit (NA0) are solved assuming 1 ≤ NA0Nmax − 1. Using the typical values provided in Table 1, the detection limit of the interface assuming the fastest reading of the ADC unit could be achieved after one clock-cycle (Δt = 62.5 ns). Then, the minimum range of the transient acquisition method varies between 214 fF ≤ Cmin ≤ 392 fF with 22.4 kΩ ≤ Rpu ≤ 41.6 kΩ. Nevertheless, the impact of the stray capacitances (Cpin) was neglected, and therefore such a range is merely indicative, since CpinCmin. As for the maximum range of the transient acquisition method, the maximum Δt is limited by the size of the unsigned long variables given by Δt = (232 − 1) × 1 µs ≅ 4295 s. Thus, the maximum range corresponds to a battery-like storage unit rather than a capacitor, as it is some hundreds of farads. The pseudo-code of a routine to perform the measurement of CLOAD through the transient acquisition mode is described in Figure 4c.

2.6. Measurements of a Serial RC Network (RC–Meter Mode)

Considering that in the equivalent circuit shown in Figure 1f, ZLOAD is composed by a series RC network, the strategy to extract CLOAD and RLOAD resembles the previously described techniques to measure a pure resistor in Section 2.4 and a pure capacitor through the transient acquisition mode in Section 2.5.2. However, the TTL-based technique used to determine CLOAD cannot guarantee that a TTL transition will occur in the transient response of the circuit, since the voltage VA0 might start at a value above the TTL threshold (VIH). Instead, the monitoring process of the transient response must be carried out exclusively using the analog functions available on the AVR® micro-controller ports. First, the CLOAD must be completely discharged, which requires defining both ports PA0 and PA1 to low output configuration for a reasonable time, and then defining PA0 to a high-impedance SMU, while maintaining PA1 as low output. For the sake of simplicity, the stray capacitances (Cpin) are neglected, which is allowed if they are not larger than some tens of pico-farads (pF).
With CLOAD fully discharged, after setting the port PA0 to a high-impedance SMU (t = 0), a voltage step is applied on the serial RC circuit. Since CLOAD is empty, it behaves as a short-circuit, which results in an equivalent circuit, as shown in Figure 2a, thus allowing the extraction of the RLOAD value through use of the technique described in Section 2.4 to measure a pure resistor (note that the port configuration is the same). The measured voltage (VA0) at the instant t = 0 defines an offset voltage (VR). For any instant t > 0, CLOAD starts to accumulate charge, and the same circuit analysis described in Section 2.5.2 applies to determine the transient dynamics of the voltage step response. For t → ∞, CLOAD is fully charged and behaves as an open circuit, thus forcing the current to flow exclusively through the analog input resistance (RAIN), as represented in Figure 1f by the current path ‘iR’. Thus, considering the influence of the charging current (iL) due to the series RLOAD, an estimation of CLOAD is obtained using the step response of the equivalent circuit shown in Figure 1f that is given by:
V A 0 ( t ) = V R + V REF ( 1 e t τ ) ,   V R = V S R pu ( R out + R LOAD ) ( R AIN     R pu ) R out + R LOAD + R AIN     R pu ,
where VR is the offset voltage due to the series RLOAD, VREF is the new reference voltage of the circuit given by VREF = vs. − VR, τ is the characteristic time constant of the equivalent circuit given by the τ = RTCLOAD and RT is the total resistance path contributing to the potential difference on the capacitance terminals given by RT = RAIN || Rpu + RLOAD + Rout. Thus, CLOAD can be found at any time t by rearranging Equation (9) to:
C LOAD = t R T ln ( V REF V REF V A 0 ( t ) )
where t is the time that takes charges to accumulate in the capacitance. Figure 5a illustrates the transient response to a voltage step expressed by Equation (10), where the highlighted region consists of the offset voltage (VR) due to the bridge of ports PA0 and PA1 with the serial RC network. As for the reading capacitance voltage level (VC) it is determined when t = τ = RTCLOAD, and is given by VC = VR + (1 − e1)(VSVR). Therefore, all parameters in Equation (10) are known except for the time (t). To extract CLOAD, a routine to determine the elapsed time (Δt) until the measured voltage (VA1) is greater than or equal to VC (VA0VC) must be implemented. Figure 5b depicts the pseudo-code of a routine to implement the measurement of a serial RC network. In practical terms, CLOAD is found by replacing in Equation (10) VR with the measured value of NA0 at t = 0 (NR), vs. with the maximum resolution of the ADC unit (Nmax) and VA0 and t with the measured value of NA0 and Δt after VA0VC, respectively.

2.7. Measurements of a Parallel RC Network (RC–Meter Mode)

Considering that in the equivalent circuit shown in Figure 1f, ZLOAD is composed of a parallel RC network (CLOADRLOAD), the strategy to extract CLOAD and RLOAD resembles the previously described technique in Section 2.6, although it must be noted that the change of the load capacitance (CLOAD) from serial mode to parallel mode causes RLOAD to saturate at the reference voltage (VF = VR) level when t → ∞ and the voltage offset is null at t = 0. Thus, the step response of the equivalent circuit shown in Figure 1f is given by:
V A 0 ( t ) = V F ( 1 e t τ ) ,
where VF is given by the expression of VR that is defined in Equation (9), τ is the characteristic time constant of the equivalent circuit given by τ = RTCLOAD and RT is the total resistance path given by RT = (RAIN || Rpu) || (RLOAD + Rout). Figure 6a illustrates the transient response to a voltage step expressed by Equation (11). For t → ∞, CLOAD is fully charged and behaves as an open circuit, forcing the current (iL) represented in the equivalent circuit shown in Figure 1f to flow exclusively through the RLOAD to the ground. Therefore, the extraction of RLOAD is analytically indeterminate, unless an approximation is made, such as, considering for any period (Δt) larger than five times the characteristic time constant (τ) (Δt > 5τ), Equation (11) is approximately equal to VA0 = VF(1 − e−5) ≈ VF, where the term (1 − e−5) ≈ 0.993 shows that the approximation has a maximum error of 0.7% when determining the RLOAD value. Thereby, assuming for any Δt > 5τ the plateau VA0 = VF is reached, the RLOAD value is obtained using the technique described in Section 2.4 to measure a pure resistor, replacing in Equation (2) VA0 by VF, where VF is the measured voltage for any instant Δt > 5τ. The next step is to determine the CLOAD value through the arrangement of Equation (11) with τ = RTCLOAD by:
C LOAD = t R T · ln ( V F V F V A 0 ( t ) )
where t is any instant of the step-response and VA0 the correspondent measured voltage. The determination of VF is critical to find both CLOAD and RLOAD values. The simplest approach to find VF using the transient response to a voltage step is to define the maximum characteristic time constant (τmax) to measure. In these circumstances all parameters are known, and both CLOAD and RLOAD values can be measured using Equations (2) and (10). Figure 6b depicts the pseudo-code of a routine to implement the measurement of a parallel RC network.

2.8. Measurements of an Isolated Load Inductance (L–Meter Mode)

Considering that in the equivalent circuit shown in Figure 1f, ZLOAD is composed of an isolated load inductance (LLOAD), and that for the sake of simplicity, the stray capacitances (Cpin) are neglected, which is allowed if they are not larger than some tens of pico-farads (pF), the circuit analysis is simpler than and preferable to using the impedance analysis. Figure 7a shows the impedance representation of the equivalent circuit, where Zin represents the impedance due to the pull-up resistance (Rpu) at the input port PA1, and Zout is the output impedance formed by the parallel RC network between the analog input resistance (RAIN) and the series RC network (ZLOAD + Rout). ZLOAD is the impedance representation of the load inductance (LLOAD), given by ZLOAD = jωLLOAD. Therefore, an estimation of LLOAD is obtained using the step response of the impedance divider circuit shown in Figure 7a, which is given by:
V A 0 ( t ) = V S ( 1 e t τ ) ,   τ   = L LOAD / R T ,
where RT is the total resistance path contributing to the potential difference on the inductance terminals given by RT = RAIN || Rpu + Rout. Thus, LLOAD can be found at any time t by rearranging Equation (13) to:
L LOAD = t R T ln ( V S V S V A 0 ( t ) ) ,
where t is the time that takes charges to accumulate in the inductance. Except for the time (t), all parameters in Equation (14) are known and available in Table 1. Therefore, the strategy to solve the time (t) of Equation (14) requires a similar approach, as previously described for the measurement of an isolated capacitance through the transient response. In this case, it must be monitored when the threshold voltage (Vth) over LLOAD is approximately equal to Vth = VS·(1 − e−1). As for the isolated capacitance measurement described in Section 2.5.2, the elegant and simpler procedure for testing Vth, involves making use of the built-in transistor-transistor logic (TTL) unit to monitor VA0 by setting the TTL unit low voltage threshold (VIL) the Vth (Vth = VIL). In practical terms, the elapsed time (Δt) since LLOAD initiates the cycle (t = 0) until the TTL unit changes to the logical state low ‘0’ (VA0VIL) must be measured, proceeding afterwards to the reading of VA0 using the ADC unit (NA0). Then, LLOAD is found by replacing VA0 and t with the measured values of NA0 and Δt in Equation (14). Figure 7b depicts the voltage step response of the impedance divider circuit. The highlighted region delimited between the voltage level VIL and vs. represents the operation region where the TTL logic unit changes of logic state high ‘1’ to low ‘0’.
The measurement range of the inductance is limited due to the ADC unit resolution, where the technique described above to monitor the transient response to a voltage step is limited by the characteristic time constant (τ) of the circuit, such that if τ → 0, the charging current velocity (di/dt) of the LLOAD decreases to such proportions that accurately measuring the NA0 requires high temporal resolution, since NA0 → 0 just before the first reading is taken, causing the ADC unit to overflow. An approximation of the ranging limits of the transient acquisition mode is given by:
Δ t · R T ln ( N max ) L LOAD ( t ) Δ t · R T ln ( N max N max 1 )
where in Equation (15) the lower and upper resolution of the ADC unit (NA0) are solved assuming 1 ≤ NA0Nmax − 1. With the same values and assumptions used for the transient C-method, the range of measurement will vary between 0.2 mH ≤ LLOAD ≤ 1.5 H with Rpu = 22.4 kΩ, and 0.4 mH ≤ LLOAD ≤ 2.7 H with Rpu = 41.6 kΩ. These measurable values of LLOAD are not very useful in real life applications, and for that reason in this manuscript only the methodology is provided as proof of concept to perform measurements with AVR® micro-controllers of an isolated inductance. In spite of this, the pseudo-code is provided in Figure 7c to implement the measurements of an isolated LLOAD through the transient acquisition mode built-in AVR® micro-controllers.

2.9. Data Acquisition and Analysis

The open-source Arduino® IDE software was used to program and upload the scripts on the AVR® micro-controllers. All routines that were programmed to perform the measurements of the RCL-meter are based on the pseudo-codes previously described in each method. The data acquisition was carried out with the serial interface made available on the Arduino® IDE software. The collected data were handled with MATLAB® to perform the data analysis. All measurements were performed at room temperature, about 25 °C.

2.10. Noise and Uncertainty of the Measurements

To achieve the highest measurement accuracy of the RCL parameters, the parasitic capacitances must be minimized by leaving a space of two analog pins between the measured ports, e.g., ports PA0 and PA3, and shorten the connection cables to a minimum size.
Additionally, the impact of noise sources in the measurements must be considered. This includes the thermal and 1/f contributions, which are not easily modelled, but are included in the global noise measurements. The measured noise of the voltage source (ΔVn) was 6.7 mV (with the Arduino board powered through the USB interface connected to a local-PC), comparable to the digitalization uncertainty of the ADC (5 mV) described below. This value permits an enhancement of the accuracy of the ADC unit by oversampling techniques. This shows that the digitalization dominates over thermal and 1/f noise contributions. Thus, in this analysis we only calculate the effect of digitalization uncertainty. Using the default ADC sampling time of 100 µs, the digitalization uncertainty of a 10-bit ADC unit relative to the reference voltage (VREF) of 5 V, the least significant bit (LSB) voltage is 4.9 mV. To analyze the impact of this digitalization uncertainty, the relative uncertainty (ur) associated with the analog to digital round off was determined as:
u r = f ( N meas + 0.5 ) f ( N meas 0.5 ) f ( N meas ) ,
where f(N) represents one of the previous Equations (2), (4), (7), (10), (12) and (14) used to determine the RLOAD, CLOAD and LLOAD values. Then, the oversampling technique allow for reducing the digitalization uncertainty (ur) by a factor of 1/N but limited by other sources of uncertainty (noise).

2.11. Relative Accuracy and Precision of the Measurements

The errors associated with the accuracy and precision of the measurements were analyzed through the relative accuracy (ar) and the relative precision (pr). The relative precision (pr) measures the dispersion of the measured impedance values (Zmeas) normalized to their average ( Z ¯ meas) and was estimated by pr = SD(Zmeas)/ Z ¯ meas, where SD represents the standard deviation of the measured values. The relative accuracy (ar) measures the closeness of the measured Zmeas to the true or reference value, Znominal, and was estimated by ar = | Z ¯ measZnominal|/Znominal.

2.12. Linearization of the ADC Unit

Work was done to improve the linearization of the ADC unit output. By linearization is here meant the maximization of the correlation between measured and nominal values, which depends on the correct knowledge of the micro-controller’s parameters. Since all methods presented previously to measure an unknown load impedance (ZLOAD) use the same ports configuration (except for the measurements of an isolated load capacitance using the fast acquisition mode), the simplest method to optimize the linearization of the measurements is to replace ZLOAD with a pure known load resistance (RLOAD) and use different resistor sizes to test and maximize the range and accuracy of the ADC unit. Then, Equation (2) must be used as a fitting function, where the RLOAD values must be replaced by the nominal values provided by the manufacturer of the resistor, and VA0 and vs. by the ADC unit values. Figure 8a shows the NA0 values collected with through-hole resistors bridging two ports of the micro-controllers. All samples consist of an average of 100 consecutive measurements. The data were distributed in a logarithmic scale along the horizontal axis according to the nominal resistance value provided by the manufacturer. The red triangles represent the samples measured with the ATmega328P and the blue circles represent the ATmega32U4. Ordinary Least Squares (OLS) were used to fit the data shown in Figure 8a, but with a small twist, which consisted of applying the natural logarithm (ln) to the OLS objective fit function and to the measured NA0 values. This proved able to cope better with the large range of resistance values, encompassing several orders of magnitude. Then, to extract the optimized values of RAIN, Rout and Rpu, the user must provide a guess estimation and use a nonlinear programming solver to find the minimum values of the OLS objective function around the estimated values, taken from the manufacturer datasheets. Table 2 shows the extracted values of RAIN, Rout and Rpu for both ATmega328P and ATmega32U4 AVR® micro-controllers used in the current work.
Figure 8a shows the ADC readings as a function of the nominal ADC values. Actual values for both ATmega328P and ATmega32U4 micro-controllers are represented by symbols, and the corresponding fitted lines from Equation (2) (overlapped) in dashed green. The figure inset provides a closer view of the measured samples between 0.5 Ω to 10 Ω. The fitted parameters allow a broad working range of about 8 orders of magnitude for the measured resistance. Otherwise, using typical values provided by the manufacturer would result in a working range of only 2 orders of magnitude. This procedure was performed only once and the values obtained for RAIN, Rout and Rpu were used in all the subsequent measurements.
Likewise, the same fitting analysis previously described was used to optimize the value of Cpin, which is required to perform measurements of an isolated load capacitance through the fast acquisition mode. In this case, through-hole capacitors of different sizes were used to bridge two I/O ports of the micro-controller, and Equation (4) was used as a fitting function for the measurements of the NA0 values shown in the Figure 9a. The Cpin values extracted for each micro-controller are shown in Table 2. The MATLAB scripts written to perform the OLS fitting are available in the Supplementary Materials.

3. Results

Commercial through-hole resistors and capacitors in the ranges 0.5 Ω–80 MΩ and 100 Ff–4.7 mF (±5%), respectively, were used to perform measurements of either isolated or in series and parallel electrical components with the AVR® micro-controllers. The capacitances in the fF range were of SMD type (Kyocera AVX, Fountain Inn, SC, USA), and all capacitances above 1 μF were aluminum electrolyte capacitor type. The validations were made by comparing the measurements results with the components’ nominal values. In all cases, each data point corresponds to the average of 100 measurements performed in a continuous loop.

3.1. Characterization of Isolated Resistance Measurements

The resistance measurements were performed with a set of resistors independent of those used to linearize the ADC. Using the methodology described in Section 2.4, the voltages at port PA0 (VA0) were recorded with the ADC unit (NA0), and the measurements were inserted in Equation (2), to obtain the RLOAD values shown in Figure 8b. This figure also includes the same resistances measurements recorded with a commercial instrument, the Fluke 8840A multimeter (Fluke Corporation, Everett, WA, USA), for reference and validation. These are excellent results for a low-cost technique. However, it is important to keep in mind that each individual point is the average of 100 consecutive measurements, performed in a loop. Table 3 provides numeric detail on the data shown in Figure 8b.
Figure 8c shows the relative accuracy (ar) of the measurements as a function of the nominal resistance, as defined in Section 2.11. Figure 8d shows their relative precision, pr, also defined in Section 2.11 (data points), and the estimated upper limit for the relative uncertainty caused by the digitalization round-off error, ur, defined in Equation (16) and represented by the dashed line. Note that the standard deviations are calculated on samples that are already averages of 100 points, which means that ur should be divided by 10, for a correct comparison with pr. Both plots include white and grey shading regions to highlight the levels of ar and pr better than 5%, 10% and 20%. The two plots show better performance of the method in the intermediate resistance range and its degradation in the regime of very low or very high resistances. This is because the lower and upper limits for RLOAD correspond to NA0 tending to the higher (Nmax) and lower (≈0) values of the digital output, respectively, where the roundoff errors introduced by digitalization become more important, affecting both precision and accuracy.
Most of the data points lay below the ur curve. This is because ur is merely an upper limit for the digitalization noise, which is actually lower. In any case, the plot indicates that the main uncertainty source in the determination of resistance is the digitalization roundoff.
In terms of performance, the ATmega32U4 delivers better results. The range defined by pr < 5% is approximately 10 Ω–10 MΩ for the ATmega328P and 10 Ω–80 MΩ for the ATmega32U4, while the range defined by ar < 5% is 100 Ω–100 kΩ for the ATmega328P and 100 Ω–10 MΩ for the ATmega32U4.
The sensitivity of the R-meter (minimum detectable increment in resistance) was assessed at a representative value of 1 kΩ, as well at increments of 0.5, 1 and 4.7 Ω. 50 measurements were acquired at each resistance value. The average of the 50 ADC counts were plotted against the resistance values and a local slope ADC counts/Ω was determined. The standard deviations of the 4 measurements were also calculated and averaged to get a typical value. A conservative estimative of the sensitivity was then performed by calculating the increase in resistance needed to shift the ADC count by two standard deviations, which was about 1.2 Ω or 0.1% of the nominal value. Additionally, a student t-test analysis was performed by comparing all the 4 datasets of 50 measurements against each other to conclude that they were all different (p < 0.05). This suggested that even an increment of 0.5 Ω is enough to change the output of the R-meter, which is about 2 times less than the previous conservative estimate.

3.2. Characterization of Isolated Capacitance Measurements: Fast Acquisition Method

Using the methodology described in Section 2.5.1 with different commercial capacitors varying from 100 fF to 100 nF, measurements of the voltage at port PA0 (VA0) were recorded with the ADC unit (NA0) and shown in Figure 9a. Figure 9a also includes a green dashed line that represents the theoretical lines for the two micro-controllers (overlapped), obtained from Equation (3) with the fitted Cpin values shown in Table 2. The measured NA0 and fitted Cpin values were replaced in Equation (4) to determine the load capacitance (CLOAD), shown in Figure 9b. At the end of Section 3.2, Table 4 was included, providing numeric detail on the data shown in Figure 9b. For reference and validation, this plot also includes the measurements recorded with two commercial instruments, the BK Precision 890C capacitance meter (B&K Precision Corporation, Yorba Linda, CA, USA) and the Fluke PM6304 impedance meter (Fluke Corporation, Everett, WA, USA) at the lowest frequency available (f = 50 Hz). The green dashed line is CLOAD = Cnominal, showing that the CLOAD values determined by both micro-controllers match the target values within the range 100 Ff–10 nF, thus achieving a range of about 5 orders of magnitude.
Figure 9c,d allow a more detailed view of the quality of this match and display ar, pr and ur (in the same way as in Figure 8c,d). The accuracy ar drops significantly above 10 nF because the voltage drop at the load capacitance tends towards the circuit voltage source (NA0Nmax), as predicted by Equation (5), inducing large errors in the determination of CLOAD.
This is evidenced in the ur curve represented (black dashed line in Figure 9d), showing the same V-shaped distribution ur, as described in Figure 8d, for the resistance measurement. The overlap between ur and pr means that the main source of variability is the digitalization noise, to which the fast C-meter adds almost no contribution.
The sensitivity estimates were performed according to the same lines described in Section 3.1, this time for the representative values of 18 pF and 22 pF, with small increments of 1, 1.2 and 1.5 pF. The sensitivity was estimated to be about 10–20 fF in both cases. The student t-test analysis also concluded that all the capacitance measurement datasets were different from each other (p < 0.05).

3.3. Characterization of Isolated Capacitance Measurements: Transient Acquisition Method

The capacitance meter in the transient mode was tested according to the methodology described in Section 2.5.2 with different commercial capacitors ranging from 100 pF to 4.7 mF. The transient acquisition mode requires waiting until the TTL logic unit returns ‘1’ and the elapsed time (Δt) until that transition. The measurements of port PA0 (NA0), taken at the transition and the corresponding elapsed time (Δt) are shown in Figure 10a.
The upper graph shows NA0 as symbols. Note that by definition these NA0 readings correspond to TTL parameter VIH—High-Level Input Voltage (because they are acquired at the transition). The same graph shows that the lower the capacitance, the higher the VIH of the TTL unit. This aspect is consistent with the expected operation mode of the TTL unit. In fact, the TTL unit uses the output high-level current (iHL) as a test condition, thence, as CLOADCpin, the more leakage current flows through CLOAD, leading to a non-constant VIH. It should be remarked that the inconstancy of the threshold does not represent a problem for the application of Equation (7), since it only requires a given time and the associated reading VA0.
VIH stabilizes above 22 nF because in that range iHL remains essentially undisturbed. This allows the estimation of the “basal” VIHNA0) averaging the values of NA0 at the transition for all samples above 22 nF, specifically ΔNA0 ≅ 536 for the ATmega328P and ΔNA0 ≅ 331 for the ATmega32U4, which are represented by the green dashed lines. The measured values of ΔNA0 are consistent with the typical values described in Table 1.
The measured elapsed time (Δt) shown in the bottom graph of Figure 10a closely matches the green dashed line, which represents the characteristic time constant τ = RTCLOAD, where RT = RAIN || Rpu + Rout. The linearity still holds in spite of a non-constant VIH due to the role of iHL, since the leakage current is also determined by the RC constant of the circuit. The RT values differ only slightly for the two micro-controllers (RT ≅ 35 kΩ for ATmega328P and RT ≅ 37 kΩ for ATmega32U4), causing overlap of the corresponding time constant lines.
For the smallest capacitances (CLOAD < 1 nF), Δt tends toward a plateau (Δtmin) given by 12.5 μs for both micro-controllers, because CLOADCpin. Thus, the CLOAD values determined with Equation (7), and shown in Figure 10b, are affected by larger errors in the low capacitance range. This is not very apparent in this figure, where the data points seem very close to the green dashed line (CLOAD = Cnominal) because of the logarithmic scale. Still, at the end of Section 3.3, Table 5 provides numeric detail on the data shown in Figure 10b.
The plots of ar in Figure 10c illustrate better the difficulties in the low capacitance ranges. The relative accuracy drops significantly (worse than 5%) below 70 nF for the ATmega32U4 and below 10 nF for the ATmega328P. However, both remain, at least, on a 5% accuracy level above those critical values, representing a linear response of the instrument across 6 decades.
Figure 10d shows pr (points) and ur (dashed lines). Contrary to the fast C-meter case, here the ur and pr lines are clearly above ur, which means that the method introduces sources of noise other than digitalization. This is probably because variations of some ADC units in the threshold level impact much more the measurement than one ADC unit only, related to the digitalization error. These variations may be caused by the internal noise of the micro-processors. The performance degradation in the low capacitance regime is also evident from this figure.
The sensitivity estimates were performed according to the same lines described in Section 3.1, for the representative value of 1 μF, with small increments of 1.8, 2.2, 2.7, 3.3, 3.9 and 4.7 nF. The sensitivity was estimated to be about 10–20 fF in both cases. The student t-test analysis also concluded that all the capacitance measurement datasets were different from each other (p < 0.05).

3.4. Characterization of Measurements for Serial RC Networks

Using different sets of commercial resistors varying in factors of 10, from 10 Ω to 10 MΩ, and capacitors with 2 samples per order of magnitude, from 100 pF to 4.7 mF, seven trials were made to test the methodology described in Section 2.6. Each trial consisted of keeping the RLOAD constant and varying the CLOAD. Figure 11 compiles a total of 14 trials carried out with the two micro-controllers. The white points with red edges represent the data measured with the ATmega328P, and the blue points represent the ATmega32U4. They are mostly overlapped.
The method implies measurement of the port PA0 voltage level (VA0) at t = 0 to find the offset voltage (VR) and at t = Δtτ, to find the voltage level VC (defined in Section 2.6).
Figure 11a,b show the measured discrete values (NA0) at the instants t = 0 and tτ, respectively, with both micro-controllers. Figure 11b also includes in the bottom graph the measured elapsed time (Δt) until VA1VC, together with the theoretical time constants, τ = RTCLOAD. Note that, from Equation (9), NA0(t = 0) = VR, which is independent of CLOAD. This means that all the curves in Figure 11a should be horizontal lines. However, the minimum available acquisition time (ca. 3 μs) is insufficient to capture the initial curve values for CLOAD < 1 μF. Thus, the captured NA0 values at t = 0 tend to Nmax in the limit of very small capacitances. This explains why the (ideal) straight lines become distorted in Figure 11a, especially for lower RLOAD. Likewise, the plateau NA0 (tτ) = VC is reached for any CLOAD > 100 nF, which hampers the measurements of NA0 after tτ in this range and induces the same type of distortion in Figure 11b, top.
RLOAD and CLOAD were determined through the use of Equations (2) and (10), with the results shown in Figure 11c,d, respectively. The horizontal lines in Figure 11c represent the ideal result, Rmeasured = RLOAD. The measured RLOAD values are unreliable within a domain in the R-C plane approximately defined by Rnominal Cnominal < 10−4 s.
As discussed above, the system loses accuracy for smaller values of RLOAD. In fact, when RLOAD ≪ (RAIN || Rpu) + Rout, then RT = (RAIN || Rpu) + RLOAD + RoutRpu + Rout, and the information about RLOAD is lost. For this reason, the higher the RLOAD, the better the accuracy. This observation is valid for both micro-controllers, except for the trials performed with a RLOAD of 10 MΩ since NA0Nmax at t = 0.
The measurements of the elapsed time (Δt), after VA0VC, shown in the bottom graph of Figure 11b, exhibit a relative shift in the vertical axis due to the different RLOAD values. Deviations from the straight line are consequence of the excess digitalization uncertainty. This aspect is evidenced after determination of the CLOAD values using Equation (10) and shown in Figure 11d, where the deviations from the black dashed line (CLOAD = Cnominal) relate to the excess digitalization uncertainty.
Overall, there is a trade-off between the RLOAD and CLOAD ranges for best accuracy. There are three extreme regimes: (case 1) RLOAD is large (>1 MΩ), irrespective of the CLOAD value: the accuracy of the measurements is good for the resistance and poor for the capacitance; (case 2) small RLOAD (<100 kΩ) and large CLOAD (>1 nF): measurements with poor accuracy for the resistance, good for the capacitance; (case 3) small RLOAD (<100 kΩ) and small CLOAD (<0.1 nF): measurements with very poor accuracy for the resistance, poor for the capacitance. Outside these extreme regimes, the accuracy is at least acceptable for RLOAD and CLOAD simultaneously.

3.5. Characterization of Measurements for Parallel RC Networks

The experimental procedures to perform the characterization of measurements for parallel RC networks were the same as those of the previous section.
For the parallel RC, the saturation voltage (VF) lies below VS, and it is necessary to determine both VF and τ from the data. There are simple and computationally light algorithms allowing the identification of a stationary plateau, such as that occurring at VF. These have been tested and verified, but including here the description of such methods would increase the length of this report. Thus, the subsequent analysis assumes that τ is already known. No generality is lost with this assumption.
Therefore, to each combination of a parallel RC network (RLOAD || CLOAD) that was measured, the time constant τ was directly assumed as RTCLOAD. The total acquisition time was set to 10τ, VF was read from VA0 at t = 5τ and VC was read from VA0 at t = τ.
Figure 12 aligns the results in two columns. The left column [(a) and (c)] refers to the measurements of RLOAD values and the right one [(b) and (d)] refers to the measurements of CLOAD values. The NA0 values at the instants t = 5τ and t = τ are shown in Figure 12a,b, respectively. Figure 12c,d show the RLOAD and CLOAD values, which were obtained from Equations (2) and (12), respectively.
The RLOAD values are generally in line with the measurements carried on with isolated resistors shown in Figure 8b, but with few deviations to linearity (at 10 Ω and any CLOAD, for the ATmega328P; at 1 MΩ and CLOAD > 1 μF, for both micro-controllers).
As discussed before, in Section 3.4, a too large minimal acquisition time and/or the excess of digitalization noise are the reason the collected samples deviate from the theoretical lines represented by the horizontal black dashed lines. Similarly, the CLOAD values are in line with the measurements carried on with isolated capacitors shown in Figure 9b. However, the accuracy of the measurements is variable, for the same reasons mentioned above.
Overall, there is a trade-off between the RLOAD and CLOAD ranges for best accuracy. There are two extreme regimes: (case 1) CLOAD is small (<1 μF), and RLOAD is large (<1 kΩ): the accuracy of the measurements is good for the resistance and poor for the capacitance; (case 2) large RLOAD (>1 MΩ) and small CLOAD (<1 μF): measurements with very poor accuracy for the capacitance, and poor for the resistance. Outside these extreme regimes, the accuracy is at least acceptable for RLOAD and CLOAD simultaneously.

4. Discussion and Conclusions

This work described and characterized methods to accurately measure impedance using Arduino® boards with built-in AVR® micro-controllers. This is highly remarkable considering the ultra-low cost of the hardware. The measurement method allows the extraction of the resistance (R) and capacitance (C) values of either isolated or series and parallel configuration. Furthermore, inductance (L) measurements can be also performed, yet the range of measurable values is not very useful.
To check the cross-platform applicability of our proposed RCL-meter, two different AVR® micro-controllers assembled on Arduino® boards were selected, namely the ATmega328P assembled on an Arduino® Uno and the ATmega32U4 assembled on an Arduino® Leonardo. A benchmark was made to test the performance of micro-processors.
As for the measurements of isolated resistances and capacitances, the ATmega32U4 outperforms the ATmega328P, and some specific differences were identified. For instance, the ATmega32U4 was revealed to be more efficient in terms of acquisition time, providing a significant improvement when recording long-term transients. In the worst-case scenario, when recording an isolated capacitance (CLOAD = 4.7 mF) through the transient acquisition mode, the ATmega32U4 performs two times faster than the ATmega328P. In addition, when measuring both CLOAD and RLOAD values of in-series or parallel RC networks, the ATmega32U4 takes a slight advantage over the ATmega328P for larger values of RLOAD, while, conversely, the ATmega32U4 performs better for larger values of CLOAD.
The noise profiles of the direct measurements (R-meter and fast C-meter) are essentially defined by the digitalization noise, while the transient C-meter brings an important extra noise source from the variability in the determination of instants of time required to perform the calculations.
The fast and transient C-meter methods complement each other, since the fast method is best for low capacitances and the transient method best for high capacitances. Operated together, they are able to deliver a relative accuracy equal to or better than 20% in the range 100 fF–10 mF, that is, across 11 orders of magnitude. Furthermore, the accuracy is equal to or better than 5% in the ranges 100 fF–100 pF and 100 nF–10 mF. The series and parallel RC combinations are also able to deliver good measurements of R and C in specific domains of the R-C plane.
Additional investigations were made to analyze the performance of both Arduino® boards supplied via a large power bank (Litionite Tanker 90 W/50,000 mAh) and using a data logger shield (RobotDynTM, Zhuhai, China) to store the measurements in a local micro-SD card. This work led to the conclusion that no substantial improvements are achieved by using a low-noise and low-uncertainty voltage supply, and therefore all presented data considers the typical noise and uncertainty from a common USB interface voltage supply source. However, the voltage supply unit determines the overall measurement quality in regions close to the ADC unit threshold values (N) for N < 20 or N > 1000.
Additionally, measurements of the same RLOAD and CLOAD values were made with commercial instruments and presented in the manuscript to provide insight on the overall performance of the ATmega328P and ATmega32U4 micro-controllers as a low-cost alternative to more expensive and sophisticated instruments.
Moreover, the concept proposed in this work, based on AVR® micro-controllers, may possibly be extended to other microcontrollers such as the STM32 family based on ARM architecture. The latter have more or improved integrated hardware features relative to the former, such as more flash memory, higher resolution ADC drive and faster clocks. On the other hand, using more sophisticated microcontrollers brings the disadvantage of idle but power-consuming internal hardware, for example, the digital-to-analog unit (DAC), which is not required in the present work. In any case, the inherent specificities of each architecture imply different implementations, difficult to cover in a single report.
The work carried out in the investigation of an ultra-low-cost RCL meter was mainly targeted towards impedimetric biosensor measurements, in order to facilitate the integration of the sensing and processing layers to the IoT. Its simplicity opens new possibilities for the improvement of ongoing and future projects in the field of smart sensing. The long-term goal of this work is to integrate the control of the sensing and processing layers into the Web of Things (WoT), which is an upper layer of interaction between devices that may be managed by artificial intelligence.

Supplementary Materials

The following supporting information can be downloaded at: https://www.mdpi.com/article/10.3390/s22062227/s1, C++ code A.1: High-level routine to measure isolated resistances; C++ code A.2: High-level routine to measure isolated capacitances through the fast acquisition mode; C++ code A.3: High-level routine to measure isolated capacitances through the transient acquisition mode; C++ code A.4: High-level routine to measure a series RC-network; C++ code A.5: High-level routine to measure a parallel RC-network; C++ code A.6: High-level routine to measure an isolated inductance; MATLAB code B.1: High-level routine for fitting the Ordinary Least Squares (OLS) function to the resistance values; MATLAB code B.2: High-level routine for fitting the Ordinary Least Squares (OLS) function to the capacitance values.

Author Contributions

Conceptualization, P.M.C.I. and P.S.; methodology, P.M.C.I. and P.S.; software, P.M.C.I.; validation, P.M.C.I.; formal analysis, P.M.C.I.; investigation, P.M.C.I. and R.G.; resources, R.G.; data curation, P.M.C.I.; writing—original draft preparation, P.M.C.I.; writing—review and editing, R.G. and P.S.; supervision, P.S.; project administration, R.G.; funding acquisition, R.G. All authors have read and agreed to the published version of the manuscript.

Funding

This research was funded by the FCT—Fundação para a Ciência e a Tecnologia, Portugal, through the CEOT project UIDB/00631/2020 CEOT BASE and UIDP/00631/2020 CEOT PROGRAMATICO. This work was also developed under the FEDER/Portugal2020 project NIBAP (ALG-01-0247-FEDER-037303).

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Not applicable.

Data Availability Statement

Not applicable.

Conflicts of Interest

The authors declare no conflict of interest.

References

  1. Cima, M.J. Next-generation wearable electronics. Nat. Biotechnol. 2014, 32, 642–643. [Google Scholar] [CrossRef] [PubMed]
  2. Stoppa, M.; Chiolerio, A. Wearable electronics and smart textiles: A critical review. Sensors 2014, 14, 11957–11992. [Google Scholar] [CrossRef] [PubMed] [Green Version]
  3. Heo, J.S.; Eom, J.; Kim, Y.-H.; Park, S.K. Recent Progress of Textile-Based Wearable Electronics: A Comprehensive Review of Materials, Devices, and Applications. Small 2017, 14, 1–16. [Google Scholar] [CrossRef] [PubMed]
  4. Joo, H.; Lee, Y.; Kim, J.; Yoo, J.-S.; Yoo, S.; Kim, S.; Arya, A.K.; Kim, S.; Choi, S.H.; Lu, N.; et al. Soft implantable drug delivery device integrated wirelessly with wearable devices to treat fatal seizures. Sci. Adv. 2021, 7, eabd4639. [Google Scholar] [CrossRef] [PubMed]
  5. Matsukawa, R.; Miyamoto, A.; Yokota, T.; Someya, T. Skin Impedance Measurements with Nanomesh Electrodes for Monitoring Skin Hydration. Adv. Healthc. Mater. 2020, 9, e2001322. [Google Scholar] [CrossRef] [PubMed]
  6. Chung, M.; Fortunato, G.; Radacsi, N. Wearable flexible sweat sensors for healthcare monitoring: A review. J. R. Soc. Interface 2019, 16, 20190217. [Google Scholar] [CrossRef] [PubMed]
  7. Boutry, C.M.; Kaizawa, Y.; Schroeder, B.C.; Chortos, A.; Legrand, A.; Wang, Z.; Chang, J.; Fox, P.; Bao, Z. A stretchable and biodegradable strain and pressure sensor for orthopaedic application. Nat. Electron. 2018, 1, 314–321. [Google Scholar] [CrossRef]
  8. Oren, S.; Ceylan, H.; Schnable, P.S.; Dong, L. High-Resolution Patterning and Transferring of Graphene-Based Nanomaterials onto Tape toward Roll-to-Roll Production of Tape-Based Wearable Sensors. Adv. Mater. Technol. 2017, 2, 1700223. [Google Scholar] [CrossRef]
  9. Giraldo, J.P.; Wu, H.; Newkirk, G.M.; Kruss, S. Nanobiotechnology approaches for engineering smart plant sensors. Nat. Nanotechnol. 2019, 14, 541–553. [Google Scholar] [CrossRef] [PubMed]
  10. Catini, A.; Papale, L.; Capuano, R.; Pasqualetti, V.; Di Giuseppe, D.; Brizzolara, S.; Tonutti, P.; Di Natale, C. Development of a sensor node for remote monitoring of plants. Sensors 2019, 19, 4865. [Google Scholar] [CrossRef] [PubMed] [Green Version]
  11. Mizukami, Y.; Sawai, Y.; Yamaguchi, Y. Moisture content measurement of tea leaves by electrical impedance and capacitance. Biosyst. Eng. 2006, 93, 293–299. [Google Scholar] [CrossRef]
  12. Li, M.Q.; Li, J.Y.; Wei, X.H.; Zhu, W.J. Early diagnosis and monitoring of nitrogen nutrition stress in tomato leaves using electrical impedance spectroscopy. Int. J. Agric. Biol. Eng. 2017, 10, 194–205. [Google Scholar] [CrossRef]
  13. Diacci, C.; Abedi, T.; Lee, J.W.; Gabrielsson, E.O.; Berggren, M.; Simon, D.T.; Niittylä, T.; Stavrinidou, E. Diurnal in vivo xylem sap glucose and sucrose monitoring using implantable organic electrochemical transistor sensors. iScience 2020, 24, 101966. [Google Scholar] [CrossRef] [PubMed]
  14. Lopez-Martin, A.J.; Carlosena, A. Sensor signal linearization techniques: A comparative analysis. In Proceedings of the 2013 IEEE 4th Latin American Symposium on Circuits and Systems, LASCAS 2013-Conference Proceedings, Cusco, Peru, 27 February–1 March 2013; IEEE: Piscataway, NJ, USA, 2013; pp. 1–4. [Google Scholar]
  15. Kraska, M. Digital linearization and display of non-linear analog (sensor) signals. In Proceedings of the IEEE Workshop on Automotive Applications of Electronics, Dearborn, MI, USA, 19 October 1988; IEEE: Piscataway, NJ, USA, 1988; pp. 45–51. [Google Scholar] [CrossRef]
  16. Islam, T.; Mukhopadhyay, S.C. Linearization of the sensors characteristics: A review. Int. J. Smart Sens. Intell. Syst. 2019, 12, 1–21. [Google Scholar] [CrossRef] [Green Version]
  17. Alegria, F.; Moschitta, A.; Carbone, P.; Serra, A.D.C.; Petri, D. Effective ADC linearity testing using sinewaves. IEEE Trans. Circuits Syst. I Regul. Pap. 2005, 52, 1267–1275. [Google Scholar] [CrossRef]
  18. Gong, Z.; Liu, Z.; Wang, Y.; Gupta, K.; da Silva, C.; Liu, T.; Zheng, Z.H.; Zhang, W.P.; van Lammeren, J.P.M.; Bergveld, H.J.; et al. IC for online EIS in automotive batteries and hybrid architecture for high-current perturbation in low-impedance cells. In Proceedings of the 2018 IEEE Applied Power Electronics Conference and Exposition (APEC), San Antonio, TX, USA, 4–8 March 2018; pp. 1922–1929. [Google Scholar] [CrossRef]
  19. Manfredini, G.; Ria, A.; Bruschi, P.; Gerevini, L.; Vitelli, M.; Molinara, M.; Piotto, M. An ASIC-Based Miniaturized System for Online Multi-Measurand Monitoring of Lithium-Ion Batteries. Batteries 2021, 7, 45. [Google Scholar] [CrossRef]
  20. Crescentini, M.; De Angelis, A.; Ramilli, R.; De Angelis, G.; Tartagni, M.; Moschitta, A.; Traverso, P.A.; Carbone, P. Online EIS and Diagnostics on Lithium-Ion Batteries by Means of Low-Power Integrated Sensing and Parametric Modeling. IEEE Trans. Instrum. Meas. 2020, 70, 1–11. [Google Scholar] [CrossRef]
  21. Monteiro, F.D.R.; Stallinga, P. Using an Off-the-Shelf Lock-In Detector for Admittance Spectroscopy in the Study of Plants. Agric. Sci. 2020, 11, 390–416. [Google Scholar] [CrossRef] [Green Version]
  22. Grassini, S.; Corbellini, S.; Angelini, E.; Ferraris, F.; Parvis, M. Low-cost impedance spectroscopy system based on a logarithmic amplifier. IEEE Trans. Instrum. Meas. 2014, 64, 1110–1117. [Google Scholar] [CrossRef]
  23. Grassini, S.; Corbellini, S.; Parvis, M.; Angelini, E.P.M.V.; Zucchi, F. A simple Arduino-based EIS system for in situ corrosion monitoring of metallic works of art. Measurement 2018, 114, 508–514. [Google Scholar] [CrossRef]
  24. Campbell, S. How to Make and Arduino Capacitance Meter. Available online: https://www.circuitbasics.com/how-to-make-an-arduino-capacitance-meter/ (accessed on 17 March 2021).
  25. Viraktamath, S.V.; Kannur, K.; Kinagi, B.; Shinde, V.R. Digital LCR meter using arduino. In Proceedings of the 2017 International Conference on Computing Methodologies and Communication (ICCMC), Erode, India, 18-19 July 2017; pp. 805–808. [Google Scholar] [CrossRef]
  26. MICROCHIP. 8-Bit AVR Microcontroller with 32K Bytes In-System Programmable Flash, ATmega328P DATASHEET, Rev.: 7810D–AVR–01/15; Microchip Technology Inc.: Chandler, AZ, USA, 2015. [Google Scholar]
  27. MICROCHIP. 8-Bit Microcontroller with 16/32K Bytes of ISP Flash and USB Controller, ATmega16U4/ATmega32U4 DATASHEET, Rev.: Atmel-7766I-USB-ATmega16U4-32U4 07/2015; Microchip Technology Inc.: Chandler, AZ, USA, 2015. [Google Scholar]
Figure 1. Equivalent circuits for the four operation modes available to configure each analog input/output (I/O) port. (a) mode 1, floating input. (b) mode 2, pull-up input. (c) mode 3, low output. (d) mode 4, high output. Each equivalent circuit is adapted from the schematics provided in the datasheets. (e) Block diagram of the proposed measurement system, including the serial communication and voltage source through USB interface to local PC, flash and SRAM memory, internal voltage source, and internal circuitry to program I/O ports to digital or alternate functionalities. (f) Equivalent circuit of two analog I/O ports bridged with a load impedance (ZLOAD).
Figure 1. Equivalent circuits for the four operation modes available to configure each analog input/output (I/O) port. (a) mode 1, floating input. (b) mode 2, pull-up input. (c) mode 3, low output. (d) mode 4, high output. Each equivalent circuit is adapted from the schematics provided in the datasheets. (e) Block diagram of the proposed measurement system, including the serial communication and voltage source through USB interface to local PC, flash and SRAM memory, internal voltage source, and internal circuitry to program I/O ports to digital or alternate functionalities. (f) Equivalent circuit of two analog I/O ports bridged with a load impedance (ZLOAD).
Sensors 22 02227 g001
Figure 2. Set-up of a pure load resistance meter (R-meter). (a) Reduction of the equivalent circuit to a voltage divider circuit. (b) Pseudo-code used to implement the resistance meter mode.
Figure 2. Set-up of a pure load resistance meter (R-meter). (a) Reduction of the equivalent circuit to a voltage divider circuit. (b) Pseudo-code used to implement the resistance meter mode.
Sensors 22 02227 g002
Figure 3. Set-up of a pure load capacitance meter (C-meter). (a) Equivalent circuit of two analog I/O ports bridged with a load capacitance (CLOAD). (b) Reduction of the equivalent circuit to an impedance divider. (c) Pseudo-code used to implement the fast acquisition mode.
Figure 3. Set-up of a pure load capacitance meter (C-meter). (a) Equivalent circuit of two analog I/O ports bridged with a load capacitance (CLOAD). (b) Reduction of the equivalent circuit to an impedance divider. (c) Pseudo-code used to implement the fast acquisition mode.
Sensors 22 02227 g003
Figure 4. Set-up for recording a pure load capacitance (CLOAD) through the transient acquisition mode. (a) Impedance representation of the reduced equivalent circuit. (b) Illustration of the step response in voltage measured at the input terminal of CLOAD. VIH is defined in Table 1. (c) Pseudo-code used to implement the transient acquisition mode.
Figure 4. Set-up for recording a pure load capacitance (CLOAD) through the transient acquisition mode. (a) Impedance representation of the reduced equivalent circuit. (b) Illustration of the step response in voltage measured at the input terminal of CLOAD. VIH is defined in Table 1. (c) Pseudo-code used to implement the transient acquisition mode.
Sensors 22 02227 g004
Figure 5. Set-up for recording a load impedance (ZLOAD) formed by a serial RC network. (a) Illustration of the transient response to a voltage step at the input terminal (PA0). (b) Pseudo-code used to implement the measurement of a serial RC network.
Figure 5. Set-up for recording a load impedance (ZLOAD) formed by a serial RC network. (a) Illustration of the transient response to a voltage step at the input terminal (PA0). (b) Pseudo-code used to implement the measurement of a serial RC network.
Sensors 22 02227 g005
Figure 6. Set-up for recording a load impedance (ZLOAD) formed by a parallel RC network. (a) Illustration of the transient response to a voltage step at the input terminal (PA0). (b) Pseudo-code used to implement the measurement of a parallel RC network.
Figure 6. Set-up for recording a load impedance (ZLOAD) formed by a parallel RC network. (a) Illustration of the transient response to a voltage step at the input terminal (PA0). (b) Pseudo-code used to implement the measurement of a parallel RC network.
Sensors 22 02227 g006
Figure 7. Set-up for recording an isolated load inductance (LLOAD) through the transient acquisition mode. (a) Impedance representation of the reduced equivalent circuit. (b) Illustration of the step response in voltage measured at the input terminal of LLOAD. VIL is defined in Table 1. (c) Pseudo-code used to implement the inductance transient acquisition mode.
Figure 7. Set-up for recording an isolated load inductance (LLOAD) through the transient acquisition mode. (a) Impedance representation of the reduced equivalent circuit. (b) Illustration of the step response in voltage measured at the input terminal of LLOAD. VIL is defined in Table 1. (c) Pseudo-code used to implement the inductance transient acquisition mode.
Sensors 22 02227 g007
Figure 8. Comparison between the ATmega328P and ATmega32U4 AVR® micro-controllers configured to record an isolated load resistance (RLOAD). (a) Measured ADC unit discrete values at port PA0 (NA0). Each sample consists of an average of 100 consecutive measurements. (b) Measured load resistance (RLOAD) values according to Equation (2). The green dashed lines represent the theoretical lines. (c) Relative accuracy (ar) and (d) relative precision (pr) of the measurements in function of Rnominal. The black dashed line represents the relative uncertainty (ur) of the RLOAD measurements according to Equation (16). The white and grey shading areas highlight the levels of ur, ar and pr better than 5%, 10% and 20%. A legend to describe the color scheme used in all plots of Figure 8 was included.
Figure 8. Comparison between the ATmega328P and ATmega32U4 AVR® micro-controllers configured to record an isolated load resistance (RLOAD). (a) Measured ADC unit discrete values at port PA0 (NA0). Each sample consists of an average of 100 consecutive measurements. (b) Measured load resistance (RLOAD) values according to Equation (2). The green dashed lines represent the theoretical lines. (c) Relative accuracy (ar) and (d) relative precision (pr) of the measurements in function of Rnominal. The black dashed line represents the relative uncertainty (ur) of the RLOAD measurements according to Equation (16). The white and grey shading areas highlight the levels of ur, ar and pr better than 5%, 10% and 20%. A legend to describe the color scheme used in all plots of Figure 8 was included.
Sensors 22 02227 g008
Figure 9. Comparison between the ATmega328P and ATmega32U4 AVR® micro-controllers configured to record an isolated load capacitance (CLOAD) through the fast acquisition mode. (a) Measured ADC values at port PA0 (NA0). Each ADC sample consists of an average of 100 consecutive measurements. (b) Measured load capacitance (CLOAD) given by Equation (4). The green dashed lines represent the theoretical lines. (c) Relative accuracy (ar) and (d) relative precision (pr) of the measurements in function of Cnominal. The black dashed line represents the relative uncertainty (ur) of the CLOAD measurements according to Equation (16). The white and grey shading areas highlight the levels of ur, ar and pr better than 5%, 10% and 20%. A legend to describe the color scheme used in all plots of Figure 9 was included.
Figure 9. Comparison between the ATmega328P and ATmega32U4 AVR® micro-controllers configured to record an isolated load capacitance (CLOAD) through the fast acquisition mode. (a) Measured ADC values at port PA0 (NA0). Each ADC sample consists of an average of 100 consecutive measurements. (b) Measured load capacitance (CLOAD) given by Equation (4). The green dashed lines represent the theoretical lines. (c) Relative accuracy (ar) and (d) relative precision (pr) of the measurements in function of Cnominal. The black dashed line represents the relative uncertainty (ur) of the CLOAD measurements according to Equation (16). The white and grey shading areas highlight the levels of ur, ar and pr better than 5%, 10% and 20%. A legend to describe the color scheme used in all plots of Figure 9 was included.
Sensors 22 02227 g009
Figure 10. Comparison between the ATmega328P and ATmega32U4 AVR® micro-controllers configured to record an isolated load capacitance (CLOAD) through the transient acquisition mode. (a) Measured ADC value and time (Δt) until the TTL unit changes to digital state high, logic ‘1’ at port PA0 (NA0). Each ADC and Δt sample consist of an average of 100 consecutive measurements. (b) Measured load capacitance (CLOAD) given by Equation (7). The green dashed lines represent the theoretical lines. (c) Relative accuracy (ar) and (d) relative precision (pr) of the measurements in function of Cnominal. The black dashed line represents the relative uncertainty (ur) of the CLOAD measurements according to Equation (16). The white and grey shading areas highlight the levels of ur, ar and pr better than 5%, 10% and 20%. A legend to describe the color scheme used in all plots of Figure 10 was included.
Figure 10. Comparison between the ATmega328P and ATmega32U4 AVR® micro-controllers configured to record an isolated load capacitance (CLOAD) through the transient acquisition mode. (a) Measured ADC value and time (Δt) until the TTL unit changes to digital state high, logic ‘1’ at port PA0 (NA0). Each ADC and Δt sample consist of an average of 100 consecutive measurements. (b) Measured load capacitance (CLOAD) given by Equation (7). The green dashed lines represent the theoretical lines. (c) Relative accuracy (ar) and (d) relative precision (pr) of the measurements in function of Cnominal. The black dashed line represents the relative uncertainty (ur) of the CLOAD measurements according to Equation (16). The white and grey shading areas highlight the levels of ur, ar and pr better than 5%, 10% and 20%. A legend to describe the color scheme used in all plots of Figure 10 was included.
Sensors 22 02227 g010
Figure 11. Comparison between the ATmega328P and ATmega32U4 AVR® micro-controllers configured to measure a serial RC network. (a) Measured ADC value at t = 0. (b) Measured ADC value and time (Δt) until VA1VC. (c,d) Obtained RLOAD and CLOAD values according to Equations (2) and (10), respectively. A legend to describe the color scheme used in all plots of Figure 11 was included. The black dashed lines always represent the theoretical lines.
Figure 11. Comparison between the ATmega328P and ATmega32U4 AVR® micro-controllers configured to measure a serial RC network. (a) Measured ADC value at t = 0. (b) Measured ADC value and time (Δt) until VA1VC. (c,d) Obtained RLOAD and CLOAD values according to Equations (2) and (10), respectively. A legend to describe the color scheme used in all plots of Figure 11 was included. The black dashed lines always represent the theoretical lines.
Sensors 22 02227 g011
Figure 12. Comparison between the ATmega328P and ATmega32U4 AVR® micro-controllers configured to measure a parallel RC network. (a) Measured ADC value at t = 5τ. (b) Measured ADC value at t = τ. (c,d) Obtained RLOAD and CLOAD values according to Equations (2) and (12), respectively. A legend to describe the color scheme used in all plots of Figure 12 was included. The black dashed lines always represent the theoretical lines.
Figure 12. Comparison between the ATmega328P and ATmega32U4 AVR® micro-controllers configured to measure a parallel RC network. (a) Measured ADC value at t = 5τ. (b) Measured ADC value at t = τ. (c,d) Obtained RLOAD and CLOAD values according to Equations (2) and (12), respectively. A legend to describe the color scheme used in all plots of Figure 12 was included. The black dashed lines always represent the theoretical lines.
Sensors 22 02227 g012
Table 1. Typical values of the operational voltage of the circuits (VS), the ADC unit, the internal circuitry to each I/O port and the TTL unit to each AVR® micro-controller [26,27].
Table 1. Typical values of the operational voltage of the circuits (VS), the ADC unit, the internal circuitry to each I/O port and the TTL unit to each AVR® micro-controller [26,27].
Voltage SourceADC
Unit
Internal Circuitry
Parameters
TTL Unit
ATmega328PATmega32U4
VS
(V)
nNmax
(2n − 1)
RAIN
(MΩ)
Rout
(Ω)
Rpu
(kΩ)
Cpin
(pF)
VIL
(V)
VIH
(V)
VIL
(V)
VIH
(V)
51010231006003224−0.5–1.53.0–5.5−0.5–0.91.9–5.5
Table 2. Optimized values of the RAIN, Rout, Rpu and Cpin for both ATmega328P and ATmega32U4 AVR® micro-controllers.
Table 2. Optimized values of the RAIN, Rout, Rpu and Cpin for both ATmega328P and ATmega32U4 AVR® micro-controllers.
ATmega328PATmega32U4
RAIN
(MΩ)
Rpu
(kΩ)
Rout
(Ω)
Cpin
(pF)
RAIN
(MΩ)
Rpu
(kΩ)
Rout
(Ω)
Cpin
(pF)
3.53736.89565.823.485.45136.66542.225.5
Table 3. Comparison of the ATmega328P, ATmega32U4 and Fluke 8840A measured load resistance (RLOAD) values ± standard deviation (SD).
Table 3. Comparison of the ATmega328P, ATmega32U4 and Fluke 8840A measured load resistance (RLOAD) values ± standard deviation (SD).
RnominalATmega328PATmega32U4Fluke 8840A ATmega328PATmega32U4Fluke 8840A
RLOAD ± SD RnominalRLOAD ± SD
0.5 Ω0.6 ± 0.40.62 ± 0.40.548 ± 0.0015.6 kΩ5.679 ± 0.0015.7261 ± 0.00065.5390 ± 0.0002
1 Ω1.2 ± 0.20.86 ± 0.21.044 ± 0.0018.2 kΩ8.539 ± 0.0098.6078 ± 0.00098.1837 ± 0.0002
2.2 Ω1.6 ± 0.32.30 ± 0.52.247 ± 0.00110 kΩ10.101 ± 0.00210.1772 ± 0.00089.9313 ± 0.0002
5.6 Ω5.7 ± 0.45.70 ± 0.65.645 ± 0.00122 kΩ21.9 ± 0.322.1858 ± 0.000821.846 ± 0.0000
8.2 Ω9.1 ± 0.27.72 ± 0.68.251 ± 0.00156 kΩ55.0 ± 0.155.789 ± 0.00255.8529 ± 0.0003
10 Ω10.5 ± 0.38.77 ± 0.510.031 ± 0.00582 kΩ80.8 ± 0.181.891 ± 0.00281.914 ± 0.002
22 Ω22.4 ± 0.420.1 ± 0.521.901 ± 0.002100 kΩ97.3 ± 0.298.812 ± 0.00398.622 ± 0.008
56 Ω59.7 ± 0.455.7 ± 0.556.023 ± 0.004220 kΩ211.9 ± 0.4217.55 ± 0.01219.267 ± 0.007
82 Ω83.3 ± 0.383.1 ± 0.482.532 ± 0.0014560 kΩ535 ± 5549.7 ± 0.1561.045 ± 0.009
100 Ω102.2 ± 0.3101.9 ± 0.499.44 ± 0.02820 kΩ777 ± 7811.4 ± 0.2824.71 ± 0.01
220 Ω224.3 ± 0.3224.2 ± 0.4220.560 ± 0.0041 MΩ0.906 ± 0.0070.9894 ± 0.00021.0140 ± 0.00004
560 Ω576.9 ± 0.4573.6 ± 0.8556.14 ± 0.012.2 MΩ2.14 ± 0.052.193 ± 0.004 2.2171 ± 0.0002
820 Ω835.8 ± 0.6833.840 ± 0.0001817.19 ± 0.036.8 MΩ6.3 ± 0.36.89 ± 0.016.986 ± 0.002
1 kΩ1.0348 ± 0.00061.0331 ± 0.00040.9945 ± 0.00018.2 MΩ8.8 ± 0.37.87 ± 0.058.2066 ± 0.0001
2.2 kΩ2.242 ± 0.0012.2596 ± 0.00052.1955 ± 0.000110 MΩ10.3 ± 0.29.60 ± 0.0310.129 ± 0.008
Table 4. Comparison of the ATmega328P, ATmega32U4 and Fluke 8840A measured load capacitance (CLOAD) values ± standard deviation (SD) through the fast acquisition mode.
Table 4. Comparison of the ATmega328P, ATmega32U4 and Fluke 8840A measured load capacitance (CLOAD) values ± standard deviation (SD) through the fast acquisition mode.
CnominalATmega-328PATmega-32U4Fluke
PM6304
BK
890C
ATmega-328PATmega-32U4Fluke
PM6304
BK
890C
CLOAD ± SDCnominalCLOAD ± SD
1 pF1.126 ± 0.0041.050 ± 0.00512 ± 81.3 ± 0.6560 pF550.0 ± 0.8510.89 ± 0.05526 ± 3531 ± 3
1.5 pF1.640 ± 0.0021.541 ± 0.00316 ± 181.9 ± 0.3 680 pF644 ± 1600.30 ± 0.05678 ± 5677 ± 7
2.7 pF2.834 ± 0.0032.782 ± 0.00414 ± 83.3 ± 0.61 nF1.012 ± 0.0030.93558 ± 0.000040.999 ± 0.0091.008 ± 0.004
3.9 pF4.101 ± 0.0033.998 ± 0.00412 ± 58 ± 1 1.5 nF1.445 ± 0.0071.34302 ± 0.000031.493 ± 0.0051.517 ± 0.002
5.8 pF5.860 ± 0.0025.709 ± 0.00317 ± 197 ± 32.2 nF2.08 ± 0.011.88744 ± 0.000042.185 ± 0.0052.24 ± 0.01
8.2 pF8.527 ± 0.0038.278 ± 0.00317 ± 59.3 ± 0.43.3 nF3.29 ± 0.032.93701 ± 0.000033.314 ± 0.0063.401 ± 0.003
10 pF10.231 ± 0.0029.900 ± 0.00218 ± 511.2 ± 0.36.8 nF7.4 ± 0.26.58318 ± 0.000037.096 ± 0.027.13 ± 0.06
20 pF20.711 ± 0.00319.672 ± 0.00225 ± 422.300 ± 0.0007.5 nF9.0 ± 0.27.98201 ± 0.000047.56 ± 0.057.7540 ± 0.0004
47 pF46.934 ± 0.00946.59 ± 0.0449 ± 749.3 ± 0.510 nF12.0 ± 0.49.51585 ± 0.0000310.15 ± 0.079.668 ± 0.001
82 pF80.88 ± 0.0281.01 ± 0.0289 ± 783.4 ± 0.515 nF20 ± 117.8541 ± 0.0000415.44 ± 0.0615.570 ± 0.0000
100 pF99.56 ± 0.04100.87 ± 0.0399 ± 5103.183 ± 0.0422 nF27 ± 128.6855 ± 0.0000321.623 ± 0.00722 ± 1
180 pF179.1 ± 0.1178.6 ± 0.2187 ± 1185 ± 156 nF46 ± 570.0663 ± 0.0000257.21 ± 0.0457.2 ± 0.9
220 pF210.7 ± 0.2208.5 ± 0.2221 ± 12217.6 ± 0.568 nF47 ± 575.7749 ± 0.0000268.39 ± 0.0769 ± 2
470 pF440.0 ± 0.7409.77 ± 0.05469 ± 6449.9 ± 0.8100 nF55 ± 596.2257 ± 0.00003101.3 ± 0.02101.536 ± 0.005
Table 5. Comparison of the ATmega328P, ATmega32U4 and Fluke 8840A measured load capacitance (CLOAD) values ± standard deviation (SD) through the transient acquisition mode.
Table 5. Comparison of the ATmega328P, ATmega32U4 and Fluke 8840A measured load capacitance (CLOAD) values ± standard deviation (SD) through the transient acquisition mode.
CnominalATmega-328PATmega-32U4Fluke
PM6304
BK
890C
ATmega-328PATmega-32U4Fluke
PM6304
BK
890C
CLOAD ± SDCnominalCLOAD ± SD
100 pF111 ± 472 ± 199 ± 5101.41 ± 0.042.2 μF2.259 ± 0.0072.158 ± 0.0062.2742 ± 0.00042.292 ± 0.005
1 nF0.703 ± 0.0080.49 ± 0.010.999 ± 0.0091.008 ± 0.0044.7 μF4.933 ± 0.0084.883 ± 0.0094.24 ± 0.044.5010 ± 0.0006
2.2 nF1.591 ± 0.0091.22 ± 0.012.185 ± 0.0052.24 ± 0.016.8 μF6.92 ± 0.016.71 ± 0.027.1687 ± 0.00017.1870 ± 0.0001
4.7 nF3.99 ± 0.023.26 ± 0.024.77 ± 0.034.90 ± 0.0310 μF10.31 ± 0.0210.204 ± 0.0099.76 ± 0.019.998 ± 0.02
6.8 nF6.10 ± 0.025.01 ± 0.057.10 ± 0.027.13 ± 0.0622 μF23.01 ± 0.0223.06 ± 0.0420.98 ± 0.0321.29 ± 0.03
10 nF9.43 ± 0.027.85 ± 0.0410.15 ± 0.079.667 ± 0.00147 μF49.10 ± 0.0947.12 ± 0.0942.69 ± 0.0443.0 ± 0.5
22 nF22.10 ± 0.0419.66 ± 0.0421.623 ± 0.00722 ± 168 μF70.6 ± 0.170.8 ± 0.266.39 ± 0.0268.68 ± 0.06
56 nF56.89 ± 0.0953.03 ± 0.0657.21 ± 0.0457.2 ± 0.9100 μF104.2 ± 0.2101.0 ± 0.398.14 ± 0.04102.30 ± 0.08
68 nF67.22 ± 0.0665.52 ± 0.0568.39 ± 0.0769 ± 2220 μF225.6 ± 0.4226.5 ± 0.8200.29 ± 0.08206.7 ± 2
100 nF97.2 ± 0.195.9 ± 0.2101.34 ± 0.02101.536 ± 0.005470 μF491.9 ± 0.6446.6 ± 0.8455.7 ± 0.2472.6 ± 3
220 nF228.3 ± 0.4212.2 ± 0.2221.79 ± 0.03221.900 ± 0.0001 mF1.006 ± 0.0030.981 ± 0.0040.9608 ± 0.00060.994 ± 0.006
470 nF480 ± 1456 ± 1468.54 ± 0.05469.800 ± 0.0002.2 mF2.240 ± 0.0072.250 ± 0.0072.1667 ± 0.00052.1987 ± 0.0000
680 nF692 ± 1669 ± 2665.67 ± 0.2680.000 ± 0.0003.3 mF3.62 ± 0.023.631 ± 0.0093.1891 ± 0.00073.441 ± 0.002
1 μF1.047 ± 0.0030.972 ± 0.0030.983 ± 0.0010.989 ± 0.0074.7 mF4.85 ± 0.014.91 ± 0.014.6754 ± 0.00054.935 ± 0.003
Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Share and Cite

MDPI and ACS Style

Inácio, P.M.C.; Guerra, R.; Stallinga, P. An Ultra-Low-Cost RCL-Meter. Sensors 2022, 22, 2227. https://doi.org/10.3390/s22062227

AMA Style

Inácio PMC, Guerra R, Stallinga P. An Ultra-Low-Cost RCL-Meter. Sensors. 2022; 22(6):2227. https://doi.org/10.3390/s22062227

Chicago/Turabian Style

Inácio, Pedro M. C., Rui Guerra, and Peter Stallinga. 2022. "An Ultra-Low-Cost RCL-Meter" Sensors 22, no. 6: 2227. https://doi.org/10.3390/s22062227

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