AD9833 DDS Waveform Generator

Generate any sine, triangle, or square wave from 0.1 Hz to over 12 MHz from a single chip — the same DDS engine inside every lab function generator and ham-radio VFO.

Difficulty: Breadboard. Estimated build time: about 35 minutes. Estimated parts cost: about US$11.80. 7-line bill of materials. Compare supplier offers when available. A microcontroller-driven function generator built around a single Direct Digital Synthesis chip.

Wire power and the SPI bus

The AD9833 runs from 2.3 to 5.5 V on AVDD and DVDD — most breakout boards tie them together to a single VCC pin. Connect VCC to 5 V (or 3.3 V if your MCU is 3.3 V), GND to ground, then SCLK, SDATA, and FSYNC to three free MCU GPIOs. Add a 100 nF ceramic from VCC to GND right at the chip and a 10 uF tantalum from VCC to GND a centimetre away for bulk. The breakout board's onboard 25 MHz crystal oscillator handles the reference clock for you — no extra wiring needed. The VOUT pin carries the synthesized signal, with a typical level of about 600 mV peak-to-peak into 200 ohms.

Push a 1 kHz sine wave to the output

Install the MD_AD9833 library by MajicDesigns. The sketch is: MD_AD9833 dds(FSYNC_PIN); in setup() call dds.begin(); dds.setMode(MD_AD9833::MODE_SINE); dds.setFrequency(MD_AD9833::CHAN_0, 1000); — that loads the frequency register with 10737 and the output is a clean 1 kHz sine. Probe VOUT with a scope — you should see about 600 mV peak-to-peak. If you don't have a scope, wire VOUT through a 1 uF cap into a powered speaker — you should hear a clean 1 kHz tone.

Sweep frequencies and switch waveforms

Inside loop(), step through frequencies: for (uint32_t f = 100; f < 10000; f += 100) { dds.setFrequency(MD_AD9833::CHAN_0, f); delay(20); } — a slow audible sweep from 100 Hz to 10 kHz. Change MODE_SINE to MODE_TRIANGLE or MODE_SQUARE1 (square at the set frequency) or MODE_SQUARE2 (square at half that frequency). For a finished function generator, add a rotary encoder and a small OLED, and you have a benchtop instrument that cost USD 500 in the 1980s for under USD 15 in parts.