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:

http://www.analog.com/media/en/technical-documentation/data-sheets/AD9850.pdf

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:

http://telecnatron.com/modules/ad9850/index.html

http://kv4qb.blogspot.co.uk/2017/04/the-sa-becomes-sna-jrv3-for-now.html

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:

https://github.com/F4GOJ/AD9850

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  
 // http://m0xpd.blogspot.com  
 // 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...  
  DDS dds(W_CLK, FQ_UD, DATA, RESET);  
 void setup() {  
  // start up the DDS...    
  dds.init();   
  // (Optional) change value if the clock crystal does not resonate at 125MHz...  
  dds.trim(125000000); // enter actual oscillation frequency   
  // start the oscillator...  
  dds.setFrequency(freq);   
 }  
 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!

10 comments :

  1. if I will use arduino uno, then I get to the same result like mega?

    ReplyDelete
    Replies
    1. Hi,

      It will work with an Arduino Uno R3 but you may fine you are short of pins when you add the amplification stage and need other functionality from the devices - Good luck!

      Delete
    2. now, I try to your code, but "DDS dds(W_CLK, FQ_UD, DATA, RESET)" is error....
      and I get to library at https://github.com/F4GOJ/AD9850. then #include and #include is equal?

      Delete
    3. From what you have written it would seem that the library has not been installed correctly. Which version of the Arduino IDE are you using?
      I would try installing the library from within the Arduino IDE and ensure you are using the #include - Line. The '<' '>' tell the compiler where to look for the library. If the library has been installed correctly there should be examples available from the drop down menus - Good luck!

      Delete
    4. I want to make 9Mhz ~ 11Mhz pulse wave. then, Which module I can use?

      Delete
    5. The module that you have - the AD9850 will work in those frequencies. I think we need to email each other so I can help you - alexanderlang1980@gmail.com

      Delete
  2. To "unknown". To use that library, change the #include to #include . That library instantiates a instance for you, in a variable DDS. Look at the example code that came with that library - there are some differences in how the methods get invoked.

    ReplyDelete
  3. The include should be AD9850.h - the website removed the less than and greater than.

    ReplyDelete
  4. what is the value of resistors R4 and R5 actually mounted on your board ? The board I got had 30ohms, not 200. Any thoughts on that ?

    ReplyDelete
  5. I would have to look at my board to check the exact value. Based upon the schematic above those resistors are for matching the input and output of the filter and using different values could possibly attenuate the output signal. 30 Ohms is an odd value for certain. Is this the measured value or the value on the components?

    ReplyDelete