The book in front of you introduces the subjects of sensing and actuation. At first it would seem that nothing could be easier; we may think we know what a sensor is, and certainly we know what an actuator is. But do we know it so well that it actually escapes us? There are literally thousands of devices all around us that qualify in either category. In Chapter 1 there is an example that lists many of the sensors and actuators just in a car. The count is approximately 200, and this is merely a partial list The approach adopted here is to view all devices as belonging to three categories: sensors, actuators, and processors (interfaces). Sensors are the devices that provide input to systems and actuators are those devices that serve as outputs. In between, linking, interfacing, processing, and driving are the processors. In other words, the view advocated in this text is one of general sensing and actuation. In that sense, a switch on the wall is a sensor (a force sensor), and the light bulb that turns on as a result is an actuator (it does something). In between there is a ‘‘processor’’ – the wiring harness or, in case a dimmer is used, an actual electronic circuit – that interprets the input data and does something with it. In this case it may be no more than a wiring harness, but in other cases it may be a microprocessor or an entire system of computers.
Sensors, Actuators, and their Interfaces As sensors and actuators are normally not (and have not been) treated in academic curricula as a subject in its own right; many students and current professionals often find themselves limited in their knowledge and dealing with topics and issues based on material they may have never encountered Until now This book brings sensors, actuators and interfaces out of obscurity and integrates them for multiple disciplines including electrical, mechanical, chemical, and biomedical engineering Real world cases, worked examples, and problem sets with selected answers provide both fundamental understanding and how industry develops sensor systems Students and professionals from any of these disciplines will easily learn the foundational concepts and then be able to apply them to cross-discipline requirements The idea is simple A sensor system in general is made of three components: Inputs (sensors) Outputs (actuators) Processor (the unit to which the inputs and outputs are connected and performs all, or the most, tasks needed to interface them) Sensors, Actuators, and their Interfaces focuses on the broad area of detection, outlining and simplifying the understanding of theory behind sensing and actuation It is an invaluable textbook for undergraduate and graduate level courses, as well as a reference for professionals who were never afforded the opportunity to take an introductory course ABOUT THE AUTHOR Nathan Ida is currently a Distinguished Professor of Electrical and Computer Engineering at the University of Akron He received his Bachelor and Master degrees from Ben-Gurion University of the Negev (Israel) and his Ph.D from Colorado State University in 1983 Dr Ida has written five successful books in electromagnetics including the undergraduate textbook Engineering Electromagnetics (now in its second edition) He teaches several courses at the University of Akron including a very popular course on sensors and actuators, which is the foundation of this book He has researched and developed systems for industrial use that help control the thickness of rubber during tire production, oil leak sensing systems, wireless sensors and networks, and many other systems for several clients He is a Fellow of the IEEE, ASNT (American Society for Nondestructive Testing), and ACES (Applied Computational Electromagnetics Society) RELATED BOOKS Microwave & RF Design: A Systems Approach, 2nd Edition - by Michael Steer • ©2013 • ISBN: 9781613530214 Introduction to Biomechatronics - by Graham Brooker • ©2013 • ISBN: 9781891121272 Sensors, Actuators, and their Interfaces Sensors, Actuators, and their Interfaces A Multidisciplinary Introduction Nathan Ida University of Akron Edison, NJ scitechpub.com Published by SciTech Publishing, an imprint of the IET www.scitechpub.com www.theiet.org Copyright 2014 by SciTech Publishing, Edison, NJ All rights reserved No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, scanning or otherwise, except as permitted under Sections 107 or 108 of the 1976 United States Copyright Act, without either the prior written permission of the Publisher, or authorization through payment of the appropriate per-copy fee to the Copyright Clearance Center, 222 Rosewood Drive, Danvers, MA 01923, (978) 750-8400, fax (978) 646-8600, or on the web at copyright.com Requests to the Publisher for permission should be addressed to The Institution of Engineering and Technology, Michael Faraday House, Six Hills Way, Stevenage, Herts, SG1 2AY, United Kingdom While the author and publisher believe that the information and guidance given in this work are correct, all parties must rely upon their own skill and judgement when making use of them Neither the author nor publisher assumes any liability to anyone for any loss or damage caused by any error or omission in the work, whether such an error or omission is the result of negligence or any other cause Any and all such liability is disclaimed Editor: Dudley R Kay Cover Design: Brent Beckley 10 ISBN 978-1-61353-006-1 (hardback) ISBN 978-1-61353-195-2 (PDF) Typeset in India by MPS Limited Printed in the USA by Sheridan Books, Inc Printed in the UK by Hobbs The Printers Ltd Contents Preface with Publisher’s Acknowledgements xv Introduction 1.1 1.2 1.3 1.4 1.5 1.6 Introduction A Short Historical Note Definitions Classification of Sensors and Actuators 12 General Requirements for Interfacing 16 Units 18 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 Base SI Units 18 Derived Units 19 Supplementary Units 20 Customary Units 20 Prefixes 22 Other Units and Measures 1.6.6.1 1.6.6.2 22 Units of Information 22 The Decibel (dB) and Its Use 23 1.7 Problems Performance Characteristics of Sensors and Actuators 31 2.1 2.2 Introduction 31 Input and Output Characteristics 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 2.2.7 2.2.8 2.2.9 2.2.10 2.2.11 2.3 26 32 Transfer Function 32 Impedance and Impedance Matching 35 Range, Span, Input and Output Full Scale, Resolution, and Dynamic Range 39 Accuracy, Errors, and Repeatability 42 Sensitivity and Sensitivity Analysis 45 Hysteresis, Nonlinearity, and Saturation 52 Frequency Response, Response Time, and Bandwidth 56 Calibration 58 Excitation 59 Deadband 59 Reliability 59 Problems 61 v vi Contents 3.1 Temperature Sensors and Thermal Actuators 67 Introduction 3.1.1 3.2 67 Units of Temperature, Thermal Conductivity, Heat, and Heat Capacity 69 Thermoresistive Sensors: Thermistors, Resistance Temperature Sensors, and Silicon Resistive Sensors 70 3.2.1 Resistance Temperature Detectors 3.2.1.1 3.2.1.2 3.2.2 3.2.3 3.3 3.4 3.5 Silicon Resistive Sensors Thermistors 84 Thermoelectric Sensors 3.3.1 3.3.2 3.3.3 81 88 Practical Considerations 94 Semiconductor Thermocouples 101 Thermopiles and Thermoelectric Generators p-n Junction Temperature Sensors Other Temperature Sensors 109 3.5.1 3.5.2 70 Self-Heat of RTDs 78 Response Time 80 Optical and Acoustical Sensors 109 Thermomechanical Sensors and Actuators 3.6 Problems Optical Sensors and Actuators 129 4.1 4.2 4.3 4.4 Introduction 130 Optical Units 131 Materials 132 Effects of Optical Radiation 4.4.1 4.4.2 4.6 The Photoelectric Effect 133 Quantum Effects: The Photoconducting Effect Spectral Sensitivity 137 Tunneling Effect 137 138 Photoconducting Sensors 138 Photodiodes 142 Photovoltaic Diodes 147 Phototransistors 150 Photoelectric Sensors 4.6.1 4.6.2 4.7 4.8 132 Thermal Effects 132 Quantum Effects 133 Quantum-Based Optical Sensors 4.5.1 4.5.2 4.5.3 4.5.4 153 The Photoelectric Sensor Photomultipliers 154 153 Coupled Charge (CCD) Sensors and Detectors Thermal-Based Optical Sensors 159 4.8.1 110 118 4.4.2.1 4.4.2.2 4.4.2.3 4.4.2.4 4.5 102 104 Passive IR Sensors 4.8.1.1 4.8.1.2 4.8.1.3 160 Thermopile PIR 160 Pyroelectric Sensors 162 Bolometers 165 156 135 Contents 4.9 4.10 4.11 Active Far Infrared (AFIR) Sensors Optical Actuators 167 Problems 168 Electric and Magnetic Sensors and Actuators 177 5.1 5.2 5.3 Introduction 177 Units 179 The Electric Field: Capacitive Sensors and Actuators 5.3.1 5.3.2 5.3.3 5.4 Inductive Sensors 5.4.1.1 5.4.1.2 5.4.1.3 5.4.2 5.6 5.7 211 Magnetostrictive Actuators 227 232 236 Voice Coil Actuators 237 Motors as Actuators 240 5.9.2.3 5.9.2.4 5.9.2.5 Operation Principles 241 Brushless, Electronically Commutated DC Motors (BLDC Motors) 245 AC Motors 247 Stepper Motors 248 Linear Motors 254 Magnetic Solenoid Actuators and Magnetic Valves Voltage and Current Sensors 5.10.1 5.10.2 222 230 Coil Magnetometer 230 The Fluxgate Magnetometer The SQUID 235 5.9.2.1 5.9.2.2 5.9.3 218 MHD Generator or Sensor 219 MHD Pump or Actuator 219 Magnetic Actuators 5.9.1 5.9.2 5.10 Inductive Proximity Sensors 201 Eddy Current Proximity Sensors 205 Position and Displacement Sensing: Variable Inductance Sensors 208 Hall Effect Sensors Magnetometers 5.8.1 5.8.2 5.8.3 5.9 194 Magnetoresistance and Magnetoresistive Sensors Magnetostrictive Sensors and Actuators 224 5.7.1 5.8 183 199 Magnetohydrodynamic (MHD) Sensors and Actuators 5.5.1 5.5.2 180 Capacitive Position, Proximity, and Displacement Sensors Capacitive Fluid Level Sensors 187 Capacitive Actuators 189 Magnetic Fields: Sensors and Actuators 5.4.1 5.5 166 Voltage Sensing Current Sensing 259 260 263 5.11 Problems 267 Mechanical Sensors and Actuators 281 6.1 6.2 Introduction 281 Some Definitions and Units 282 256 vii viii Contents 6.3 Force Sensors 6.3.1 6.3.2 283 Strain Gauges 283 Semiconductor Strain Gauges 6.3.2.1 6.3.2.2 6.3.3 6.3.4 6.4 6.5 297 Capacitive Accelerometers 298 Strain Gauge Accelerometers 300 Magnetic Accelerometers 301 Other Accelerometers 302 Pressure Sensors 6.5.1 6.5.2 6.5.3 6.5.4 6.6 6.7 Other Strain Gauges 292 Force and Tactile Sensors 292 Accelerometers 6.4.1 6.4.2 6.4.3 6.4.4 305 Mechanical Pressure Sensors 305 Piezoresistive Pressure Sensors 310 Capacitive Pressure Sensors 314 Magnetic Pressure Sensors 314 Velocity Sensing 315 Inertial Sensors: Gyroscopes 6.7.1 6.7.2 285 Application 288 Errors 288 319 Mechanical or Rotor Gyroscopes Optical Gyroscopes 321 320 6.8 Problems Acoustic Sensors and Actuators 335 7.1 7.2 7.3 Introduction 335 Units and Definitions 337 Elastic Waves and Their Properties 7.3.1 7.3.2 7.3.3 7.3.4 7.4 7.6 357 Electrostriction 361 Piezoelectric Sensors 361 Acoustic Actuators 7.6.1 7.6.2 363 Loudspeakers 363 Headphones and Buzzers 7.6.2.1 7.6.2.2 7.7 350 The Carbon Microphone 350 The Magnetic Microphone 352 The Ribbon Microphone 354 Capacitive Microphones 354 The Piezoelectric Effect 7.5.1 7.5.2 340 Longitudinal Waves 341 Shear Waves 349 Surface Waves 349 Lamb Waves 350 Microphones 7.4.1 7.4.2 7.4.3 7.4.4 7.5 324 369 The Magnetic Buzzer 369 The Piezoelectric Headphone and Piezoelectric Buzzer Ultrasonic Sensors and Actuators: Transducers 7.7.1 7.7.2 Pulse-Echo Operation 377 Magnetostrictive Transducers 380 373 371 Contents 7.8 7.9 7.10 Piezoelectric Actuators 381 Piezoelectric Resonators and SAW Devices Problems 390 Chemical Sensor and Actuators 403 8.1 8.2 8.3 Introduction 404 Chemical Units 405 Electrochemical Sensors 8.3.1 8.3.2 8.3.3 8.4 8.5 421 Thermistor-Based Chemical Sensors Catalytic Sensors 422 Thermal Conductivity Sensor 425 Mass Humidity and Gas Sensors SAW Mass Sensors 431 431 432 Capacitive Moisture Sensors 433 Resistive Humidity Sensor 435 Thermal Conduction Moisture Sensors Optical Humidity Sensor 437 Chemical Actuation 8.9.1 8.9.2 8.9.3 8.9.4 421 425 Humidity and Moisture Sensors 8.8.1 8.8.2 8.8.3 8.8.4 8.9 Glass Membrane Sensors 414 Soluble Inorganic Salt Membrane Sensors 417 Polymer-Immobilized Ionophore Membranes 418 Gel-Immobilized Enzyme Membranes 419 The Ion-Sensitive Field-Effect Transistor (ISFET) 420 Optical Chemical Sensors Mass Sensors 429 8.7.1 8.7.2 8.8 413 Thermochemical Sensors 8.5.1 8.5.2 8.5.3 8.6 8.7 406 Metal Oxide Sensors 406 Solid Electrolyte Sensors 409 The Metal Oxide Semiconductor (MOS) Chemical Sensor Potentiometric Sensors 8.4.1 8.4.2 8.4.3 8.4.4 8.4.5 385 436 439 The Catalytic Converter 439 The Airbag 441 Electroplating 442 Cathodic Protection 444 8.10 Problems Radiation Sensors and Actuators 457 9.1 9.2 9.3 Introduction 457 Units of Radiation 459 Radiation Sensors 460 9.3.1 445 Ionization Sensors (Detectors) 9.3.1.1 9.3.1.2 9.3.1.3 461 Ionization Chambers 461 Proportional Chamber 463 Geiger–Muller Counters 463 413 ix Appendix B: Thermoelectric Reference Tables 0 C to 1300 C T90 ¼ 3:8783277  10À2 E1 À 1:1612344  10À6 E2 þ 6:9525655  10À11 E3 À 3:0090077  10À15 E4 þ 8:8311584  10À20 E5 À 1:6213839  10À24 E6 þ 1:6693362  10À29 E7 À 7:3117540  10À35 E8 ½ C B.6 TYPE B THERMOCOUPLES (PLATINUM [30%]-RHODIUM-PLATINUM) E¼ n X ci ðt90 Þi ½ mV i¼0 Temperature range [ C] 0 C to 630.615 C 630.615 C to 1820 C C0 C1 C2 C3 C4 C5 C6 C7 C8 0.0 À2.4650818346  101 5.9040421171  10À3 À1.3257931636  10À6 1.5668291901  10À9 À1.6944529240  10À12 6.2290347094  10À16 À3.8938168621  103 2.8571747470  101 À8.4885104785  10À2 1.5785280164  10À4 À1.6835344864  10À7 1.1109794013  10À10 À4.4515431033  10À14 9.8975640821  10À18 À9.3791330289  10À22 0 C to 630.615 C E ¼ À2:4650818346  101 T þ 5:9040421171  10À3 T À 1:3257931636  10À6 T þ 1:5668291901  10À9 T À 1:6944529240  10À12 T þ 6:2290347094 Â10À16 T ½mV 630.615 C to 1820 C E ¼ À3:8938168621  103 þ 2:8571747470  101 T À 8:4885104785  10À2 T þ 1:5785280164  10À4 T À 1:6835344864  10À7 T þ 1:1109794013  10À10 T À 4:4515431033  10À14 T þ 9:8975640821  10À18 T À 9:3791330289  10À22 T ½ mV Inverse polynomials T90 ¼ n X i¼0 ci E i ½ mV 737 738 Appendix B: Thermoelectric Reference Tables Temperature range [ C] Voltage range [mV] 250 C to 700 C 291 to 2431 700 C to 1820 C 2431 to 13,820 C0 C1 C2 C3 C4 C5 C6 C7 C8 Error range 9.4823321  101 6.9971500  10À1 À8.4765304  10À4 1.0052644  10À6 À8.3345952  10À10 4.5508542  10À13 À1.5523037  10À16 2.9886750  10À20 À2.4742860  10À24 0.03 C to À0.02 C 2.1315071  102 2.8510514  10À1 À5.2742887  10À5 9.9160804  10À9 À1.2965303  10À12 1.1195870  10À16 À6.0625199  10À21 1.8661696  10À25 À2.4878585  10À30 0.02 C to À0.01 C 250 C to 700 C T90 ¼ 9:4823321  101 þ 6:9971500  10À1 E1 À 8:4765304  10À4 E2 þ 1:0052644  10À6 E3 À 8:3345952  10À10 E4 þ 4:5508542  10À13 E5 À 1:5523037  10À16 E6 þ 2:9886750  10À20 E7 À 2:4742860  10À24 E8 ½ C 700 C to 1820 C T90 ¼ 2:1315071  102 þ 2:8510504  10À1 E1 À 5:2742887  10À5 E2 þ 9:9160804  10À9 E3 À 1:2965303  10À12 E4 þ 1:1195870  10À16 E5 À 6:0625199  10À21 E6 þ 1:8661696  10À25 E7 À 2:4878585  10À30 E8 ½ C B.7 TYPE R THERMOCOUPLES (PLATINUM [13%]/RHODIUM-PLATINUM) E¼ n X ci ðt90 Þi ½ mV i¼0 Temperature range [ C] À50 C to 1064.18 C 1064.18 C to 1664.5 C 1664.5 C to 1768.1 C C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 0.0 5.28961729765 1.39166589782  10À2 À2.38855693017  10À5 3.56916001063  10À8 À4.62347666298  10À11 5.00777441031  10À14 À3.73105886191  10À17 1.57716482367  10À20 À2.81038625251  10À24 2.95157925316  103 À2.52061251332 1.59564501865  10À2 À7.64085947576  10À6 2.05305291024  10À9 À2.93359668173  10À13 1.52232118209  105 À2.68819888545  102 1.71280280453  10À1 À3.45895706453  10À5 À9.34633971046  10À12 Appendix B: Thermoelectric Reference Tables À50 C to 1064.18 C E ¼ 5:28961729765T þ 1:39166589782  10À2 T À 2:38855693017  10À5 T þ 3:56916001063  10À8 T À 4:62347666298  10À11 T þ 5:00777441034  10À14 T À 3:73105886191  10À17 T þ 1:57716482367  10À20 T À 2:81038625251  10À24 T ½ mV 1064.18 C to 1664.5 C E ¼ 2:95157925316  103 À 2:52061251332T þ 1:59564501865  10À2 T À7:64085947576  10À6 T þ 2:05305291024  10À9 T À2:93359668173  10À13 T ½mV 1664.5 C to 1768.1 C E ¼ 1:52232118209  105 À 2:68819888545  102 T þ 1:71280280453  10À1 T À 3:45895706453  10À5 T À 9:34633971046  10À12 T ½mV Inverse polynomials T90 ¼ n X ci Ei ½ C i¼0 Temperature À50 C to 250 C range [ C] 250 C to 1200 C 1064 C to 1664.5 C 1664.5 C to 1768.1 C Volt range [mV] À226 to 1923 1923 to 13,228 11,361 to 19,769 19,769 to 21,103 C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 C10 Error range 0.0 1.8891380  10À1 À9.3835290  10À5 1.0368619  10À7 À2.2703580  10À10 3.5145659  10À13 À3.8953900  10À16 2.8239471  10À19 À1.2607281  10À22 3.1353611  10À26 À3.3187769  10À30 0.02 C to À0.02 C 1.334584505  101 1.472644573  10À1 À1.844024844  10À5 4.031129726  10À9 À6.249428360  1013 6.468412046  10À17 À4.458750426  10À21 1.994710146  10À25 À5.313401790  10À30 6.481976217  10À35 À8.199599416  101 1.553962042  10À1 À8.342197663  10À6 4.279433549  10À10 À1.191577910  10À14 1.492290091  10À19 3.406177836  104 À7.02372/171 5.582903813  10À4 À1.952394635  10À8 2.560740231  10À13 0.005 C to À0.005 C 0.001 C to À0.0005 C 0.002 C to À0.001 C À50 C to 250 C T90 ¼ 1:8891380  10À1 E1 À 9:3835290  10À5 E2 þ 1:3068619  10À7 E3 À 2:2703580  10À10 E4 þ 3:5145659  10À13 E5 À 3:8953900  10À16 E6 þ 2:8239471  10À19 E7 À 1:2607281  10À22 E8 þ 3:1353611  10À26 E9 À 3:3187769  10À30 E10 ½ C 739 740 Appendix B: Thermoelectric Reference Tables 250 C to 1200 C T90 ¼ 1:334584505  101 þ 1:472644573  10À1 E1 À 1:844024844  10À5 E2 þ 4:031129726  10À9 E3 À 6:249428360  10À13 E4 þ 6:468412046  10À17 E5 À 4:458750426  10À21 E6 þ 1:994710146  10À25 E7 À 5:313401790  10À30 E8 þ 6:481976217  10À35 E9 ½ C 1064 C to 1664.5 C T90 ¼ À 8:199599416  101 þ 1:553962042  10À1 E1 À 8:342197663  10À6 E2 þ 4:279433549  10À10 E3 À 1:191577910  10À14 E4 þ 1:492290091  10À19 E5 ½ C 1664.5 C to 1768.1 C T90 ¼ 3:406177836  104 À 7:023729171E1 þ 5:582903813  10À4 E2 À 1:952394635  10À8 E3 þ 2:560740231  10À13 E4 ½ C B.8 TYPE S THERMOCOUPLES (PLATINUM [10%]/ RHODIUM-PLATINUM) E¼ n X ci ðt90 Þi ½mV i¼0 Temperature range [ C] À50 C to 1064.18 C 1064.18 C to 1664.5 C 1664.5 C to 1768.1 C C0 C1 C2 C3 C4 C5 C6 C7 C8 0.0 5.40313308631 1.25934289740  10À2 À2.32477968689  10À5 3.22028823036  10À8 À3.31465196389  10À11 2.55744251786  10À14 À1.25068871393  10À17 2.71443176145  10À21 1.32900445085  103 3.34509311344 6.54805192818  10À3 À1.64856259209  10À6 1.29989605174  10À11 1.46628232636  105 À2.58430516752  102 1.63693574641  10À1 À3.30439046987  10À5 À9.43223690612  10À12 À50 C to 1064.18 C E ¼ 5:40313308631T þ 1:25934289740  10À2 T À 2:32477968689  10À5 T þ 3:22028823036  10À8 T À 3:31465196389  10À11 T þ 2:55744251786  10À14 T À 1:25068871393  10À17 T þ 2:71443176145  10À21 T ½mV 1064.18 C to 1664.5 C E ¼ 1:32900445085  103 þ 3:34509311344T þ 6:54805192818  10À3 T À 1:64856259209  10À6 T þ 1:29989605174  10À11 T ½ mV Appendix B: Thermoelectric Reference Tables 1664.5 C to 1768.1 C E ¼ 1:46628232636  105 À 2:58430516752  102 T þ 1:63693574641  10À1 T À 3:30439046987  10À5 T À 9:43223690612  10À12 T ½ mV Inverse polynomials T90 ¼ n X ci E i ½ mV i¼0 Temperature À50 C to 250 C range [ C] 250 C to 1200 C 1064 C to 1664.5 C 1664.5 C to 1768.1 C Volt range [mV] À235 to 1874 1874 to 11,950 10,332 to 17,536 17,536 to 18,693 C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 0.0 1.84949460  10À1 À8.00504062  10À5 1.02237430  10À7 À1.52248592  10À10 1.8821343  10À13 À1.59085941  10À16 8.23027880  10À20 À2.34181944  10À23 2.79786260  10À27 1.291507177  101 1.466298863  10À1 À1.534713402  10À5 3.145945973  10À9 À4.163257839  10À13 3.187963771  10À17 À1.291637500  10À21 2.183475087  10À26 À1.447379511  10À31 8.211272125  10À36 À8.087801117  101 1.621573104  10À1 À8.536869453  10À6 4.719686976  10À10 À1.441693666  10À14 2.081618890  10À19 5.333875126  104 À1.235892298  101 1.092657613  10À3 À4.265693686  10À8 6.247205420  10À13 Error range 0.02 C to À0.02 C 0.01 C to À0.01 C 0.0002 C to À0.0002 C 0.002 C to À0.002 C À50 C to 250 C T90 ¼ 1:84949460  10À1 E1 À 8:00504062  10À5 E2 þ 1:02237430  10À7 E3 À 1:52248592  10À10 E4 þ 1:88821343  10À13 E5 À 1:59085941  10À16 E6 þ 8:23027880  10À20 E7 À 2:34181944  10À23 E8 þ 2:79786260 Â10À27 E9 ½ C 250 C to 1200 C T90 ¼ 1:291507177  101 þ 1:466298863  10À1 E1 À 1:534713402  10À5 E2 þ 3:145945973  10À9 E3 À 4:163257839  10À13 E4 þ 3:187963771  10À17 E5 À 1:291637500  10À21 E6 þ 2:183475087  10À26 E7 À 1:447379511  10À31 E8 þ 8:211272125  10À36 E9 ½ C 1064 C to 1664.5 C T90 ¼ À8:087801117  101 þ 1:621573104  10À1 E1 À 8:536869453  10À6 E2 þ 4:719686976  10À10 E3 À 1:441693666  10À14 E4 þ 2:081618890  10À19 E5 1664.5 C to 1768.1 C T90 ¼ 5:333875126  104 À 1:235892298  101 E1 þ 1:092657613  10À3 E2 À 4:265693686  10À8 E3 þ 6:247205420  10À13 E4 ½ C 741 Appendix C Computation on Microprocessors In the following we explore a few issues associated with integer and fixed point mathematics on microprocessors We not discuss floating point mathematics since floating point operations are rarely resorted to in interfacing in the context of 8-bit microprocessors C.1 REPRESENTATION OF NUMBERS ON MICROPROCESSORS C.1.1 Binary Numbers: Unsigned Integers Internally the microprocessor represents all variables as binary integers, that is, base integers The integers may be unsigned (i.e., positive numbers) or may be signed (i.e., may be positive or negative) A positive decimal number, say, the four-digit number 3792, makes use of the numbers to and may be represented as 3792 ¼  103 þ  102 þ  101 þ  100 : (C.1) Parallel to the decimal system, binary or base integers make use of the numbers and An 8-bit unsigned integer, say, 10011011, may be represented as follows: 10011011 ¼  27 þ  26 þ  25 þ  24 þ  23 þ  22 þ  21 þ  20 ¼ 128 þ þ þ 16 þ þ þ þ ¼ 155: (C.2) The representation above also shows how numbers can be converted from one system to the other For the particular case shown here, the decimal equivalent is 155 To convert a binary number to a decimal number it suffices to sum up the products indicated in Equation (C.2) To convert from decimal to binary we can proceed in two simple ways A formal method is based on division by The decimal number is divided by If the division is exact, one writes the least significant bit as a ‘‘0’’ If not, it is written as a ‘‘1’’ and the quotient is then divided again by until the quotient is zero Using again the number 3792, we write 743 744 Appendix C: Computation on Microprocessors 3792=2 1892=2 948=2 474=2 237=2 118=2 59=2 29=2 14=2 7=2 3=2 1=2 ¼ ¼ ¼ ¼ ¼ ¼ ¼ ¼ ¼ ¼ ¼ ¼ 1896 - 948 - 474 237 118 59 - 29 - 14 - 1 1: (C.3) The digital representation is 111011010000 and requires 12 bits An often simpler method is suggested by Equation (C.3) Find the largest power of that fits in the number and subtract it from the decimal number Set the digit that corresponds to that power to ‘‘1’’ for the most significant bit (MSB) Find the next largest power of that fits in the remainder and subtract it Set the corresponding digit to ‘‘1’’ and so on until the remainder is zero All other digits are zero In the example above, the largest power of is 211 ¼ 2048 Digit 11 becomes ‘‘1’’ and the remainder is 1744 Now the largest power that fits in 1744 is 210 ¼ 1024 Digit 10 is ‘‘1’’ and the remainder is 720 The next largest power of is 29 ¼ 512 Digit is ‘‘1’’ and the remainder is 208 The next power of is 27 ¼ 128 The remainder is 80 Digit is ‘‘1’’, but since 28 ¼ 256 was not used, digit is ‘‘0’’ Continuing the process we obtain the representation 111011010000, as above C.1.2 Signed Integers In the decimal system we use the minus sign to indicate negative numbers (integers or fractions), but in the digital system there is no negative sign In the common notation, negative integers are treated as positive integers with the MSB serving as a sign digit If the MSB is ‘‘0’’, the number is considered positive, whereas if it is ‘‘1’’, the number is negative Consider, for example, the signed integer 01000101 This is a positive number equivalent to 69 The signed integer 11000101 is negative, equivalent to À59 To understand the notation we write the two integers as follows: –27 0 1 26 25 24 23 22 21 20 –27 0 1 26 25 24 23 22 21 20 (C.4) The first integer is 01000101 ¼  ðÀ27 Þ þ  26 þ  25 þ  24 þ  23 þ  22 þ  21 þ  20 ¼ þ 64 þ þ þ þ þ þ ¼ 69: The second integer is 11000101 ¼  ðÀ27 Þ þ  26 þ  25 þ  24 þ  23 þ  22 þ  21 þ  20 ¼ À128 þ 64 þ þ þ þ þ þ ¼ À59: Since the sign bit cannot be used as part of the representation of the signed integer, the range of numbers that can be represented is from À128 to þ127, or in general, Appendix C: Computation on Microprocessors from À2n À1 to 2n À1 À1, whereas unsigned numbers range from to 255 or from to 2n À 1, where n is the number of digits in the representation Negative integers are represented using the 2’s complement method as follows: Start with the positive value of the negative number That is, if we need to find the representation of the number ÀA, start with A in binary format Calculate the 1’s complement of A The 1’s complement of a binary integer is found by replacing all zeroes with ones and all ones with zeroes, including the sign bit Add ‘‘1’’ to the 1’s complement to get the 2’s complement For example, suppose we need to write the integer À59 We first write 59 as 00111011 The 1’s complement is 11000100 Adding to this gives 11000101 Note first that this is clearly a negative number Its value is À59, as was seen above In the representation of signed integers we used a ‘‘reserved’’ sign digit, but in the process the range of values that can be represented has been seriously reduced This is particularly problematic with 8-bit integers To alleviate this problem, microprocessors have adopted a slightly different strategy Both signed and unsigned numbers use bits (or 16 bits in 16-bit microprocessors) so that the range of integers is the same for signed and unsigned integers Two extra bits in a different register are used to indicate carry and borrow When a carry bit is set, it is an indication that an add function has overflowed the register, whereas when the borrow bit is set, an underflow occurred, indicating a negative number From the point of view of representation of negative numbers this is the same as using a 9-bit register to represent an 8-bit signed integer C.1.3 Hexadecimal Numbers Binary numbers are particularly useful for computation because the hardware used in microprocessors (and in computers) can represent two states quite easily The main shortcoming of binary representation outside of computers is that the digital numbers are long In programming and display it is more convenient to use higher base numbering schemes that are related to base numbers Two distinct representations that satisfy this requirement are the octal (base 8) and hexadecimal (base 16) numbering schemes In microprocessors, the hexadecimal representation is most commonly used The scheme uses the numbers to plus A (¼ 10), B (¼ 11), C (¼ 12), D (¼ 13), E (¼ 14), and F (¼ 15) In this system, the least significant bit (LSB) is multiplied by 160, the next by 161, then 162, and so on The number 3792 can be written as 3792 ¼ 14  162 þ 13  161 þ  160 : The representation of 3792 in hexadecimal format is therefore ED0 The subtraction method discussed above for binary numbers applies here as well, with the obvious modifications C.2 INTEGER ARITHMETIC Since microprocessors were designed for digital control, they can only manipulate binary integers That means first that integer computation is ‘‘natural’’ in the 745 746 Appendix C: Computation on Microprocessors microprocessor and, second, that computation in any other format must be adapted to the binary integer environment Integer computation is exact, that is, there is no loss of accuracy due to round-off errors, as long as it can be done within the number of bits allocated If, for example, one allocates bits for unsigned integers, the largest value that can be represented is 255 As long as all numbers required for the computation as well as the result are smaller than 255, the result is exact Allocation of, say, 16 bits allows integers from to 216 À ¼ 65,535 If negative numbers must be used as well, such as in performing subtraction, one must use signed integers Since typically the MSB is used for sign indication, a 16-bit signed integer representation will use 15 digits for the integer, allowing representation of integers from À215 to þ215 À 1, or À32,768 to þ32,767 (see, however, Section C.1.2 on how microprocessors handle negative integers) This also shows the main shortcoming of integer computation—its dynamic range is low, that is, the range of numbers it can represent is small For this reason computers use floating point numbers, characterized by a mantissa and an exponent By using a short mantissa and an exponent one can describe any number, although numbers are, in general, truncated, hence floating point calculation is not exact C.2.1 Addition and Subtraction of Binary Integers The basic arithmetic operation in a microprocessor is the addition of two binary integers Almost all other mathematical operations must rely on addition, together with logical operations Notable exceptions are multiplication and division by powers of 2, since that can be done as logic shifting to the left (shifting the bits one location to the left multiplies the number by 2) or to the right (each shift divides the number by 2) Addition is performed as with decimal numbers except that þ produces a carry 1, that is, þ ¼ 10 and þ þ ¼ 11 (i.e., þ þ carry ¼ 11, whereas þ carry ¼ 10) For two 8-bit signed integer digital numbers A ¼ 00110101 and B ¼ 00111011 we have 00110101 þ 00111011 ¼ 01110000 ð53 þ 59 ¼ 112Þ: In this case all three values are less than 255 and no carry is generated But suppose that B ¼ 01111011 (123): 00110101 þ 01111011 ¼ 10110000 ð53 þ 123 ¼ 176Þ: The result has a ‘‘1’’ where the sign bit should be, but because both integers are positive, the result cannot be negative, hence the resulting integer is properly interpreted as 176 Suppose now we wish to subtract B ¼ 01111011 (123) from A ¼ 00110101 (53) First we must write the value ÀB, so we can perform the operation A þ ( ÀB) We write 10000100, the 1’s complement of B 10000100 þ ¼ 10000101, the 2’s complement of B This equals À123 (i.e., À128 þ þ ¼ À123) Now we add the 2’s complement of B and A: 00110101 þ 10000101 ¼ 10111010 ð53 À 123 ¼ À70Þ: Appendix C: Computation on Microprocessors This is clearly a negative number, equal to (À128 þ 32 þ 16 þ þ ¼ À70), as can be verified using the decimal numbers Note that since we perform subtraction, the sign bit cannot be interpreted as a carry, it can only be considered as a sign C.2.2 Multiplication and Division The principle of multiplication and division of binary numbers follows the same principles as the multiplication of decimal numbers The simple long multiplication and long division, as used in hand calculation, can be adapted to binary numbers, and in fact it is much easier to However, the term ‘‘long’’ has a particularly clear meaning in binary multiplication and division Because binary numbers are very long (in comparison with equivalent decimal numbers), the process of long multiplication and division requires a significant number of steps For this reason microprocessors and computers perform these operations either in special hardware or using optimized algorithms that are much more efficient than long multiplication or division However, to see the principles involved we will look here at the process by emulating hand multiplication/division C.2.2.1 Binary Integer Multiplication Multiplication is implemented by a sequence of shifts and adds, operations that not require any special hardware Consider the multiplication of two 8-bit unsigned integers A ¼ 10110011 (179) and B ¼ 11010001 (209) The result is 37,411, or 1001001000100011 In long multiplication this is done as follows: 10110011 11010001 10110011+ 10110011 101111100011+ 10110011 11100010100011+ 10110011 1001001000100011 The calculation above differs from the common long multiplication in that intermediate sums are computed and instead of multiplying by zero, the multiplicand is shifted one position to the left The multiplication process requires that the multiplicand be placed in a variable twice as long as itself (16 bit in this case, to allow shifting) The intermediate results are also placed in a 16-bit integer The multiplier remains unchanged (8 bits) Multiplication is simply a matter of shifting the multiplicand to the left and adding it to the previously calculated intermediate result The algorithm is as follows: Place the multiplicand in a 16-bit register (M register) Zero the intermediate result register (I register) If MSB is ‘‘1’’, add the M and I registers Place result in the I register If MSB is ‘‘0’’, shift the M register bit to the left Set STEP ¼ and scan the multiplier register starting from bit STEP If bit # ¼ STEP is ‘‘0’’, shift the M register bit to the left If bit # ¼ STEP is ‘‘1’’, shift the M register bit to the left and add it to the I register Increment STEP 747 748 Appendix C: Computation on Microprocessors If STEP ¼ 9, go to STOP If not, got to (6) 10 STOP The result is in the I register It should be noted that the result is twice as long as the original integers The algorithm itself requires eight shifts and eight adds and longer word lengths, but requires no other type of operation It is clearly a much slower algorithm than either addition or subtraction As indicated above, this is a ‘‘worst case’’ algorithm and serves to illustrate the process Actual multiplication algorithms are much more sophisticated than this and require considerably fewer operations We have assumed here that the integers are unsigned If they are, the multiplication is done by first changing any negative integers into their positive equivalent, multiplying the integers without the sign bits, and then calculating the sign of the product from the signs of the two multiplicands and the multiplier If the product is negative, it is converted to its negative representation as discussed in Section C.1.2 C.2.2.2 Binary Integer Division Long division of unsigned integers is similar to long division of decimal numbers and results in a quotient and remainder As with multiplication, it is done by a series of right shifts and subtractions (which themselves are done through additions) Consider the division of the dividend A ¼ 11101110 (238) by the divisor B ¼ 00001001 (9) The result expected is 26 (the quotient) with a remainder of since we discuss here integer division (26  þ ¼ 238) It is instructive first to look at the division in Figure C.1a, as it is done by hand First the divisor is aligned with the leftmost bit of the dividend If the divisor is smaller than the number made of digits above it, we subtract the divisor from the (4) digit number above it to obtain a remainder, in this case equal to 101 The MSB of the quotient is set to If this is not to be the case, subtraction is not performed and the MSB stays Next we drop the next digit (fifth digit from the left) of the dividend to the right of the remainder to produce 1011 Now we subtract the divisor from this, producing a remainder equal to 10 and the next digit in the quotient becomes (the quotient now is 11) The sixth digit from the dividend is dropped to the remainder to change it to 101 This is smaller than the divisor As a consequence, the next digit in the quotient is and no subtraction takes place The seventh digit is dropped and the remainder becomes 1011 The divisor is subtracted to produce a remainder equal to 10 and the quotient becomes 1101 The last digit is dropped down to the remainder, making it 100 Since this is smaller than the divisor, the quotient becomes 11010 (26) and the remainder is 100 (4), as expected Now consider Figure C.1b, which produces the same result using 8-bit integers The following algorithm may be used to accomplish this The dividend (DD register) and the divisor (DR register) are each in an 8-bit register Create two additional registers: a quotient (Q register) and a remainder (R register) Zero the Q and R registers Shift the DS register to the left until all leading zeroes clear out and the MSB is ‘‘1’’ Save the number n as the number of shifts that were necessary Subtract the first n digits of the DS register from the first n digits of the DD register If the result is negative, set the nth digit of the Q register to ‘‘0’’ and disregard the subtraction Appendix C: Computation on Microprocessors 11010 11101110 1101 1011 1001 1011 1001 100 (a) 11010 11101110 10010000 01011000 01001000 00010110 00010010 00000100 00001001 00000100 (b) If the subtraction in (4) results in a positive value, place that in the R register and set the nth digit in the Q register to ‘‘1’’ Shift the DR register one position to the right and increment n (n ¼ n þ 1) Set the nth digit in the R register equal to the nth digit in the DD register Subtract the DR register from the R register If the value is negative, set the nth bit in the Q register to Disregard the subtraction If n ¼ 8, go to (10) Otherwise go to (6) If R ÀDR > 0, set the nth bit in the Q register to If n ¼ 8, go to (10) Otherwise go to (6) 10 The quotient is in the Q register and the remainder is in the R register This is a long algorithm that can be implemented in software, but it is an inefficient way of performing division It does exemplify, however, the fact that division can be performed using only shifts and additions, as indicated previously C.3 FIXED POINT ARITHMETIC In some instances one must use fractional numbers For example, one may need to find a ratio of two integers or scale an input voltage to a microprocessor by a noninteger value or add a fixed, offset value to a result In microprocessors this is usually done using fixed point arithmetic, as it requires fewer resources than floating point arithmetic using established routines that are usually available from manufacturers, but from other sources as well At times it may be useful for the user to write his/her own routines for fixed point computation Floating point routines are also available The basic idea of fixed point arithmetic is to treat the integer and fraction parts of a single integer with the radix point placed implicitly at a fixed location within the integer By so doing, one has the ability to represent fractional numbers while still operating only on integers Consider the 8-bit unsigned number shown below with the weights associated with each digit: 1 0 1 27 26 25 24 23 22 21 20 The digital number represents the decimal value 205 We could just as easily say that it represents the value 205.0, but by doing so we placed a decimal point (in general we will call this a radix point) at the end of the number Suppose now we move the decimal point one position to the left We obtain the value 20.5 In decimal format this can be written 749 FIGURE C.1 ¢ (a) Hand process for long division (b) Equivalent long division on a microprocessor using 8-bit integers 750 Appendix C: Computation on Microprocessors as  101 þ  100 þ  10 À1 In effect the number has been divided by 10, or more appropriately, scaled by 10 À1 Similarly, if we place a radix point, say, between the fourth and fifth digits in the binary number 11001101 we obtain 1100.1101 Following the example for the decimal number, the representation becomes 1 0 23 22 21 20 1 2–1 2–2 2–3 2–4 The digital number represents the value 12.8125 and is in fact 205/24 ¼ 205  À4 ¼ 12.8125 For this reason, fixed point numbers are often called scaled integers Note that the digital number itself has not changed but the weights of the digits have been scaled by 10 À4 The problem with this representation is that the integer can only vary between 0000 and 1111 (or and 15), whereas the fraction can vary between 0000 and 1111 (or and 0.9375 with a resolution of 1/16) If we wish to represent signed numbers as fixed point numbers, the integer in the example above is reduced by bit and will only be able to represent numbers between and (000 and 111) Clearly for the method to be useful, a larger number of bits are needed In an 8-bit microprocessor, the natural choice is to use bits for the integer and bits for the fraction, allowing unsigned numbers between and 255.99609575 and signed numbers from À127.99609575 and 127.99609575 Of course, one can use, say, 12 bits for the fraction and bits for the integer or any combination that fits the application at hand However, most routines supplied by manufacturers of microprocessors use (or 16) bits for each part Any other combination might need to be written by the user, usually as a subroutine to be called when needed All operations on fixed point numbers are done as with any integer numbers, with the obvious allowance for the radix point Addition and subtraction is identical to that of signed or unsigned integers For example, the sum of the two unsigned fixed point numbers A ¼ 11010010.11010101 (210.83203125) and B ¼ 01000101.00111101 (69.23828125) is 1101001011010101+ 0100010100111101 (1)0001100000010010 The result is 00011000.00010010 with a carry The result is 24.0703125 and a carry equivalent to 256 The decimal result is 280.073125 ¼ 24.0703125 þ 256 Obviously the result requires nine digits for the integer rather than eight, but the summation is correct The main point to notice is that the two numbers are treated as any two integers and that the radix point does not affect the operations performed to obtain the result Signed fixed point numbers are handled the same as signed integers Multiplication and division of fixed point numbers also follows the same process as for integers, but the radix point must be adjusted For example, multiplication of two 16-bit fixed point numbers, each with bits for the integer and bits for the fraction, results in a 16-bit integer and a 16-bit fraction that must be truncated to a total of 16 bits Assuming the integer can fit in bits, there will be no loss in accuracy or one would have to use a larger number of bits As an example, suppose the product of Appendix C: Computation on Microprocessors A ¼ 00000100.11101110 (4.9296875) and B ¼ 00010010.00111010 (18.2265625) is required The multiplication follows the same rules as decimal multiplication: b ¼ 00010010 Á 00111010 ¼ 18:2265625: 0000010011101110 0001001000111010 0000000000000000+ 0000010011101110 00000100111011100+ 0000010011101110 0000011000101001100+ 0000010011101110 00001000000000101100+ 0000010011101110 0000010001110111101100+ 0000010011101110 0000010101111100111101100+ 0000010011101110 00000000010110011101100111101100 16 bit integer 16 bit fraction 00000000010110011101100111101100 bit integer bit fraction The result is c ¼ 0000000001011001 Á 1101100111101100: The multiplication results in 16 bits for the fraction and 16 bits for the integer The LSB must be removed from the fraction and the MSB removed from the integer since only bits are available for each representation even though the internal multiplication is handled with 16 bits for each part Therefore the result is c ¼ 01011001 Á 11011001 ¼ 89:84765625: Because of the truncation of the fraction this is not exact: the correct result should be 89.8512573242 (the error is about 0.8%) Note that truncation of the fraction results in a loss of accuracy but the truncation of the integer does not, as long as the product can fit in bits If it does not then the result is wrong, since the MSB will be truncated 751 [...]... must understand in xv xvi Preface with Publisher’s Acknowledgements sufficient detail the principles involved, the materials used, and the construction of sensors and actuators The textbook is sufficiently detailed to allow reasonable understanding of principles To bridge the divide between the theory of sensors and actuators and their application and to gain insight into design of sensing and actuation,... of forces and the related quantities of strain and stress But it is also used in accelerometers, load cells, and pressure sensors Accelerometers, force sensors, pressure sensors, and inertial sensors take the bulk of the chapter Mechanical actuators are exemplified by the bourdon tube, bellows, and vacuum motors Chapter 7 discusses acoustic sensors and actuators By acoustic, we mean sensors and actuators... However, the importance of these sensors and actuators justifies their introduction and the deviation in the usual method of presentation Some of the methods of production are first given, followed by a number of common classes of sensors and actuators including inertial and electrostatic sensors and actuators, optical switches, valves, and others In the context of smart sensors, we emphasize issues associated... text is to look at sensors and actuators based on the broad area of detection or actuation This has the advantage that in a particular class of sensors, only one or a few related physical principles are used, simplifying understanding of the theory behind sensing and actuation Thus we will discuss temperature sensors, optical sensors, magnetic sensors, chemical sensors, and so on Each of these classes... photoconducting effect and then through silicon-based sensors that include photodiodes, transistors, and photovoltaic sensors Photoelectric cells, photomultipliers, and CCD sensors are a second important class, followed by thermal-based optical sensors that include thermopiles, infrared sensors, pyroelectric sensors, and bolometers Although one seldom thinks of optical actuators, these do exist, and they conclude... address electric and magnetic sensors and actuators Naturally, a large number of devices fall into this class, and, as a consequence, the chapter is rather extensive It starts with electric and capacitive devices, followed by magnetic devices We discuss here a variety of sensors and actuators including position, proximity, and displacement sensors, as well as magnetometers, velocity, and flow sensors... 10.3.2.1 Thermal and Piezoelectric Actuation 10.3.2.2 Electrostatic Actuation 526 10.3.3 Some Applications 10.3.3.1 10.3.3.2 10.3.3.3 10.3.3.4 10.3.3.5 10.4 10.4.1 529 Optical Switches 529 Mirrors and Mirror Arrays Pumps 530 Valves 531 Others 533 Smart Sensors and Actuators 524 529 533 Wireless Sensors and Actuators and Issues Associated with Their Use 538 10.4.1.1 The ISM and SRD Bands 538 10.4.1.2... all interfacing issues in sensors and actuators are electrical in nature This means that to understand and use these devices, and certainly to interface them and integrate them into a system, requires elements of electrical engineering Conversely, the sensed quantities pertain to all aspects of engineering, and electrical engineers will find that mechanical, biological, and chemical engineering issues... circuits and data transmission methods A section on excitation circuits deals with linear and switching power supplies, current and voltage references, and oscillators The chapter ends with a discussion on noise and interference Chapter 12 introduces the microprocessor and its role in interfacing sensors and actuators Although the emphasis is on 8-bit microprocessors, the issues addressed are general and. .. hearing to locate sounds Still others, such as sharks and fish (as well rays and the platypus), sense variations in electric fields for location and hunting Birds and some other animals can detect magnetic fields and use these for orientation and navigation Pressure is one of the main mechanisms fish use to detect motion and prey in the water, and vibration sensing is critical to a spider’s ability