< async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"">

Sunday, February 16, 2014

Quickly test an AD9850 ebay module with an arduino and a software defined radio (SDR) [quick start for beginners]

ADVERTISEMENT
Quick test for AD9850 ebay module with arduino, Note the jumper settings

Direct digital synthesis or DDS is becoming popular among many electronic hobbyists. The availability of the popular AD9850/51 based ebay modules at a very reasonable price has made it possible to quickly setup a nice RF signal generator with an AD9850 module and a micro-controller. In a previous post, i have described an option to control them without a microcontroller (Read here). The basic point is to tell the frequency value to the AD9850 in what ever possible way. The use of a microcontroller makes it easy and open up a wide range of possibilities. For example it is easy to build an automated CW  beacon or to make a simple sweep generator. This module can also be controlled by a raspberry pi and will be in an other post. If you are interested a pi can be used as an RF generator with its built in pll!

So for a quick test of the module you need an arduino boeard and i used  a uno with atmega328. But it should work with any other versions as well. Just keep track of the pin numbers used. So get a couple of connectors and hook it up to uno board as shown in figure. Load the sketch below and tune your receiver at 10MHZ and watch. Attached a small video of my test after a small break.

There are two popular ebay boards and their pin connections are usually written over them. But have a look at the figure below to get an idea

 

An other type of module has some jumpers on the board. It is important to set J1 (see the first figure on the start of the blog post) so that the board is ready to receive serial data on D7 pin

Connecting AD9850 ebay module to Arduino Uno (Click to Enlarge)

There is an other module which is also popular and the connections are similar. Make sure you connect D7 , W_CLK, FQ_UD, and RESET pins correctly to arduino (see figure for details)

AD9850 module quick pin connection details for arduino

After connecting the module you need to load the firmware and is much easier with arduino. Connect the arduino board with a usb cable to your computer. Download and install the arduino ide (From here)
Paste the code (courtesy : nr8o) below in to the ide and press upload and turn the receiver on and check at 10MHZ. I have put a frequency shift at every second and can be easily noticed. See the video at the end.

If you are interested in generating an RF signal, there is a simple way with a raspberry pi gpio (beware of some odd harmonics). You may read it here (Raspberry pi as a simple low cost rf signal generator [quick and dirty solutions])

Also an other application of the module to study weak signal propagation (WSPR or whisper) -


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/* 
 * A simple single freq AD9850 Arduino test script
 * Original AD9851 DDS sketch by Andrew Smallbone at www.rocketnumbernine.com
 * Modified for testing the inexpensive AD9850 ebay DDS modules
 * Pictures and pinouts at nr8o.dhlpilotcentral.com
 * 9850 datasheet at http://www.analog.com/static/imported-files/data_sheets/AD9850.pdf
 * Use freely
 */
 
#define W_CLK 8       // Pin 8 - connect to AD9850 module word load clock pin (CLK)
#define FQ_UD 9       // Pin 9 - connect to freq update pin (FQ)
#define DATA 10       // Pin 10 - connect to serial data load pin (DATA)
#define RESET 11      // Pin 11 - connect to reset pin (RST).
 
#define pulseHigh(pin) {digitalWrite(pin, HIGH); digitalWrite(pin, LOW); }
 
 // transfers a byte, a bit at a time, LSB first to the 9850 via serial DATA line
void tfr_byte(byte data)
{
  for (int i=0; i<8; i++, data>>=1) {
    digitalWrite(DATA, data & 0x01);
    pulseHigh(W_CLK);   //after each bit sent, CLK is pulsed high
  }
}

 // frequency calc from datasheet page 8 = <sys clock> * <frequency tuning word>/2^32
void sendFrequency(double frequency) {
  int32_t freq = frequency * 4294967295/125000000;  // note 125 MHz clock on 9850
  for (int b=0; b<4; b++, freq>>=8) {
    tfr_byte(freq & 0xFF);
  }
  tfr_byte(0x000);   // Final control byte, all 0 for 9850 chip
  pulseHigh(FQ_UD);  // Done!  Should see output
}

void setup() {
 // configure arduino data pins for output
  pinMode(FQ_UD, OUTPUT);
  pinMode(W_CLK, OUTPUT);
  pinMode(DATA, OUTPUT);
  pinMode(RESET, OUTPUT);
   
  pulseHigh(RESET);
  pulseHigh(W_CLK);
  pulseHigh(FQ_UD);  // this pulse enables serial mode - Datasheet page 12 figure 10
}

void loop() {
  sendFrequency(10.e6);
  delay (1000);
  sendFrequency(10.01e6);  // freq
  delay(1000);
}

There are some better libraries if you want to do more with arduino and ad9850.


10 comments:

  1. I am interested in using this module for a balloon gps tracker.So far only able to find code to send test rtty.I already have a working tracker based on arduino and NTX2 module,the AD9850 is a bit tricky to accomplish the same goal.Any guidance would be appreciated.My email good on www.qrz.com
    Jim,N2NXZ

    ReplyDelete
  2. You can modulate the ad9850 by quickly changing the frequency. See my post on rc car control where an arduino uno can send the control sequence http://blog.riyas.org/2014/06/computer-controlling-27mhz-remote-control-car-ad9850-dds.html

    It may work, and an other option may be a raspberry pi's gpio with extra filters to remove the odd harmonics

    ReplyDelete
  3. Hi, very good content. Many thanks. It was very helpful. Do you know where I could get some documentation about the AD9850 board, the one with jumpers? Many thanks again.

    ReplyDelete
  4. The wiring picture having the module with jumpers is wrong. The RST is tied to the 3.3. RST shall be tied to pin 11 of the Arduino. 3.3V of the Arduino shall be tied to the VCC pin beside the RST pin on the DDS module.

    ReplyDelete
  5. Your pictures shows 9/reset 10/data, but your sketch says 9/FQ, 10/data & 11/reset. Is the source right or the picture?

    ReplyDelete
    Replies
    1. Thanks for the question. just follow the sketch and connect the pins as described in the sketch. This doesnt use spi, so as long as you connect the correct pins as is in sketch or modify the sketch to match the pins shown in figure, it will work

      Delete
  6. This is only one code that works as is, thanks very much for sharing!
    zZee

    ReplyDelete