Author Topic: Function Generator  (Read 5674 times)

0 Members and 1 Guest are viewing this topic.

Offline rexxarTopic starter

  • Frequent Contributor
  • **
  • Posts: 439
  • Country: us
    • Forever Tinkering
Function Generator
« on: August 06, 2015, 11:44:16 pm »
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?
 

Offline rfeecs

  • Frequent Contributor
  • **
  • Posts: 807
  • Country: us
Re: Function Generator
« Reply #1 on: August 07, 2015, 12:14:02 am »
There are DDS (Direct Digital Synthesis) chips.  They might be what you are looking for.
 

Offline w2aew

  • Super Contributor
  • ***
  • Posts: 1780
  • Country: us
  • I usTa cuDnt speL enjinere, noW I aR wuN
    • My YouTube Channel
Re: Function Generator
« Reply #2 on: August 07, 2015, 12:57:18 am »
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.
YouTube channel: https://www.youtube.com/w2aew
FAE for Tektronix
Technical Coordinator for the ARRL Northern NJ Section
 

Offline rexxarTopic starter

  • Frequent Contributor
  • **
  • Posts: 439
  • Country: us
    • Forever Tinkering
Re: Function Generator
« Reply #3 on: August 07, 2015, 01:22:50 am »
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?
 

Offline MarkF

  • Super Contributor
  • ***
  • Posts: 2594
  • Country: us
Re: Function Generator
« Reply #4 on: August 07, 2015, 01:57:11 am »
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 these SMT Breakout PCB for SOIC-20 or TSSOP-20 from Adafruit for through hole mounting and development.
 

Offline tron9000

  • Frequent Contributor
  • **
  • Posts: 423
  • Country: gb
  • Still an Electronics Lab Tech
    • My Hack-a-day project page
Re: Function Generator
« Reply #5 on: August 07, 2015, 08:13:24 am »
Are you wanting to build an ARB generator or just a triangle, square, sine generator?
Partsbox.io - orangise your parts!
"If you're green you can only ripen. If you're ripe you can only rot!"
 

Offline rexxarTopic starter

  • Frequent Contributor
  • **
  • Posts: 439
  • Country: us
    • Forever Tinkering
Re: Function Generator
« Reply #6 on: August 07, 2015, 08:54:29 am »
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!
 

Offline Kleinstein

  • Super Contributor
  • ***
  • Posts: 14494
  • Country: de
Re: Function Generator
« Reply #7 on: August 07, 2015, 09:15:05 am »
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.

 

Offline Kalvin

  • Super Contributor
  • ***
  • Posts: 2145
  • Country: fi
  • Embedded SW/HW.
Re: Function Generator
« Reply #8 on: August 07, 2015, 09:28:43 am »
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.
There 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.
 

Offline charlespax

  • Regular Contributor
  • *
  • Posts: 191
  • Country: us
    • Pax Instruments
Re: Function Generator
« Reply #9 on: August 09, 2015, 10:50:01 am »
The AD site has more info including a link to a wiki page with a schematic and bom and gerbers for the EVAL BOARD.

Amazing! Well, I think I know what my next project is :-)
 

Offline tron9000

  • Frequent Contributor
  • **
  • Posts: 423
  • Country: gb
  • Still an Electronics Lab Tech
    • My Hack-a-day project page
Re: Function Generator
« Reply #10 on: August 10, 2015, 08:02:41 am »
Indeed! Very nice!

Going back to the AD9834 though, this chap does show it off pretty well as to what can be achieved!
Partsbox.io - orangise your parts!
"If you're green you can only ripen. If you're ripe you can only rot!"
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf