Function Generator
Function Generator
i
ABSTRACT
The purpose of the report is to show how a simple function generator can be designed. The
function generator produces three waveform, sinusoidal, square and triangular at a single
frequency of 6.2 kHz. The report contains the background theory that is used to come up with
the design; the design process and the results of the design. The report also shows other
methods that can be used besides the one that the design in the report uses.
ii
Contents
1 CHAPTER ONE ........................................................................................................................... 1
1.0 INTRODUCTION .................................................................................................................. 1
1.1 AIM ......................................................................................................................................... 1
1.2 OBJECTIVES ......................................................................................................................... 1
1.3 JUSTIFICATION ................................................................................................................... 1
1.4 OVERVIEW AND CONCLUSION ....................................................................................... 1
2 CHAPTER TWO .......................................................................................................................... 2
2.0 Introduction ............................................................................................................................. 2
2.1 Signals ..................................................................................................................................... 2
2.1.1 The Sine Wave ................................................................................................................ 2
2.1.2 Pulse Waveforms ............................................................................................................ 3
2.1.3 Triangular waveforms ..................................................................................................... 4
2.2 Generation of Waveforms ....................................................................................................... 4
2.2.1 Oscillators ....................................................................................................................... 4
2.3 Signal Impairments ................................................................................................................. 5
2.3.1 Noise ............................................................................................................................... 5
2.3.2 Distortion ........................................................................................................................ 6
2.3.3 Bandwidth Restrictions ................................................................................................... 6
2.4 Producing the Sine Wave (sine wave oscillators) ................................................................... 6
2.4.1 Oscillators with RC Feedback Circuits ........................................................................... 6
2.4.2 Oscillators with LC Feedback Circuits. .......................................................................... 8
2.5 Triangular wave oscillator ...................................................................................................... 9
2.6 Square Wave Oscillator ........................................................................................................ 10
2.7 The Comparator .................................................................................................................... 11
2.8 Integrators and Differentiators .............................................................................................. 11
2.9 Conclusion ............................................................................................................................ 12
3 CHAPTER THREE .................................................................................................................... 13
3.0 Introduction ........................................................................................................................... 13
3.1 Block Diagram of Design ..................................................................................................... 13
3.2 Wien-bridge Oscillator.......................................................................................................... 13
3.3 Comparator ........................................................................................................................... 15
3.4 Integrator ............................................................................................................................... 16
3.4.1 Finding the value of R and C ........................................................................................ 16
3.5 Function Generator ............................................................................................................... 16
3.6 Practical Design .................................................................................................................... 17
3.7 Conclusion ............................................................................................................................ 17
iii
4 CHAPTER FOUR ....................................................................................................................... 18
4.0 Introduction ........................................................................................................................... 18
4.1 Simulation Results ................................................................................................................ 18
4.2 Practical results ..................................................................................................................... 18
4.3 Analysis of results ................................................................................................................. 21
4.4 Conclusion ............................................................................................................................ 21
5 CHAPTER FIVE ........................................................................................................................ 22
5.0 CONCLUSIONS................................................................................................................... 22
References ............................................................................................................................................ 23
List of symbols
iv
1 CHAPTER ONE
1.0 INTRODUCTION
A function generator is a device that is composed of a circuit/circuits that perform the task of
producing waveforms at required frequencies. The simple function generator in this report
operates at a single frequency producing the sinusoidal, square and triangular waveforms. Such
a device can be made using a circuit that is composed of op-amps and other components such
as resistors, capacitors and inductors.
1.1 AIM
The aim is to show the background information that leads to the design of the circuit, the
designing stages that can be followed, the results and an analysis of the method used together
with others that can be used.
1.2 OBJECTIVES
To give a brief overview of what signals are
To give description of the different types of oscillators
To show how oscillators produce waveforms
To design a setup that can be used for the required frequency
To show the various calculations involved in coming up with the circuit
To show how one waveform produced can be used to produce the other two waveforms
To implement the design in the laboratory and show the results
To come up with an analysis of the results
1.3 JUSTIFICATION
In engineering and scientific work, it is often required that a circuit is energized by a signal
whose characteristics are known. This means it is of much importance that a circuit be designed
that gives a signal with required characteristics at the command of the user. This is the reason
why electronic engineers design function generators.
1.4 OVERVIEW AND CONCLUSION
The circuit to be designed produces a single frequency and the user cannot tune the device to
get different frequencies. However in real electronic engineering situations signal generators
are required to produce waveforms which vary according to the user’s commands.
1
2 CHAPTER TWO
2.0 Introduction
For one to be able to understand how a function generator works and how to come up with a
design of a function generator, knowledge is required on the waveforms that need to be
produced and the principles that are employed in signal generation.
2.1 Signals
A signal is an electrical voltage or current which varies with time. A signal source generates
the signal. The signal can be periodic or non-periodic.
2.1.1 The Sine Wave
The sine can be represented mathematically by s (t)
𝑠(𝑡) = 𝐴 sin 2𝜋𝑓𝑡 Where f is the signal frequency, t is the time and A is the signal amplitude.
A sine wave has the following important characteristics
1. Phase- Useful when comparing waveforms
2. Period- time needed for phase to shift by 2𝜋
3. Frequency- number of cycles per second
4. Amplitude- maximum instantaneous value
A sine wave is basic because all other waveforms (periodic and non-periodic) are composed of
a combination of sine waves with different frequencies, amplitudes and phases. If the waveform
is periodic, it is made up of sine wave components whose frequencies are integer multiples
called harmonics of a fundamental frequency [1].
As an example we consider a square wave which is symmetrical and has a period 0.001s. This
wave consists of sine waves at frequencies of 1000Hz (the fundamental frequency), 3000Hz,
and 5000Hz and so on. If the waveform is to be symmetrical the harmonics should be odd
multiples of the fundamental frequency.
Figure 2.1 below is an example of how a symmetrical sine wave is produced by odd harmonics
of the fundamental frequency.
2
Figure 2.1- Combining sine wave harmonics
3
2.1.3 Triangular waveforms
An ideal triangular waveform has linear slopes connected together. If the triangular wave is
symmetrical it will be composed of the fundamental frequency sine wave and only odd
harmonics. If the waveform is unsymmetrical it is called a saw tooth wave [1].
2.2 Generation of Waveforms
Oscillators and signal processing circuitry are necessary for the generation of waveforms.
2.2.1 Oscillators
An oscillator can be defined in four ways [2]
I. An oscillator converts dc energy into periodic signals
II. An oscillator is a source of ac voltage
III. An oscillator is a circuit which produces output without input
IV. An oscillator is an amplifier with positive feedback
Oscillators can be divided into two categories which are
a. AC amplifier with filtered feedback
b. Threshold decision circuitry
4
The filter quality factor Q is used in determining the frequency stability of the oscillator. Q is
a measure of the energy stored in the resonant circuit to the energy being dissipated. For the
filter, the rate of change of its phase shift at resonance is directly proportional to Q [1].
2.2.1.2 Threshold Decision Oscillators
These are circuits capable of producing time varying voltage or current. An example is an RC
circuit which begins operating from some initial state. As it charges its instantaneous state is
monitored by a detector which looks for a certain threshold condition such as a voltage level.
When the detector decides that the threshold is reached it resets the circuit to its initial state.
The detector also resets and another cycle starts. [1]
If there are two detectors, the time varying circuit can be made to move back and forth between
two states thereby producing an alternating voltage or current.
An example is illustrated by the circuit shown in figure 2.4 below
a) lead-lag circuit
b) Response curve
6
c) Wien-bridge oscillator
Figure 2.5c shows how the lead-lag circuit is used in the positive feedback loop whilst a voltage
divider is used in the negative feedback loop. The voltage divider determines the closed loop
𝑅1 +𝑅2
gain of the amplifier𝐴𝑐𝑙 = . In order to satisfy the unity gain condition this gain should
𝑅2
1
be equal to 3 so that the 3 attenuation in the lead lag circuit is offset.
𝑅1 + 𝑅2
=3
𝑅2
𝑅1 = 2𝑅2
2.4.1.2 Phase Shift Oscillator
This oscillator also makes use of RC circuits to create oscillations. Figure 2.6 shows the
circuit for the phase shift oscillator.
7
Figure 2.6- RC phase shift oscillator
Each of the three RC circuits can provide a maximum phase shift approaching900 . Oscillation
occurs at a frequency where the total phase shift through the RC circuits is1800 so that together
the1800 phase shift of the op-amp the total phase shift is00 . If 𝑅1 = 𝑅2 = 𝑅3 = 𝑅 and 𝐶1 =
1
𝐶2 = 𝐶3 = 𝐶 then𝑓𝑟 = 2𝜋√6𝑅𝐶.
8
Figure 2.8- Colpitts Oscillator
9
Figure 2.10- Triangular wave oscillator and its output waveform
The op-amp comparator performs a switching function. If the voltage of the comparator is at
its maximum negative level, the integrator will produce a positive going ramp. When the ramp
reaches the upper trigger point UTP, the comparator switches to its maximum positive level.
The integrator will then produce a negative going ramp which continues until the lower trigger
point is reached. At this point the comparator switches back to its maximum positive level and
the cycle repeats.
The circuit can also be used as a square wave output since the comparator produces a square
wave output.
1 𝑅2
The frequency of this setup is 𝑓𝑟 = 4𝑅
1 𝐶 𝑅3
10
The capacitor voltage is the input to the inverting input terminal. The input to the non-inverting
input terminal is the portion of the output fed back through resistors 𝑅2 and 𝑅3 to provide
hysteresis.
When the capacitor voltage charges to a value equal to the feedback voltage of the non-
inverting input, the op-amp output switches to a maximum negative state. The capacitor will
start discharging and when it reaches −𝑉𝑓 the op-amp switches to a maximum positive level
and the capacitor starts charging. The cycle repeats and a square wave is produced.
2.7 The Comparator
The op-amp can be used as a voltage level detector or comparator. To accomplish this, a
reference voltage Vref is applied to one input of an op-amp. The reference voltage could be 0
V, a positive voltage or a negative voltage with respect to ground. To the other input a time-
varying voltage 𝑉𝑖 is applied. When 𝑉𝑖 crosses the reference voltage level, the output of the op-
amp will switch to either positive saturation or negative saturation depending on the type of
comparator circuit the polarity of the differential voltage. A typical comparator with reference
voltage 0V (also called zero level detector) is shown in figure 2.12. [2]
𝑉𝑟𝑒𝑓
11
simulates mathematical differentiation, which is a process of determining the instantaneous
rate of change of a function.
Integrators and differentiators are important because when either a square wave or a triangular
wave has already been produced one of them can be used to produce the other waveform. [3]
An op-amp integrator circuit is shown in figure 2.13.
12
3 CHAPTER THREE
3.0 Introduction
The function generator required should produce the sine, square and triangular waves at a
certain frequency. Because there is a relationship between the waveforms a circuit can be built
which produces all the three waveforms using one oscillator. This helps to make the frequencies
of all three waveforms equal and less hardware is used than if for each waveform a different
oscillator is used.
For the given frequency of 6.2 kHz the Wien-bridge is an appropriate choice.
3.1 Block Diagram of Design
The diagram in figure 3.1 below is a block diagram showing the outline of the function
generator design.
Triangular
wave
Sine wave Square
wave
Wien-Bridge Comparator Integrator
oscillator
Vref=0V
13
The frequency of oscillation is given by
1
𝑓𝑟 = 2𝜋𝑅𝐶. ……….3.1
The frequency that is required is 6.2 kHz. Substituting this into equation 3.1 and rearranging
gives
1
𝑅𝐶 = 12.4𝜋×103 ……….3.2
The next procedure is to choose the value of either R the resistor or that of C the capacitor.
Method 1;
Choosing R=10kΩ. From equation 3.2 this gives
1
𝐶=
12.4𝜋 × 103 × 10 × 103
C= 2.57nF
Method 2:
Choosing C=2.2nF. From equation 3.2 we get
1
𝑅=
12.4𝜋 × 103 × 2.2 × 10−9
R=11.67kΩ
𝑉 𝑉 1
From figure 3.2 at resonant frequency we have the ratio𝑉1 = 𝑉2 = 3= 𝛽 which is the gain of the
0 0
lead-lag portion.
But we do know that for oscillations to occur we should have 𝐴𝑐𝑙 𝛽 = 1. This means that the
closed loop gain 𝐴𝑐𝑙 = 3. The gain 𝐴𝑐𝑙 is determined by the values of 𝑅1 𝑎𝑛𝑑 𝑅2. It is given
by
𝑅1 +𝑅2
𝐴𝑐𝑙 = …………3.3
𝑅2
14
R3
12k
R1 R2 D1
10k 10k DIODE
R4
60k D2
DIODE
U1
Q
Vout
C R
2.2nF 11.67k
C R
2.2nF 11.67k
C R
2.2nF 11.67k
C R
2.2nF 11.67k
15
3.4 Integrator
The rate of change of a linearly changing voltage is a constant. This means if the integral of a
constant voltage is to be found the result will be a voltage which changes at a rate that is
equal to the amplitude of the constant voltage. Using this concept voltages that change
linearly at a rate equal to the maximum levels in the square wave can be obtained. They are
obtained by connecting an integrator to the output of the square wave. The integrator circuit
will produce an output voltage that changes negatively with respect to the sign of the input
voltage. The circuit in figure 3.5 below shows the circuit of the integrator.
𝑅𝐶 = 1.21 × 10−3
Choosing C=0.1uF gives R=12.1 kΩ.
Thus with the values of R and C and the 741 op=amp an integrator is obtained.
3.5 Function Generator
The integrator is connected with the square wave as the input and the whole circuit will now
produce all three waveforms at the same frequency. The circuit in figure 3.6 below is the
complete circuit of the function generator.
16
R3
12k
R1 R2 D1
10k 10k DIODE Sine C
Square 0.1uF Triangle
R4 wave
60k D2 wave wave
DIODE
UA741 U2
Q LM7301/NS U1
R5 UA741
+ 12k
Vout
C R +
2.2nF 11.67k
C R
2.2nF 11.67k
17
4 CHAPTER FOUR
DISCUSSION OF RESULTS
4.0 Introduction
To test how good the design is the circuit has to be tested using a simulation and then a practical
implementation in the laboratory. This chapter shows the results that were obtained from the
tests.
18
Figure 4.2- Sine wave produced
19
Figure 4.4- Triangular waveform produced
The results show that the function generator had a frequency of 6.5 kHz. This value is close to
the required 6.2 kHz.
The Wien-Bridge produced a smooth sinusoidal waveform which had a duty cycle of 50.6%.
This means there is no offset voltage. The peak to peak voltage was 52V. This implies that the
amplitude of the waveform was 21V.
The square wave had a rising edge with a duration of 1.8us. This means the percentage of the
period that was in between the peak voltages is 2.34% since the period is 153.8us. Figure 4.5
shows a picture of the rising edge.
20
Figure 4.5- Square wave rising edge
The duty cycle of the square wave is 48.67% which is close to the required 50%.
The triangular waveform on the other hand had a duty cycle of 51% which is also close to the
required 50%.
4.3 Analysis of results
The Wien-bridge oscillator can be used to produce a reliable sinusoidal signal which has a zero
offset voltage. Oscillations occur at the resonant frequency. The result has shown that the
frequency of oscillation of a Wien-Bridge oscillator depends on the values of resistors and
capacitors chosen for the lead-lag circuit.
Another point that can be noted from these results is that a comparator can be used to obtain a
rectangular wave if an input is applied which varies below and above the reference voltage. If
this input is periodic with an offset equal to the reference voltage of the comparator then a
square waveform is obtained.
From mathematics it is known that the derivative of a linear function is a constant. This
relationship can also be interpreted as the integral of a constant is a linear function. Since the
square wave has half cycles of constant amplitudes we can therefore obtain linear half cycles
from integrating this square wave and obtain a triangular waveform.
4.4 Conclusion
The design is a good one since the results that were produced are the results that the circuit was
designed to produce.
21
5 CHAPTER FIVE
5.0 CONCLUSIONS
The Wien-bridge oscillator can thus be used to produce a sinusoidal signal then the signal is
manipulated to produce other required signals. Several other methods could have been used to
come up with the design and a designer has a variety of choices depending on what is required
of the waveform. For example an RC phase shift oscillator could have been used instead of the
Wien-bridge.
For the low frequency oscillations like the one in this design RC feedback oscillators can be
used. This is why RC oscillators find much use in the audio range. However for much larger
frequencies above 1MHz the use of LC oscillators is much appropriate. In these circuits discrete
transistors are used because op-amps have lower unity gain frequency.
LC oscillators find use at radio frequencies in tunable radio transmitters, local oscillators and
radio receivers.
Much more useful function generators can be designed in which the amplitude of the signal
and its frequency can be varied.
22
References
23