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
10 Comments to “Function Generator”
Post comment
Please note
Categories
- All projects
- Audio
- Clock
- Electric Train
- Gadjet
- General Posting
- Laser
- Lastes News
- LED
- Library
- Sensor
- Software
- Work Bench Tools

admin

All my source codes were taken from my personal projects.
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
No it can t be done
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!
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).
It’s due to all the opamp, and digital pot limitation
Sylvain
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?
The high is teoricaly infinit, the low just calcul the Zin of the circuit with 220uF, It’s many time lower than 1Hz
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
I just send you the hex file
Thank you
i received
Regards
Joseph