DDS Sine Sweeper
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
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: