Analog Devices DDS Arduino Library

Updated 2015-03-06

Here’s a library that I created for interfacing the Arduino to Analog Devices DDS chips.  Currently the 9850 and 9851 are supported.  Support for the 9834 is currently in development. Please post on the Radio Artisan discussion group if you are interested in support for other chips or if you can contribute code.

To install this library:

1.  Download dds.h and dds.cpp from GitHub or Sourceforge.

2.  Create a directory in your sketchbook library directory called dds.

3.  Copy the two files into the dds directory.

How to use the library:

First you need to create a dds instance by calling ddschip like so:

dds ddschip(DDS9850, 8, 6, 7, 100000000LL);

The parameters are:

  1. Chip type
  2. Data Pin Number
  3. Load Pin Number
  4. Clock Pin Number
  5. Clock Frequency in Hertz (if using the clock multiplier on chips equipped with one, use the frequency after multiplication, not the actual clock frequency going into the chip)

If you are using the clock multiplier in the 9851 chip, activate the multiplier:


If you would like to calibrate the frequency output, call the calibrate function like so:


This is used to compensate for a reference clock that is off frequency (they all are, unless you’re using some sort of uber-expensive atomic clock.  The correct factor is applied as so:

clock_frequency_used_in_formula  = clock_frequency – ( clock frequency * calibration_value)

In the example above, the calibration value of 0.0000495 would result in a correction of -4.95 kHz.

To set the unit frequency, call the setfrequency function:


The frequency unit is hertz.

Connecting the Arduino to the Chip

There are three data connections required: data, clock, and load, and of course, a common ground.  The three pins on the Arduino side are defined in the ddschip instance, as shown in the example above.  Here are the pins to connect to on the chips:

9850 & 9851

  • Data Pin: 25
  • Load Pin: 8
  • Clock Pin: 7


  • Data Pin: 13
  • Load Pin: 15
  • Clock Pin: 14

Support and Feature Requests

For support or to request features, please go to the Radio Artisan discussion group.

sample code

#include <stdio.h>
#include <dds.h>

// chip, data_pin, load_pin, clock_pin, clock_hz
dds ddschip(DDS9850, 8, 6, 7, 100000000LL);

void setup()




void loop()

9 responses to “Analog Devices DDS Arduino Library

  1. Hi, can you add support for AD9834 and publish some schematics of how connect arduino to dds pin?
    Thank you

    • Yes. I’m looking at the 9834 datasheet and I should be able to add support for that in a few days. I’ll also enhance the documentation here on how to connect the chip to the Arduino and use the library.

    • Updated code uploaded with 9834 support. I have no way to test this as I don’t have a 9834 chip, but I’ve followed the device documentation in writing this. I also added a function to activate triangle wave:


      You’ll need to do a ddschip.setfrequency to activate it.

  2. Thank you but I’ve tested it but doesn’t works with 9834 (that is like 9833 in programming)..
    There is no load pin, i’ve used FSYNC but doesn’t works..
    Output is always a 12.5 MHz Sine wave (with a 50 MHz oscillator)

Comments are closed.