Cheap DDS Signal Generator Using ADS9851 and Arduino Nano

5,678

20

9

An inexpensive DDS Signal generator based on the AD9851 module to generate sine wave of up to 70MHz (20-30MHz realistically). The module also has a built-in reference square wave up to 1 MHz, this works independent of the sine wave and the duty cycle is controlled through a potentiometer built in the module itself.

The project utilizes an Arduino Nano, I am using a clone version that can be purchased for just a couple of dollars. I am also using a rotary encoder to control the signal frequency for the sine wave. I am using the KTM-S1201 7 Segment LCD display only because it's the only display I had at hand (It's not the best option but works). The LCD display requires a potentiometer to control the display contrast.

Bill of material

Total cost approximately $16-$20

Step 1: Wiring Up the Components

The Pin connectivity can really be pretty arbitrary as you can specify the assignment in the Arduino code. However the CLK pin of the rotary encode needs to be connected to either D2 or D3 on the Arduino as these are the only two pins that support interrupt attachment on the Arduino Nano.

Rotary encoder

  • connect Nano D2 to encoder CLK
  • connect Nano D3 to encoder DT
  • connect Nano D4 to encoder SW
  • connect encoder ground to ground
  • connect encoder Vcc to Arduino +5v

AD9851 (DDS)

  • connect Nano D5 to DDS Reset
  • connect Nano D6 to DDS Data
  • connect Nano D7 to DDS Load
  • connect Nano D8 to dds Clock
  • connect DDS ground to ground
  • connect DDS Vcc to Arduino +5v

KTM-S1201

  • connect Nano D9 to LCD CD (5)
  • connect Nano D10 to LCD Reset (6)
  • connect Nano D11 to LCD CS (8)
  • connect Nano D12 to LCD N_SCK (3)
  • connect Nano D13 to LCD SI (4)
  • connect LCD ground to ground (2)
  • connec LCD Vcc to Arduino +5v (1)

Potentiometer

  • connect pot left pin to ground
  • connect pot right pin to Arduino +5v
  • connect pot center to LCD VLc (9)

Step 2: How It Works

The code is pretty straight-forward and self explanatory and I have split it into two files for manageability. All functions related to configuring and controlling the DDS is in a separate file that gets automatically pulled in by Arduino IDE.

The top of the main file specifies the pin selection for each of the components (LCD, Rotary encoder and AD9851). The rest of the code uses the identifiers instead of the actual pin numbers. This provides flexibility in changing the wiring to suit individual design and needs.

The setup initializes the signal generator to and initial value of 5 KHz and the rotary encoder step to 1Hz. Pushing the encoder as a button increases the frequency step by multiples of 10 all the way up to 1MHz and then back to 1Hz.

The 7 Segment LCD display shows the set frequency in KHz to 4 decimal place resolution and shows the increment step when the encoder is pushed.

Step 3: Next Steps

The Arduino code is available through my GitHub repository.

I plan to put everything in an enclosure to turn it into something I can use day to day.

I am also thinking of using the ESP8266 or ESP32 instead of the Arduino to possibly control it over WiFi. Leave a comment if you are interested in either or both of the options.

I hope others find this useful and can implement their own version.

Share

Recommendations

  • PCB Contest

    PCB Contest
  • Comfort Food Challenge

    Comfort Food Challenge
  • Warm and Fuzzy Contest

    Warm and Fuzzy Contest

9 Discussions

0
None
Beamehome29

2 years ago

hay I have a question if u have a pc in front of u and u turn the nob to a just to pc frequence what would u need to or for that to happen

3 replies
0
None
usearBeamehome29

Reply 2 years ago

Not sure I understand what you mean by turning the nob to the PC's frequency.

0
None
Beamehome29usear

Reply 2 years ago

example u see when u go to hospitals they say don't use cell because the cell phone can inter fear with device I am looking for the same effect on home pc not to harm but to get an effect ( out come)

0
None
Beamehome29usear

Reply 2 years ago

if u know any thing about pc they have a international clock or harmic frequence your device has the capability to create the same thing in light form so I would like to know what frequence rang is ur device humid at

0
None
Beamehome29

2 years ago

u know how every thing has a frequence well your device has a just able nob what I me is if ur dice was conned to something different that would allow electrons emit that would affect examples would be to shut a car off every one is trying emp device I beleave it to be more deeper it like effecting and internal clock u meat it's frequence and pull it the direction u won't so when I came a cross your device I was wondering what is the frequence rang 1 to ? psychological can I buyer ur device what is the price range

0
None
Beamehome29

2 years ago

Can u stimulate a reaction to pc seeing ur a effecting frequence