Author Topic: DIY Function Generator  (Read 43626 times)

0 Members and 1 Guest are viewing this topic.

Offline perfect_disturbance

  • Regular Contributor
  • *
  • Posts: 144
  • Country: us
DIY Function Generator
« on: September 28, 2012, 01:19:53 am »
OK So I want to try and build a function gen i see there's a couple different ways to go with advantages and disadvantages.

Some people are using dedicated function gen chips like a MAX038 or XR2206 these actually seem pretty straigtforward but both of those chips are no longer in production.
and the only one I could flnd with a listed price on mouser was 80 bucks (which seems unreasonable hi so I may be looking at the wrong part)

http://www.mouser.com/ProductDetail/Exar/XR2206-11-12EB/?qs=sGAEpiMZZMs%252bwIVMMV7AyT%252ba%252bM0aLAJO

The other consept seems to be using a microcontroller (I'd probably use an atmega328) to directly synthesize the signal.  to do this I would need some sort of dac I've seen some people getting by with r/2r networks like this

http://www.mouser.com/ProductDetail/Murata/RGSD8L102G/?qs=sGAEpiMZZMvrmc6UYKmaNYgyMGTqqrwcgSLMHCLOy9Y%3d

I thought I could also use a dac ic but I'm not sure what part would work well for that.  I'd like something I could wire directly to the microcontroller (preferably parallel) with out a lot of other components.

What do people think?
« Last Edit: September 28, 2012, 01:34:05 am by perfect_disturbance »
 

Offline M0BSW

  • Frequent Contributor
  • **
  • Posts: 674
  • Country: 00
  • Left this site 2013, they will not delete it ????
Re: DIY Function Generator
« Reply #1 on: September 28, 2012, 01:32:00 am »
Hope you get plenty of replies , because Im looking for a winter project , and this sounds really interesting.
Paul
no one would or will tell me how to delete this account
 

Offline madires

  • Super Contributor
  • ***
  • Posts: 4361
  • Country: de
  • A qualified hobbyist ;)
Re: DIY Function Generator
« Reply #2 on: September 28, 2012, 02:30:37 am »
Some people are using dedicated function gen chips like a MAX038 or XR2206 these actually seem pretty straigtforward but both of those chips are no longer in production.
and the only one I could flnd with a listed price on mouser was 80 bucks (which seems unreasonable hi so I may be looking at the wrong part)

25 years ago all EE magazines were full of XR2206 circuits :-) Just checked Reichelt, XR 2206CP for EUR 5,20, on stock. Has anyone tested the cheap MCU based DDS signal generators from ebay?
 

Offline kripton2035

  • Super Contributor
  • ***
  • Posts: 1670
  • Country: fr
    • kripton2035 schematics repository
Re: DIY Function Generator
« Reply #3 on: September 28, 2012, 02:56:31 am »
here is the open source AVR DDS signal generator V2.0
http://www.scienceprog.com/avr-dds-signal-generator-v20/

Offline kripton2035

  • Super Contributor
  • ***
  • Posts: 1670
  • Country: fr
    • kripton2035 schematics repository
Re: DIY Function Generator
« Reply #4 on: September 28, 2012, 02:59:18 am »

Offline T4P

  • Super Contributor
  • ***
  • Posts: 3706
  • Country: sg
    • T4P
Re: DIY Function Generator
« Reply #5 on: September 28, 2012, 03:42:34 am »
max038 on ebay around $15 free shipping...
http://www.ebay.com/sch/i.html?_trksid=p3984.m570.l1313&_nkw=max038&_sacat=0

xr2206 less than $3 on ebay...free shipping too
http://www.ebay.com/sch/i.html?_nkw=xr2206&_sacat=0&_odkw=max038&_osacat=0
XR2206 and the MAX038 is old and done for, inaccurate and runs very hot + power hungry
 

Offline crispus

  • Regular Contributor
  • *
  • Posts: 107
  • Country: ro
Re: DIY Function Generator
« Reply #6 on: September 28, 2012, 04:04:17 am »
What is the alternative to those old chips?
I know I'm numskull, but I look around me and I feel better.
 

Offline T4P

  • Super Contributor
  • ***
  • Posts: 3706
  • Country: sg
    • T4P
Re: DIY Function Generator
« Reply #7 on: September 28, 2012, 04:36:06 am »
What is the alternative to those old chips?
DDS! AD98XX series
 

Offline AndyC_772

  • Super Contributor
  • ***
  • Posts: 3294
  • Country: gb
  • Will design for cookies
Re: DIY Function Generator
« Reply #8 on: September 28, 2012, 04:44:43 am »
If you wanted, you could do it with a microcontroller, dual port RAM and a DAC. The microcontroller writes a pattern of data corresponding to a sine, square or any other type of wave into one port of the RAM, while on the other port, a programmable counter reads the data out at a predefined rate and presents it to the DAC.

Arguably the best way to implement the counter and RAM would be to use an FPGA; depends how steep a learning curve you're in the mood for, unless you've used them before.
 

Offline PA0PBZ

  • Super Contributor
  • ***
  • Posts: 3812
  • Country: nl
Re: DIY Function Generator
« Reply #9 on: September 28, 2012, 04:54:34 am »
Or old school: an EPROM (remember those?) with R/2R on the data lines, a counter on a number of address lines and the other address lines to select the waveform  :)
Keyboard error: Press F1 to continue.
 

Offline kripton2035

  • Super Contributor
  • ***
  • Posts: 1670
  • Country: fr
    • kripton2035 schematics repository
Re: DIY Function Generator
« Reply #10 on: September 28, 2012, 05:00:34 am »
Or old school: an EPROM (remember those?) with R/2R on the data lines, a counter on a number of address lines and the other address lines to select the waveform  :)
typically what's inside a dds chip isn't it ?

I bought this on ebay :
http://www.ebay.com/itm/-/170682095715?item=170682095715
a microcontroller, a display and voila...
« Last Edit: September 28, 2012, 05:02:49 am by kripton2035 »
 

Offline PA0PBZ

  • Super Contributor
  • ***
  • Posts: 3812
  • Country: nl
Re: DIY Function Generator
« Reply #11 on: September 28, 2012, 05:12:27 am »
typically what's inside a dds chip isn't it ?

Of course, but the EPROM FG can be build on a breadboard on a rainy sunday afternoon.  ;)
Also, you can put sine, square, triangle and such in it very simple.
Keyboard error: Press F1 to continue.
 

Offline G7PSK

  • Super Contributor
  • ***
  • Posts: 3609
  • Country: gb
  • It is hot until proved not.
Re: DIY Function Generator
« Reply #12 on: September 28, 2012, 06:31:35 am »
 

Offline jerry507

  • Regular Contributor
  • *
  • Posts: 246
Re: DIY Function Generator
« Reply #13 on: September 28, 2012, 07:10:14 am »
As T4P said, just get a dds. Unless the frequency you want is really low or you want insanely high quality outputs, it's the easiest solution and it'll give you some good experience designing relatively high frequency circuits.
 

Offline M0BSW

  • Frequent Contributor
  • **
  • Posts: 674
  • Country: 00
  • Left this site 2013, they will not delete it ????
Re: DIY Function Generator
« Reply #14 on: September 29, 2012, 05:43:06 am »
Or old school: an EPROM (remember those?) with R/2R on the data lines, a counter on a number of address lines and the other address lines to select the waveform  :)
typically what's inside a dds chip isn't it ?

I bought this on ebay :
http://www.ebay.com/itm/-/170682095715?item=170682095715
a microcontroller, a display and voila...

So will this you'd just put a display with it some bnc sockets a box, and you have a function generator  !!!!!!!

no one would or will tell me how to delete this account
 

Offline Smokey

  • Super Contributor
  • ***
  • Posts: 1532
  • Country: us
Re: DIY Function Generator
« Reply #15 on: September 29, 2012, 06:09:21 am »
I have that same DDS board from ebay.  It's amazing what you can get for 6 bucks USD.  The chip itself in 1s is like 15bucks USD.  I already built a motherboard for it with uC, control pots, and +/-12V regulator from +5V input.  Going to level shift the DDS output so it's centered around 0V and amplitude scale from there.  Still need to write the code though.  Should be a killer little USB controlled function gen.

Those DDS chips are pretty much just a DAC, but the magic happens with the internal filtering and PLL stuff from what I can tell.  The data sheets are super dense with info.  Generating a nice sine wave is way harder than it appears.
 

Offline Rerouter

  • Super Contributor
  • ***
  • Posts: 3739
  • Country: au
  • Question Everything... Except This Statement
Re: DIY Function Generator
« Reply #16 on: September 29, 2012, 08:07:21 am »
Unless the frequency you want is really low

so what would be the solution for 0-20khz for sine and square if not a conventional dds chip but still digitally controllable?
 

Offline Smokey

  • Super Contributor
  • ***
  • Posts: 1532
  • Country: us
Re: DIY Function Generator
« Reply #17 on: September 29, 2012, 08:22:33 am »
They make these DDSs for different applications.  Check out the part matrix at the bottom of the page:
http://www.analog.com/en/rfif-components/direct-digital-synthesis-dds/products/index.html
The really fast ones are usually for clock generation, so they have parts that go up into the GHz.  There are other ones specifically for function gen applications, like the AD9833, that has a frequency output from 0MHz to 12.5Mhz at 0.1Hz steps and outputs sine, square, and triangle wave via software settings.  They really are versatile chips.

Here is a really interesting use of the AD9833 DDS.
http://electronicdesign.com/article/analog-and-mixed-signal/turn-dds-chip-into-low-frequency-arbitrary-signal-generator

(edit to add)
For only 20khz you can just hook a DAC up to a uC and step through a sine table.  20khz square wave is easy.
« Last Edit: September 29, 2012, 08:26:00 am by Smokey »
 

Online ejeffrey

  • Super Contributor
  • ***
  • Posts: 1683
  • Country: us
Re: DIY Function Generator
« Reply #18 on: September 29, 2012, 09:06:13 am »
Those analog devices function generator chips are nice, but they aren't very flexible.  They can definitely do your basic sin, triangle, square wave, but if you want a nice set of modulation, sweep, burst, and triggering options you have to implement that by manually adjusting the tuning word. 

If I were designing a lab function generator I would use an FPGA with an external DAC.
 

Offline grenert

  • Frequent Contributor
  • **
  • Posts: 446
Re: DIY Function Generator
« Reply #19 on: September 30, 2012, 03:53:32 am »
If you're interested in going the one-chip route, Jameco sells a kit (no enclosure) based on the XR2206:
https://www.jameco.com/webapp/wcs/stores/servlet/Product_10001_10001_20685_-1

They also have the bare chip for $6.49:
https://www.jameco.com/webapp/wcs/stores/servlet/Product_10001_10001_34972_-1

Velleman makes a complete kit that is based on a PIC:
https://www.jameco.com/webapp/wcs/stores/servlet/Product_10001_10001_2137262_-1
 

Online ejeffrey

  • Super Contributor
  • ***
  • Posts: 1683
  • Country: us
Re: DIY Function Generator
« Reply #20 on: October 01, 2012, 06:31:36 am »
so what would be the solution for 0-20khz for sine and square if not a conventional dds chip but still digitally controllable?

The problem with using a conventional DDS for low frequency is that you can really see the stair-stepping with a typical 10 bit DAC.  If you know you are only going to go to 20 kHz you can just change the output filter cutoff, but it is better to use a high resolution DAC or use an FPGA+DAC and apply dither and noise shaping.
 

Offline jerry507

  • Regular Contributor
  • *
  • Posts: 246
Re: DIY Function Generator
« Reply #21 on: October 02, 2012, 02:45:02 am »
I am always very skeptical of advising people to go with an FPGA for a project if learning to use the FPGA isn't the point. Perhaps this is bias from when I got my butt kicked by an FPGA in college, but it seems like just learning the FPGA can derail the original intent.

That said, wanting to build a function generator or similar test equipment is rarely about building the test equipment and more about learning whatever technology you want to use to build it. So the OP should look at his options:

1. FPGA w/ DAC
2. Microcontroller w/ DAC
3. DDS chip with perhaps some switchable output filters to clean up excessive stairstepping
4. A fully analog solution

Pick a path and then go down that one, so you're focused and have a real goal.
 

Offline Mechatrommer

  • Super Contributor
  • ***
  • Posts: 8482
  • Country: my
  • reassessing directives...
Re: DIY Function Generator
« Reply #22 on: October 02, 2012, 03:23:44 am »
or switchable among all 1-4? as in "audiophoolery" anything other than 4 is not tolerated? stairstepping will produce highly unwanted harmonics noise.
if something can select, how cant it be intelligent? if something is intelligent, how cant it exist?
The Future is Now, Breaking the GHz Barrier... (Lecroy DDA5005 5GHz 20GS/s XXL)
 

Offline perfect_disturbance

  • Regular Contributor
  • *
  • Posts: 144
  • Country: us
Re: DIY Function Generator
« Reply #23 on: October 03, 2012, 03:06:12 am »
OK so I m interested in the AVR DDS I was looking at some of the schematics and had a couple questions.

first I noticed in the power supply that after each of the regulators there are 2 caps a 100 and a .01 (I'm assuming uF).  In most reference designs I'v seen there is only a .1 cap after the regulator what is the 100 in this on for? Filtering lower frequency noise? Adapting to rapid changes in current drawn buy the rest of the circuit?



Next question is about the resistor network would I be better off buying resistor network or building my own?

Thanks
 

Offline poptones

  • Frequent Contributor
  • **
  • Posts: 711
  • Country: 00
Re: DIY Function Generator
« Reply #24 on: October 03, 2012, 04:57:53 am »
You should not get bad stairstepping with "conventional dds" if you use linear interpolation. It's not that hard.

If your goal is to make an audio frequency function gen buy a low cost audio i2c DAC and drive it from a microcontroller. Feed it 48ksamples/sec and the built in 8x oversampling feature will take care of a lot of it.

Another way, if you just want sines, is to use a mux as a 3 bit dac and a switched capacitor filter. I built one of these years ago and it works pretty well. And you can get all the parts sampled from maxim.

 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf