Introduction
Throughout this course, we have utilized Red Pitaya’s function generator to output different types of waveforms. However, we haven’t delved into how it works. The function generator employs a Digital-to-Analog Converter (DAC), which generates a voltage output that corresponds to the type of waveform selected (sine, triangular, square, DC, etc.). Since DACs (and Red Pitayas) can be expensive, it is economically advantageous to explore alternative function generator options for cost-sensitive applications.
Discrete Fourier Transform (DFT)
Theory and Application
The Discrete Fourier Transform (DFT) is a mathematical technique used to transform a discrete set of data points into its frequency components. This is fundamental in digital signal processing, allowing us to analyze and manipulate signal frequencies. The DFT is given by the equation:
where is the frequency component at frequency , is the nth data point of the time-domain signal, N is the total number of data points, and j is the square root of -1.
Up until now, we have used two tools from Red Pitaya’s toolbox: the oscilloscope and the Bode analyzer. Today, we will introduce a new tool: the DFT spectrum analyzer. DFT stands for Discrete Fourier Transform, which is used to identify the spectral components present in a signal. But what are spectral components? Any signal can be represented as a sum of an infinite number of sine and cosine functions, each with its own amplitude and frequency. The DFT tells us the factors for each frequency. This is a simplified explanation, but it will suffice for our purposes today. An ideal square wave with a fundamental frequency of F0 and an amplitude of 1 can be approximated as follows:
So we would expect our square wave signal to contain the base frequency and its odd multiples. And what do we really get?
During the experiment, I configured the oscillator to produce a 30 kHz signal and set the DFT analyzer to detect frequencies up to 500 kHz. The resulting spectrum showed equally spaced spikes, with odd spikes being much larger than even ones. Keep in mind that the vertical axis is logarithmic. While we anticipated the odd spectral components, the even ones were unexpected. However, we can attribute them to the discrepancy between an ideal square wave and the approximation we generated. Therefore, if we disregard the even components, we can observe the anticipated pattern for a square wave.
Utilization in Function Generators
In function generators, DFT can be used to analyze and synthesize waveforms, ensuring that the generated signal accurately represents the desired waveform through its harmonic content.
Inverting and Non-Inverting Schmitt Trigger
Design Principles
Schmitt triggers are used to convert analog signals into digital, acting as a comparator with hysteresis. This hysteresis provides noise immunity and clean switching behavior. The inverting Schmitt Trigger flips the output state when the input voltage crosses a specific threshold from high to low, while the non-inverting version does so from low to high.
Equations and Functionality
The threshold voltages for the inverting and non-inverting Schmitt Trigger are determined by the resistive network connected to it. The voltage thresholds can be calculated as:
- For the non-inverting Schmitt Trigger:
- For the inverting Schmitt Trigger:
where VT+ and VT− are the upper and lower threshold voltages, respectively, Vref is the reference voltage, and R1 and R2 are the resistors determining the hysteresis width.
An OpAmp Multivibrator
An OpAmp multivibrator is a circuit that generates a periodic waveform (usually square or triangular) without requiring any external signal source. It is essentially a type of oscillator that relies on feedback to maintain its operation.
Operational Principle and Equation
For a simple astable multivibrator, the frequency of oscillation can be determined by the resistors and capacitors in the circuit, typically given by:
where R and C are the values of the resistor and capacitor in the feedback loop, and Rf and R1 are the resistances determining the rate of charge and discharge of the capacitor.
You will notice that turning the potentiometer impacts the signal’s frequency. This is due to the changing threshold voltage and thus varying time between output’s transition and RC filtered voltage exceeding the threshold. Here are the equations:
And for those wondering where the came from, we use it to simplify the equations. We could also use it in equations for the inverting Schmitt trigger:
You have now learned how to build a basic adjustable oscillator that produces a square wave output. However, did you know that a sine wave is actually hidden inside the square wave? It may sound surprising, but it’s true!
OpAmp Triangular Wave Generator
Waveform Synthesis
Triangular wave generators use an integrator in conjunction with a square wave generator (like a Schmitt trigger) to produce a triangular waveform. The frequency and amplitude of the waveform can be adjusted through the circuit components.
Circuit Operation
The conversion from square to triangular waveform is governed by the charging and discharging cycles of the capacitor in the integrator, with the frequency determined by:
where R and C are the resistance and capacitance in the integrator circuit.
Conclusion
Throughout this course, we have covered the basics of oscillator design, DFT analysis, and waveform conversion from square waves to sine or triangular waveforms. However, it should be noted that the oscillator design discussed in this course is only one of many designs available. Interested individuals are encouraged to explore the internet to learn about oscillators that naturally produce sine waves or other waveforms, such as sawtooth or asymmetric square waves. In conclusion, we hope you found this course informative, and until next time, we bid you farewell.
Written by Andraž Pirc
This teaching material was created by Red Pitaya & Zavod 404 in the scope of the Smart4All innovation project.