You are on page 1of 7

QUN SUN et al: SIMULATION AND DESIGN OF A WAVEFORM GENERATOR BASED ON DDS TECHNOLOGY

Simulation and Design of a Waveform Generator Based on DDS Technology

Qun Sun 1*, Zhenmin Ge 1, Chao Li 2, Linlin Chen 1, Chong Wang 1

1
School of Mechanical and Automotive Engineering, Liaocheng University, Liaocheng 252059,China
2
College of Mechanical Engineering and Applied Electronics Technology
Beijing University of Technology, Beijing 100124.
* Corresponding author: sunxiaoqun97@163.com

Abstract - Waveform generators employed in college laboratories are often purchased instruments with ultra precision, which may
cause unnecessary expenditure since the prices are often high whilst some functionalities are not required. By analyzing the
principle of existing products, a simple waveform generator based on DDS (direct digital synthesis) technology has been developed
using AT89S52 single chip microcomputer combined with DDS chip AD9851, which can produce square wave, sine wave and
triangular wave signals. While meeting the requirements of college laboratories, surplus functionalities were avoided to limit the
cost. In addition to advantages such as small size, simple structure and easy operation, experiments showed that the generated
waveforms are of high precision.

Keywords - DDS technology, wave generator, AT89S52 microcomputer

I. INTRODUCTION The requirements of system design are to achieve the


basic functions of a waveform generator, i.e., ready to
Waveform generators are widely used in scientific configure the output signal waveform types, numerically
research, engineering education and production practice. control output signal amplitude and frequency, ensure the
Square waves and sine waves are extensively utilized output frequency to reach as high as 6 MHz, operate
signals, often as the standard signals in electronic circuit through the keyboard and display frequency and amplitude
performance test or parameter measurement [1-3]. etc.
In addition, many testing instruments also need standard The block diagram of the system construction is shown
sine wave and square wave signals to detect some physical in Figure 1, including a human-computer interface module,
quantities. The Direct Digital Synthesis (DDS) technology a micro-computer controller module, a signal generating
has been dramatically developed in recent years for several module and a signal processing module. The signal
advantages such as very high resolution, continuous phase processing module includes operational amplifier circuit
of frequency conversion, easy synthesis and convenient and filter circuit.
extension [4-8]. Waveform generators in many laboratories
at present are mainly purchased instruments with ultra
precision and high costs, which could cause waste of
resources since not all the functionalities can be fully
utilized[9-15].
For the above reason, a simplified waveform generator
has been developed using single chip microcomputer
combined with integration of DDS chip to achieve high
precision, small volume, simple structure and easy Figure 1. The block diagram of wave generator
operation. It can produce square wave, sine wave and
triangle wave to meet the requirements of laboratories in The frequency values are typed through a keyboard and
colleges and universities, whilst other functionalities not sent to the micro-computer control unit to judge whether it
commonly used are removed to limit the cost. is beyond the frequency range. If it is within the scope, then
the frequency control code is generated and sent parallel to
II. THE OVERALL DESIGN OF WAVE the DDS chip, which synthesizes the frequencies required
GENERATOR by the users and produces sine wave and square wave
signals, and shows on the LCD display through
A. System Design Requirement and Module programming. The waveform signals are processed through
Construction filter and operational amplifier circuits, and the amplitudes
can be adjusted by a slide rheostat.

DOI 10.5013/IJSSST.a.17.32.24 24.1 ISSN: 1473-804x online, 1473-8031 print


QUN SUN et al: SIMULATION AND DESIGN OF A WAVEFORM GENERATOR BASED ON DDS TECHNOLOGY

B. Selection of System Main Components In the -12V voltage generating circuit, a 10uF bypass
capacitor was added between pin CAP+ and pin CAP- to
The human-machine interface module consists of a avoid pressure drop attenuation, and a 10uF capacitor was
keyboard and LCD1602 display. The controller module is added to pin VOUT to introduce filter effect. This circuit is
based on an AT89S52 single chip microcomputer that a voltage inversion circuit, which outputs -12V voltage
controls other modules, and the signal generating module is through the stabilized +12V input voltage, as shown in
an AD9851 chip that produces the signal. The signal Figure 4.
processing module is a LM224 amplifier that processes
signals after these are produced.

III. HARDWARE DESIGN OF THE WAVE


GENERATOR

A. The Design of stabilized Voltage Supply

The power supply module provides voltage to the whole


circuit so that the voltage source condition determines the
performance of the circuit to a great extent. This design
employs three voltage source types including +5V and Figure 4. The circuit of generating -12V voltage.
±12V. It would be very inconvenient if all the required
voltages are external inputs, therefore a single +12V input B. Design of the Signal Generating Module
voltage was chosen as the power supply and the other two
voltages were obtained from conversion of +12V. Signal generation is made through an AT89S52 single
The single chip microcomputer in the control module chip microcomputer and a DDS chip AD9851. Users send
needs +5V voltage power supply, which can be obtained the frequency values through keyboard to the single chip
from a three-terminal voltage regulator LM7805. The signal microcomputer (SCM), where the frequency values can be
processing module LM224 needs ±12V power supply, processed into control word, and finally the control word is
where +12V voltage can be obtained directly, and the -12V sent to the DDS chip that can generate frequency
voltage is obtained by CMOS voltage converter controllable waveform signals. The circuit scheme of
ICL7662CPA. AT89S52 and AD9851 is shown in Figure 5.
The principle of the power unit is shown in Figure 2.

Figure 2. The principle of stabilized voltage supply

The 12V input produces +5V voltage after a filtering


circuit and the voltage regulator 7805 circuit. It needs to use
a 100uF capacitor and a 0.1uF capacitor before power
supply voltage input for the purpose of filtering, and to add
a 100uF capacitor and a 0.1uF capacitor at the voltage
output for the purpose of filtering and damping. A light
emitting diode is connected at the end of the output and Figure 5. The circuit scheme of AT89S52 and AD9851.
cascaded with a 1kΩ resistance to indicate the voltage. The
5V voltage regulator circuit is shown in Figure 3. C. Design of the Controller Module
+12V U1 VCC
1 V V 2
IN OUT
GND AT89S52 MCU is advantageous in its low power
consumption and has 8k internal storage capacity. The
3

D1
78L05 LED0
C3 C4 C7 C8
Cap
0.1uF
Cap Pol2
100uF
Cap
0.1uF
Cap Pol2
100uF XTAL1 and XTAL2 pins of the MCU are connected to a
R2
Res2 12M crystal oscillator and 30pF capacitors before
1K
grounding. The clock circuit can be set up as shown in
GND Figure 6.
Figure 3. +5V voltage regulator circuit

DOI 10.5013/IJSSST.a.17.27.23 23.2 ISSN: 1473-804x online, 1473-8031 print


QUN SUN et al: SIMULATION AND DESIGN OF A WAVEFORM GENERATOR BASED ON DDS TECHNOLOGY

The square wave amplifier circuit adopts inverting input


and the in-phase input was grounded. The input signal
connects with a 5kΩ resistor and then to the inverting input
terminal, while a 10kΩ slide rheostat was linked between
inverting input end and the output end. The amplification
factor ranges from 0 to 2 and the square wave amplifier
circuit is shown in Figure 9.

Figure 6. The clock circuit

The RST pin connects to a switch button and VCC, with


a 10uF capacitor in parallel connection, grounded via a 10K
resistor. This constitutes a reset circuit as shown in Figure
7.

Figure 9. The square amplifier circuit

The sine wave amplifier circuit adopts inverting input


Figure 7. The reset circuit and the in-phase input was grounded. The input signal
connects with a 5kΩ resistor and then to the inverting input
D. Design of the Human-Machine Interface Module terminal, while a 10kΩ slide rheostat was linked between
inverting input end and the output end. The amplification
LCD1602 with 2×16 characters, internal font,and factor ranges from 0 to 10 and the sine wave amplifier
adjustable character brightness is chosen as LCD display circuit is shown in Figure 10.
module.
The 8-line data cables of the LCD module are connected
to the microcontroller Port 0, while pin RS, pin RW, pin E
respectively link to P3.5, P3.6 and P3.7 of the MCU, with a
slide rheostat used to adjust the brightness of the display.
The LCD interface circuit is shown in Figure 8.

Figure 10. The sinusoidal amplifier circuit

Compared with the inverting circuit, a 0.1uF capacitor


was used to replace the resistor as the feedback element, so
as to construct an integral arithmetic circuit. Its role is to
convert square wave signals into triangle wave signals, as
shown in Figure 11.

Figure 8. The LCD interface circuit.

E. The Design of Signal Processing Module

Op-Amp LM224 was chosen within amplifying circuit


and integral circuit for signal processing, and the amplitude
was adjusted by a slide rheostat. Figure 11. The circuit of generating triangular wave

DOI 10.5013/IJSSST.a.17.27.23 23.3 ISSN: 1473-804x online, 1473-8031 print


QUN SUN et al: SIMULATION AND DESIGN OF A WAVEFORM GENERATOR BASED ON DDS TECHNOLOGY

The triangle wave amplifier circuit adopts inverting modes are detected, the program moves into different sub-
input and the in-phase input was grounded. The input signal functions.
connects with a 1kΩ resistor and then to the inverting input
terminal, while a 10kΩ slide rheostat was linked between
inverting input end and the output end. The amplification
factor ranges from 0 to 10 and the square wave amplifier
circuit is shown in Figure 12.

Figure 12. The triangular amplifier circuit

F. The Anti-Interference Design

The anti-interference circuit adopts an elliptic filter as


shown in Figure 13. Since this signal generator is a hybrid-
system of digital and analogue circuits with very high
operating frequency, much attention should be paid to the
PCB anti-interference design. The PCB separates the layer
out and wiring of digital circuit and analogue circuit, while
the digital signal ground and analogue signal ground are
separated but grounded at one point. The crystal oscillator
is close to the pins of the DDS chip. The wires of the crystal
oscillator and the power supply were thickened.

Figure 13. The filtering circuit


Figure 14. The main program flow chart

IV. THE SOFTWARE DESIGN OF WAVE


B. The design of DDS Controller
GENERATOR
The DDS control flow chart is shown in Figure 15.
A. The Main Program Design
Programming the DDS chip will make the DDS chip
produce square wave or sine wave signals that are of the
The software is based on the idea of structured and
corresponding frequencies. The D/A output voltage of
modular design, and the flow diagram is shown in Figure
MCU can be adjusted according to the input amplitude, so
14. The initialization program mainly writes in several
as to control the amplitude of the square wave and sine
special function registers, and sets the working modes and
wave, and store the frequency and amplitude values into
initial values of each module. If the reset source is
MCU internal flash to avoid losing data. If the reset source
watchdog or the clock looses detector, the latest working
is watchdog or the clock looses detector, the frequency and
condition will be restored. The keyboard scanning is
amplitude values saved in the last working cycle is restored.
controlled by the T0 timer, and after different waveform

DOI 10.5013/IJSSST.a.17.27.23 23.4 ISSN: 1473-804x online, 1473-8031 print


QUN SUN et al: SIMULATION AND DESIGN OF A WAVEFORM GENERATOR BASED ON DDS TECHNOLOGY

conditions. The oscilloscope is a selected DS1102E digital


Start
oscilloscope.
Statistical method has been used for the sampling test,
mainly to see whether or not a waveform has distortion. The
Input the Frequency data collection procedures of three waveforms are the same.
Firstly, the frequency is fixed at 1Hz to detect the waveform
ranging from 1V to 10V using 1V step. Then the frequency
is fixed at 10Hz to detect the waveform ranging from 1V to
10V using 1V step. The tests are carried on using this
The requency is Yes
beyond the scope? method by gradually increasing the frequency.

A. The Square Waveform Testing


No

Convert the In order to make waveform more accurate, some


frequency into improvements to the original amplifier circuit has been
control word made by adding a voltage comparator to the circuit. UR is
the reference voltage added to the in-phase input end and
the input voltage U1 is added to the inverting input end.
Send control word,
The operational amplifier works in an open loop condition.
writing enabled
Because of high voltage in open-loop amplification and a
tiny difference can lead to output saturation voltage, an
ideal square wave only exists in a saturated zone. The actual
End
square wave experiment is shown in Figure 16.

Figure 15. The DDS flow gram

C. The key Scanning Program

The keyboard is firstly initialized and anti-shake


program is added to prevent detection error during key
scanning. If key 1 is pressed, the LCD cursor moves to the
right. Pressing key 2 increases the frequency value, and
pressing key 3 reduces the frequency value. If key 4 is
pressed, the microcontroller will reset and the program will
restart.

D. The LCD display

The display module is a LCD1602 panel that can


display two lines and each line can display 16 characters.
Firstly initialize LCD1602 and then set the position of the Figure 16. The measured drawing of square wave
first line and display the contents of the first line. In order to
ensure that the control command can be received B. The Sinusoidal Waveform Testing
completely, time delay is added in the program. The second
line is configured after completion of the first line of data The sinusoidal wave is output directly by the AD9851,
transmission, using the same approach as for the first line. by adjusting the slide rheostat to adjust the amplitude. For
sinusoidal wave with any arbitrary frequency and
V. EXPERIMENTAL ANALYSIS AND amplitude, the test found that the waveform is ideal. The
IMPROVEMENT OF THE WAVE GENERATOR actual experiment of sinusoidal wave is shown in Figure 17.

Because this design is for laboratory in colleges and


universities, therefore there are not very strict requirements
for environmental conditions. The scope of the room
temperature ranging from 10Ԩto 35Ԩ have been provided,
and relative humidity is no more than 80% under the testing

DOI 10.5013/IJSSST.a.17.27.23 23.5 ISSN: 1473-804x online, 1473-8031 print


QUN SUN et al: SIMULATION AND DESIGN OF A WAVEFORM GENERATOR BASED ON DDS TECHNOLOGY

Figure 17. The measured drawing of sinusoidal wave.

C. The Triangular Waveform Testing (A)Before improvement;(B)After improvement;(C)Frequency control


word
Triangle wave generating circuit is actually an integral Figure 19.The experimental data of frequency testing
circuit, which is integral of the square wave output of
AD9850, resulting in a triangle wave. Because the E. The Improvement of System Amplitude-Frequency
triangular wave is obtained by square wave, the quality of Characteristics
the square wave directly affects the quality of the triangular
wave. Therefore, in order to get ideal triangle wave, it is Before nonlinear compensation, the D/A output voltage
essential to firstly ensure the quality of the square wave. is linear and its input amplitude is fixed at 306mV. The
The actual experiment of triangular wave is shown in system amplitude-frequency characteristics are those
Figure 18. characteristics of the operational amplifiers. The amplitude-
frequency characteristic curve is shown in Figure 20, where
the signal attenuation is 0dB within the low frequency band
and the actual output amplitude is consistent with the
configured range. When the frequency is 80 kHz, the
amplitude begins to decay, the higher the frequency the
greater the decay. The amplification factor decreases when
the input signal frequency is increased.

Figure 18. The measured drawing of triangular wave.

D. Improvement of the System Frequency Performance

Frequency synthesis adopts a ROM look-up table. From


the perspective of the application, the frequency control
word determines the output frequency and sampling points,
which can either increase the frequency decreasing the
sampling points, or decrease the frequency and increase
sampling points. Due to variations of output frequency, the
output waveform signal distortion also changes, as shown in Figure 20. The comparison of the amplitude-frequency characteristics of
before and after non-linear compensation.
Figure 19.

DOI 10.5013/IJSSST.a.17.27.23 23.6 ISSN: 1473-804x online, 1473-8031 print


QUN SUN et al: SIMULATION AND DESIGN OF A WAVEFORM GENERATOR BASED ON DDS TECHNOLOGY

[6] Yifan TAO. Design of a Signal Generator Based on AD9854[J].


Control & Automation, 2006(02Z): 241-243.
[7] Guoguang ZHANG. Research of DDS-based high-precision multi-
channel signal generation system[J]. Electronic Measurement
Technology,2014,37(4):125-129.
[8] Qun SUN, Qing SONG. Portable signal generator based on direct
digital synthesis[J]. Instrument Technique and sensor .2009,4(4):67-
70.
[9] Jianqing LIAO. Design of Phase Adjustable Signal Generator Based
on DDS[J].Journal of Luoyang Normal University, 2014,33(2):29-
32.
[10] Zhengjiao CAO. Design of DDS Signal Generator Based on
FPGA[J].Computer Measurement & Control, 2011,19(12):3175-
3177,3186.
[11] Yingying SUN, Jingyang LU, Sijiu LIU, Hongqi BEN. Design of
sinusoidal signal generator based on AD9833 and
Figure 21. The developed waveform generator. potentiometer[J].Electrical Measurement & Instrumentation,
2012,7:93-96.
[12] Dawei YANG, Xiufang YANG, Jianghong CHEN. Design and
VI. CONCLUSION implementation of direct digital frequency synthesis
[13] Chuansheng ZHANG. Visualization Versatile Waveform-generator
Based on S3C2440 [J].Chinese Journal of Liquid Crystals and
The lost cost waveform generator has been developed Displays, 2014, 29(6):939-943.
with several advantages such as high precision, small size, [14] Shou.Y.Z, Zhang.H, Ge.Y.H. Design and Implementation of DDS
simple structure and easy operation. It can produce square Signal Generator Based on FPGA[J]. Journal of Jimei University
wave, sine wave and triangle wave signals to satisfy the (Natural Science), 2014, 19(5):393-400.
[15] ZHANG Genxuan,WU Zihuai. Design of Signal Generator Based on
requirements of laboratories in colleges and universities. At AT89S52 Microcontroller[J]. Journal of Hunan Institute of
the same time, some rarely used functions have been Engineering, 2010, 20(3): 18-20.
removed to reduce costs.
Under the control of the MCU, waveform signals with
adjustable frequency and amplitude can be directly
synthetized by the DDS device. According to the sampling
theorem, the frequency of the output sine signal can reach
6MHz when the DDS chip uses a 125MHz reference clock.
However due to restrictions of the operational amplifier, the
waveform quality becomes poor when the output frequency
increases to 10MHz.

ACKNOWLEDGEMENT

This project is founded by Shandong Province special


funding to upgrade technology research of large scientific
instruments (ID: 2013SJGZ26) and national college
students innovation and National Training Programs of
Innovation and Entrepreneurship for Undergraduates (ID:
201510447034) .

REFERENCES

[1] Xiaoling XIA. The design of waveform generator based on FPGA


and MCU[J]. Electronic Technology & Software Engineering. 2015,
06:141.
[2] Haibo WANG, Weitao REN, Xu LIU. Simulative HPM Pulse
Generation Based on Arbitrary Waveform Generator[J]. Modern
Applied Physics, 2015,01: 66-69.
[3] Shuming LAI, Zhuoxin YANG, Lijuan ZHANG. A new type of
digital development of high frequency signal generator[J]. Digital
Technology and Application, 2015, 02: 60-61.
[4] Kaiyan LI. Multi-functional signal generator[J]. Journal of Tianjin
University of Commerce, 2006,26(3):69-71.
[5] Wenting LI, Shaobo LIU, Zhaozhi LONG. Calculated performance
analysis of impulse measurement software[J]. Electrical
Measurement & Instrumentation, 2015,01:64-69.

DOI 10.5013/IJSSST.a.17.27.23 23.7 ISSN: 1473-804x online, 1473-8031 print

You might also like