Signal generators are widely used in experimental courses of universities. However, most of the commercial tests signal generators are expensive and bulky. In addition, a majority of them are in a fixed working mode with many little-used signals. In order to improve this situation, a small sized and highly accurate economic signal generator based on DDS technology has been developed, which is capable of providing wave signals commonly used in experiments. Firstly, it is introduced the basic principles of DDS and is determined the overall scheme of the signal generator. Then, it proposes a design of the hardware, which include power supply module, display module, keyboard module, waveform generating module based on DDS chip, and the minimum system module based on C8051F010. The signal generator was designed to output sine and square waveforms, and the other achieved performances included the frequency range 0.1 Hz–12.5 MHz, the frequency resolution 0.05 Hz–0.1 Hz, the output amplitude 1.0–4.5 V, the frequency accuracy
Signal generators are widely utilized in experimental courses [
The basic principle of DDS is using the phase concept to carry out frequency synthesis [
Diagrammatic sketch of the operating principle of phase accumulator.
The functional structure of the signal generator block diagram, as shown in Figure
Block diagram of the signal generator based on DDS.
As shown in Figure
Circuit of the power supply.
The liquid crystal display module was built on LCM1602 that has 2 × 16 characters and internal font. The interface is shown in Figure
The interface circuit of LCD.
The front panel of the signal generator is shown in Figure
The shifting keyboard panel design.
As shown in Figure
The keyboard circuit.
As is shown in Figure
The circuit of wave generator.
According to the required sinusoidal amplitude which is input by the keyboard, the D/A port of the microcontroller produces a corresponding DC signal, then feeds it to the multiplier, and multiplies it with a fixed amplitude sinusoidal signal, to achieve the function of regulating the amplitude, as shown in Figure
The circuit of regulating the sinusoidal amplitude.
The multiplier is selected to be MPY634, which is powered by ±15 V voltage, and can adopt a single-ended input (±10 V) or a differential input (
Since the multiplier has internal negative feedback and
The sinusoidal wave amplitude ranges from 0.038 V to 0.650 V; thus the DC component (
Assuming the resistances of
Therefore,
Assuming that
The current of the multiplier output cannot output directly because of its weakness of driving power, so a high speed operational amplifier must be set before the input of the multiplier to increase the output current.
Taking
The output voltage of DAC of the MCU is ranging from 0 to 2.4 V and the sinusoidal waveform of DDS is ranging from 0 to 0.65 V, so the DC component of sinusoidal waveform (
Reducing the DC component at
Multiplying the two differential inputs
The way of the circuit connection decides the value of
When Port SF is hanging, the amplification factor is SF = 10 V which is accurately modified by laser in the integrated circuit and the error is 0.1% or less.
Through resistor
Defining
Because of the amplifier providing
The amplitude of sinusoidal waveform ranges from 0.038 V to 0.650 V and its DC component is 0.344 V, which is obtained by resistor divider. As shown in Figure
The circuit of offset voltage of the amplifier.
Taking
Therefore, the output scope of reference voltage ranges from 0.3125 V to 0.6250 V, and it is possible through adjusting potentiometer to get the offset voltage of 0.344 V. Therefore it is possible to eliminate the DC component of sinusoidal waveform from DDS output. Introducing a positive feedback to the circuit constitutes a hysteresis comparator, through adding a branch of voltage divider from comparator output to in-phase input. This can be seen from the schematic in Figure
Principle of the hysteresis comparator.
The schematic diagram of hysteresis comparator
The voltage transmission characteristic of hysteresis comparator
When input voltage
When the input voltage
The threshold voltage is
From Figure
The circuit of generating square waveform is shown in Figure
The circuit of generating square waveform.
As shown in Figure
The circuit of relay controller.
When the sine/square waveform switch is released, SIN/REC becomes high level, and there is no current through the relay coil or the current is very small, which means that it does not produce magnetic force. The connection of PIN6 and PIN7 will put the sinusoidal signal into the comparator to create square waveform. Then, the square signal will input into PIN2 of the decay, which would sent to external interface because of the connection of PIN2 and PIN3. When the sine/square waveform switch is pressed, SIN/REC changes to low level; thus the relay coil generates a magnetic force. The connection of PIN5 and PIN6 separates the sine wave signal from the comparator to prevent generating interference. The connected PIN4 and PIN3 deliver the sine signal generated from the amplitude to the external output interface.
As shown in Figure
The controlling circuit of MCU.
Because of the hybrid-system of digital circuit and analog circuit, and its high operating frequency, much attention should be put to the deployment of PCB and its anti-interference design. Considering the cost and the size, the PCB board is designed with double-layer plate and double wiring. Separate the digital circuit and analog circuit in PCB layout and wiring. In general, we should adopt the way of separating digital signal ground with analog signal ground and connecting them at a point. For the part of analog circuit, which includes DDS chip, multiplier, and relay, it should use the way of linking grounds, respectively, and linking the ground at a point, thicken the ground line at the same time.
The clock circuit of DDS wave generator is a critical part in the design, which can be easily interfered and have great influence on the quality of the output wave, so we should pay special attention to this part. In order to reach the purpose of isolation, the crystal oscillator should be close to the pin of DDS chip, thicken the line of crystal oscillator and the power, add cuprum to the shell of the crystal oscillator. The PCB design diagram of AD9833 is shown in Figure
The PCB design diagram of AD9833.
We should make the power line bold as large as possible because of its high current and take the impedance into consideration. The STAR structure is used in the power wiring. In fact, in this design, it is designed into the shortest structure by manual wiring at first, which must control the width of the conducting wire. Then, for each current channel of their device, the conducting wire must guarantee more than 20 mils. Finally, the circuit will be fulfilled into STAR structure. Finally fulfill the circuit into STAR structure. The whole PCB design diagram is shown in Figure
The whole PCB design diagram.
The main program diagram of SCM software is shown in Figure
The main program diagram.
AD9833 is programmable DDS signal generator with two 28-bit frequency registers inside and two 12-bit phase registers. The software block diagram is shown in Figure
The block diagram of DDS writing data.
Firstly, write 16-bit operating mode command word to determine working conditions and select the frequency register and phase register, and, secondly, write one or two frequency control words to control the output frequency. Finally, write phase control word, so that the DDS signal generator can output waveforms corresponding to a frequency determined by the value of the frequency register, and the phase determined by the value in the mode register. The sequence chart of data writing is shown in Figure
The sequence chart of DDS writing data.
The block diagram of keyboard scanning is as shown in Figure
The block diagram of keyboard scanning.
In different modes, the LCD must display different interface for the user. If it is the normal sinusoidal waveform generation mode, as demonstrated in Figures
The block diagram of LCD displaying under the state of sinusoidal wave.
Normal mode
FM mode
AM mode
The LCD working sketches under the state of sinusoidal wave.
Normal mode
FM mode
AM mode
Using the keys is the only way to adjust the frequency under the condition of the square wave, so there are only two modes in this state: normal mode and FM mode. If it is the normal mode as shown in Figure
The LCD working sketches under the state of square wave.
Normal mode
FM mode
The control word
Among the above,
The most significant deviation of the frequency control word is 0.5, so the frequency resolution is
The worst relative frequency accuracy is
In the formula,
The more the sampling points, the higher the frequency accuracy; on the contrary, the fewer the number of samples, the lower the frequency accuracy. In this paper, the number of points varies with different output frequencies, which means the accuracy of frequency can be different:
When considering the impact of D/A converter on the accuracy of waveform distortion, the equation can be rewritten as
In the formula,
The frequency synthesizer in this paper is based on ROM look-up table. The principle suggests that the frequency control word not only determines the output frequency, but also determines the number of sampling points of the synthesized signal. The larger the frequency control word, the larger the output frequency and the smaller the number of sampling points; on the contrary, the smaller the frequency control word, the smaller the output frequency and the larger the number of sampling points. Along with the output frequency variation, the output signal waveform distortion also changes.
The waveform distortion contrast chart is shown in Figure
The waveform distortion contrast chart.
The normal sine wave output
The distorted diagram
This paper presents the maximum and minimum output signal waveform distortion:
The frequency testing data curves are as shown in Figure
Experimental data of frequency testing.
In the above
As shown in Figure
Amplitude characteristic.
Set the output amplitude to 1 V
Set the output amplitude to 2 V
Set the output amplitude to 3 V
Set the output amplitude to 4 V
The amplitude and frequency are improved by the above method, and the output of the sine wave is measured as an example. Figure
Sinusoidal signal output waveform with different frequency and fixed amplitude.
The sinusoidal signal waveform output peak-peak voltage of 4 V and frequency of 6 Hz
The sinusoidal signal waveform output peak-peak voltage of 4 V and frequency of 3 Hz
The sinusoidal signal waveform output peak-peak voltage of 4 V and frequency of 1 Hz
Sinusoidal signal output waveform with different amplitude and fixed frequency.
The sinusoidal signal waveform output peak-peak voltage of 5 V and frequency of 3 Hz
The sinusoidal signal waveform output peak-peak voltage of 3 V and frequency of 3 Hz
The sinusoidal signal waveform output peak-peak voltage of 2 V and frequency of 3 Hz
A signal generator with integrated programmable DDS device is present. By DDS device and microcontroller, and it can change frequency and phase under the control of MCU. The amplitude of the output sinusoidal signal can be adjusted using the microcontroller; 12-bit D/A port was used to generate a variable voltage and then do the multiplication with the fixed amplitude of a sinusoidal signal in the multiplier. A sinusoidal signal with certain amplitude can be changed into a square wave signal through hysteresis comparator, changing comparison voltage to adjust the variable duty cycle of the square wave. Experimental results showed that the signal generator is of high resolution, high precision, small size, and light weight and is convenient and stable in use. According to the sampling theorem, the system DDS chip operates at 25 MHz reference clock, and the output frequency of the sinusoidal signal can theoretically reach 12.5 MHz. However, when the output frequency increases to 10 kHz the amplitude begins to decay due to bandwidth limitations of the multiplier. Although nonlinear compensation algorithm has been used in the system software to enlarge bandwidth to some extent, further improvements are still needed.
The authors declare that there is no conflict of interests regarding the publication of this paper.
This project is funded by Shandong Province special funding to upgrade technology research of large scientific instruments (ID: 2013SJGZ26).