DDS Sine Sweeper


AD9850 Module

Circuit Diagram



A sweeping sine signal source based on the STM8S-Discovery and a cheap AD9850 module.  Capable of frequencies from 1Hz to 40MHz (potentially up to 60MHz).  It outputs a 1Vp-p signal and trigger output to synchronise an oscilloscope for quick frequency response testing.

The AD9850 is a Direct Digital Synthesiser which allows you to generate sine waves in steps of less than 1Hz,  up to about 60MHz.  I used a cheap module from eBay  which cost about £5 (roughly $8), this is rated up to 40MHz due to the on-board filter. It also has a square wave output, but due to the poor decoupling around the IC it creates bad switching transients (probably why it's so cheap).


The hex file is located in the firmware directory and can be flashed using the ST Visual Programmer, the circuit diagram is located in the schematic directory.  Although the Eagle schematic does include footprints these haven't been checked so it's advisable to use breadboard for the construction.

I also recommend turning the potentiometer to either of it's limits otherwise the sine output gets mangled on each edge of the square wave output.

The modules I used have a 125MHz crystal which seems very common. If yours has a different frequency you'll have to change the AD9850_CLOCK definition in main.c otherwise the output frequency will be off.


Use the Left/Right buttons to move between digits and options, the Enter button selects a digit or option.

Options are indicated by a right arrow.

To change the frequency move to the desired digit, press Enter and use the Left/Right buttons to change the digit. Press Enter again when finished.

To start sweeping use the Left button and move to the arrow, press Enter and use the Left/Right buttons to select a mode. Press Enter again when finished.

When a sweep mode is selected enter the desired frequency limits, followed by pressing Enter on OK. The next screen allows you to select the period or the step of the sweep. Finally start the sweep by selecting OK.

To stop the sweep press Enter which will return to the fixed mode.


  • Fixed - Output a single fixed frequency (defaults to 10MHz)
  • Ramp Sweep - Sweep from the start to stop frequencies and repeat
  • Triangle Sweep - Sweep from the start to stop frequencies, reverse and repeat
  • Restore defaults - Restore the firmware default frequencies


Testing frequency responseFrequency response setup

Connect the sine output of the Sweeper to the input of the filter, amplifier or device under test (DUT).

Connect the output of the DUT to the oscilloscope channel 1. Set this channel to AC and optionally set a logarithmic x-axis.

Connect the trigger output of the Sweeper to the oscilloscope channel 2.  This channel should be set to DC and optionally hide this channel.

Set the oscilloscope to trigger on the falling edge of channel 2 and select it's mode to 'Normal'.

Start sweeping with a period of 1 second and adjust channel 1 so 0v is at the bottom of the scope display.  Now adjust the timebase so an entire second is shown and adjust the position of the sweep to show the whole response.

For a clearer plot it's worth setting the scope to peak (or fill) mode.

For a more in depth look at this method check out Dave Jones (a.k.a That Crazy Aussie Bloke) in EEVBlog #396. Please note that he uses a positive going trigger pulse but the Sweeper outputs a falling pulse.

Below is an screen shot from an Owon PDS5022S with a simple 3400kHz low-pass filter from 20Hz to 10kHz and a 10 second period:

Oscilloscope screen capture




Click to view comments

I think you'll find this website interesting

I have a setup like this using an AD8310 ( ) which outputs an accurate db signal level scale on a scope. It's great for designing and aligning all sorts of RF filters or equipment testing. Making this work with your setup should mostly be hardware and the AD8310 (and 8307) are very easy to use 8 pin IC's

Al's picture

Thanks for the links, it's interesting to see some other applications.

I'm working on an upgraded version of this based on the STM32F4 which is much more flexible and also uses a GPS receiver to calibrate the output frequency. Don't expect anything soon as my other projects are taking all my time at the moment, but I'll post it at some point.

You say these can potentially run to 60MHz - can I use a cheap eBay one if I remove the filter? I only want to use the sinewave output.


Al's picture

The 60MHz limit is due to the maximum frequency of the AD9850 clock (125MHz @5v and 110MHz @3.3v). At 60MHz the output would be very distorted and therefore it's probably better (apart from cost) to use a better specified device.

I'm guessing the output filter does roll off high frequencies but it has the advantage of making the signal look less like a square wave at this point.

Click to add a comment