AD9850 based signal generator

Few days ago I tested AD9850 DDS module in home in hope to some day have a working signal generator using it. The initial tests went well, so I could plan the next step. I was already doing some information searching to make decision if I should do the controlling using web interface (with Ethernet shield) or should I rather stick to traditional serial console controlling (through virtual serial port over USB).

When I tried to make decision on that and thinking of how much time is needed to implement the basic application for this use, I found interesting skech, something pretty much in line I was planning to code myself. When there is ready made free code, then why not use it… I found the code at It starts with the following documentation:

Simple controller for AD9850 modules
Uses serial protocol (refer to AD9850 datasheet what pins need to be pulled up/down
Uses library by Elecfreaks
(for use with chipkit delete that unnecessary line “#include <avr/pgmspace.h>” from .h file)
Fix the pin numbers used to communicate with module
Serial comms – 9600, NewLine (0x0A) denotes end of input,
f 10000 – set frequency
s 20 20000 10 1000 – sweep from frequency to frequency using this step size in that many milliseconds
o 10 10000 5 3000 – oscillating sweep from frequency to frequency and back using this step size in that many ms
NB! no error checking in input, code relies on intelligence of user

It looked pretty what I was looking for. So I did Cut&pase from web page and changed module connection configuration to match my wiring:

EF_AD9850 AD9850(8, 9, 11, 10);

Next task was to compile the thing and load to Arduino. But in this step I got compiling problems: Error messages told that EF_AD8950.h was missing..

Because the source code did not seem to have pointer to the needed library, I had to use Google searches in hope to find that. I found what I was looking at So I downloaded the needed library from link

Then I copied the library file form ZIP to to C:\Users\Tomi\Documents\Arduino\libraries\EF_AD9850

Tried compiling: Still problems with #include "WProgram.h"

I solved those problems with instructions from So I needed to replace

#include "WProgram.h"

line at C:\Users\Tomi\Documents\Arduino\libraries\EF_AD9850\EF_AD8950.h with following (using Notepad++ editor):

#if ARDUINO >= 100
  #include "Arduino.h"
  #include "WProgram.h"

Now I got the code to compile correctly.

I loaded the code to the Arduino Uno and started communication test with is using Serial Monitor provided with Arduino IDE. I connected my oscilloscope/multimeter between ZOUT1 and GND pins to monitor the output signal.

First test: f 10000 – set frequency

Sent: f 10000

Result: Nothing. After some investication I found out that I had to have the setting “No line ending” in Serial Monitor. I changed that option to “Both NL & CR” and got everythign working well. I tried different frequencies from 1 Hz to 20 MHz, and they worked well.

Next test: s 20 20000 10 1000 – sweep from frequency to frequency using this step size in that many milliseconds
Third test: o 10 10000 5 3000 – oscillating sweep from frequency to frequency and back using this step size in that many ms

One question raised after testing: How to turn off? Just set frequency to zero, meaning “f 0″ or just “f”.

The two analogue signal outputs give out around 0.5V signal level sinewave at about 100 ohms impedance. Both outputs give out same frequency but the outputs have 90 degrees phase shift between them. In addition to that there are TTL level square wave outs.





  1. Tomi Engdahl says:

    Article on some more testing with this signal generator:

    AD9850 scalar network analyzer

  2. Tomi Engdahl says:

    Another clock generator project based on Arduino and Si5351 clock generator:

    Triple Frequency VFO on a Bamboo Breadboard

    Historically when hams built low power (QRP) transmitters, they’d use a crystal to set the frequency. Years ago, it was common to find crystals in all sorts of radios, including scanners and handheld transceivers. Crystals are very stable and precise and it is relatively easy to make a high quality oscillator with a crystal and a few parts.

    The big problem is you can’t change the frequency much without changing crystals. Making a high quality variable frequency oscillator (VFO) out of traditional components is quite a challenge.

    [N2HTT] likes to build radio projects and he decided to take an Si5351 clock generator and turn it into a three frequency VFO for his projects. The Si5351 uses a crystal, so it is very stable. However, you can digitally convert that crystal frequency into multiple frequencies over a range of about 8kHz to 160MHz.

    The device [N2HTT] used is in a tiny 10 pin MSOP package, but there are plenty of inexpensive breakout boards available.

    One thing of interest is the breadboard the VFO is built on. [N2HTT] used an Arduino and a small display along with an encoder to control the chip. But the chip generates some high frequencies and common wisdom is that solderless breadboards aren’t good for high frequency. Acting on a tip he read in a magazine article [N2HTT] took a bamboo cutting board and then affixed standard solderless breadboards to unetched copper PCB material. He then made sure the PCB ground planes were well connected and grounded. It seems to work

  3. Tomi Engdahl says:

    Home> Test-and-measurement Design Center > How To Article
    Optimizing Arduino and the AD9851 DDS signal generator

    Arduino has taken the product “maker” world by storm and one of the more popular Arduino modules is the Analog Devices AD9851 DDS waveform generator. An Internet Web search for “Arduino DDS” showed more than 100,000 results, while the same video search turned up many dozens of videos. Internet forums are filled with discussions related to two specific issues. One issue is that the output amplitude is not constant with frequency, requiring a level control loop. The second issue is that the distortion gets pretty horrific, particularly at higher output frequency settings. In this article, we’ll show how to correct these issues, as well as providing some additional tips for improving the quality of the output.

    DDS basics

    While this article concentrates on the AD9851 device, Analog Devices produces many others that operate in a similar fashion. The devices combine a clock reference with a digital divider and a phase locked loop to provide a sinewave output with very fine resolution. In the case of the AD9851, the digital divider is 32 bits and the clock frequency is typically 125 MHz. This results in a frequency resolution of approximately 30 milli-Hz. A single resistor, Rset controls the current output level and therefore the output voltage level.

    The digital nature of the DDS process results in an output signal and many signal images. The images follow a sin(x)/x envelope.


Leave a Comment

Your email address will not be published. Required fields are marked *