DDS Signal Generator
1Hz to 10MHz
Sine, Triangle, Square Wave and Sweep
Touch screen display and control
This easy to build signal generator will generate signals covering a wide range from audio to RF. The output frequency can be set precisely and it can be used as a sweep generator to test the frequency response of audio circuits, IF filters and more.
It is based on a low cost (US$10), fully assembled DDS module and will make a handy addition to any toolkit.
This project was described in the April 2017 issue of Silicon Chip magazine. This web page provides a shorter description so, if you would like the full story, you are encouraged to read the magazine article. Back issues of the magazine can be purchased from Silicon Chip or electronic access can be purchased for about the cost of the printed issue.
1Hz to 10MHz selectable with 1Hz resolution. Accuracy ±50ppm.
3V peak-to-peak (about 1V RMS) from 10Hz to 1MHz (0.8V peak-to-peak at 10MHz).
Adjustable down to 10mV peak-to-peak (about 3mV RMS).
Selectable Amplitude Modulation (1KHz square wave).
THD < 0.05% at audio frequencies.
1Hz to 1MHz selectable with 1Hz resolution. Accuracy ±50ppm.
Maximum 3V peak-to-peak from 20Hz to 1MHz. Adjustable down to 10mV peak-to-peak.
1Hz to 1MHz selectable with 1Hz resolution. Accuracy ±50ppm.
Fixed 3.3V peak-to-peak from 20Hz to 1MHz.
Sine wave sweep from 1Hz (minimum) to 10MHz (maximum) selectable with 1Hz resolution.
Sweep rate selectable between 50mS, 100mS, 200mS, 500mS, 1 second or 2 seconds.
Linear sweep or exponential.
Output level from 3V to 10mV peak-to-peak.
Power: 4.5V to 5.5V DC at 350mA
Micromite LCD Backpack
This project is based on the Micromite LCD Backpack which is the combination of a low cost colour LCD display and a 32 bit microcontroller programmable in BASIC. In part this project was created to provide an example of what the Micromite is capable of so please feel free to download the BASIC program and extract portions of it for your own projects.
If you have a backpack and just want to play with the program you can do this because the DDS Signal Generator program will run exactly the same with or without the DDS function generator module.
How It Works
This signal generator is just the combination of two modules with the BASIC program making them work together. The first module is the Micromite LCD Backpack (described above) and the second is a DDS module based on the Analog Devices AD9833 waveform generator IC. The BASIC program running on the Micromite is responsible for the user interface and sends the required commands to the AD9833 waveform generator IC which creates the waveforms.
The module also includes a AD8051 rail to rail amplifier (also manufactured by Analog Devices) which can drive low impedance loads (eg, 50Ω) and also provides higher output levels (up to 3V peak to peak). To control the gain of the output amplifier the module uses a Microchip MCP41010 8-bit digital potentiometer which is also under control of the Micromite.
The diagram on the right shows the basic functions of a DDS sine wave generator. On every sample clock cycle the value in the frequency register is added to the phase register and any overflow is discarded. In the AD9833 the phase register is 28 bits long and the lower 12 bits are used to index into the wave table which is a read only memory (ROM) containing a lookup table of sine wave values. The output of the ROM is then fed to a 10-bit digital to analogue converter (DAC) to create the analog waveform.
The Direct Digital Synthesis technique allows the output frequency to be precisely selected by writing a value to the frequency register and because the waveform is derived from a crystal oscillator calibration is not be required and the frequency will not drift with time.
Sine, Triangle and Square Wave Output
Using the colourful LCD touch screen the operation of the signal generator is intuitive and reasonably obvious. On the bottom of the screen there are four touch sensitive icons which are used to select the four operating modes. For sine, triangle and square wave modes the frequency is adjusted by touching the red up/down buttons on the right of the frequency display. The least significant digit that you want to change is specified by touching any digit which will be highlighted in blue. If you hold down either the up or down buttons the frequency will increment or decrement with increasing speed.
If you want to jump to a specific frequency you can touch and hold a digit on the display and an on-screen numeric keypad will pop up allowing you to directly key in the frequency that you want.
Adjusting the signal level is similar although you do not need to select a digit as the up/down buttons will always change the least significant digit. Touching a digit in the signal level display will also take you to a numeric keypad where you can enter a specific level. The level is specified as a number from zero to 100 where 100 is the full output (about 3V peak-to-peak).
All the changes that you make are automatically saved in non volatile memory. This means that when you turn on the signal generator it will start up with exactly the same settings that you were using the last time.
Because the waveform is digitally created the output is not perfectly smooth. The resulting harmonic distortion means that you cannot use the sine wave output for precise noise and distortion measurements however it is perfectly good for general purpose tasks.
Following the amplifier the module incorporates a low pass filter (to reduce distortion) and this reduces the signal level above about 2MHz. The output is still good for up to 10MHz but the signal level for sine waves will be reduced and the triangle and square waves will look more like sine waves so they should only be used for frequencies up to 1MHz.
In sweep mode the display is different, as shown on the left. You can select the start and stop frequencies as well as the output level, the sweep speed and the sweep type (linear or logarithmic).
When you touch a frequency number or the signal level number a pop up keyboard will allow you to select the exact frequency or level. This keyboard is illustrated on the right.
The sweep time is a little different, every time you touch it the sweep speed will cycle between 50mS, 100mS, 200mS, 500mS, 1 second or 2 seconds for the full sweep. Normally the frequency sweep is linear with time however you can select an exponential (ie, log) sweep with the Log check box.
The swept output is a sine wave and at the start of the sweep the Micromite will generate a 250µS positive going pulse on its pin 15, which is connected to the trigger output RCA socket. This signal can be used to trigger an oscilloscope so that it can lock onto the start of the sweep cycle for analysing the frequency response of a circuit or device.
Because the signal generator is based on two self contained modules the full circuit is relatively simple .
The Micromite LCD Backpack consists of a 28-pin microcontroller with a low cost LCD display and less than a dozen other components and can be built in half an hour. If you are not familiar with it you should read this web page for the full description and assembly instructions. Another component that you need to be familiar with is the standard 28-pin Micromite and this page provides a short description of it. For further information it is worth downloading the Micromite User Manual which covers every aspect of the device.
The AD9833 module is supplied fully assembled so you have an easy job there. There are a number of outputs on the module but you need to use the pair marked PGA and GND as they provide the amplified output with the gain controlled by the Micromite.
For the output you can do pretty much what you like. I used AC coupling via a capacitor and a second output socket which attenuated the main output by a factor of ten. Between the two output sockets this gives an output range from about 10mV to 3V peak to peak. You could use switches to select between DC and AC coupling, or even switch in different levels of fixed attenuation. Another variation would be to replace the RCA output sockets with BNC versions. There are many ways to go in this area.
Sourcing the DDS Module
To find the DDS function generator module on eBay.com you should search for "AD9833" and you will get plenty of hits with prices of about US$10 (try this link).
However, you must be careful to purchase the correct module – there are a number of variations out there and the firmware is written specifically to suit the module pictured on the right – it will not work with other modules, even if they also use the AD9833. So, check that the photograph matches perfectly and do not purchase anything different.
Many of the photos on eBay show the module with the I/O connector and SMA output socket already soldered to the board but most vendors supply these two components separately as shown in the photo.
When it comes to putting the signal generator into a box you can again do pretty much what you want. I built mine in a standard sized UB3 plastic box. Suitable suppliers for this are Altronics (Cat H0203) and Jaycar (Cat HB6013).
I replaced the lid with a plastic sheet sold by Silicon Chip which was laser cut by them to suit the 2.8" version of the Micromite LCD Backpack. If you do not want to go to this expense you can fabricate your own by cutting the required holes in the standard lid supplied with the box.
The AD9833 module should be mounted on the base of the box positioned so that it will not interfere with the pin headers on the Micromite LCD Backpack and then you can use point to point wiring to connect it to the backpack. For this it is worth using wires with "DuPont" connectors on the end so that you can easily remove the connections for testing or if you need to replace something.
The output components are best mounted on the connectors themselves. The photo at the bottom of this page shows what the completed prototype looks like.
If you do not have a PIC32 programmer you can purchase a 28-pin PIC32 microcontroller from Silicon Chip magazine pre programmed with the full firmware (ie, SigGeneratorFull.hex). This makes it very easy, all that you need do is just plug the chip into its socket on the PCB. Silicon Chip also offer a full kit of parts for the Micromite LCD Backpack, their front panel, the PCB, etc. Follow this link if you are interested.
If you already have a Micromite LCD Backpack you can load the BASIC program SigGenerator.bas (available below) into MMBasic and run it. You can do this even if you do not have a AD9833 module connected as the BASIC program only sends commands to the AD9833 module (it does not expect a response) and this allows you to play with the program to see how it works.
This is a combined firmware file that contains the Micromite firmware configured for the LCD panel, the fonts and the BASIC Signal Generator program.
|Signal Generator BASIC Program (SigGenerator.bas)||DOWNLOAD|