Electronics > Beginners
DIY Function Generator
Kleinstein:
Using a µC, RAM and DAC is rather similar to a DDS chip. So you should have analog filtering in both cases.
The external RAM can be a little faster than using an µC internal sine table. So this way the AVR (Arduino) might get you up to maybe 3.5 MSPS and thus maybe 1.2 MHz with a good reconstruction filter. Having the the sine table in the AVR limits the speed to about 2 MSPS and thus about 700 kHz usable sine frequency. So if you want to go cheap and soft, one could leave out the RAM. One might need a second µC for the user interface, as the µC would be busy all the time, when doing DDS in software.
Since the ready made DDS modules are not that expensive (slightly over 10 EUR / $10) - they are really attractive, as they include the clock and the filter (not really good, but also not that bad and definitely better than no filter). The AD9850 is also way more powerful than you get with µC, RAM and 8 bit DAC, as it includes a 10 Bit DAC and usually uses a 125 MHz clock.
ziplock9000:
--- Quote from: Kleinstein on January 16, 2017, 08:28:02 pm ---Using a µC, RAM and DAC is rather similar to a DDS chip. So you should have analog filtering in both cases.
The external RAM can be a little faster than using an µC internal sine table. So this way the AVR (Arduino) might get you up to maybe 3.5 MSPS and thus maybe 1.2 MHz with a good reconstruction filter. Having the the sine table in the AVR limits the speed to about 2 MSPS and thus about 700 kHz usable sine frequency. So if you want to go cheap and soft, one could leave out the RAM. One might need a second µC for the user interface, as the µC would be busy all the time, when doing DDS in software.
Since the ready made DDS modules are not that expensive (slightly over 10 EUR / $10) - they are really attractive, as they include the clock and the filter (not really good, but also not that bad and definitely better than no filter). The AD9850 is also way more powerful than you get with µC, RAM and 8 bit DAC, as it includes a 10 Bit DAC and usually uses a 125 MHz clock.
--- End quote ---
Thing is I'd be using this not just for sine waves but as an arbitrary function generator. I'm from a Software Engineer background so I'd write some nice front end software for the Arduino and PC to drive it with a nice GUI. So are you saying that external RAM would not be sufficient for waveforms beyond 3.5MPS?
rstofer:
--- Quote from: Kleinstein on January 16, 2017, 08:28:02 pm ---Using a µC, RAM and DAC is rather similar to a DDS chip. So you should have analog filtering in both cases.
The external RAM can be a little faster than using an µC internal sine table. So this way the AVR (Arduino) might get you up to maybe 3.5 MSPS and thus maybe 1.2 MHz with a good reconstruction filter. Having the the sine table in the AVR limits the speed to about 2 MSPS and thus about 700 kHz usable sine frequency. So if you want to go cheap and soft, one could leave out the RAM. One might need a second µC for the user interface, as the µC would be busy all the time, when doing DDS in software.
Since the ready made DDS modules are not that expensive (slightly over 10 EUR / $10) - they are really attractive, as they include the clock and the filter (not really good, but also not that bad and definitely better than no filter). The AD9850 is also way more powerful than you get with µC, RAM and 8 bit DAC, as it includes a 10 Bit DAC and usually uses a 125 MHz clock.
--- End quote ---
This dual CPU approach (AVRs) is exactly what is done with the FG085
http://cdn.sparkfun.com/datasheets/Tools/Schematic_085G.pdf
This design can sample at 2.5 Msps to generate a 200 kHz sine wave. Performance for other waveforms is MUCH lower:
--- Quote ---Function Range
Sine -- 200 kHz
Square -- 10 kHz
Triangle -- 10 kHz
Ramp -- 10 kHz
Staircase -- 10 kHz
--- End quote ---
This is a neat little FG but it is nowhere near a real AWG.
rstofer:
--- Quote from: ziplock9000 on January 16, 2017, 09:10:45 pm ---Thing is I'd be using this not just for sine waves but as an arbitrary function generator. I'm from a Software Engineer background so I'd write some nice front end software for the Arduino and PC to drive it with a nice GUI. So are you saying that external RAM would not be sufficient for waveforms beyond 3.5MPS?
--- End quote ---
The Arduino is just about fast enough to blink an LED. Seriously, it is not quick when compared to any of the more advanced ARM chips. Nor does it have the neat internal features like a DAC or DMA.
It's pretty easy to think about just incrementing RAM addresses and using a DAC to convert the value to a voltage. The hard part is knowing WHEN to increment the address and this is usually by detecting overflow in a long addition (64 bits?). This phase accumulator, as it is called, decides when to change addresses (when overflow occurs). We had a discussion about phase accumulators within the last couple of months over on the FPGA sub-forum. It might be worth a search.
Perhaps Google for 'digital frequency synthesis'.
Google also returns a lot of hits for 'op amp signal generator'. In a perfect world, square waves have zero rise time. At worst, a couple of nanoseconds! I'm not sure a garden variety op amp can slew that fast. There is also the problem of 'range'. There will need to be multiple timing capacitors and some method of switching. And scaling, and offset, etc...
http://www.ece.ucsb.edu/Faculty/rodwell/Classes/ece218b/notes/DDFS.pdf
MarkF:
--- Quote from: Brutte on January 16, 2017, 08:39:12 am ---
--- Quote from: MarkF on January 16, 2017, 12:23:51 am ---I started trying to build an arbitrary generator but quickly found that the frequencies that I could generate was very limited by the update rate I could achieve for the DAC. 100KHz in your case . My range is limited to 1Hz to 1Mhz because I only used a 32MHz clock for the AD9834. A DAC with a SPI interface would be even more limiting.
--- End quote ---
You cannot generate an arbitrary function with AD9834 at 32Msps as that would require 32MHz*8bit = 256Mbaud SPI! This chip can go that fast only by using internal memory (sine, square and triangle IIRC, + kind of sweep) so no arbitrary.
Arbitrary function generator has to be able to generate absolutely any programmable shape one can imagine. With that AD you are limited to the SPI speed (<3 MB/s for a PIC18F2550 at ~100% cpu load) so in theory you could reach 3Msps and 8-bit resolution max (IMHO).
--- End quote ---
I know. I didn't start looking at the AD9834 until I decided not to bother with the arbitrary waveform. I started with just a PIC16F877 and it's built-in DAC. I was unable to reach the frequency range I was looking for. That's when I turned to just the waveforms available in the AD9834 and the PIC18F2550 to do the GUI. The AD9834 more than meets my current needs.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version