DataAcquisitionandSignalProcessingforSmartSensors NikolayKirianaki,SergeyYurish,NestorShpak,VadimDeynega Copyright2002JohnWiley&SonsLtd ISBNs:0-470-84317-9(Hardback);0-470-84610-0(Electronic) DATA ACQUISITION AND SIGNAL PROCESSING FOR SMART SENSORS DATA ACQUISITION AND SIGNAL PROCESSING FOR SMART SENSORS Nikolay V. Kirianaki and Sergey Y. Yurish International Frequency Sensor Association, Lviv, Ukraine Nestor O. Shpak Institute of Computer Technologies, Lviv, Ukraine Vadim P. Deynega State University Lviv Polytechnic, Ukraine Copyright2002byJohnWiley&Sons,Ltd BaffinsLane,Chichester, WestSussex,PO191UD,England National 01243779777 International (+44)1243779777 e-mail(forordersandcustomerserviceenquiries):[email protected] VisitourHomePageonhttp://www.wileyeurope.com AllRightsReserved.Nopartofthispublicationmaybereproduced,storedinaretrievalsystem,or transmitted,inanyformorbyanymeans,electronic,mechanical,photocopying, recording, scanningorotherwise,exceptunderthetermsoftheCopyright,DesignsandPatentsAct1988or underthetermsofalicenceissuedbytheCopyrightLicensingAgencyLtd,90TottenhamCourt Road,London,UKW1P0LP,withoutthepermissioninwritingofthePublisher. NeithertheauthorsnorJonWiley&SonsLtdacceptanyresponsibilityorliabilityforlossor damageoccasionedtoanypersonorpropertythroughusingthematerial,instructions,methodsor ideascontainedherein,oractingorrefrainingfromactingasaresultofsuchuse.Theauthorsand Publisherexpresslydisclaimallimpliedwarranties,includingmerchantabilityoffitnessforany particularpurpose. Designationsusedbycompaniestodistinguishtheirproductsareoftenclaimedastrademarks.In allinstanceswhereJohnWiley&Sonsisawareofaclaim,theproductnamesappearininitial capitalorcapitalletters.Readers,however,shouldcontacttheappropriatecompaniesformore completeinformationregardingtrademarksandregistration. OtherWileyEditorialOffices JohnWiley&Sons,Inc.,605ThirdAvenue, NewYork,NY10158-0012,USA Wiley-VCHVerlagGmbH,Pappelallee3, D-69469Weinheim,Germany JohnWiley&SonsAustralia,Ltd,33ParkRoad,Milton, Queensland4064,Australia JohnWiley&Sons(Asia)PteLtd,2ClementiLoop#02-01, JinXingDistripark,Singapore129809 JohnWiley&Sons(Canada)Ltd,22WorcesterRoad, Rexdale,OntarioM9W1L1,Canada LibraryofCongressCataloging-in-PublicationData Dataacquisitionandsignalprocessingforsmartsensors/NikolayV.Kirianaki...[etal.]. p.cm. Includesbibliographicalreferencesandindex. ISBN0-470-84317-9(alk.paper) 1.Detectors.2.Microprocessors.3.Signalprocessing.4.Automaticdatacollection systems.I.Kirianaki,NikolaiVladimirovich. TA165.D382001 681(cid:1).2–dc21 2001046912 BritishLibraryCataloguinginPublicationData AcataloguerecordforthisbookisavailablefromtheBritishLibrary ISBN0470843179 Typesetin10/12ptTimesbyLaserwordsPrivateLimited,Chennai,India PrintedandboundinGreatBritainbyBiddlesLtd,Guildford&King’sLynn Thisbookisprintedonacid-freepaperresponsiblymanufacturedfromsustainableforestry, inwhichatleasttwotreesareplantedforeachoneusedforpaperproduction. CONTENTS Preface ix List of Abbreviations and Symbols xiii Introduction xv 1 Smart Sensors for Electrical and Non-Electrical, Physical and Chemical Variables: Tendencies and Perspectives 1 1.1 Temperature IC and Smart Sensors 8 1.2 Pressure IC and Smart Sensors and Accelerometers 14 1.3 Rotation Speed Sensors 18 1.4 Intelligent Opto Sensors 23 1.5 Humidity Frequency Output Sensors 24 1.6 Chemical and Gas Smart Sensors 24 Summary 27 2 Converters for Different Variables to Frequency-Time Parameters of the Electric Signal 29 2.1 Voltage-to-Frequency Converters (VFCs) 29 2.2 Capacitance-to-Period (or Duty-Cycle) Converters 47 Summary 50 3 Data Acquisition Methods for Multichannel Sensor Systems 51 3.1 Data Acquisition Method with Time-Division Channelling 52 3.2 Data Acquisition Method with Space-Division Channelling 55 3.3 Smart Sensor Architectures and Data Acquisition 57 3.4 Main Errors of Multichannel Data-Acquisition Systems 59 3.5 Data Transmission and Error Protection 61 3.5.1 Essenceofquasi-ternarycoding 62 3.5.2 Codingalgorithmandexamples 62 3.5.3 Quasi-ternarycodedecoding 65 Summary 67 vi CONTENTS 4 Methods of Frequency-to-Code Conversion 69 4.1 Standard Direct Counting Method (Frequency Measurement) 70 4.2 Indirect Counting Method (Period Measurement) 74 4.3 Combined Counting Method 79 4.4 Method for Frequency-to-Code Conversion Based on Discrete Fourier Transformation 82 4.5 Methods for Phase-Shift-to-Code Conversion 85 Summary 86 5 Advanced and Self-Adapting Methods of Frequency-to-Code Conversion 89 5.1 Ratiometric Counting Method 89 5.2 Reciprocal Counting Method 94 5.3 M/T Counting Method 94 5.4 Constant Elapsed Time (CET) Method 96 5.5 Single- and Double-Buffered Methods 96 5.6 DMA Transfer Method 97 5.7 Method of Dependent Count 98 5.7.1 Methodofconversionforabsolutevalues 99 5.7.2 Methodsofconversionforrelativevalues 100 5.7.3 Methodsofconversionforfrequencydeviation 104 5.7.4 Universalmethodofdependentcount 104 5.7.5 Exampleofrealization 105 5.7.6 Metrologicalcharacteristicsandcapabilities 107 5.7.7 Absolutequantizationerror(cid:1)q 107 5.7.8 Relativequantizationerrorδq 109 5.7.9 Dynamicrange 110 5.7.10 Accuracyoffrequency-to-codeconvertersbased onMDC 112 5.7.11 Calculationerror 114 5.7.12 Quantizationerror(errorofmethod) 114 5.7.13 Referencefrequencyerror 114 5.7.14 Triggererror 115 5.7.15 Simulationresults 117 5.7.16 Examples 120 5.8 Method with Non-Redundant Reference Frequency 121 5.9 Comparison of Methods 123 5.10 Advanced Method for Phase-Shift-to-Code Conversion 125 Summary 126 6 Signal Processing in Quasi-Digital Smart Sensors 129 6.1 Main Operations in Signal Processing 129 6.1.1 Addingandsubtraction 129 6.1.2 Multiplicationanddivision 130 6.1.3 Frequencysignalunification 132 6.1.4 Derivationandintegration 135 CONTENTS vii 6.2 Weight Functions, Reducing Quantization Error 136 Summary 142 7 Digital Output Smart Sensors with Software-Controlled Performances and Functional Capabilities 143 7.1 Program-Oriented Conversion Methods Based on Ratiometric Counting Technique 145 7.2 Design Methodology for Program-Oriented Conversion Methods 150 7.2.1 Example 158 7.3 Adaptive PCM with Increased Speed 161 7.4 Error Analysis of PCM 164 7.4.1 Referenceerror 165 7.4.2 Calculationerror 171 7.4.3 ErrorofT02 forming 173 7.5 Correction of PCM’s Systematic Errors 174 7.6 Modified Method of Algorithm Merging for PCMs 175 Summary 182 8 Multichannel Intelligent and Virtual Sensor Systems 183 8.1 One-Channel Sensor Interfacing 183 8.2 Multichannel Sensor Interfacing 184 8.2.1 Smartrotationspeedsensor 185 8.2.2 Encoder 187 8.2.3 Self-adaptivemethodforrotationspeedmeasurements 188 8.2.4 Sensorinterfacing 190 8.3 Multichannel Adaptive Sensor System with Space-Division Channelling 193 8.4 Multichannel Sensor Systems with Time-Division Channelling 197 8.5 Multiparameters Sensors 199 8.6 Virtual Instrumentation for Smart Sensors 199 8.6.1 Setofthebasicmodelsformeasuringinstruments 201 8.7 Estimation of Uncertainty for Virtual Instruments 215 Summary 224 9 Smart Sensor Design at Software Level 225 9.1 Microcontroller Core for Smart Sensors 225 9.2 Low-Power Design Technique for Embedded Microcontrollers 227 9.2.1 Instructionselectionandordering 234 9.2.2 Codesizeandspeedoptimizations 234 9.2.3 Jumpandcalloptimizations 236 9.2.4 Cycleoptimization 237 9.2.5 Minimizingmemoryaccesscost 239 9.2.6 Exploitinglow-powerfeaturesofthehardware 240 9.2.7 Compileroptimizationforlowpower 241 Summary 244 viii CONTENTS 10 Smart Sensor Buses and Interface Circuits 245 10.1 Sensor Buses and Network Protocols 245 10.2 Sensor Interface Circuits 248 10.2.1 Universaltransducerinterface(UTI) 248 10.2.2 Time-to-digitalconverter(TDC) 252 Summary 253 Future Directions 255 References 257 Appendix A What is on the Sensors Web Portal? 267 Glossary 269 Index 275 PREFACE Smartsensorsareofgreatinterestinmanyfieldsofindustry,controlsystems,biomed- ical applications, etc. Most books about sensor instrumentation focus on the classical approachtodataacquisition,thatistheinformationisintheamplitudeofavoltageora current signal. Only a few book chapters, articles and papers consider data acquisition fromdigitalandquasi-digitalsensors.Smartsensorsandmicrosensorsincreasinglyrely onresonantphenomenaandvariableoscillators,wheretheinformationisembeddednot intheamplitude butinthefrequencyortimeparameteroftheoutput signal.Asarule, the majority of scientific publications dedicated to smart sensors reflect only the tech- nological achievements of microelectronics. However, modern advanced microsensor technologies require novel advanced measuring techniques. Because data acquisition and signal processing for smart sensors have not been adequately covered in the literature before, this book aims to fill a significant gap. Thisbookisbasedon40yearsoftheauthors’practicalexperienceinthedesignand creation of sensor instrumentation as well as the development of novel methods and algorithmsforfrequency–time-domainmeasurement,conversionandsignalprocessing. Digitalandquasi-digital(frequency,period,duty-cycle,timeintervalandpulsenumber output) sensors are covered in this book. Research results, described in this book, are relevant to the authors’ international research in the frame of different R&D projects and International Frequency Sensor Association (IFSA) activity. Who Should Read this Book? This book is aimed at PhD students, engineers, scientists and researchers in both academia and industry. It is especially suited for professionals working in the field of measuring instruments and sensor instrumentation as well as anyone facing new challenges in measuring, and those involved in the design and creation of new digital smart physical or chemical sensors and sensor systems. It should also be useful for students wishing to gain an insight into this rapidly expanding area. Our goal is to providethereaderwithenoughbackgroundtounderstandthenovelconcepts,principles and systems associated with data acquisition, signal processing and measurement so that they can decide how to optimize their sensor systems in order to achieve the best technical performances at low cost. x PREFACE How this Book is Organized This book has been organized into 10 chapters. Chapter 1, Smart sensors for electrical and non-electrical, physical and chemical quantities: the tendencies and perspectives, describes the main advantages of frequency–time-domain signals as informative parameters for smart sensors. The chapter gives an overview of industrial types of smart sensors and contains classifications of quasi-digital sensors. Digital and quasi-digital (frequency, period, duty-cycle, time interval and pulse number output) sensors are considered. Chapter 2, Convertersfordifferentvariablestofrequency–timeparametersofelec- tric signals, deals with different voltage (current)-to-frequency and capacitance-to- period (or duty-cycle) converters. Operational principles, technical performances and metrological characteristics of these devices are discussed from a smart sensor point of view in order to produce further conversion in the quasi-digital domain instead of the analog domain. The open and loop (with impulse feedback) structures of such converters are considered. (Figures 2.11, 2.12, 2.13, 2.14, 2.15 and some of the text appearing in Chapter 2, section 2.1, are reproduced from New Architectures of Inte- grated ADC, PDS ’96 Proceedings. Reproduced by permission of Maciej Nowinski.) Chapter3,Dataacquisitionmethodsformultichannelsensorsystems,coversmulti- channelsensorsystemswithcyclical,acceleratedandsimultaneoussensorpolling.Data acquisition methods with time-division and space-division channelling are described. The chapter contains information about how to calculate the time-polling cycle for a sensor and how to analyse the accuracy and speed of data acquisition. Main smart sensorarchitecturesareconsideredfromadataacquisitionpointofview.Datatransmit- ting and error protection on the basis of quasi-ternary cyclic coding is also discussed. Chapter 4, Methods of frequency-to-code conversion for smart sensors, discusses traditional methods for frequency (period)-to-code conversion, including direct, indi- rect, combined, interpolation, Fourier conversion-basedcounting techniques as well as methodsforphase-shift-to-codeconversion.Suchmetrologicalcharacteristicsasquan- tization error, conversion frequency range and conversion speed as well as advantages and disadvantages for each of the methods are discussed and compared. Chapter 5, Advanced and self-adapting methods of frequency-to-code conversion, discusses reciprocal, ratiometric, constant elapsed time (CET), M/T, single-buffered, double-bufferedand DMA transfer advanced methods. Comparative and cost-effective analyses are given. Frequency ranges, quantization errors, time of measurement and other metrological performances as well as hardware and software requirements for realization from a smart sensor point of view are described. This chapter is very important because it also deals with the concepts, principles and nature of novel self- adapting methods of dependent count (MDC) and the method with non-redundant reference frequency. The chapter covers main metrological performances including accuracy,conversiontime,frequencyrangeaswellassoftwareandhardwareforMDC realization. Advanced conversion methods for frequencies ratio, deviations and phase shifts are also described. Finally, some practical examples and modelling results are presented. Chapter 6, Signal processing for quasi-digital smart sensors, deals with the main frequencysignalmanipulationsincludingmultiplication,division,addition,subtraction, derivation, integration and scaling. Particular attention has been paid to new methods