DIGITAL SAMPLING OF DATA LEARNING GOALS This activity will focus on selecting a suitable sample rate for a given measurement. You will be able to do this by using the VI developed in the previous LSA. You will… 1. 2. 3. …extend your previously developed VI to add functionality. …be able to appropriately choose DAQ parameters like sample rate. …explain what the DAQ measures when the sample rate is chosen differently. GETTING STARTED You will be building upon the VI built in the previous Lab Skills Activity. This activity will focus on properly setting up the VI and using it to its full potential for data collection in future experiments IMPROVING THE USEFULNESS OF YOUR EXISTING VI a. Modify the LabVIEW VI from the previous activity so that the Number of Samples and Sample Rate are now inputs on the front panel. a. b. Set up a function generator to produce a 10 kHz sine wave. Connect the function generator’s output to both the oscilloscope and the DAQ to record data. Question 1 Question 2 INITIAL MEASUREMENTS Question 3 a. b. c. d. Set the sample rate in the LabVIEW VI to 5000 samples per second and the number of samples such that it records 5 seconds of data Record and plot a dataset with both the oscilloscope and the DAQ. Make sure that the range on the oscilloscope is set such that it is on the same order as the data being recorded by the DAQ Compare the two plots. What are the major differences between the two? Why might one or both of these plots be giving an incorrect result? Think about the wave you are measuring and the result you are getting. How do they relate? ENHANCING UNDERSTANDING This section will guide you to understanding of nyquist’s theorem and a more appropriate sample rate for digital data collection using the DAQ and your VI. a. Question 4 Why do you think the data from the DAQ produced a wave of lower frequency? b. Adjust the sample rate in a way you think might provide a more accurate measurement of the wave. What do you think the measured waveform will look like this time? c. Take a dataset, record and plot it. Did it match your predictions? d. Now record another dataset with the function generator set to the same parameters but the sample rate set to 30,000 samples per second and the number of samples set to record 5 seconds of data. e. Plot this new dataset. What is the frequency of the new dataset? f. What are the fundamental differences between the first, second, and third datasets? NYQUIST FREQUENCY The discrepancies between the sampled wave forms in questions 3 and 4 can be explained by Nyquist’s theorem. It states that to accurately measure a signal by discrete sampling methods (like the DAQ) that the sampling rate must be at least twice that of the measured signal. If this were not the case, like in Question 2, a measurement might not be taken at every interval of oscillation, a situation called “undersampling.” Sampling the signal at least twice as fast as the maximum frequency of interest ensures that at least two data points are recorded each period. Definition: The Nyquist Frequency is defined to be half the sample rate. Question 5 Predict the apparent period of the signal recorded by the DAQ. Observe what really happens using your waveform generator, DAQ, and LabVIEW VI. Explain the result. Suppose the DAQ is set to 1 kS/s sample rate in all of the cases, while the waveform generator is set to: a. b. c. d. e. f. Question 6 You want to measure the random fluctuations (noise) in a signal from 0-100 Hz. a. b. c. Question 7 1 kHz 998 Hz 1004 Hz 1500 Hz 1997 Hz 2005 Hz If you set the sample rate at 200 Hz, what set of frequency ranges will contribute to the noise measurement? If you set the sample rate at 1000 Hz, what set of frequency ranges will contribute to the noise measurement? How could you help achieve the desired measurement in (a) using a combination of changing the sample rate and adding filtering? Explain why your choice of sample rate and signal filter would work better. Undersampling on the oscilloscope. Undersampling is an issue with any device that samples data at regular discrete time intervals. This question requires the use of a Rigol DS1052E oscilloscope and a waveform generator. a) Figure 2-37, and Table 2-19 are copied from the Rigol Scope Manual. The Horizontal menu allows you to view the actual sample rate “Sa Rate” of the digital acquisition on the scope. b) Predict what should you observe if you set the waveform generator to the same frequency as the sample rate? Try it out, compare with your prediction, and explain your observations. c) What happens if you change the oscilloscope time scale? Or change the waveform generator frequency slightly? Try to explain what you observe.