Monday, 12 March 2018

AD9850 Signal Generator

I have a bit of free time at the moment and I was looking at previous projects and what equipment I have available to me.

I have couple of bench power supplies, an oscilloscope, a multimeter and a good stock of components for development.  I still don't have a Signal generator!  In previous posts I wrote about how I developed some addon circuitry for an AD9833 breakout board.  I never actually finished that project and I have since decided that there are better DDS signal generator breakout boards available.  I bought an AD9850 breakout board from a maker-faire vendor at least two years ago and it has sat in my breakout boards pile for a long time!

The breakout board is based on the AD9850 from Analog Devices and it's a DDS synthesis circuit.  The datasheet for the device is here:

There are lots of tutorials and information available on the internet for how this device works and can be used to make a simple signal generator.  Some of the links I used for reference are below:

The number of projects and posts available for this board and how to use it are a testament to how good the device is and how easy it should be to use and get it up and running.  I may yet build a simple scalar network analyser with one to allow for filter and amplifier testing at some point.

For now I just need access to a signal generator.  I should have finished the one I designed years ago or bought one off the shelf!  The off the shelf devices that I see are all still quite expensive and don't have all of the functions I need.  I could probably find one that did meet all of my requirements if I looked hard enough and was prepared to part with a little more money!  The module itself costs £15.00 from various online vendors although I'm certain I paid less for it than that.

Here is the schematic diagram for the AD9850 breakout board:

As can be seen there is a filtered and unfiltered output.  Obviously we want to use the filtered output and see what comes out of the unit.

By connecting the unit up to an arduino and using example code we should be able to get the unit up and generating signals.  From that we can design an amplifier and match the circuit to 50 ohms and hopefully put together a useful piece of test equipment in short order!

Helpfully there are several libraries already written for driving the module using an arduino so that saves some time and effort:

Here is how the module is connected up for testing with an arduino mega:

AD9850 breakout board connected to an Arduino Mega
For connecting up the AD9850 module:

Pin 1 (Vcc), connect to the arduino +5V pin
Pin 2 (W_CLK), connect to the arduino digital pin 8
Pin 3 (FQ_UD), connect to the arduino digital pin 9
Pin 4 (Data), connect to the arduino digital pin 10
Pin 5 (Reset), connect to the arduino digital pin 11
Pin 6 (GND), connect to the arduino GND pin

Pin 10 (Filtered Sine Out), connect to an oscilloscope for testing

Here is the code I used to test the module:

 // Langster's DDS test Code  
 // Date: 12/03/2018  
 // Makes use of m0xpd's DDS Arduino Library  
 // include the DDS Library:  
 #include <DDS.h>  
 // AD9850 Module is connected to the following  
 // arduino pins  
 const int W_CLK = 8;  
 const int FQ_UD = 9;   
 const int DATA = 10;  
 const int RESET = 11;  
 double freq = 0;  
  // Instantiate the DDS...  
 void setup() {  
  // start up the DDS...    
  // (Optional) change value if the clock crystal does not resonate at 125MHz...  
  dds.trim(125000000); // enter actual oscillation frequency   
  // start the oscillator...  
 void loop() {  
  dds.setFrequency(1000); //set the frequency output to 1 kHz   

The code will initiate the DDS module and then set an output of 1 kHz.

I connected up the filtered sine output to an oscilloscope and here is the result:

1 kHz sine output from Ad9850 DDS Module
A nice clean 1 Vpk to pk, 1 kHz sine wave!  The square wave output was also present and in good shape.  I'm going to perform more testing to check the useable frequency range but so far so good.

By changing the value in the line:

dds.setFrequency(1000); //set the frequency output to 1 kHz

The frequency output is changed.

That's all for now - Langster!