B1 Function Generator
B1 Function Generator
XXXXXXXXXXXX
1XXXXXXX
Department of Electrical & Electronics Engineering
2017-18
Department of Electrical & Electronics Engineering
(Autonomous)
CERTIFICATE
XXXXX - 1xxxxA0xxx
XXXXX - 1xxxxA0xxx
XXXXX - 1xxxxA0xxx
III
Internal guide:
UMADEVI APPADURAI
Assistant Professor
Head of Department:
Dr. C. BHARGAVA,
IV
ACKNOWLEDGEMENT
V
ABSTRACT
VI
CONTENTS
CERTIFICATE………………………………………………………. i
ACKNOWLEDGEMENT…………………………………………… ii
ABSTRACT…………………………………………………………... iii
1 INTRODUCTION………………………………………………….. 1
1.1 Background…………………………………………………….
1.2 Wave generator architectures………………………………….
1.3 Aim……………………………………………………………..
2 SYSTEM OVERVIEW…………………………………………….. 2
2.1 Functions and outputs…………………………………………. 2
2.2 Modulation…………………………………………………….
3 HARDWARE………………………………………………………. 7
3.1 Power supply………………………………………………….. 7
3.1.1 Circuit Diagram…………………………………………. 7
3.1.2 Design…………………………………………………… 8
3.1.3 Wave forms……………………………………………… 9
3.2 AD9833 Board………………………………………………… 10
VII
3.2.1 Pin Diagram……………………………………………... 10
3.2.2 Circuit Diagram………………………………………….. 12
3.2.3 Working…………………………………………………. 13
3.2.4 Key Features…………………………………………….. 15
4 SOFTWARE……………………………………………………….. 18
4.1 Arduino……………………………………………………….. 18
4.2 AD9833……………………………………………………….. 21
4.3 Wave forms……………………………………………………. 24
5 CONCLUSION…………………………………………………….. 26
6 REFERENCE………………………………………………………. 26
VIII
1 INTRODUCTION
1
1.1 Background
2
measurements, and in time modulation. With the development of
modern technology, the function generator with independent control
of amplitude and frequency play an important role in applied
electronics, communications, instrumentation and signal processing
applications.
3
frequency and wave form, and added to the device or equipment
which being measured, then observe and measuring the output
response of the measured instrument to analyse and identify their
performance parameters. Function generator is the most basic and
widely used electronic instruments in electronic measurement field.
4
capacitive sensors. In this part, different kinds of wave generator
and its applications will be introduced
5
Figure 1-1, Square-Wave and Clock Generator
6
Figure 1-2, The proposed Triangular/Square-Wave Generator
7
equal to discharge time constant, pin 3 generate approximate symmetry square
wave. As component parameters in the Figure 1-3, its frequency is 1kHz, and it
can change the oscillator frequency to adjust potentiometer RP. Through R4
and C5 integrating circuit, generate triangle wave. The triangle wave pass
through R5 and C6 integrating circuit again, generate approximate symmetry
sine wave. C2 is power filter capacitor. The light-emitting diode VD is a power
light.
8
This type is based on the direct digital synthesis techniques (DDS) and
uses integrated circuits to be created relatively and for an economic price.
Figure 1-5 shows the phase advances around the circle corresponds to
advances in the wave. From it, it can be obtain the faster we complete the
cycles, the higher we can achieve the frequency of the wave.
9
Figure1-5, Phase relationship for a signal
10
Figure1-6, Block digram of a variable clock arbitrary waveform generator
The Agilent and B&K precision are very famous companies in this
field. They build various function generators.
11
1.3 Aim
12
simulation of a function generator will be created by Multisim. Finally
combine the three types of waveforms to build up a function generator.
2 SYSTEM OVERVIEW
Both the function output and a TTL SYNC output are available
through floating, front-panel BNC connectors. Both outputs have 50 Ω
output impedances and may be floated up to ±40 V relative to earth
ground. The amplitude of all function outputs is adjustable from 10
mVpp to 10 Vpp with 3-digit resolution, and can be displayed in Vp,
13
Vpp, Vrms or dBm. In addition, standard TTL and ECL output levels
can be selected.
14
The sinusoidal oscillator is one of the classical applications of op-amp
based active circuits. Canonic sinusoidal oscillators are designed with two
capacitors, four resistors, and only one op-amp [8], that is Wien-Bridge
Oscillator.
15
Figure 2-2, Modification to the basic Wien-Bridge Oscillator
16
Square wave: A square wave is normally relatively easy for a
function generator to produce. It consists of a signal moving
directly between high and low levels.
Since the anode of the zener is connected to the inverting (-) input, it is
a virtual ground (≌ 0V). Therefore, when the output voltage reaches a
positive value equal to the zener voltage, it limits at that value, as illustrated
in Figure 2-7(a). When the output switches negative. The zener acts as a
regular diode and becomes forward-biased at 0.7 V, limiting the negative
output voltage to this value. As shown in part (b). Turning the zener around
limits the output voltage in the opposite direction.
17
Figure 2-4 Operation of a bounded comparator
Two zener diodes arranged as in Figure 2-8 limits the output voltage to
the zener voltage plus the forward voltage drop (0.7V) of the forward-biased
zener, both positively and negatively, as shown.
18
Pulse: A pulse waveform is another type that can be
produced by a function generator. It is effectively the same as a
square wave, but with the mark space ratio very different to 1:1.
The integrator current: In Figure 2-9, the inverting input of the op-amp is at
virtual ground (0V), so the voltage across Ri equals Vin. Hence, the input
current is
19
If Vin is a constant voltage, then Iin is also a constant because the
inverting input always remains at 0V, keeping a constant voltage across Ri.
Because of the very high input impedance of the op-amp, there is negligible
current at the inverting input. This makes all of the input current go through
the capacitor, as indicated in Figure 2-9
The capacitor voltage: Since Iin is constant, so is IC. The constant IC charges
the capacitor linearly and produces a linear voltage across C. The positive
side of the capacitor is held at 0 V by the virtual ground of the op-amp. The
voltage on the negative side of the capacitor, which is the op-amp output
voltage, decreases linearly from zero as the capacitor charges, as shown in
Figure 2-10.
The output voltage: Vout is the same as the voltage on the negative
side of the capacitor. When a constant positive input voltage in the
20
form of a step or pulse (a pulse has a constant amplitude when high)
is applied, the output ramp decreases negatively until the op-amp
saturates at its maximum negative level. This is indicated in Figure
2-11.
21
2.2 Modulation
22
Fig., 2.1
Fig. 2.2
23
Burst Modulation
You can generate tone bursts of any output function except noise. In the
burst mode, the AD9833 will output an exact number of complete
waveform cycles after receiving a trigger. By adjusting the phase, you can
control where in the waveform the burst begins. While using the burst
mode, the maximum frequency for sine waves and square waves is 1
MHz, while triangles and ramps are limited to 100 kHz. Burst mode may
be used with arbitrary waveforms at any frequency.
Fig., 2.3
Frequency Sweeps
The AD9833 can frequency sweep any of its function outputs (except
noise). You can sweep up or down in frequency using linear or log
sweeps. Unlike conventional function generators, there are no annoying
discontinuities or band-switching artifacts when sweeping through
certain frequencies. The AD9833's DDS architecture inherently allows it
to perform smooth, phase-continuous sweeps over it's entire frequency
range.
24
Fig., 2.4
3 Hardware
There are two main parts regarding the hardware aspect of this
build: the power supply and the main PCB containing the function
generator IC and the microcontroller.
The main PCB will need two voltage rails: +12V and -12V. The
symmetrical supplies are needed for the final amplification of the signal.
A smaller +5V rail will be created directly on the main PCB by
regulating the +12V one; it is needed to power the microcontroller, the
AD9833, the function generator IC, and finally the 24MHz crystal
oscillator. Below you can find the schematic of the power supply board:
25
Fig., 3.1
3.1.2 Design
26
two large capacitors, each 1000µF rated at 35V. Below you can find the
output waveforms for the power supply rails at various stages:
3.1.3 Waveforms
Fig., 3.2
27
to be as smooth as possible, as we will be using them to offset our final
output voltage, and any AC components will propagate to the output.
Fig. 3.3
28
Fig. 3.4
Pin Description:
29
expressed as a binary fraction of the frequency of
MCLK. This clock determines the output
frequency accuracy and phase noise
6 SDATA Serial Data Input. The 16-bit serial data
-word is applied to this input
7 SCLK Serial Clock Input. Data is clocked into the
AD9833 on each falling edge of SCLK
8 FSYNC Active Low Control Input. FSYNC is the frame
synchronization signal for the input data. When
FSYNC is taken low, the internal logic is
informed that a new word is being loaded into the
device
9 AGND Analog Ground
10 VOUT Voltage Output. The analog and digital output
from the AD9833 is available at this pin. An
external load resistor is not required because the
device has a 200 Ω resistor on-board.
30
Fig., 3.5
3.2.3 Working
31
won’t be adding any pull-up resistors as we will be using the ones
integrated into the microcontroller.
A plain green LED is hooked up to pin PD7 (D7 on the Uno), for
debugging purposes or to display status. The display used is a simple
LCD with an HD44780 controller, which has 16 lines and two columns
and includes a backlight. To reduce the number of connecting wires, an
adapter board was used so that the only pins needed to control the LCD
are 2 for data over I2C and another 2 for power (+5V and GND). The
I2C lines on the microcontroller are on pins PC4 for SDA and PC5 for
SCL. On the Arduino Uno, these are named A4 and A5, respectively.
32
Fig., 3.6
3.2.4 Key Features
33
The output has a peak-to-peak value of 0.65V-0.038V (VOUT
maximum – VOUT minimum), and it has an offset of (0.65V-0.038V)/2.
This means that VOUT minimum is very close to 0V. One important
note is that the clock output (rectangular signal) has an amplitude of
2.5V, which is the voltage generated by the device's internal voltage
regulator.
Fig., 3.7
34
The output of the IC is fed into the non-inverting input of the
op-amp using a 1.3kΩ resistor. The trimmer POT1 (a variable resistor),
which has its side pins connected to -12V and +12V, has the sweeper
connected to a switch's input terminal to provide an offset voltage. The
other input terminal of the SPDT switch is wired directly to ground, and
the output terminal is connected to the non-inverting input of the
op-amp with another 1.3kΩ resistor. This configuration combined with a
50kΩ potentiometer allows us to have a variable gain between 1 and
approximately 20. This was computed using Millman’s theorem and the
fact that the op-amp keeps its inputs, V+ and V-, at the same voltage:
The offset voltage is set to -350mV using the trimmer POT1. When
the switch is in position 3 (R4 connected to ground), the output voltage
is the output of the IC, a signal with an amplitude of 350mV and an
offset of 350mV, multiplied by the gain set by the potentiometer POT2.
With this configuration, the output voltage can either swing from
-7V to +7V or from 0V to what the op-amp is capable of (something
near +12V).
35
The offset voltage is set to VOUT minimum of the AD9833. This is
then multiplied by the gain, which can vary from 1 to 20.
Fig., 3.8
4 Software
36
The proposed design of the functiong generator is shown in Figure
3-2 by using Multisim software. The design contains three part like illustrated
in Figure 3-1, and that can obtain three kinds of waveform with different
frequency. The testing result will be shown in the results section.
37
working with five registers: the control register; two phase registers,
PHASE0 and PHASE1; and two frequency registers, FREQ0 and
FREQ1.
4.1 Arduino
38
using traditional compiler toolchains, the Arduino project provides an
integrated development environment (IDE) based on the Processing
language project.
The source code for the IDE is released under the GNU General
Public License, version 2. The Arduino IDE supports the languages C
and C++ using special rules of code structuring. The Arduino IDE
supplies a software library from the Wiring project, which provides
many common input and output procedures. User-written code only
requires two basic functions, for starting the sketch and the main
program loop, that are compiled and linked with a program stub main()
into an executable cyclic executive program with the GNU toolchain,
also included with the IDE distribution. The Arduino IDE employs the
program avrdude to convert the executable code into a text file in
39
hexadecimal encoding that is loaded into the Arduino board by a loader
program in the board's firmware.
Pin Description:
40
Reset Reset Resets the microcontroller.
Used to provide analog input in the range
Analog Pins A0 – A5
of 0-5V
Input/Output Digital Pins 0 -
Can be used as input or output pins.
Pins 13
Used to receive and transmit TTL serial
Serial 0(Rx), 1(Tx)
data.
External
2, 3 To trigger an interrupt.
Interrupts
PWM 3, 5, 6, 9, 11 Provides 8-bit PWM output.
10 (SS), 11
(MOSI), 12
SPI Used for SPI communication.
(MISO) and 13
(SCK)
Inbuilt LED 13 To turn on the inbuilt LED.
A4 (SDA), A5
TWI Used for TWI communication.
(SCA)
To provide reference voltage for input
AREF AREF
voltage.
Operating Voltage 5V
Recommended Input
7-12V
Voltage
41
Input Voltage Limits 6-20V
SRAM 2 KB
EEPROM 1 KB
Pin Diagram:
42
Fig. 4.1
We will create two files, AD9833.cpp, the file that will contain
the source code, and AD9833.h, its header.
43
These can be one of two types: public, which we can call from
outside the class methods (functions), or private, which we can call only
when we are inside a class’s method.
44
Operation Register Value
Reset CNTRL D8 = 0 or 1
45
Sleep - Internal clock disabled CNTRL D7 = 1, D6 = 0
In the table below from the datasheet contains data of which bits
need to be set to execute the operations.
The registers have different sizes. The control register is 16 bits
long, the phase registers are 12 bits long, and the frequency registers
have 28 bits. To output data via SPI, we send one byte at a time, as can
be seen in the “writeData” function, starting with the low byte (first 8
bits from the data integer) and then the high byte.
frequency 2 28
FREQREG =
f mclk
46
4.3 Waveforms
47
Fig., 4.3: Triangular Wave of 1KHz
48
5 CONCLUSION
In this thesis, a function generator has been achieved. Three kinds of
waveforms have been generated by simulating the function generator and
debugging the model of the function generator. Also the frequency of the
each kind wave can be changed by changing the resistance and capacitance,
but the amplitude of the waveforms is unable to change.
49
Multisim is equipped with a database of as many as 22,000
components from leading semiconductor manufacturers such as Analog
Devices, National Semiconductor, NXP, ON Semiconductor, and Texas
Instruments. Choose from a comprehensive list of up-to-date amplifiers,
diodes, transistors, switch mode power supplies, and other components to
rapidly design and evaluate analog and digital circuits. So when use the
Multisim to simulate the function generator, it is possible to find all
components. But in our laboratory, that is not possible, sometime it is
necessary to change.
50
We believe there were a number of factors that allowed us to
succeed in this Industrial project. After finishing the Industrial Training,
we set ourselves a team goal that consisted of learning from the hands-on
practical experience in the industry. The sessions consisted of learning
various of the block level components used in a Function Generator and
learn how they work internally. These practical sessions pushed us to
refine our knowledge quickly and get to a grasp on the system. Once we
were able to display output waveform of Function Generator on the screen
of CRO, we implemented additional features on top of the original
waveforms like Lissajous patterns. Therefore, in the three weeks of the
training, we were always building on top of a working system. Finally, we
set ourselves clear goals every week and wrote them in a report. This
document served as a Go-To list to find out what we had to achieve each
week.
6 REFERENCE
http://www.hiqelectronics.com/
51