Chapter 8 Annotated PDF - EE429 Mechatronics Fall 2024
Document Details
Uploaded by UnselfishNoseFlute7805
King Faisal University
2024
King Faisal University
Dr. Mohammed Morsy Farag
Tags
Related
- Certified Cybersecurity Technician Computer Forensics Exam 212-82 PDF
- Data Acquisition Methodology PDF
- Certified Cybersecurity Technician Exam 212-82 Data Sanitization PDF
- Chapter 20 - Data Acquisition PDF
- Certified Cybersecurity Technician Computer Forensics PDF Exam 212-82
- Introduction to Data Acquisition Practice Quiz PDF
Summary
This document is an annotated chapter 8 from a King Faisal University EE429 Mechatronics course for the Fall 2024 semester. The chapter details data acquisition, outlines concepts, data acquisition in mechatronic systems, data acquisition definition, and architectures. It includes information about signals, analog/digital conversion, sampling theory, and related concepts.
Full Transcript
Electrical Engineering Department ELECTRICAL ENGINEERING DEPARTMENT EE429: MECHATRONICS FALL 2024 CHAPTER 8 DAT...
Electrical Engineering Department ELECTRICAL ENGINEERING DEPARTMENT EE429: MECHATRONICS FALL 2024 CHAPTER 8 DATA ACQUISITION Dr. Mohammed Morsy Farag [email protected] [email protected] EE429: Mechatronics Dr. Mohammed Farag Fall 2024 1 Electrical Engineering Department Outline Understand how to properly sample a signal for digital processing Understand how digitized data are coded Know the components of an A/D converter Understand how A/D and D/A converter functions, and recognize their limitations Be aware of commercially available hardware and software tools for data acquisition and control Understand the basics of LabVIEW programming and data acquisition Understand the effects of sampling rate and resolution on music sampling EE429: Mechatronics Dr. Mohammed Farag Fall 2024 2 Electrical Engineering Department Data Acquisition in Mechatronic Systems Microprocessors, microcontrollers, single-board computers, & personal computers are ubiquitous in mechatronics. ❑Engineers should understand direct access to environmental data using these devices. Analog Signal Processing ❑Record with analog devices (e.g., chart recorder) ❑Display with oscilloscopes ❑Store digitally via computer/microprocessor for: Analog to Digital Conversion ❑Transform analog signals into coded digital values. ❑First step: Sampling – numerically evaluate the signal at discrete instants in time. Digitized Signal: ❑Sequence of numbers approximating an analog signal ❑Sampled data points form a data array (sequence of numbers) EE429: Mechatronics Dr. Mohammed Farag Fall 2024 3 Electrical Engineering Department Data Acquisition Definition The process of measuring and storing or transmitting analog signals from sources such as physical systems, control systems, mechatronic systems, network control systems, telemetry, remote sensing, etc using the digital computer , is known as computer data acquisition. Computer data acquisition involves the following steps (1) Sensing or measurement (2) Analog to digital conversion EE429: Mechatronics Dr. Mohammed Farag Fall 2024 4 Electrical Engineering Department Architecture of a measurement system Measurement Device Software Measurand Sensor Signal Conditioning Driver Analog-to-Digital Converter Application L Voltage Current Charge Texas instruments … Bosch PLC Visual C++/Basic Arduino etc. Arduino Labview Conversion to another, typically electric National Instruments Matlab physical quantity Measurement Computing … Data Translation etc. EE429: Mechatronics Dr. Mohammed Farag Fall 2024 5 Electrical Engineering Department Signals Come in Two Forms: Digital and Analog EE429: Mechatronics Dr. Mohammed Farag Fall 2024 6 Electrical Engineering Department Signals Analog Voltage Current Digital ❑Standard ranges o Standard ranges o 0 or 1 ◼0…10V o 0 or 5 V 0…20mA o 0 or 3.3 V ◼0…5V 4…20mA o Easy to process further ◼1…5V o Better immunity to o The best immunity to ◼-5…+5V disturbance disturbance ◼-10…+10V o “Computer proof” ❑Easy and cheap, susceptible to disturbance EE429: Mechatronics Dr. Mohammed Farag Fall 2024 7 Electrical Engineering Department Sampling Theory & Aliasing Sampling Rate: ❑Not "as fast as possible" ❑Minimal required rate for given application ❑Shannon's sampling theorem: 𝑓𝑠 > 2 𝑓𝑚𝑎𝑥 (Nyquist rate) Aliasing: ❑Sampling at 𝑓𝑠 < 2 𝑓𝑚𝑎𝑥 causes errors & creates false information ("phantoms") ◼Example: sine wave freq = 𝑓0 ◼Original ◼Sampled freq = 1.2 𝑓0 (undersampled) ◼Apparent sampled freq =.2 𝑓0 EE429: Mechatronics Dr. Mohammed Farag Fall 2024 8 Electrical Engineering Department EE429: Mechatronics Dr. Mohammed Farag Fall 2024 9 Electrical Engineering Department 8.1 Sampling Definition: The process of representing an analog signal by samples of its S(t) values at discrete points in time, is referred to as sampling. Sampling is usually done at equally spaced intervals or a constant rate given by 1 𝑓𝑠 = 𝑇𝑠 Where Ts is the sampling period given by t0 t1 t2 t3 tN-2 tN-1tN t Ts= 𝑡1 - 𝑡0 =…=𝑡𝑖 - 𝑡𝑖−1 =…….=𝑡𝑁 - 𝑡𝑁−1 EE429: Mechatronics Dr. Mohammed Farag Fall 2024 10 Electrical Engineering Department Sampling The collection of samples of values of the above signal s(t) denoted by 𝑆 = 𝑠 𝑡0 , 𝑠 𝑡1 , 𝑠 𝑡2 … … … 𝑠 𝑡𝑁 is an approximation of the continuous-time (analog signal) s(t), and the process of obtaining S is known as sampling Question: Under what conditions can we recover or reconstruct s(t) from S perfectly? EE429: Mechatronics Dr. Mohammed Farag Fall 2024 11 Electrical Engineering Department Sampling The answer to the above question is provided by the sampling theorem. Shannon’s Sampling Theorem (Nyquist Sampling Theorem) In order to recover or reconstruct s(t) from S perfectly, the signal must be sampled at a rate give by 𝑓𝑠 ≥ 2 𝑓𝑚𝑎𝑥 where 𝑓𝑚𝑎𝑥 is the maximum frequency in the signal, or simply the bandwidth of the signal. Moreover, the frequency 𝑓𝑁𝑦𝑞 = 2 𝑓𝑚𝑎𝑥 is known as the Nyquist sampling rate, and is the minimum sampling frequency at which the sampled signal can be perfectly reconstructed. EE429: Mechatronics Dr. Mohammed Farag Fall 2024 12 Electrical Engineering Department Sampling The consequence of sampling at less than the Nyquist rate, i.e., 𝑓𝑠 < 2 𝑓𝑚𝑎𝑥 is a distortion of the reconstructed signal that is known as aliasing. This is depicted as shown in the figure below. Original signal s(t) Reconstructed aliased signal 𝑠ෛ (𝑡) t EE429: Mechatronics Dr. Mohammed Farag Fall 2024 13 Electrical Engineering Department Example 1 Example 2 For the signal An audio signal s(t) is sampled at 10 s 𝑡 =5cos200π𝑡 + 2𝑠𝑖𝑛500𝑡 kHz and then transmitted to a remote location to a receiver. It is Calculate the Nyquist rate. What is discovered that the received signal the sampling period? has some distortion. What should be the maximum bandwidth (BW) of the signal audio signal s(t) in order to avoid the distortion? EE429: Mechatronics Dr. Mohammed Farag Fall 2024 14 Electrical Engineering Department Analog to Digital Conversion As a first step in A/D conversion qN-1 qN-2 is the process of quantization. qN-3 S(nTs) This is defined as the process of approximating a discrete signal Smax value to one of a set of distinct Q preassigned values (or quantum levels) suitable for binary or t=nTs digital representation. q3 Smin q2 q1 q0 N-quantum levels EE429: Mechatronics Dr. Mohammed Farag Fall 2024 15 Electrical Engineering Department EE429: Mechatronics Dr. Mohammed Farag Fall 2024 16 Electrical Engineering Department Analog to Digital Selection criteria: 8bit → 2^8 = 256 Number of bits 16bit → 2^16 = 65536 Resolution, quantization noise 22bit → 2^22 = 4194304 Sampling frequency Dictates the highest measurable frequency Input range 0…1V, ±5V, … Number of channels Multichannel Sample and Hold / Multiplexer EE429: Mechatronics Dr. Mohammed Farag Fall 17 Electrical Engineering Department Resolution 7 1Hz sine wave: 10S/sec, 3bit 6 3bit → 23 = 8 5 4 3 2 1 0 0 0,1 0,2 0,3 0,4 0,5 0,6 0,7 0,8 0,9 1,0 EE429: Mechatronics Dr. Mohammed Farag TimeFall (s) 18 Electrical Engineering Department Range 7 1Hz sine wave: 10S/sec, 3bit 6 3bit → 23 = 8 5 4 3 2 1 0 0 0,1 0,2 0,3 0,4 0,5 0,6 0,7 0,8 0,9 1,0 Time (s) EE429: Mechatronics Dr. Mohammed Farag Fall 19 Electrical Engineering Department Quantization The quantized values of the signal are Quantization given by qN-1 qN-2 s(iTs) 𝑠𝑖 = 𝑞𝑖−1 if 𝑞𝑖−1 ≤s(iTs)≝si < 𝑞𝑖 qN-3 Smax In this case, the maximum quantization error is given by Q 𝓔𝑄 =Q Each quantum level is then assigned a binary code as : q3 Smin q2 t=iTs 𝑞𝑖 ~ 𝐵𝑖 q1 q0 N-quantum levels EE429: Mechatronics Dr. Mohammed Farag Fall 2024 20 Electrical Engineering Department Quantization Q1: if we want to represent each quantum level 𝑞𝑖 by n binary bits, what should be the relation between “n” and “N” ? Answer: 𝑁 = 2𝑛 Q2: What should be the quantization step-size? Answer: 𝑺 −𝑺 𝑺 −𝑺 𝑸 = 𝒎𝒂𝒙 𝒎𝒊𝒏 = 𝒎𝒂𝒙 𝒏 𝒎𝒊𝒏 𝑵 𝟐 Definition: The resolution of an A/D conveter is the number “n” of binary bits that is used to represent each sample value of the input 𝑆𝑖 EE429: Mechatronics Dr. Mohammed Farag Fall 2024 21 Electrical Engineering Department Example 1 Example 2 The signal The voltage signal s 𝑡 =10sin1000π𝑡 (volts) s 𝑡 =5cos200π𝑡 (volts) is converted to digital using 8bits and is to be converted to digital and transmitted to a remote receiver. (i) For a transmitted using 4bits. (i) What should digital output of B=10001001, what is the be the quantization step-size Q ? (ii) corresponding analog value? (ii) If 6bits are What digital value will be assigned a used instead, what is the maximum error in sample value of 𝑆𝑖 =4 volts? volts that can be incurred in approximating the above digital value? EE429: Mechatronics Dr. Mohammed Farag Fall 2024 22 Electrical Engineering Department EE429: Mechatronics Dr. Mohammed Farag Fall 2024 23 Electrical Engineering Department 8.4 ANALOG-TO-DIGITAL CONVERSION Components: ❑BufferAmplifier ❑Low-Pass Filter (Antialiasing) ❑Sample and Hold Amplifier ❑Analog-to-Digital Converter (ADC) ❑Computer/Processing Unit Functionality: ❑Buffer Amplifier ◼Isolatesoutput from input, draws negligible current/power. ◼Provides signal with gain close to full ADC range. ❑Low-Pass Filter (Antialiasing) ◼Removes high-frequency components preventing aliasing. ◼Cutoff frequency ≤ 1/2 sampling rate. ❑Sample and Hold Amplifier ◼Maintains fixed input value during short ADC conversion time. EE429: Mechatronics Dr. Mohammed Farag Fall 2024 24 Electrical Engineering Department Conditioning Signals Signal conditioning improves a signal that is difficult for your DAQ device to measure Signal conditioning is not always required Noisy, Low-Level Signal Filtered, Amplified Signal EE429: Mechatronics Dr. Mohammed Farag Fall 25 Electrical Engineering Department Amplification Used on low-level signals Maximizes use of analog-to-digital converter (ADC) range and increases accuracy Increases signal-to-noise ratio (SNR) EE429: Mechatronics Dr. Mohammed Farag Fall 26 Electrical Engineering Department Attenuation Decreases the input signal amplitude to fit within the range of the DAQ device Necessary when input signal voltages are beyond the range of the DAQ device EE429: Mechatronics Dr. Mohammed Farag Fall 27 Electrical Engineering Department Filtering Filters remove unwanted noise from a measured signal and block unwanted frequencies Time domain Frequency domain EE429: Mechatronics Dr. Mohammed Farag Fall 28 Electrical Engineering Department Low-pass filter http://www.electronics-tutorials.ws/filter/filter_2.html Passband = low frequencies Stopband = high frequencies Cutoff frequency - Amplitude -3 dB i.e. gain ~0.7 Example: RC filter - 1st order low pass filter - Simple to implement, not very effective - 1 resistor, 1 capacitor EE429: Mechatronics Dr. Mohammed Farag Fall 29 Electrical Engineering Department EE429: Mechatronics Dr. Mohammed Farag Fall 2024 30 Electrical Engineering Department 8.4.2 Successive Approximation A/D Converter One practical A/D converter is the successive approximation converter that can be described by the block diagram: start control unit end signal signal analog S&H successive input comparator approximation digital register latch output D/A EE429: Mechatronics Dr. Mohammed Farag Fall 2024 31 Electrical Engineering Department Successive Approximation A/D It is widely used because it is relatively cheap and fast. When the start signal is received, the sample and hold (S&H) amplifier latches the analog input. Then the control unit begins an iterative process, where the digital value is approximated, converted to analog value with the D/A converter, and compared to the analog input with the comparator. When the D/A output equals the analog input, the end signal is set by the control unit, and the correct digital output is latched at the output. The successive approximation converter has embedded in it a D/A converter. This is not a disadvantage, since the D/A converter is very simple and relatively cheap to produce. EE429: Mechatronics Dr. Mohammed Farag Fall 2024 32 Electrical Engineering Department EE429: Mechatronics Dr. Mohammed Farag Fall 2024 33 Electrical Engineering Department Successive Approximation A/D The iterative process in the A/D converter can be explained by the above Iterative successive approximation diagram with a 4bit converter. 1 1 1 1 FS FS FS FS 2 8 16 The most significant bit (MSB), 𝑏3 , has 4 the highest weight in the conversion process, and is set to 𝑏3 =1, while the other bits are set to 0, i.e., 𝑏2 = 𝑏1 = 𝑏0 =0. 𝑠𝑖 𝑣𝑖 FS The corresponding analog approximation error 𝓔𝑖 =𝑠𝑖 -𝑣𝑖 is then calculated. If the error is 𝑏3 =1 𝑏2 =0 𝑏1 =0 𝑏0 =0 negative, then, 𝑏3 is set to 0, i.e., 𝑏3 =0 and 𝑏2 is set to 𝑏2 =1, while 𝑏1 = 𝑏0 =0. EE429: Mechatronics Dr. Mohammed Farag Fall 2024 34 Electrical Engineering Department Successive Approximation A/D On the other hand, if the error is Iterative successive approximation positive, then, 𝑏3 is kept at 1, i.e., 𝑏3 =1 1 1 1 1 FS FS FS FS and 𝑏2 is set to 𝑏2 =1, while 𝑏1 = 𝑏0 =0 2 4 8 16 as shown in Fig.8.10(b). This process 𝑣𝑖2 is repeated until 𝓔𝑖 is approximately zero. The conversion process is then 𝑠𝑖 𝑣𝑖1 completed. FS 𝑏3 =1 𝑏2 =1 𝑏1 =0 𝑏0 =0 EE429: Mechatronics Dr. Mohammed Farag Fall 2024 35 Electrical Engineering Department Example 1 Example 2 The signal The output of a 5bit successive 𝑠 𝑡 = 5𝑠𝑖𝑛200π𝑡 approximation A/D is B=10110. If the full- is to be converted to digital using 4bits, and scale of the converter is 10V, calculate a successive approximation A/D converter. the corresponding input sample 𝑠𝑖 volts, For an input sample 𝑠𝑖 =4 volts, what is the to this output. output of the A/D? EE429: Mechatronics Dr. Mohammed Farag Fall 2024 36 Electrical Engineering Department Flash Analog-to-Digital Converter Fastest Type: ❑ Parallelcomparison & identification ❑ Easily converted to binary output with combinational logic Adding Resolution: ❑ Increase resistors, comparators & latches ❑ Modify combinational logic code converter ❑ No increase in conversion time compared to successive approximation converters Multiplexing Analog Signals: ❑ Switch among multiple inputs using transistors/ relays and control signals ❑ Reduces system cost Selecting an A/D Converter: ❑ Considerinput voltage range, output resolution & conversion time EE429: Mechatronics Dr. Mohammed Farag Fall 2024 37 Electrical Engineering Department 8.5 Digital-to-Analog (D/A) Conversion This is reverse process of A/D conversion, whereby a digital signal (or single digital value) is converted to analog on a certain scale. The simplest type of D/A converter is the resistor ladder-network converter shown in the figure below. R R R 2R 𝑉𝑠 2R 2R 2R 2R R MSB 𝑏3 𝑏2 𝑏1 LS 𝑏0 B 𝑉𝑜 Fig. 8.15: 4bit R-2R Resistor Ladder Network D/A Converter EE429: Mechatronics Dr. Mohammed Farag Fall 2024 38 Electrical Engineering Department EE429: Mechatronics Dr. Mohammed Farag Fall 2024 39 Electrical Engineering Department R-2R Resistor Network (D/A) Converter It is essentially a summing amplifier in the inverting configuration. The binary input is applied through the switches 𝑏3 𝑏2 𝑏1 𝑏0. Then, the voltage from the source 𝑉𝑠 =FS is divided, using the ladder network, in the ratio of 1 11 1 : : : 2 4 8 16 among the bits 𝑏3 𝑏2 𝑏1 𝑏0 respectively, depending on the value of each bit, and then summed up by the amplifier to obtain the analog output voltage 1 1 1 1 𝑉𝑜 = - 𝑏 + 𝑏2 + 𝑏1 + 𝑏 𝑉𝑠 2 3 4 8 16 0 EE429: Mechatronics Dr. Mohammed Farag Fall 2024 40 Electrical Engineering Department Example 1 Example 2 A 4bit D/A converter uses 𝑉𝑠 =-5v. An 3bit D/A converter with source What is the output for the following voltage 𝑉𝑠 =-5v has output 𝑉𝑜 =3v. inputs: What is the corresponding binary (i) B=1001 (ii) B=1101 (iii) B=1111? input to the D/A? Chapter 8 Worksheet: Problems 8.4, 8.7, 8.10, 8.11, 8.14 From Textbook EE429: Mechatronics Dr. Mohammed Farag Fall 2024 41 Electrical Engineering Department EE429: Mechatronics Dr. Mohammed Farag Fall 2024 42 Electrical Engineering Department ADC & DAC on PIC16F877A Digital To Analog Converter (DAC) & Waveform Generation With MCU (deepbluembedded.com) Analog To Digital Converter | How ADC Works With PIC MCU (deepbluembedded.com) EE429: Mechatronics Dr. Mohammed Farag Fall 2024 43