4.2. Measuring external waveforms with the Red Pitaya

4.2.1. Introduction

The Red Pitaya is a versatile platform that enables the measurement and analysis of external waveforms. It offers various applications, including an oscilloscope and spectrum analyzer, making it suitable for studying discrete time systems. Understanding key concepts related to bandwidth, bit depth, crosstalk, and different types of input/output devices is essential for effective waveform analysis.

4.2.2. Theory

4.2.2.1. Bandwidth

Bandwidth is a fundamental concept in signal processing and refers to the range of frequencies over which a device or system can accurately transmit or reproduce signals. In the context of audio devices like DACs, the bandwidth is closely tied to the device’s sample rate. The sample rate determines the number of samples taken per second and is usually expressed in kilohertz (kHz). According to the Nyquist-Shannon sampling theorem, the maximum frequency that can be accurately represented by a DAC is half of its sample rate, known as the Nyquist frequency.

When sampling signals, frequencies above the Nyquist frequency can lead to aliasing. Aliasing occurs when high-frequency components “fold back” into the lower frequency range, causing distortions and artifacts in the time and frequency domains. To ensure accurate representation of signals, it is essential to consider the bandwidth limitations of audio devices. Choosing an appropriate sample rate and understanding the device’s bandwidth can help prevent aliasing and maintain signal fidelity within the desired frequency range.

4.2.2.2. Bit Depth and Quality

Bit depth plays a crucial role in determining the quality and accuracy of digital audio representation. It refers to the number of bits used to represent each sample of an analog waveform in the digital domain. A higher bit depth allows for a greater number of quantization levels, resulting in more precise and detailed representation of the analog signal.

With a higher bit depth, the DAC can assign more discrete values to represent the signal, leading to smoother waveform reconstruction and improved signal resolution. This helps to minimize quantization noise, which is the noise introduced during the conversion of analog to digital and vice versa. Higher bit depths enable audio devices to capture and reproduce subtle nuances in the original signal, resulting in improved dynamic range and overall audio quality.

4.2.2.3. Crosstalk

Crosstalk is an undesirable phenomenon that occurs when there is interference or leakage of signals between different channels of a device. In the case of the Red Pitaya, crosstalk refers to the interference between input channels. Crosstalk can arise from various factors such as electrical coupling, inadequate channel isolation, or improper signal routing.

Quantifying and understanding crosstalk is essential in signal analysis and measurement applications. Excessive crosstalk can lead to signal bleed and distort the integrity of the measured signals. By minimizing crosstalk, accurate and reliable signal measurements can be achieved, ensuring that each channel captures only the intended signal without interference from other channels. Proper channel isolation and careful signal routing are important considerations to mitigate crosstalk and maintain the fidelity of the measured signals.

4.2.3. Practical Tasks

For the practical tasks, we will be using the Red Pitaya’s web applications and MATLAB to analyze external waveforms. The tasks involve exploring the audio DAC’s bandwidth, observing the effects of bit depth and quality, analyzing waveforms from USB soundcards and PC soundcards, examining the Red Pitaya’s own DAC for quantization artifacts, and quantifying crosstalk between input channels.

4.2.3.1. Single channel analysis

For all of this analysis, set the second channel to output all zeros in MATLAB, as described in the slides and class time instruction.

4.2.3.2. Audio DAC Bandwidth

Audio devices have bandwidth limits typically in the range of 20kHz due to their sample rate. In this task, we will experimentally observe this limitation using a pure sine wave tone with sufficient amplitude.

  1. Show at least one plot demonstrating aliasing in the time domain, and frequency domain.

The plot in the time domain will show distortions, such as jagged edges or waveform folding, indicating aliasing. The frequency domain plot will exhibit energy at frequencies that are not present in the original signal, indicating the presence of aliases.

  1. Observe the frequency of the aliased wave appears to have, and comment on what you estimate to be the sample rate (bandwidth) of the card.

    By stepping through the example frequencies and comparing the measured frequency with the expected frequency, we can determine the sample rate (bandwidth) of the audio DAC. When the measured frequency deviates from the expected frequency, it indicates the point at which aliasing occurs. The sample rate can be estimated by doubling the highest expected frequency at which aliasing is observed.

Hint: One way to do this is to step through each of the following example frequencies (for example like those given in the table below), and look for when the measured frequency doesn’t match the expected frequency.

Frequency (kHz)

18

19

20

22

23

24

25

30

4.2.3.3. Audio DAC Bit depth and quality

In addition to a sample rate, Audio DACs have a known number of quantized states. We will observe how this can appear by using multiple DACs, and why the rule of thumb of more bits is better is usually true.

For all tests, use a sinewave excitation signal with a frequency of 1kHz. For each sinewave, analyze the samples through both the time and frequency domains.

4.2.3.4. USB Soundcard

  1. Time domain

The time domain analysis of the captured waveforms will reveal their characteristics, such as pulse widths, rise and fall times, and overall waveform behavior.

  1. Frequency Domain

The frequency domain analysis will allow us to identify the frequency components and their magnitudes in the captured waveforms.

4.2.3.5. (optional) Higher frequency output

As an optional demonstration, set the output frequency to be 10kHz on the Soundcard. Comment as to what appears to be occurring, and if there is any unusual behavior observed. Speculate as to the origin of the atypical behavior if any is observed.

  1. Time domain

By examining the captured waveforms in the time domain, we can observe any changes in their characteristics compared to lower frequencies. This may include variations in pulse widths, amplitude, or overall waveform shape.

  1. Frequency Domain

The frequency domain analysis will reveal the spectral content of the captured waveforms at the higher frequency. This can help identify any additional frequency components or changes in the magnitude distribution.

4.2.3.6. PC Soundcard

  1. Time domain

  2. Frequency Domain

4.2.3.7. (Optional) Red Pitaya Output

The Red Pitaya also has a DAC, which is what the analog outputs employ. We have already viewed some of the signals of the Red Pitaya before, but now let’s examine them for quantization artifacts. For this, configure the red pitaya in the usual Loopback configuration using the SMA cables we have previously used, and configure the output to the same 10kHz sinewave.

  1. Time domain

The time domain analysis of the captured waveforms will reveal any quantization artifacts and their impact on the waveform shape and fidelity.

  1. Frequency Domain

The frequency domain analysis will allow us to observe any additional frequency components, distortions, or noise introduced by quantization artifacts in the Red Pitaya’s output signal.

4.2.3.8. Dual Channel analysis

For all of this analysis, both channels will have non-zero values in MATLAB.

4.2.3.9. Cross talk

We previously observed the effect of cross talk between input channels of the red pitaya. Let’s try to better quantify this now that we can load the waveforms in MATLAB. To Do this, we will setup the soundcard to output two (2) sinewaves of differing frequency, one on each channel, and measure the spectrum of one channel for content of the other.

Capture the cross talk behavior on the red pitaya’s web interface before attempting the MATLAB processing to ensure you can see the cross talk visually. Label in each screen the feature caused by cross talk.

  1. Red Pitaya - Time domain

By examining the captured waveforms in the time domain, we can observe any interference or bleed between the channels, indicating the presence of cross talk.

  1. Red Pitaya Frequency Domain

In the frequency domain, we can calculate the ratio of strength (in linear and dB) between the fundamental frequency and the frequency of the other channel. This will help us measure the extent of cross talk and evaluate any observed asymmetry.

After this, acquire the data through MATLAB, and use the variable ch_1_data to show the effects of cross talk. (Hint, for the frequency domain, plot the amplitude spectrum, and compare the relative magnitudes of the frequency bins in both frequencies)

In the frequency domain, calculate the ratio of strength (in linear and dB) of the fundamental frequency to the ratio of the strength of the frequency of the other channel. Do this for both channels, and comment on any observed asymmetry.

4.2.3.10. Conclusion

In conclusion, the Red Pitaya serves as a versatile platform for measuring external waveforms. Through the tasks and analyses conducted, we gained insights into bandwidth limitations, the impact of bit depth on waveform quality, characteristics of different soundcard outputs, and the quantification of cross talk effects. This knowledge enhances our understanding of discrete time systems and enables accurate signal measurements and analysis. The Red Pitaya’s capabilities empower us to explore and experiment with waveforms, contributing to advancements in signal processing and analysis.