Function Generator - Page 1
Forum section: electronics / projects

author: rexxar
author_rank: Frequent Contributor
timestamp: August 06, 2015, 11:44:16 pm
content: Hi all, I decided I wanted to try making a function generator, but after some dead ends, I'm not sure what direction I should go.My first thought was to use an arduino board. First thing I tried was an SPI DAC, but that was far too slow, so I went to an R-2R ladder. I ditched the Arduino IDE for AVR Studio, and got program execution down to five clock cycles, but even then I could only get an 8-bit triangle wave to 6KHz or so.I know there are some dedicated function gen ICs, I have one that goes up to 1MHz, but I like the idea of possibly doing arbitrary waveform generation.What do "real" lab function gens use? FPGA? DSP? I'm sure it'd be easy to buy a China Special off ebay, but in part I want to do this to improve my coding. Any idea where I should start?

author: rfeecs
author_rank: Frequent Contributor
timestamp: August 07, 2015, 12:14:02 am
content: There are DDS (Direct Digital Synthesis) chips. They might be what you are looking for.

author: w2aew
author_rank: Super Contributor
timestamp: August 07, 2015, 12:57:18 am
content: Most modern designs are DDS based. Earlier analog designs were often based on a classic triangle wave oscillator (using current sources and diode switching), with sine shaping circuits and comparators to do the sine and square waveforms.

author: rexxar
author_rank: Frequent Contributor
timestamp: August 07, 2015, 01:22:50 am
content: Huh, I didn't know about DDS chips. Do these usually require a fast processor to drive, or do they take care of most of it on their own?

author: MarkF
author_rank: Super Contributor
timestamp: August 07, 2015, 01:57:11 am
content: I have a few AD9834 to do the same thing. There are 50Mhz and 75MHz versions of the same chip. The SPI interface just sets up the waveform to generate: 2 frequencies, 2 phases, sine/triangle/square wave outputs. The chip does all the work to generate the waveform. You can switch between the two frequencies or the two phases to do freq. or phase modulation. However, it has NO arbitrary waveform capability.I bought theseSMT Breakout PCB for SOIC-20 or TSSOP-20from Adafruit for through hole mounting and development.

author: tron9000
author_rank: Frequent Contributor
timestamp: August 07, 2015, 08:13:24 am
content: Are you wanting to build an ARB generator or just a triangle, square, sine generator?

author: rexxar
author_rank: Frequent Contributor
timestamp: August 07, 2015, 08:54:29 am
content: I'd like to do arbitrary. The AD9160 looks like you can just load a waveform into RAM and let it run. That sounds perfect, but it's $25 each on Mouser!

author: Kleinstein
author_rank: Super Contributor
timestamp: August 07, 2015, 09:15:05 am
content: The DDS Chips take care of all the fast thing. One only sets the frequency via SPI (or similar interface) and the chips makes a sine. In addition to the chip one needs a stable clock (e.g. crystal oscillator) typical in the 20-80 MHz range and an output filter. The trinagle via DDS is far lower quality than the sine and most faster DDS chips don't support it at all.There are a few DDS Modules with clock / DDS chip (usually AD9850) and filter available. A few yeas ago there was a series with wrong calculated filter which was available really cheap.Most modern FGens either use DDS Chips or FPGA+external DAC to implement a DDS and arbtrary generator.With a parallel DAC (e.g. R2R as low cost), a 20 MHz AVR can run DDS in software up to about 2 MHz update rate or about 500 kHz useful sine wave frequency. Some of the very cheep chineese FGens you find on EBay do exactly that. However the trinagle is good only to about 20 kHz.

author: Kalvin
author_rank: Super Contributor
timestamp: August 07, 2015, 09:28:43 am
content: Quote from: Kleinstein on August 07, 2015, 09:15:05 amThere are quite a few FPGA boards which can be extended to implement 1 or 2 R2R DAC outputs, and which would provide higher sample rate (100Mhz+) and larger sample memory (A few Ksamples). However, this requires some FPGA knowhow.

author: charlespax
author_rank: Regular Contributor
timestamp: August 09, 2015, 10:50:01 am
content: Quote from: AcHmed99 on August 07, 2015, 11:41:49 amAmazing! Well, I think I know what my next project is :-)

author: tron9000
author_rank: Frequent Contributor
timestamp: August 10, 2015, 08:02:41 am
content: Indeed! Very nice!Going back to the AD9834 though, this chap does show it off pretty well as to what can be achieved!