Acta IMEKO, Title ACTA IMEKO ISSN: 2221-870X December 2017, Volume 6, Number 4, 25-30 ACTA IMEKO | www.imeko.org December 2017 | Volume 6 | Number 4 | 25 Hardware and software implementation aspects for low-cost multi-channel interface for passive resistive sensors Zivko Kokolanski, Vladimir Dimcev, Dimitar Taskovski Ss. Cyril and Methodius University in Skopje, Faculty of electrical engineering and information technologies, Rugjer Boskovic 18, 1000 Skopje, Republic of Macedonia Section: RESEARCH PAPER Keywords: multivibrator; sensor interface; passive sensors; multi-electrode sensors; LabVIEW Citation: Zivko Kokolanski, Vladimir Dimcev, Dimitar Taskovski, Hardware and software implementation aspects for low-cost multi-channel interface for passive resistive sensors, Acta IMEKO, vol. 6, no. 4, article 4, December 2017, identifier: IMEKO-ACTA-06 (2017)-04-04 Section Editor: Alexandru Salceanu, Technical University of Iasi, Romania Received May 12, 2017; In final form August 19, 2017; Published December, 2017 Copyright: © 2017 IMEKO. This is an open-access article distributed under the terms of the Creative Commons Attribution 3.0 License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original author and source are credited Corresponding author: Z. Kokolanski, e-mail: kokolanski@feit.ukim.edu.mk 1. INTRODUCTION Very often there is a need for measurements of a lot of physical quantities by a single data acquisition system, such as when performing sensor fusion. These systems must have multiple input channels in order to interface all of the sensors. Regarding the application, the implementation of the systems ranges from individual sensor signal conditioning and separate analog-to-digital (AD) or time-to-digital (TD) conversion for each channel, to sensor multiplexing and interfacing with only one input channel. However, quite often the overall performance of the system, its size, and cost, relies on the implementation of the sensor signal conditioning module. Multi-channel sensor interfaces are used in many applications: in multi-electrode sensor systems [1], sensor data fusion [2], [3], multi-sensor systems regulated in standards [4], etc. Generally, the sensor interfaces can be divided in two groups: ones based on AD conversion that utilize analog-to- digital converters (ADC) [5], and other based on relaxation oscillators (multivibrators) [6] and time-to-digital (TD) [7] or frequency-to-digital (FD) [8] conversion. The second approach can be sometimes advantageous, especially when the sensors are directly interfaced to a digital programmable device (such as microcontrollers) [9]-[11]. Microcontrollers usually include peripherals for accurate measurement of time events, which can be used for TD or FD sensor interfacing without the need of ADC. 2. MULTIVIBRATOR-BASED SENSOR SIGNAL CONDITIONING Generally, a multivibrator is an oscillating electronic circuit with discrete signal output, which is rather suitable for direct digital interfacing. It can be configured in monostable or astable operation. When triggered by an external trigger pulse, the monostable multivibrator (Figure 1a) changes state and remains in this second state for an amount of time determined by the external RC components used. Once this time interval has passed, the monostable multivibrator returns back to its original state awaiting a new trigger pulse. The result is an output pulse, which width is proportional to the RC time constant, arising each time the multivibrator is triggered. In astable operation (Figure 1b), the multivibrator constantly switches between two states. The time duration of each stage is determined by the external RC network. Now, the multivibrator delivers a pulse train which frequency, time interval, or duty cycle is determined by the RC network. ABSTRACT The paper elaborates the hardware and software design and implementation aspects of a low-cost multichannel interface for passive resistive sensors. The interface is based on a multivibrator in a monostabile configuration and is suitable for direct interface to a programmable devices (e.g. microcontrollers, field programmable gate arrays, etc.). In the paper, details concerning the sensor interface are presented, and different calibration techniques are described. The theoretical analysis is supported by a practical realization of a prototype multichannel resistive sensor interface and software implementation in a LabVIEW environment. ACTA IMEKO | www.imeko.org December 2017 | Volume 6 | Number 4 | 26 When used as a passive sensor interface circuit, the sensor (resistive or capacitive) is placed in the multivibrator RC network, whereas the other remaining component (R or C) is fixed. Despite the fact that both circuits (monostable or astable) can be used as sensor signal conditioners, they have different metrological performances. Namely, the measurement uncertainty of such interface circuit is analyzed in [6], where it is proven that the standard deviation of the output pulse width (Type A measurement uncertainty) of the monostable multivibrator is lower than that of the astabile configuration. Therefore, the proposed signal conditioning circuit in this paper is based on the monostabile multivibrator topology. In monostable operation, the multivibrator generates a single output pulse whenever the trigger input has been triggered by an external pulse. In such case, the voltage across the external capacitor increases exponentially with time constant τ=RC, where R is the value of the external resistor and C the value of the external capacitor. The waveforms of the characteristic signals during monostabile operation are given in Figure 2. The output pulse width of the monostabile multivibrator T is given with: ,kRCT ≡ (1) where the constant k depends on the power supply voltage Vcc and the threshold voltage Vth of the “threshold” port in Figure 1a. Hence, assuming that R in (1) is a resistive sensor, the output pulse width T is directly proportional to the sensor resistance. From a metrological point of view, the instability of k (and C when analysing a resistive sensor interface) in (1) is problematic. This is usually solved by calibration [12]. Another challenge is the ability to interface a larger number of sensors with less interface connections. 3. MULTICHANNEL SENSOR INTERFACE DESCRIPTION One possible solution towards increasing the number of sensors in the multivibrator-based sensor interfaces, while keeping a low number of interface connections to the programmable logic, is by time multiplexing. Such solution is given in Figure 3, which allows interfacing n×n passive resistive sensors, where n is the length of the ring counters 1 and 2. The ring counters change the state of their outputs D1 to Dn on every clock (CLK) period. When the counter reaches the final state (Dn is “high”), it returns back to the initial position and generates a carry-out bit (COUT). The carry-out bit signal acts as a clock of the ring counter 2. Therefore, the clock frequency of the ring counter 2 is n times lower than the frequency of ring counter 1. Even though there are commercially available integrated solutions of ring counters, a discrete implementation with D flip-flops is given in Figure 4. The sensors are wired to the ring counters through MOSFET transistors forming a sensor matrix, where ring counter 1 activates the rows and ring counter 2 activates the columns of the matrix. At a given moment, only a single sensor in the intersection row-column point is brought at the input of the monostabile multivibrator. An example of a simple monostabile multivibrator is given in Figure 5. After “selection” of the sensor, the time constant of the multivibrator is determined by the sensor resistance Rx and the fixed capacitor C. In this way, a consecutive sensor read-out is performed in a form of a pulse train at the output of the multivibrator. It is important to note that, in this solution, the speed of the measurements decreases proportionally with the number of sensors in the matrix. However, having in mind the speed of the actual digital programmable devices, time multiplexing is often acceptable, especially when measuring a slow-varying physical quantity (such as temperature or humidity). When a particular resistive sensor is selected with the switching matrix, and the monostabile multivibrator is triggered, the output pulse width is given with: ( ) ,1ln2       −+−= cc th dsONxx V V CRRT (2) where RdsON is the drain-to-source ON resistance of the MOSFET transistors, considering that all transistors in the matrix are identical. In order to implement the simplest “single point” calibration, a second measurement with a fixed calibration resistor is performed. This time the output pulse width is given with: ( ) ,1ln2       −+−= cc th dsONcc V V CRRT . (3) The sensor resistance is calculated by dividing (2) and (3), that is: ( ) dsONdsONc c x x RRRT T R 22 −+= , (4) where Rc is the value of the calibration resistor. By considering the following approximations: Rx>>2RdsON and Rc>>2RdsON, (4) becomes: c c x x RT T R = . (5) It is clear that (4) suggests errors in a form of offset and gain in the transfer characteristics. However, these errors can be reduced by implementing a two point calibration [12] or the three signals method [13]. The two point calibration is performed in three phases: measurement of the sensor resistance Rx, measurement of the first calibration resistor Rc1, and measurement of the second calibration resistor Rc2. Figure 1. a) Monostabile multivibrator, b) Astabile multivibrator. Figure 2. Waveforms of the characteristic signals of a multivibrator in monostabile configuration. ACTA IMEKO | www.imeko.org December 2017 | Volume 6 | Number 4 | 27 Figure 3. Multivibrator-based multi-channel resistive sensor interface circuit. Figure 4. State diagram and implementation of a six bit ring counter with D Flip-flops. ACTA IMEKO | www.imeko.org December 2017 | Volume 6 | Number 4 | 28 The measured time intervals in the three measurement phases will be Tx, Tc1 and Tc2 respectively (which can be expressed similarly as (2) and (3)). According the two point calibration, the sensor resistance can be estimated by using a two point linear approximation given with: ( ) 221 21 2 ccc cc cx x RRRTT TT R +− − − = . (6) This time the offset component will not be in the order of the drain-to-source ON resistance (as with the single point calibration), rather of its mismatch between different MOSFET transistors. The three signals method can be considered as a special case of the two point calibration where the second calibration resistor is zero. So, (6) becomes: 1 21 2 c cc cx x RTT TT R − − = . (7) However, in order to implement the three signals method it is necessary to use a current protection resistor in all measurement phases (resistor in series to C in Figure 3). 4. SOFTWARE IMPLEMENTATION The software programming architecture and implementation is a very important part for a successful multichannel sensor interface implementation. In fact, any digital programmable device containing a general purpose digital input/output ports and a timer module can be used for the software control algorithm implementation. In this paper, the software implementation in a LabVIEW environment is presented. However, such software implementation concepts can also be used for implementation on any other digital programmable device. The LabVIEW software implementation for the multichannel resistive sensor interface containing nine sensors is given in Figures 7 and 8. Having in mind that the sensor signal conditioning circuit can be divided into several phases, one of the most suited programming architecture is based on the state machine principles. The state machine state transition diagram is given in Figure 6. The virtual instrument was realized for controlling the multichannel sensor interface containing nine resistive sensors and a single calibration resistor for the single point calibration implementation. The state machine contains four programming states which are represented with a simple state transition diagram (Figure 6). The program starts with the “Initialize and reset” state. In this phase, the virtual instrument resets the ring counters in order to start from the first sensor measurement and sets the default behaviour of the controls and indicators of the virtual instrument. Then, the virtual instrument enters the second state named “Trigger and measure”. Since the first sensor is “selected” with the MOSFET matrix, triggering the monostabile multivibrator results in delivering a output pulse which width is given by (2). Afterwards, the output pulse is measured with a timer in the same program state. Once the pulse width is measured, the virtual instrument enters the “Increment clock” state where a clock pulse shifts the matrix column by one position, thus, selecting the second resistive sensor. Whenever the clock port makes ten pulses (the ring counter overflows) then the virtual instrument enters the “Calculate sensor resistance” state. Otherwise it returns back into the “Trigger and measure” state. Once the sensor resistances are calculated, the virtual instrument resets the ring counters and starts the programming sequence from the beginning. In the current implementation the sensor resistance is calculated by using the single point calibration given with (5). However, the two point calibration or the three signals method can also be easily implemented by using one more external element and one additional programming state in the state transition diagram. On the other hand, when “low” drain-to- source ON-resistance MOSFETS are used for the matrix realization, it is expected that the improvement of accuracy of the two point calibration and the three signals method will not be very significant. This is especially emphasized when measuring resistive sensors of relatively “high” resistance (say higher than 10 kΩ). The block diagram of the realized state machine programming architecture is given in Figure 8. In the particular example, the control ports of the multichannel interface are controlled by using a commercial data acquisition (DAQ) card from National Instruments. 5. EXPERIMENTAL RESULTS AND DISCUSSION To support the theoretical analysis, a prototype multichannel resistive sensor interface (Figure 9) was designed. The prototype system was realized by using the timer NE555P from Texas Instruments wired in a monostabile multivibrator configuration. Low drain-source ON-resistance MOSFET transistors BS250D for all transistors in the switching matrix were used. Figure 5. Example of a simple monostabile multivibrator based on the 555 circuit. Figure 6. Programming architecture state transition diagram. ACTA IMEKO | www.imeko.org December 2017 | Volume 6 | Number 4 | 29 The boards were supplied from a “clean” 9 V battery with LM78L05 positive voltage stabilizer to obtain 5 V. As recommended from the manufacturer, a 1 µF electrolytic and 100 nF ceramic capacitor was placed between the 555 power supply pins. The ring counters were realized with integrated HCF4017 10-bit decade counters. In the current implementation, the resolution of the ring counters allows theoretically the interfacing of 100 resistive sensors, which are modularly connected in groups of ten (Figure 9). The output pulse period was measured with a data acquisition card USB6218 from National Instruments connected to a PC in a LabVIEW environment. The DAQ card contains two 32 bit timers/counters with a selectable time base and two 8-bit digital input/output ports. The time base of the timers was 20 MHz with 50 ppm accuracy. The digital output pins P1.0, P1.1, and P1.2 were used as drivers (“Clock”, “Reset”, and “Trigger” pins). The experiments were performed by interfacing six NTC temperature sensors with nominal resistance of 2000 Ω, one NTC temperature sensor with nominal resistance of 10 kΩ, and Figure 7. Realization of the virtual instrument in LabVIEW for read-out of nine resistive sensors. Figure 8. Block-diagram of the LabVIEW virtual instrument implementation with a focus on the Measure programming state. ACTA IMEKO | www.imeko.org December 2017 | Volume 6 | Number 4 | 30 two resistors with nominal values of 1 kΩ and 10 kΩ (variable). The 1 kΩ resistor was used for calibration. The transfer characteristic of the interface circuit was measured in the range from 1000 Ω to 15 kΩ in ten discrete steps (by using the variable resistor). The maximal relative error recorded was 0.43 %, which is satisfactory considering the simplicity of the signal conditioning circuit. However, the metrological performances can be improved even more, by using lower drain-to-source resistance MOSFET transistors, or by implementing a two point calibration or a three signals method. 6. CONCLUSIONS In the paper, a hardware and software implementation principle for a multi-channel interface for passive resistive sensors was elaborated. The sensor interface incorporates a multivibrator in monostable configuration, and a sensor multiplexer implemented with ring counters and a MOSFET switching matrix. Three calibration techniques were described: single point calibration, two point calibration, and the three signals method. The software programming procedure was implemented in a LabVIEW environment by using a state machine programming architecture. Key concepts for implementation of this programming architecture were identified and a prototype realization was proposed. The theoretical analysis was supported by the practical realization of a multichannel measurement system. The experimental results showed that, when implementing a sensor interface for nine resistive temperature sensors in the range from 1 kΩ to 15 kΩ, and by the implementation of the simplest “single point” calibration, a maximal relative error of 0.43 % was achieved. The performances of the signal conditioning circuit can be improved by using a two point calibration or the three signals method. Authors believe that such sensor interface is advantageous for low-cost, small size implementations with medium accuracy. REFERENCES [1] E. Danicki, Y. Tasinkevych, “Electrostatics of planar multielectrode sensors with application to surface elastometry”, Sensors, vol.12, pp. 11946-11956, 2012, DOI:10.3390/s120911946. [2] M. E. Stieber, Canadian Space Agency, Canada, E. Petriu, G. Vukovich, “Instrumentation architecture and sensor fusion for systems control”, IEEE Trans. Instr. and Meas., Vol.47, Iss.1, pp.108-113, 2002. DOI:10.1109/19.728801. [3] Marin B. Marinov, Todor S. Djamiykov, Volker Zerbe: „Sensor and actuator nodes for multi-zone demand-controlled ventilation” Electrotecnica & Electronica, Vol. 49. No 7- 8/2014, p. 26 – 32. [4] IEC 60335-1, “Safety of household and similar electrical appliences”, IEC:1999(E). [5] R. P. Areny, J. Webster, “Sensors and Signal Conditioning”, John Wiley & Sons Inc., Ney Work, USA, 2001. [6] Z. Kokolanski, C. Gavrovski, V. Dimcev, M. Makraduli, “Simple interface for resistive sensors based on pulse width modulation”, IEEE Trans. Instrum. Meas., vol. 62 pp. 2983– 2993, 2013. DOI:10.1109/TIM.2013.2266025. [7] F. Reverter, R. P. Areny, “ Direct Sensor to Microcontroller Interface Circuits”, Marcombo S.A, Barselona, Spain, 2005. [8] H. Danneels, F. Pitte, V. De Smedt, W.Dehaene, G.Gielen “A novel, PLL-based frequency-to-digital conversion mechanism for sensor interfaces”, Sensors and Actuators A: Physical, Vol. 172, Iss. 1, Dec. 2011, pp. 220-227. [9] F. Reverter, O. Casas, “Interfacing Differential Capacitive Sensors to Microcontrollers: A Direct Approach”, IEEE Trans. Instrum. Meas., October 2010. [10] F. Reverter, O. Casas, “Interfacing Differential Resistive Sensors to Microcontrollers: A Direct Approach”, IEEE Trans. Instrum. Meas., 2009. [11] A. Custodio, R. Bragos, R. Pallas-Areny, “A Novel Sensor- Bridge-to-Microcontroller Interface”, IEEE Instrumentation and Measurement Technology Conference, Budapest, May 2001 [12] A. Custodio, R. P. Areny, R. Bragos, “Error Analysis and Reduction for a Simple Sensor-Microcontroller interface”, IEEE Trans. Instrum. Meas., vol.50, no.6, 2001. DOI: 10.1109/19.982960. [13] F.M.L. van der Goes: “Low-Cost Smart Sensor Interfaces”, Ph.D Thesis, Delft University of Technology, 1996. Figure 9. Prototype thirty channel resistive sensor interface. Hardware and software implementation aspects for low-cost multi-channel interface for passive resistive sensors << /ASCII85EncodePages false /AllowTransparency false /AutoPositionEPSFiles true /AutoRotatePages /None /Binding /Left /CalGrayProfile (Dot Gain 20%) /CalRGBProfile (sRGB IEC61966-2.1) /CalCMYKProfile (U.S. Web Coated \050SWOP\051 v2) /sRGBProfile (sRGB IEC61966-2.1) /CannotEmbedFontPolicy /Error /CompatibilityLevel 1.4 /CompressObjects /Tags /CompressPages true /ConvertImagesToIndexed true /PassThroughJPEGImages true /CreateJobTicket false /DefaultRenderingIntent /Default /DetectBlends true /DetectCurves 0.0000 /ColorConversionStrategy /CMYK /DoThumbnails false /EmbedAllFonts true /EmbedOpenType false /ParseICCProfilesInComments true /EmbedJobOptions true /DSCReportingLevel 0 /EmitDSCWarnings false /EndPage -1 /ImageMemory 1048576 /LockDistillerParams false /MaxSubsetPct 100 /Optimize true /OPM 1 /ParseDSCComments true /ParseDSCCommentsForDocInfo true /PreserveCopyPage true /PreserveDICMYKValues true /PreserveEPSInfo true /PreserveFlatness true /PreserveHalftoneInfo false /PreserveOPIComments true /PreserveOverprintSettings true /StartPage 1 /SubsetFonts true /TransferFunctionInfo /Apply /UCRandBGInfo /Preserve /UsePrologue false /ColorSettingsFile () /AlwaysEmbed [ true ] /NeverEmbed [ true ] /AntiAliasColorImages false /CropColorImages true /ColorImageMinResolution 300 /ColorImageMinResolutionPolicy /OK /DownsampleColorImages true /ColorImageDownsampleType /Bicubic /ColorImageResolution 300 /ColorImageDepth -1 /ColorImageMinDownsampleDepth 1 /ColorImageDownsampleThreshold 1.50000 /EncodeColorImages true /ColorImageFilter /DCTEncode /AutoFilterColorImages true /ColorImageAutoFilterStrategy /JPEG /ColorACSImageDict << /QFactor 0.15 /HSamples [1 1 1 1] /VSamples [1 1 1 1] >> /ColorImageDict << /QFactor 0.15 /HSamples [1 1 1 1] /VSamples [1 1 1 1] >> /JPEG2000ColorACSImageDict << /TileWidth 256 /TileHeight 256 /Quality 30 >> /JPEG2000ColorImageDict << /TileWidth 256 /TileHeight 256 /Quality 30 >> /AntiAliasGrayImages false /CropGrayImages true /GrayImageMinResolution 300 /GrayImageMinResolutionPolicy /OK /DownsampleGrayImages true /GrayImageDownsampleType /Bicubic /GrayImageResolution 300 /GrayImageDepth -1 /GrayImageMinDownsampleDepth 2 /GrayImageDownsampleThreshold 1.50000 /EncodeGrayImages true /GrayImageFilter /DCTEncode /AutoFilterGrayImages true /GrayImageAutoFilterStrategy /JPEG /GrayACSImageDict << /QFactor 0.15 /HSamples [1 1 1 1] /VSamples [1 1 1 1] >> /GrayImageDict << /QFactor 0.15 /HSamples [1 1 1 1] /VSamples [1 1 1 1] >> /JPEG2000GrayACSImageDict << /TileWidth 256 /TileHeight 256 /Quality 30 >> /JPEG2000GrayImageDict << /TileWidth 256 /TileHeight 256 /Quality 30 >> /AntiAliasMonoImages false /CropMonoImages true /MonoImageMinResolution 1200 /MonoImageMinResolutionPolicy /OK /DownsampleMonoImages true /MonoImageDownsampleType /Bicubic /MonoImageResolution 1200 /MonoImageDepth -1 /MonoImageDownsampleThreshold 1.50000 /EncodeMonoImages true /MonoImageFilter /CCITTFaxEncode /MonoImageDict << /K -1 >> /AllowPSXObjects false /CheckCompliance [ /None ] /PDFX1aCheck false /PDFX3Check false /PDFXCompliantPDFOnly false /PDFXNoTrimBoxError true /PDFXTrimBoxToMediaBoxOffset [ 0.00000 0.00000 0.00000 0.00000 ] /PDFXSetBleedBoxToMediaBox true /PDFXBleedBoxToTrimBoxOffset [ 0.00000 0.00000 0.00000 0.00000 ] /PDFXOutputIntentProfile () /PDFXOutputConditionIdentifier () /PDFXOutputCondition () /PDFXRegistryName () /PDFXTrapped /False /CreateJDFFile false /Description << /ARA /BGR /CHS /CHT /CZE /DAN /DEU /ESP /ETI /FRA /GRE /HEB /HRV (Za stvaranje Adobe PDF dokumenata najpogodnijih za visokokvalitetni ispis prije tiskanja koristite ove postavke. Stvoreni PDF dokumenti mogu se otvoriti Acrobat i Adobe Reader 5.0 i kasnijim verzijama.) /HUN /ITA /JPN /KOR /LTH /LVI /NLD (Gebruik deze instellingen om Adobe PDF-documenten te maken die zijn geoptimaliseerd voor prepress-afdrukken van hoge kwaliteit. De gemaakte PDF-documenten kunnen worden geopend met Acrobat en Adobe Reader 5.0 en hoger.) /NOR /POL /PTB /RUM /RUS /SKY /SLV /SUO /SVE /TUR /UKR /ENU (Use these settings to create Adobe PDF documents best suited for high-quality prepress printing. Created PDF documents can be opened with Acrobat and Adobe Reader 5.0 and later.) >> /Namespace [ (Adobe) (Common) (1.0) ] /OtherNamespaces [ << /AsReaderSpreads false /CropImagesToFrames true /ErrorControl /WarnAndContinue /FlattenerIgnoreSpreadOverrides false /IncludeGuidesGrids false /IncludeNonPrinting false /IncludeSlug false /Namespace [ (Adobe) (InDesign) (4.0) ] /OmitPlacedBitmaps false /OmitPlacedEPS false /OmitPlacedPDF false /SimulateOverprint /Legacy >> << /AddBleedMarks false /AddColorBars false /AddCropMarks false /AddPageInfo false /AddRegMarks false /ConvertColors /ConvertToCMYK /DestinationProfileName () /DestinationProfileSelector /DocumentCMYK /Downsample16BitImages true /FlattenerPreset << /PresetSelector /MediumResolution >> /FormElements false /GenerateStructure false /IncludeBookmarks false /IncludeHyperlinks false /IncludeInteractive false /IncludeLayers false /IncludeProfiles false /MultimediaHandling /UseObjectSettings /Namespace [ (Adobe) (CreativeSuite) (2.0) ] /PDFXOutputIntentProfileSelector /DocumentCMYK /PreserveEditing true /UntaggedCMYKHandling /LeaveUntagged /UntaggedRGBHandling /UseDocumentProfile /UseDocumentBleed false >> ] >> setdistillerparams << /HWResolution [2400 2400] /PageSize [612.000 792.000] >> setpagedevice