Mar
24

Function Generator

History

This project didn’t look complicated but it was. The MCU part is really simple: just some code for the Display, Keypad and DDS Communication.

A DDS is a chip that is driven by a hi-frequency oscillator. I used a 50 Mhz clock. Inside this IC there is a big divider that goes down to less than 1Hz. The resulting clock is passed to another counter which is connected to a Sine ROM table.  If you need a triangle wave, the counter is directly connected to the output.  For a square wave, the signal which drives the counter is redirected to the primary output.
Once my MCU Board and the DDS board were done, I connected everything together and a cool sine wave was coming out of my DDS ranging from 1Hz to 5Mhz. I thought to myself that this project was almost done…. beeeeeeeeeep, wrong again! The worst part was to come. It's not so easy to amplify a signal of 400mv to +/-15v, 300ma at 5Mhz. First you CAN'T prototype this on a bread board. So I built more than 5 PCB's. Also, I had to find a very high speed Op-Amp that came in a package suitable for prototyping. I chose the LM7171 for its low cost and DIP package.  With an Op-Amp like this you must have decoupling capacitors on the – and + side to GND VERY CLOSE to the IC (each Op-Amp separately).

As you will see I mounted the DDS on a small PCB. This animal is so small that I was not sure that I could solder it. If I could then the DDS could be used on another mother-board

Note: The AD9833 DDS datasheet rates it for 25 Mhz, but in the preliminary datasheet it was rated for 50Mhz.  I made my project work at 50 Mhz and there was no problem. Just don't try it for final production. The higher the clock rate, the better the output signal will be.
 

Features

     Frequency from 1Hz to 5Mhz
     Accuracy of 0.1Hz
     Square/Sine/Triangle Output
     Variable duty cycle
    5V TTL output
     Output up to +15v to -15v peek to peek
     Adjustable DC Offset from +15v to -15v
 

Pictures 

(Those pictures are the version 1.0,  The new pictures are to come)

Download

MCU Schematic

DDS Schematic

TTL Board Schematic

Analog Board Schematic

Source Code Schematic




10 Comments to “Function Generator”

  • Bo Qiang August 23, 2010 at 2:55 pm

    Hi,

    Nice project, thanks for sharing it.

    One question: could the number of cycles be programmed? I mean, for example, I want to output 10 cycles of 100 Hz sine wave.
     
    Thanks.
     
    Bo

  • admin August 29, 2010 at 12:50 am

    No it can t be done

  • Chris September 17, 2010 at 11:29 pm

    Nice projects you have here!
    Just a thought, perhaps you should add an BOM list to make it easier to find out what components is needed for the projects?
    Other then that, keep up the good work!

  • Edwin May 24, 2011 at 9:35 pm

    Hi, 
    Just a quick question, the output frequency of the system is stated as being from 1 Hz to 5 MHz, is this a design decision or is it a limitation arising the parts used, as the AD9833 is capable of outputting up to half the driving frequency (i.e. should be able to output 25 MHz if a 50 MHz clock is used).

  • admin May 24, 2011 at 9:37 pm

    It’s due to all the opamp, and digital pot limitation

    Sylvain

  • Mihec July 22, 2011 at 11:32 am

    Hello!
    I'm working with that AD9833 to. I've problem with output stage, when amplifie signal and give a little bit of offset. 
    I've got questions for you. In schematic of output stage, you have capacitor C1 220uF for AC coupling? How much is your low and high cutoff frequency?

  • admin July 22, 2011 at 2:40 pm

    The high is teoricaly infinit, the low just calcul the Zin of the circuit with 220uF, It’s many time lower than 1Hz

  • joseph September 24, 2011 at 9:31 am

    Hi Sylvain
    this is the project what i searched to drive ad9833.i would like to build a generator for hobby purposes.
    seems like the hex file doesen't work,but i tried to complie the *c file  and i cant find nowhere the missing "shortnametype.h" theres not inside nowhere in the earlier versions of the iccavr (doesent exist in  inside v7,v8 demo too),i saw this problem in comment of your Mood light project.   you wrote that "Replace the shortnametype by
    #define ushort unsigned char
    #define uint unsigned int
    but still don't work.the complier has still type errors, missing something ,i am a beginner in c programming.
    can you help?
    Regards
    Joseh

  • admin September 27, 2011 at 1:12 pm

    I just send you the hex file

  • joseph September 28, 2011 at 11:10 am

    Thank you
    i received
    Regards
    Joseph

Post comment

Please note

All my source codes were taken from my personal projects.

Everything is for your information only. The C/C++ codes have been written
with ICCAVR. You can find the header and source CRT files by downloading their compiler.

All is for your information and everything is AS IS without any warranty of any kind. No other files are available and I don't make any modification for any body.

Categories

Blogroll

Electronic Links

Tags

AGC Anemometer AVR AVR Bootloader Bootloader Capacitence Capacitor Clock Color Control DCC Debugger Devices Digital driver Function Generator High Gain Microphone Humidity Inductance Inductor Laser LCD LED 3W Library Lightning Detector MegaLoad Meter Moodlight Mood Light MS5534 Nixie OscilloScope projector Rain Fall Sensor rgb RGB LED Scop Sensor SHT75 Temperature Terminal Tipping Bucket Train Modeling Vintage Water Detector