Interfacing to Analog World Sensor Interfacing • Introduction to Analog to digital Conversion • Why Analog to Digital? • Basics of A/D Conversion. • A/D converter inside PIC16F887 • Related Problems Prepared By- Mohammed Abdul Kader Assistant Professor, EEE, IIUC Introduction to Analog to digital Conversion Signals in the real world are analog: light, sound, temperature, pressure, acceleration or other phenomenon. So, real-world signals must be converted into digital, using a circuit called ADC (Analog-to-Digital Converter), before they can be manipulated by digital equipment. When you scan a picture with a scanner what the scanner is doing is an analog-to-digital conversion: it is taking the analog information provided by the picture (light) and converting into digital. When you record your voice on your computer, you are using an analog-to-digital converter to convert your voice, which is analog, into digital information. When an audio CD is recorded at a studio, once again analog-to-digital is taking place, converting sounds into digital numbers that will be stored on the disc. Whenever we need the analog signal back, the opposite conversion – digital-to-analog, which is done by a circuit called DAC, Digital-to-Analog Converter – is needed. When you play an audio CD, what the CD player is doing is reading digital information stored on the disc and converting it back to analog so you can hear the audio. 2 Lecture Materials on "Interfacing to Analog World", By- Mohammed Abdul Kader, Assistant Professor, EEE, IIUC Why Analog to Digital? 1. Reducing Noise: Since analog signals can assume any value, noise is interpreted as being part of the original signal. Digital systems, on the other hand, can only understand two numbers, zero and one. Anything different from this is discarded. Noise is added with Signal Information is unchanged 3 Lecture Materials on "Interfacing to Analog World", By- Mohammed Abdul Kader, Assistant Professor, EEE, IIUC Why Analog to Digital? (Continued) 2. Signal Processing: The most strong tool of processing or analyzing signal is microprocessor. Microprocessor is a digital device. It can understand only digital signal. So, we should convert the analog physical parameters into digital to process it by microprocessor. 3. Data compression capability: Another advantage of digital system against analog is the data compression capability. Since the digital counterpart of an analog signal is just a bunch of numbers, these numbers can be compressed, just like you would compress a Word file using WinZip to shrink down the file size, for example. The compression can be done to save storage space or bandwidth. 4 Lecture Materials on "Interfacing to Analog World", By- Mohammed Abdul Kader, Assistant Professor, EEE, IIUC ADC (A/D Converter) in Embedded System The main use of ADC in embedded system is to measure the voltage outputs of sensors. Most electronic sensors produce a voltage that corresponds to temperature, pressure, acceleration or other phenomenon. Music, speech, or other signals can be converted to digital form by A/D converters for storage or additional processing. Gives a decision (output) according to user instruction Physical parameter Sensor A/D Converter Microprocessor Converts physical parameter to Converts analog voltage to Analyze or process the corresponding analog voltage digital voltage physical parameter 5 Lecture Materials on "Interfacing to Analog World", By- Mohammed Abdul Kader, Assistant Professor, EEE, IIUC Related terms of A/D conversion Resolution: The resolution of an A/D converter is specified by number of bits and determines how many distinct output levels or codes (2^N) the converter is capable of producing. For example, an 8-bit A/D converter produces 2^8, or 256, output codes or levels. Mathematically the resolution for an A/D converter is Here, Reference means the conversion range and N is the no of bit in digital output. In other Words, Resolution is the smallest change or steps in the analog voltage for which output digital voltage (codes) remain unchanged. For an 3 bit A/D converter with conversion range (0-5V): Resolution= 5/2^3 = 5/ 8= 0.625 V For an 8 bit A/D converter with conversion range (0-5V): Resolution= 5/2^8 = 5/ 256 = 0.0196 V For an 10 bit A/D converter with conversion range 0-5V: Resolution = 5/2^10 = 5/1024 = 0.00488 V 6 Lecture Materials on "Interfacing to Analog World", By- Mohammed Abdul Kader, Assistant Professor, EEE, IIUC Related terms of A/D conversion (Cont.) Resolution of an 2-bit A/D converter is 1.25V Resolution of an 10-bit A/D converter is 0.00488V Another definition ,The resolution of the A/D converter is the voltage change that will result in the returned value (output digital value) changing by 1. This means that with an 3 bit A/D the returned value will change by 1 when the voltage changes by about 1.25V. With a 10 bit A/D, a change of only 4.88 mV will change the count by 1. 7 Lecture Materials on "Interfacing to Analog World", By- Mohammed Abdul Kader, Assistant Professor, EEE, IIUC Related terms of A/D conversion (Cont.) Clearly an A/D converter with more bits will give better accuracy. But, for a higher bit A/D converter you need more storage memory to store the result and at the same time A/D converter circuit become more complex and conversion time will increase. Problem 1: A weight sensor changes its output voltage 0.1 mV for 1gm change in input and it’s output varies from 0-5V. What should be the resolution and no of bits in the A/D converter if you want to get the weight in gram. The resolution should be 0.1mV = 0.0001 V 8 Lecture Materials on "Interfacing to Analog World", By- Mohammed Abdul Kader, Assistant Professor, EEE, IIUC Related terms of A/D conversion (Cont.) Quantization Error : If an AC signal is applied to an ideal A/D converter, noise present in the digitized output due to quantization error. If the input to the quantizer is moved through its full range and subtracted from the discrete output levels the error signal will be a sawtooth waveform with a peak-to-peak value Q as shown in figure (b). The quantization error is dependent on the number of quantization level (discrete levels). The quantization levels are an index of the resolution. The output of a quantizer can be considered as a noise signal with an rms value of Which is the quantization error. Fig. (b) Fig. (a) 9 Lecture Materials on "Interfacing to Analog World", By- Mohammed Abdul Kader, Assistant Professor, EEE, IIUC Related terms of A/D conversion (Cont.) Sampling: An analog signal is continuous and it has infinite number of samples. It is not possible to take the sample of analog signal at every instant of time. What the ADC circuit does is to take samples from the analog signal in a regular time interval. Each sample will be converted into a number, based on its voltage level. The frequency on which the sampling will occur is called sampling rate. If a sampling rate of 22,050 Hz is used, for example, this means that in one second 22,050 points will be sampled. Thus, the distance of each sampling point will be of 1 /22,050 second (45.35 µs, in this case). If a sampling rate of 44,100 Hz is used, it means that 44,100 points will be captured per second. In this case the distance of each point will be of 1 /44,100 second or 22.675 µs. And so on. 10 Lecture Materials on "Interfacing to Analog World", By- Mohammed Abdul Kader, Assistant Professor, EEE, IIUC Basic of A/D Conversion Sampling Rate= 10 samples/Sec 3-bit A/D converter So, to store the signal of length 1.1 s we need bit A/D converter with sampling rate samples/sec 10 of rate with sampling converter A/D bit - 3 (10*1.1*3) = 33 bit memory. 11 Lecture Materials on "Interfacing to Analog World", By- Mohammed Abdul Kader, Assistant Professor, EEE, IIUC Basic of A/D Conversion Sampling Rate= 20 samples/Sec 4-bit A/D converter bit A/D converter with sampling rate samples/sec 20 of rate with sampling converter A/D bit So, to store the signal of length 1.1 s we need - 4 (20*1.1*4) = 88 bit memory. = 11 Byte 12 Lecture Materials on "Interfacing to Analog World", By- Mohammed Abdul Kader, Assistant Professor, EEE, IIUC Basic of A/D Conversion: Performance analysis of two A/D converters of 20 samples/sec 20 of rate samples/sec 10 of rate bit A/D converter with sampling with sampling converter A/D bit - 3 bit A/D converter with sampling rate rate with sampling converter A/D bit - 4 4-bit A/D converter with sampling rate 20 sample/sec is better than 3-bit A/D converter with sampling rate 10 sample/sec because converter output of 2nd one is more closer to original signal. But, 2nd one need 88-bit memory to store the signal where 1st one need only 33-bit memory. 13 Lecture Materials on "Interfacing to Analog World", By- Mohammed Abdul Kader, Assistant Professor, EEE, IIUC Basic of A/D Conversion: Minimum Sampling Rate (Nyquist Rate) So, we have this dilemma: if the sampling rate is too high, the output quality will be close to perfection, but you will need a lot of storage space to hold the generated data (i.e., the generated file will be very big); if the sampling rate is too low, the output quality will be bad.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages31 Page
-
File Size-