Data Acquisition

EXPERIMENT #7

DATA ACQUISITION

06/14/2019

Group:

DATA ACQUISITION

PURPOSE

The objectives of this laboratory are:

  1. To examine signal sampling, aliasing and signal reconstruction.
  2. To implement a time division multiplexing system.
  3. To investigate the quantization error associated with analog-to-digital conversion.

EQUIPMENT LIST

1. PC with Matlab and Simulink.

LABORATORY PROCEDURE

I Sampling

  1. The time division Multiplexer (TDM MUX) module is used to recombine two analog signals into one data stream. The input A is connected to the OUT connector for a period T (T = 1/fs). During the next period, input B is connected to the OUT connector. The process then repeats. It should be obvious that each input, input A(or B) is “Sampled” at a rate equal to ½ fs as set by the Master clock.

NOTE: The actual waveform sampling rate = ½ fs as set by the “DATA/Sampling RATE”, output, mentioned above (e.g. to sample a 1kHz cosine, using this equipment at the Nyquist rate then fs would have to be set to 4 kHz)

  1. Next the fs were set to 10kHz and the function generator frequency was set to 1kHz. The output signal OUT was observed on a scope and was also compared with the input on a dual channel scope. The value of fs was slightly adjusted for a stable display. The scope was moved to the sample-and-hold (S & H) output. We see that the amplitude variations during the sampled period are now replaced with a constant “flat top”.

Figure 7a – Sampling using Sample and Hold

The input signal looks like the one shown in figure below

Figure 7a input of the sampling using sample and hold method

Figure 7a Output of the Sample and hold circuit
t

The result when the input is overlapped with the output is what is shown below.

  1. Next the function generator was connected to both the inputs A and B. at the OUT connector of the TDM MUX, the generator’s signal appears undistorted. We see that after moving the scope tot he S & H connector the signal is now being sampled at fs. (See figure 7B).

figure 7b(a) Time Division Multiplexing - Implementation

figure 7b (b)Time division Multiplexing – Input signal

figure 7b(c): Time division Multiplexing, Output

  1. The output spectrum of the S & H output is observed. Values of f and fs are varied and the effects of aliasing observed.
  2. Effect of filtering: The sampled signal was reconstructed by feeding through a 4th order LPF to remove the aliasing frequencies.

II Time Division Multiplexing

  1. Although multiplexing not classified as “data acquisition,” we shall make use of TDM modules at this time. Two sine waves were prepared to be multiplexed by setting the two VCO’s in open loop to 1 kHz and 2 kHz. Connect the 1 kHz sine wave to the A input and 2 kHz since wave to the B input (see figure 7c). Set fs for 10kHz. The output OUT and S & H outputs in time and frequency domain were observed. Yes, we can say that sampling frequency for the TDM system is fs/2. (i.e half the time you sample A and half the time you sample B)

Figure 7c (a) Muxed signals

  1. The S & H signal was connected to the TDM DEMUX. Internal timing connects the TDM DEMUX input signal to the A output when the A input signal is selected by the MUX. Similarly, the B output is connected to the DEMUX input when the MUX selects input B. Thus, the TDM signal becomes “demultiplexed”. The Dual LPF was used to reconstruct the S & H DEMUX output waveforms. All the waveforms observed are attached.

Figure 7c (a) Output of Signal 1 of TDM

Figure 7c(b) Implementation of 2 signal TDM

Figure 7c(c) Output of the two signal TDM

III A/D conversion

  1. Now the conversion of analog to digital pulse is considered. This conversion is part of the pulse code modulation (PCM) system.
  2. There is an inherent noise component in the system due to the quantization of the signal in the PCM encoding and decoding. This noise is the error between the actual value of the analog input and the decoded analog signal from the PCM-ANALOG module. If we were to subtract the resulting quantified signal from the original signal, a noise voltage would result. This could then be used to form a quantization signal-to-noise power ratio.

Figure 7(III) a – The pulse code modulation with variable quantization

Here is a plot of the input signal (Analog) to the PCM system

Figure 7(III)b Input signal

The quantized signal is given below

Figure 7(III)b Quantized signal

The input file is quantified using the PCM encode and de-quantified using the PCM decode block. The block parameters are shown below

Figure 7(III)b Quantizer parameters

Figure 7(III)d DE- Quantizer parameters

The output of the decoder is fed to a subractor block, which takes the difference of the input signal from the output and gives the signal noise generated. The noise generated and the numeric value is also shown.

Figure 7(III)e Difference – Noise of the PCM

The output of the de-quantized block is further filtered.

Figure 7(III)f Quantization recovered value

The output as compared to the input looks some what like below

Figure 7(III)g Input and Output compared

  1. There is a delay of about 2T in the PCM system between the input and output signals. This will result in an unwanted error due to phase shift. Selecting the maximum sampling rate and a LOW signal frequency (Say 20Hz) can reduce this error. This delay is an important point to be understood because it is inherent in al digital communication systems.
  2. Keeping this delay error in mind, the quantization SNR curve as a function of the number of quantization levels (27,26,25…21) which can be changed by the MSB/LSB switches on the ANALOG-PCM module. Your input should be +- 2.5V triangle wave at a low frequency. You should also observe the output signal with a scope.
  3. The effect of LPF on the signal reconstruction has been observed.

clear all;

close all

x = [2 4 8 16 32 64 128];

y = [1.32 0.828 0.465 0.464 0.47 0.48 0.49];

plot(x,y,'r*');

grid on

zoom on

title('Plot of L v/s Noise RMS, input rms = 1.39V');

xlabel('Quantization levels L')

ylabel('Noise RMS');

L (Quantization Levels) / Noise RMS
21 / 1.32
22 / 0.828
23 / 0.465
24 / 0.464
25 / 0.47
26 / 0.48
27 / 0.49

We see that the Noise RMS decreases with increase in the quantization levels.

Prelab Questions

Experiment # 7
  1. At 1kHz cosine wave is sampled by a series of impulses spaced T seconds apart.

where T=1/fs (sampling frequency). If fs = 5,000 Hz find the positive frequency spectrum of the sampled signal (amplitude only).

The spectrum of s(nT) is the spectrum of cos(2*1000*t) convoluted with the spectrum of the impulse train.

The spectrum of cos(2*1000*t) is

The spectrum of the impulse train is

The convolution result of the two above spectra is

The magnitude spectrum above is also the magnitude spectrum of s(nT)

An nth order low pass filter is used to reconstruct the sampled signal in question #1 and has an amplitude response of:

where n = the order of the filter and f3 = 3dB cutoff =1 kHz.

If a 4th order filter is used, what would be the lowest sampling frequency that would cause less than 1% distortion due to aliasing?

(Hint: Assume that the single aliasing impulse that is closest to the 1 kHz signal contributes the most to the aliasing error.)

If it is assume that the single aliasing impulse that is closest to the 1 kHz signal contributes the most to the aliasing error, then this problem is equivalent to find the frequency such that the |H(f)| is 1% of the value at 1 kHz. And from this frequency, the lowest sampling frequency that would cause less than 1% distortion due to aliasing is compute by adding 1000Hz to it.

So, first we have to find the frequency such that the |H(f)| is 1% of the value at 1 kHz

|H(1000)| = 2 -0.5 = 0.7071

Want to find f such that |H(f)| = 0.7071*0.01 = 0.007071

Therefore, the lowest sampling frequency must be 3448.5 + 1000 = 4448.5 Hz

  1. If an 8th order filter is used, what would be the lowest sampling frequency that would cause less than 1% distortion?

Do the same for problem #2 but this time change n to 8, then the equation that need to be solved is

Therefore, the lowest sampling frequency must be 1857.0 + 1000 = 2857.0 Hz

  1. A 4-bit A-D converter has a sampling rate of 16 kHz. This system samples a 1 kHz triangle wave that has an amplitude that exactly spans the converter’s quantization range. Sketch the unfiltered D-A output, if this signal is the A-D input.

Create one period of triangle signal in MATLAB with command:

t=[0:(16*10^3)^-1:10^-3];

s=[t(1:9) t(8:-1:1)]/.5e-3*2-1;

The use the following Simulink model to get the quantized signal.

The quantizer was configured with these parameters,

Quantization partition: p=[-1+.125:.125:.875]

Quantization codebook: c=[p-.125/2 .875+.125/2]

The output waveform compared to the original waveform is