0% found this document useful (0 votes)
72 views

Laboratory 1 - Basics of A To D Conversion: Objective

This document provides instructions for Lab 1 of the MAE 334 course on instrumentation and computers. The objectives are to become familiar with analog to digital conversion using a data acquisition system and virtual oscilloscope software. Students will explore limitations of A/D conversion related to aliasing and quantization. They will sample analog waveforms from a function generator using different sampling rates and observe aliasing of frequencies. Students will also generate a low frequency signal and observe quantization levels in the digitized output.
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
72 views

Laboratory 1 - Basics of A To D Conversion: Objective

This document provides instructions for Lab 1 of the MAE 334 course on instrumentation and computers. The objectives are to become familiar with analog to digital conversion using a data acquisition system and virtual oscilloscope software. Students will explore limitations of A/D conversion related to aliasing and quantization. They will sample analog waveforms from a function generator using different sampling rates and observe aliasing of frequencies. Students will also generate a low frequency signal and observe quantization levels in the digitized output.
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

MAE 334

Department of Mechanical and Aerospace Engineering MAE 334 - Introduction to Instrumentation and Computers

Lab 1

Laboratory 1 - Basics of A to D Conversion


Objective
To become familiar with the process and capability of data acquisition by analog to digital conversion and to explore the limitations of A to D conversion. The Virtual Oscilloscope from LabViews Virtual Bench will be the software used in this experiment. This package will be used frequently through out the semester. The LabView software is a National Instruments product and it is used in our laboratory with a National Instruments data acquisition card.

Background
Data acquisition by analog to digital conversion has become the most common way (by far) to record and process laboratory measurements. In this experiment we will use a function generator to produce time varying voltages which simulate the voltages produced by transducers taking measurements during experiments or as part of the normal operation of modern machines. The experiment is divided into three parts the first will familiarize you with the process of performing data acquisition with the Virtual Scope. The second will consider aliasing which refers to the time domain limitations of the sampling process inherent in A to D conversion. Finally, we will look carefully at the issue of quantization. This is related to precision limitations in the A to D conversion of voltage measurements.
Figure 1. Setup Photo for Lab 1

Page 1 of 10

MAE 334

Lab 1

Getting Started
If the PC is powered off: Turn on the PC. You may find it necessary to do a complete login. If so, enter labuser as the user name in the Windows dialog box and enter sunlabnt as the password. Following this, a logon program will run that will map your Engineering UNIX home directory based on your Engineering UNIX username and password. When the logon window appears, type your Engineering UNIX username and password when prompted. After the post logon message box appears, click OK. You will find that your Engineering UNIX home directory has been mapped as drive N: you may want to save your data here at the end of a lab session. You can use the My Documents folder on the PC during your lab (create your own subfolder). But dont plan on this being a permanent storage space for you from lab to lab. USB flash disks are ideal to carry your data home or to other computers. Always make sure you have backed up your data files. Dont forget to LOGOFF when you have finished your lab session.

Part 1 Basic Operation of the A to D Process


1. From the desktop icon, click on the LabView Virtual Bench program:

2. When the Virtual Bench tool bar buttons appear, select the Virtual Scope (the left most button).

Figure 2. Virtual Bench Instrument Selection Window

3. When the Virtual Scope window appears, resize the Scope window to properly position the graphic display and adjust the size or maximize as desired, similar to Figure 3. Click on Edit and then General Settings to display the dialog window of Figure 4. Set up the Virtual Bench Scope (as shown) to have the lowest buffer size possible (500 pts). Doing this will cause any single run of the Virtual Bench Scope to plot and record 500 data points.

Page 2 of 10

MAE 334 .

Lab 1

Figure 3. The Standard Display for the Virtual Bench Oscilloscope

Figure 4. Virtual Bench Edit - General Settings dialog window. This is used to set the number of samples to be acquired. You can expect the Device name to be different on the current lab systems.

Page 3 of 10

MAE 334

Lab 1

4. Set the oscilloscope time display and sampling speed by adjusting the time base (center knob to the right of the graph) to one second per division (1 Sec/div). Look to the upper left just above the plot to verify your setting. It should show: 1 Sec/div, 50 S/s This indicates that the scope is sampling at 50 samples per second (or, the sampling frequency is 50 samples/second). Time, of course, is displayed on the horizontal axis. 5. Next, set the oscilloscope voltage sensitivity (the vertical axis) to one volt per division (1V/div) by adjusting the knob on the upper right. Since the full scale range of the ADC (analog to digital converter) is +/- 10 V, setting the volts/division to 1 will display about half of the full range of the ADC. 6. Verify that the other Oscilloscope settings are as pictured above in Figure 3. Only Ch 1 is enabled, the Measure is set to Ch 1, the Trigger Mode: Auto, Ch 1. 7. The function generator can be used to produce sinusoidal waveforms of variable frequency and amplitude. Start with a signal frequency of 1 HZ and amplitude of slightly less than +/-3 V (that is 6 volts or 6 vertical divisions from minimum peak to maximum peak). Check that the 0 dB/-30 dB push button is in, the FREQUENCY knob is at 1 and the RANGE Hz X1 button is selected.

Figure 5. Simpson function generator used in the lab.

8. Become familiar with the arrangement. Increase/decrease the function frequency. Adjust the voltage up and down. Try square waves and triangle waves. Try a 5 volt/division scope setting. Adjust your wave magnitude to exceed +/- 10 volts. Activate the 0/-30 db push button. Use the scopes zoom in/zoom out buttons on the lower right enhance the horizontal resolution of the plot. to

9. Return to the nominal condition described items 5, 6 and 7 above. We now want to save a single data record. While the scope is running, click the Single button, , to store a single data record of the waveform of 500 points. To save this data record to a file, click on File and then Save Waveforms on the drop down menu. You will obtain the dialog window shown in Figure 6. The User Name and Comments fields will appear at the beginning of the saved data file. The file created by the Virtual Scope is a text file

Page 4 of 10

MAE 334

Lab 1

Figure 6. The Select Waveforms window found under the File - Save Waveforms... pull down menu.

readily compatible with Excel. After you click the OK button in the dialog window, you will be prompted for a data file name and storage location. You can store it in My Documents, on your USB flash disk or you can use a subdirectory in your Engineering Home Directory (drive N:). 10. Explore your saved file with Excel. You should see each of the 500 data points, the time at which each sample occurs and the voltage measured for each sample. Use Excel x/y plotting to display a graph equivalent to your original Virtual Scope display. Obtain a print screen image of your Visual Scope display to print in your report and also a copy of your Excel plot.

Part 2 Aliasing
In a complex periodic or a random signal, the sampling theorem states that a minimum of two points per cycle of the highest frequency component must be obtained in order to accurately reconstruct the signals frequency content. Of course, for a deterministic sinusoidal signal, more than two points per cycle are necessary to graphically display it. BUT if there are fewer than two points per cycle, the waveform may appear to have a frequency lower than the true frequency. That is, it will display an alias" of the true frequency. The Nyquist Frequency is half the sampling frequency and represents the maximum frequency for which aliasing will not occur.

Page 5 of 10

MAE 334

Lab 1

1. Set the function generator to produce a sine wave with a magnitude of a few volts with a nominal frequency of 100 Hz. 2. Sample at a high frequency, say 2500 S/s, and adjust the function generator so that the frequency is very close to 100 Hz by observing the indicator just below the plot. Now, keep the function generator frequency constant and gradually reduce the sampling rate, paying particular attention to sampling frequencies around 500 S/s, 250 S/s, 100 S/s and 50 S/s. Save a data file for the lowest sampling frequency that you feel shows the sine wave appearance adequately. Also save a data file for the first sampling frequency that you feel poorly displays the sine wave. 3. Recall that you are keeping the input sine wave frequency constant and that the function generator continually produces a smooth 100 Hz sine wave. As you lower the sampling frequency, the Virtual Scope package is eventually unable to recognize the frequency of the 100 Hz signal. Signal frequency aliasing implies that an input frequency appears to be at some other lower frequency than it is in reality. Obtain a print screen image showing the Virtual Scopes wave form display where the frequency is misrepresented. Of course, the input signal should still be 100 Hz.

Part 3 Quantization
12

The number of values that can be represented by a 12 bit binary number is 2 . The A/D converters in the lab are twelve bit converters and in normal unity gain mode, they have a 20 volt range (+/- 10 volts). This means that nominally each of the 4096 values is separated by 20 / 4096 volts. The concept of representing a continuous range with a discrete number of values is referred to as quantization and the precision of an ADC is limited by the input range and number of bits used in the conversion process. The exercise below illustrates the limits imposed by quantizing. 1. Set the Virtual Bench Scope vertical voltage sensitivity to 5 Volts/Div. 2. Set the sampling frequency to about 500 Hz. 3. Set the function generator to produce a low frequency signal (about 0.5 Hz) with an average value in the range of about 8 volts and a small oscillation less than 500 millivolts peak to peak. Use the amplitude and the offset (bias) controls on the function generator to obtain the waveform. Figure 7 shows a reasonable representation of the desired signal. 4. Using the scope in single run mode, capture the waveform and save it in a file to be read by Excel. Use the convenient plotting capability of Excel to adjust the scales and the range of an x/y plot to clearly show the quantization level of the signal. Include this plot in your report.

Page 6 of 10

MAE 334

Lab 1

Figure 7. Small Oscillations with a Considerable Average Value.

5. Readjust the function generator to remove the bias voltage from the signal. Also reduce the signal amplitude so that its oscillations are less than 20 millivolts peak to peak. You may find the -30 db button to be helpful here. Adjust the sensitivity of the Virtual Scope to 10 millivolts per division. With all of these changes, your Virtual Scope display should look very much like Figure 8. 6. Using the scope in single run mode, capture this new waveform and save it in a file to be read by Excel. Use the convenient plotting capability of Excel to adjust the scales and the range of an x/y plot so that the quantization level of the signal is apparent. Include this graph in your report.

Page 7 of 10

MAE 334

Lab 1

Figure 8. Very Small Oscillations about Zero.

Simulations
Using Excel, simulate the digital sampling process by calculating an ADC Value and then converting that to its equivalent voltage. The ADC Value = INT(V/Q + 0.5) where V is the input signal voltage and Q is the ADC resolution in volts. With unity gain for the input to the ADC: Q = ADCFSR/2M where ADCFSR is the ADC Full Scale Range in volts (maximum limit minimum limit = 20 Volts for the lab ADC). M is the number of bits of resolution of the ADC. For the ADCs used in the lab M = 12. Of course, if the gain is not unity, an adjustment of these equations is required.

Page 8 of 10

MAE 334

Lab 1

Use this representation in Excel to simulate the aliasing phenomenon by considering the oscillating voltage described by V = A sin(2* *f * t(i)+phase) + offset where: A = half of the peak to peak amplitude, f = sine wave frequency in Hertz, t(i) = the time calculated by dt*i where i=1,2,3,...500, sr = sampling rate in Hertz (S/s), dt = 1/sr is the time change between each sample Use this Excel simulation to study the aliasing behavior. Obtain a plot or two which mimic the results you obtained in the lab for Part 2 item 2. Note that each point in the plot represents the equivalent of one digital sample. By varying the sampling rate while the input sine wave remains the same (constant frequency, amplitude, phase and offset) obtain plots which correspond to those obtained in the laboratory. Youll want to avoid setting the signal frequency and the sampling frequency exactly at integral multiples of each other. Also use your Excel simulation to consider the quantization issue. For your quantization simulation, a simple sine wave may be taken as input. Set the magnitude and frequency to match the specifications of Part 3 items 2 and 3. Plot your simulation results so that you can compare them directly to Figure 7 and to your detailed plots for Part 3 items 4 and 6.

Report
In your Summary section, be sure to include a brief statement of whether you have had previous exposure to the topics in this experiment. If so, where? And what was previously familiar? The Results section should include all of the specified plots/graphs in Parts 1, 2 and 3. Each graph or plot should be in a carefully numbered and titled figure. Figure titles should clearly indicate the contents of the figure. Be sure all of your graphs are fully labeled and that the units for the axes are shown. You may add material here if you would like to discuss something not specifically requested. Your Discussion of Results should describe your ability to simulate the behavior of the A to D conversion process with Excel for aliasing and quantization. Do your simulations agree with your experience with the actual ADC behavior? Specific Questions 1. In Part 1, item 8 you are asked to increase the input signal level beyond the +/- 10 volts range of the ADC. What was the result for this case? How was the wave form affected? 2. Describe the effect of releasing the -30 db button on the function generator. For an initial wave form of +/- 10 volts, what would be the size expected after releasing the -30 db button?

Page 9 of 10

MAE 334

Lab 1

3. We have discussed quantization as an issue of analog to digital conversion. There is a form of this phenomenon that is always present in computerized graphical displays. This is quite apparent in Figure 7 of this write-up where the curve has a staircase appearance. Can you explain? 4. If you had to sample a 20 Hz signal and would like to see it displayed with reasonable quality, what minimum sampling frequency would you recommend and why?

Page 10 of 10

You might also like