Author Topic: Waveform Generator Project  (Read 37659 times)

0 Members and 1 Guest are viewing this topic.

Offline void_errorTopic starter

  • Frequent Contributor
  • **
  • Posts: 673
  • Country: ro
  • I can transistor...
Waveform Generator Project
« on: August 22, 2015, 11:46:11 am »
Yes, I know, another one of these... :scared:

Anyway, here's the idea:

Parts to be used: :-\
  • AD9833 waveform generator IC(the cheapest I could find, not one of those ebay modules)
  • PIC16F1XXX (TBD, depending on certain things)
  • LCD Display (character or graphical 128x64)
  • Rotary Encoder (for adjusting the frequency)
  • Menu buttons
  • Output filter (No idea here)
  • Offset adjustment via DAC
  • Output Attenuator (how?)
  • Output buffer OpAmp (fast one)

Questions: :o

1. Is the 8-bit DAC like the one in a PIC16F1707 good enough for DC offset adjustment?
2. Any output filter suggestions? The max output frequency for sinewave is 12.5MHz for a 25MHz clock but it's not really going to be a sinewave, right? 1MHz should be good enough.
3. How can I make an output attenuator that works for the frequencies involved? One way to do it would be small relays but I'd like a semiconductor based solution if that's possible.

The closest thing I've found to what I'm trying to do is this.
« Last Edit: August 23, 2015, 08:31:45 am by void_error »
Trust me, I'm NOT an engineer.
 

Tac Eht Xilef

  • Guest
Re: Waveform Generator Project
« Reply #1 on: August 22, 2015, 12:44:44 pm »
1) Depends how accurate / fine you want the offset to be ;)
2) Have play with the DDS simulator on the AD site, including the filtering options. I use the AD9833 as a VFO in a couple of projects, & I've found the simulator is remarkably accurate w.r.t. waveshape, amplitude, spurious noise, etc. If you're aiming at only 1MHz with a 25Mhz clock then you can practically get away with a simple first-order LC low pass, but I'd go for a low order Chebyshev or similar.
3) At 1MHz you can make an AGC amp out of practically jellybean parts and do at least some of your level control there by adjusting the gain. And again, at 1MHz you can get get away with simple constant impedance resistive attenuators & switching them in / out with just a rotary switch.

Myself, I'd aim a bit higher - 2MHz will be just about as easy, and 5MHz or more is certainly do-able with reasonable care.

For a 50ohm output buffer have a look at some of the line drivers & current feedback op-amps from TI, LT, etc. I haven't used any in anger myself yet, but I've got some THS3201's for when I get around to it.
 

Offline Kintekobo

  • Regular Contributor
  • *
  • Posts: 64
  • Country: gb
  • Avatar by the fabulous 'Space Coyote'
    • A Load of Old Bollox
Re: Waveform Generator Project
« Reply #2 on: August 22, 2015, 01:41:25 pm »
Tac Eht Xilef
2) Have play with the DDS simulator on the AD site, including the filtering options. I use the AD9833 as a VFO in a couple of projects, & I've found the simulator is remarkably accurate w.r.t. waveshape, amplitude, spurious noise, etc. If you're aiming at only 1MHz with



You know I learn something new just about every time I read this board :-+  That's a really useful resource that I didn't know about when I was building my audio sweep generator with an AD9850.
You can call me anything you like. Just don't call me late for lunch.
 

Offline void_errorTopic starter

  • Frequent Contributor
  • **
  • Posts: 673
  • Country: ro
  • I can transistor...
Re: Waveform Generator Project
« Reply #3 on: August 22, 2015, 02:46:17 pm »
1) Depends how accurate / fine you want the offset to be ;)
Hmm... I was asking because a DAC can cost more than a PIC micro, I'll have to take a closer look at the specs for both. I won't need more than 8 bits.

Quote
2) Have play with the DDS simulator on the AD site, including the filtering options. I use the AD9833 as a VFO in a couple of projects, & I've found the simulator is remarkably accurate w.r.t. waveshape, amplitude, spurious noise, etc. If you're aiming at only 1MHz with a 25Mhz clock then you can practically get away with a simple first-order LC low pass, but I'd go for a low order Chebyshev or similar.
You mean this. At 25 MHz clock a 1.25 MHz the sinewave looks almost like a sinewave so very little filtering will be required. At 2.5 MHz the sinewave still looks decent. Gotta start studying filters again... AD sim says 2nd order Chebyshev is enough.

Quote
3) At 1MHz you can make an AGC amp out of practically jellybean parts and do at least some of your level control there by adjusting the gain. And again, at 1MHz you can get get away with simple constant impedance resistive attenuators & switching them in / out with just a rotary switch.
I read that the VOUT of the AD9833 is +/- 0.6VP-P and centered around 0.3V which means I could simply amplify it to bring it up to 2VP-P and add the offset using another op amp. Add a constant impedance resistive attenuator and I'm done... well, sort of. I'll dig deeper into this.

Quote
Myself, I'd aim a bit higher - 2MHz will be just about as easy, and 5MHz or more is certainly do-able with reasonable care.

For a 50ohm output buffer have a look at some of the line drivers & current feedback op-amps from TI, LT, etc. I haven't used any in anger myself yet, but I've got some THS3201's for when I get around to it.

2.5 MHz looks pretty easy to deal with according to the simulator.

Haven't worked with any high frequency analog stuff so this will be a bit of a challenge for me.
I'll be squaring the signal using a fast comparator / schmitt trigger and only output sine/triangle with the AD9833. This way I'll have two outputs.

Thanks for the reply!

More suggestions are always welcome.
Trust me, I'm NOT an engineer.
 

Offline MarkF

  • Super Contributor
  • ***
  • Posts: 2523
  • Country: us
Re: Waveform Generator Project
« Reply #4 on: August 22, 2015, 07:14:00 pm »
Quote
1. Is the 8-bit DAC like the one in a PIC16F1707 good enough for DC offset adjustment?

I'm currently building a function generator too with the AD9834, PIC16F876, small OLED display and a rotary encoder.

The D/A functionality in the PIC can supply almost NO current.  You will need to buffer it with an op-amp.  I intend to use it to control the signal amplitude instead of the DC offset.  It uses the FS_Adjust pin on the AD9834 which is totally internal on the AD9833. 

You only get 4 bits (16 levels) of amplitude control.  That doesn't seem like a very fine adjustment. 
A Microchip MCP4802 8-bit DAC with a SPI interface would be a better choice.  They are only $1.62 at Mouser.  The MCP4822 is a 12-bit version for $3.16
 

Offline Kleinstein

  • Super Contributor
  • ***
  • Posts: 14080
  • Country: de
Re: Waveform Generator Project
« Reply #5 on: August 22, 2015, 08:32:05 pm »
The output filter is not that easy: normaly the sine wave would like a steep filter, like a 7 th Order chauer filter -sounds complicated but can be done as a passive LC filter. This is about standard with DDS chips. This way sine wave might work up to about 8 MHz, with slight reduction in amplitude at the higher end. Even if only used for generating the rectangular signal, this still might be usefull.

The triangle would like something like a Bessel filter, that is a rather slow roll-off with constant propergation delay. Still triangle will not be very good at higher frequencies, e.g. more than 500 kHz. One should do a simulation if it's worth adding a second filter just for a not so good triangle - some commercial units do that.

Usually 8 Bit for the Offset is not that bad. Still better than a normal pot can do.  DACs like MCP482x MCP492x are rather cheap as 10 and 12 Bit DACs.
Amplitude setting via the DDS current range will shift the offst a little, so some (analog) compensation would help. Still this is no more than fine tuning (e.g. 1:2).  Fine setting of the amplitude is not that simple other ways - low impedance digi Pots may still work at 1-5 MHz though.
Course setting is often done through a passive divider after the amplifier - though this would interfere with a offset, unless the GND output is shifted. However this makes the second output for the rectangular signal a little tricky.

The µC might output a PWM Signal as well, as a second, possibly faster source for rectangular signals and PWM Signals as well.
 

Offline void_errorTopic starter

  • Frequent Contributor
  • **
  • Posts: 673
  • Country: ro
  • I can transistor...
Re: Waveform Generator Project
« Reply #6 on: August 23, 2015, 08:30:51 am »
The output filter is not that easy: normaly the sine wave would like a steep filter, like a 7 th Order chauer filter -sounds complicated but can be done as a passive LC filter. This is about standard with DDS chips. This way sine wave might work up to about 8 MHz, with slight reduction in amplitude at the higher end. Even if only used for generating the rectangular signal, this still might be usefull.
The triangle would like something like a Bessel filter, that is a rather slow roll-off with constant propergation delay. Still triangle will not be very good at higher frequencies, e.g. more than 500 kHz. One should do a simulation if it's worth adding a second filter just for a not so good triangle - some commercial units do that.
Having two independent filters, one for sine and one for triangle should get around this problem. I'd only need two DPDT relays to switch between them.
I'm not planning to go too high in frequency for the triangle anyway.

Quote
Usually 8 Bit for the Offset is not that bad. Still better than a normal pot can do.  DACs like MCP482x MCP492x are rather cheap as 10 and 12 Bit DACs.
Amplitude setting via the DDS current range will shift the offst a little, so some (analog) compensation would help. Still this is no more than fine tuning (e.g. 1:2).  Fine setting of the amplitude is not that simple other ways - low impedance digi Pots may still work at 1-5 MHz though.
Course setting is often done through a passive divider after the amplifier - though this would interfere with a offset, unless the GND output is shifted. However this makes the second output for the rectangular signal a little tricky.
I haven't decided if I want fine amplitude adjustment yet but if it's too complicated I'll stick to dividers switched using relays.
As far as digital pots are concerned, I found this document.
The square wave will be 0-5V only.

Quote
The µC might output a PWM Signal as well, as a second, possibly faster source for rectangular signals and PWM Signals as well.
Planning to use the PWM output as well for variable duty cycle or use the triangle output with a DAC and a comparator to do the same thing.

The PIC in question has opamps on board. The NINV can be connected internally to the DAC you can also select Op Amp Unity Gain Select bit and save another pin, so you have a buffer. The on board OPamps are not spectacular by any means, comparable to many low cost PWM controllers EAs in performance but maybe good enough for the application at hand.
Not trying to build anything extremely precise here, if I ware to do that the cost of the whole thing will start snowballing .

Quote
You can also use an external reference with the DAC thereby setting whatever resolution you want. Use the other opamp to buffer a resistive divider off your Vcc rail to the Vref pin, make it whatever you want for ultra cheapo solution. :D
That's a pretty neat and cheap solution. 4.096V reference divided by 1,2,4, 8 or 16 down to around 0.256V will give me down to around 1mV theoretically (8 bit DAC) but I don't think I'm going to need to go that low.

Quote
EDIT

The 1707 has no DAC pick the 08 or 09
Sorry, copied typo. ::)

Quote
Edit2

You might try the PIC16F1716 only about a buck in small quantity its been out a couple years, 3 I think minimal errata and nothing major so far.

http://canada.newark.com/microchip/pic16f1716-i-so/microcontroller-mcu-8-bit-pic16/dp/96W5477
Thanks! I haven't looked into all the suitable micros for this. I can get the 1716 for about $2 from TME, pretty cheap for what it's capable of.

EDIT: Found a filter calculator, AD again http://www.analog.com/designtools/en/filterwizard/#/type
« Last Edit: August 23, 2015, 10:26:29 am by void_error »
Trust me, I'm NOT an engineer.
 

Offline void_errorTopic starter

  • Frequent Contributor
  • **
  • Posts: 673
  • Country: ro
  • I can transistor...
Re: Waveform Generator Project
« Reply #7 on: August 29, 2015, 07:43:43 am »
Found some suitable op amps - AD8066 - not so cheap but not ridiculously expensive either, two per package, MSOP-8 case - nice and tiny. Their only drawback is the Input Common-Mode Voltage Range: -5 to +1.7V for a +/-5V supply but that's not that bad.

PWM output will be made using the triangle output and DAC fed into a comparator, 0-5V output only, so no PWM available if sine is selected for the DDS output .

I'm currently stuck at how to adjust the output voltage.

One way to do it is a constant impedance divider at the output but that will probably screw with me if I add DC offset to the output voltage before the output buffer op amp. AC + 500mV DC on 50 ohms is in excess of 10mA. I should probably be thinking about a different output op amp.

Another way would be to use a digital potentiometer before the output buffer but it has frequency limitations so it's pretty much useless at anything above a few hundred kHz. Well it's still going to work but I don't want extra attenuation at higher frequencies now do I?

This leaves me with one more option: switchable resistive divider, again, before the output buffer. Using relays would work but it would bulky and rather expensive unless I can get my hands on cheap small relays. Analog switches/multiplexers are dirt cheap but they have higher parasitic capacitance and switch resistance than relays.

How should I adjust the amplitude?

EDIT: LMH6612 seems to be another candidate for the op amps.
« Last Edit: August 29, 2015, 07:59:29 am by void_error »
Trust me, I'm NOT an engineer.
 

Offline Kleinstein

  • Super Contributor
  • ***
  • Posts: 14080
  • Country: de
Re: Waveform Generator Project
« Reply #8 on: August 29, 2015, 10:21:38 am »
For amplitude control there are essentially 2 options:
1) Use a special varible gain amplifier / muliplier, like AD831 or AD603. Possible 1 more coarse stage via relais
    As a low cost version a mixer like MC1496 could be used, but is not really temperature stable.

2) Use the ref. current of the DDS to do fine adjustment (e.g. 0... 6 dB) and a switched attenuator with somthing like 5 dB steps.
    So this needs a few relais, but not that dramatical many, e,g, stages with 5 + 10 + 20 + 20 dB.

As for the DC offset, there is the option to shift the output ground. So the AC amplifier is allways running with 0 DC offset, but the ground of the Output connector is shifter by a certain voltage from a low frequency stage. The good thing is, that this still allows the full AC Amplitude independet of DC level. Also the Attenuator might be at the output.
The bad thing is, that this ony works well for one Output. So the extra sync output or PWM output would need some kind of isolation or bootstrapped output stage. For just a few digital outputs this OK and might even be used for an isolated output.  Also the Amplifier has to be able to drive the full power, as there can be additional DC current. So good cooling of the output amp may be needed.  So this might require 2-3 OPs in SO8 for the output, depending on the supply.
 

Offline void_errorTopic starter

  • Frequent Contributor
  • **
  • Posts: 673
  • Country: ro
  • I can transistor...
Re: Waveform Generator Project
« Reply #9 on: August 29, 2015, 12:40:06 pm »
AD603 looks like a good option... gotta figure out how to use it first.

I'll have to find a way to deal with the extra current caused by the DC offset, but I'm not planning on shifting the output ground.
Trust me, I'm NOT an engineer.
 

Offline void_errorTopic starter

  • Frequent Contributor
  • **
  • Posts: 673
  • Country: ro
  • I can transistor...
Re: Waveform Generator Project
« Reply #10 on: August 30, 2015, 07:42:19 am »
One more question:

So I decided to switch from the AD9833 to the more versatile AD9832...

Is it a good idea to AC couple the signal from the AD9832 output (R & C across it like in the datasheet) with a 47u MLCC & ~100k (bias, IN+ to GND) to an op amp buffer driving the active low-pass filter(s)? Cutoff frequency is below 0.1Hz with all the MLCC quirks taken into account. If anyone is wondering schematic is still work in progress.
Trust me, I'm NOT an engineer.
 

Offline Kleinstein

  • Super Contributor
  • ***
  • Posts: 14080
  • Country: de
Re: Waveform Generator Project
« Reply #11 on: August 30, 2015, 09:42:44 am »
Ac Coupling of the DDS Signal makes Adjustment easy, but there is a low frequency limit and it takes time at power on so settle. So a 0.1 Hz lower frequency limit it may take 1 minute to after power on to settle, if not special provisions are taken, to speed up. So a very low lower bound may not be so practical. Slight reduction in amplitide can be compensated by software. So even if the filter is at 1 Hz, the output might be still useful to 1-2 Hz.

The alternative to AC coupling would be adjusting the DC level with a trimmer or two (if DAC ref. voltage is variable).

At least the filter for the sine wave should be a LC filter. At somthing like 1-10 MHz, an aktive filter is rather complicated. The LC filter in contrast is rather easy at this higher frequency, as inductors are small (e.g. size 0805) enough. The typical LC filter (7th or  9th order) consists of only something like 3 or 4 induktors, 7 or 9 capacitors and 1 or 2 resistors.  Also tolerances are less critical compared to a steep (high Q) active filter. The usuall way is to have the LC fitler directly driven from the DDS Chip and a buffer / amplifier after that.
 

Offline SaabFAN

  • Frequent Contributor
  • **
  • Posts: 735
  • Country: de
Re: Waveform Generator Project
« Reply #12 on: August 30, 2015, 03:04:17 pm »
To adjust the output-amplitude, I would suggest some sort of automatic gain control.
I did some research into that area when I tried making a Waveform-Generator myself - abandoned it because I didn't have the time to do all the software.
Here is what I came up with: Use a DAC or filtered PWM to generate a reference-voltage, feed that into an OpAmp, and then use a Precision Peak Detector to get the amplitude to feed the other input of the OpAmp, which in turn controls either a variabale Gain Amp, or a variable Attenuator (JFET or PIN-Diode Attenuator). This Attenuator is then followed by the DC-Offset Stage, consisting of a fast OpAmp (THS3092 for example), followed by the output-stage (The second Amp inside the THS3092 or a dedicated Output-Amplifier).
This is roughly how the AGC and Output-Stages of Philips Function-Generators were designed and also borrows some ideas from cheap Signal-Gens you can find on ebay.

Offline void_errorTopic starter

  • Frequent Contributor
  • **
  • Posts: 673
  • Country: ro
  • I can transistor...
Re: Waveform Generator Project
« Reply #13 on: August 30, 2015, 09:11:16 pm »
Ac Coupling of the DDS Signal makes Adjustment easy, but there is a low frequency limit and it takes time at power on so settle. So a 0.1 Hz lower frequency limit it may take 1 minute to after power on to settle, if not special provisions are taken, to speed up. So a very low lower bound may not be so practical.

The alternative to AC coupling would be adjusting the DC level with a trimmer or two (if DAC ref. voltage is variable).
DC offset adjustment to 0 after the filters would be an option...

Quote
At least the filter for the sine wave should be a LC filter. At somthing like 1-10 MHz, an aktive filter is rather complicated. The LC filter in contrast is rather easy at this higher frequency, as inductors are small (e.g. size 0805) enough. The typical LC filter (7th or  9th order) consists of only something like 3 or 4 induktors, 7 or 9 capacitors and 1 or 2 resistors.  Also tolerances are less critical compared to a steep (high Q) active filter. The usuall way is to have the LC fitler directly driven from the DDS Chip and a buffer / amplifier after that.
Why is an active filter complicated at those frequencies? Parasitic capacitance/inductance? AD has a nice filter design tool but most of the values for R or C it spews out are not standard.
To be honest I've never used LC filters... Which one would be better in my case? A T or a Pi? Completely clueless here. I could simply copy/modify a filter from another DDS waveform generator but I wouldn't be learning anything, would I?
The AD9832 outputs a current which is then converted to a voltage via an external resistor (for AD9833 it's 200 ohm and inside the chip). How would attaching a filter directly to that affect the amplitude?

To adjust the output-amplitude, I would suggest some sort of automatic gain control.
I did some research into that area when I tried making a Waveform-Generator myself - abandoned it because I didn't have the time to do all the software.
Here is what I came up with: Use a DAC or filtered PWM to generate a reference-voltage, feed that into an OpAmp, and then use a Precision Peak Detector to get the amplitude to feed the other input of the OpAmp, which in turn controls either a variabale Gain Amp, or a variable Attenuator (JFET or PIN-Diode Attenuator). This Attenuator is then followed by the DC-Offset Stage, consisting of a fast OpAmp (THS3092 for example), followed by the output-stage (The second Amp inside the THS3092 or a dedicated Output-Amplifier).
This is roughly how the AGC and Output-Stages of Philips Function-Generators were designed and also borrows some ideas from cheap Signal-Gens you can find on ebay.
Already found a way, not so cheap but easy to implement, using an AD603.
Trust me, I'm NOT an engineer.
 

Offline Kleinstein

  • Super Contributor
  • ***
  • Posts: 14080
  • Country: de
Re: Waveform Generator Project
« Reply #14 on: August 30, 2015, 09:59:24 pm »
The 200 Ohms output load impedance seems typical for the DDS chips. So you can quite easily convert designs from other chips like 9850.
The typical filter is higher order, more like a chain of Pi type: The basic shape is just a chain of lets say 3 inductors and 4 caps to GND, one at each end of the inductors. The output has the 200 Ohms termination to GND. Usally the filter for a DDS has addtional zeros (Cauer type filter) so parallel to each inductor there is another cap. Though the filter looks very simple, the amplitude vs. frequency curve can be quite good, as the sensitivity to component values is not very high. The caps parallel to the inductors and there self resonance only determine the position of the extra zeros - so not critical to the passband, but only details of the stop band.

There are also filter design tools for this kind and other LC filters. There are also ready made tables to get the right values. So in this respect it't not that much different from active filters. Component value may also be non standard  so that something like 2 parallel caps are often used. Here it also helps that the caps don't need to be as accurate as in an active filter.

Steep, high Q active filters are difficult, as the caps need to be rather exact. Erros in values can result in passband ripple. At high frequencies the OPs need to be quite fast: usually something like 10*Q * f_max or even 10*Q²*f_max is needed. Also parasitics and inter stage coupling get important. So think about 100-500 MHz OPs,  1% (or better) caps and shielding between the stages if you really want to go active.

An active filter might be an option for the triangel part, as this uses lower Q and slightly lower frequency. I still would look at the LC version for comparison.
 

Offline SundayProgrammer

  • Contributor
  • Posts: 33
  • Country: fi
Re: Waveform Generator Project
« Reply #15 on: August 31, 2015, 06:48:20 am »
Like many other hobbyist I also made MCU based generator using 9833. After 5MHz or so the wave shape becomes quite ugly. I checked the output of the simulator and it is pretty close what you get from an actual chip. MCU controlled amplitude control caused some headache to me but the result is decent. I'm sure much more sophisticated analog circuit would give better result. I used VCA810+AD847+AD8001.

Axel.
 

Offline void_errorTopic starter

  • Frequent Contributor
  • **
  • Posts: 673
  • Country: ro
  • I can transistor...
Re: Waveform Generator Project
« Reply #16 on: September 01, 2015, 05:54:08 pm »
How will the elliptic (Cauer) filter affect the triangle wave? Should I try to design it with FC as high as possible? Something like 10+MHz?
Trust me, I'm NOT an engineer.
 

Offline SaabFAN

  • Frequent Contributor
  • **
  • Posts: 735
  • Country: de
Re: Waveform Generator Project
« Reply #17 on: September 01, 2015, 11:40:35 pm »
Already found a way, not so cheap but easy to implement, using an AD603.

I would suggest the LMH6505. It is cheaper (5,27€ vs. 9,81€) and also a lot faster (1500V/µs vs. 275V/µs) than the AD603.


To filter the DDS-Output, I think a Cauer-Filter might be the best idea: The 12Mhz max. Frequency is rather close to the 25Mhz Master Clock, as well as the MCU-Clock (I guess 16 Mhz). So you need a sharp filter.

Unless I missed something about creating the triangle-wave, the best way is most likely a Schmitt-Trigger (74HCT14 or 74AC14) to create a Square-Wave that is then integrated by several stages that come online in different frequency-ranges.
This method presents you with the problem of frequency dependent amplitude of the triangle-wave, however. Requiring again some sort of automatic gain control to get the amplitude right.
If you control the variable gain Amp directly from the MCU, you can use the ADC of the MCU to measure the voltage from a peak-detector to close the control-loop in the digital domain.
I would prefer the analog way though, because I don't like programming that much :)

Offline Kleinstein

  • Super Contributor
  • ***
  • Posts: 14080
  • Country: de
Re: Waveform Generator Project
« Reply #18 on: September 02, 2015, 07:43:32 am »
I would suggest a rather high filter cur off frequency, though not more than 10 MHz, but more like 8-10 MHz. The closer one is to the theoretical llimit of 12.5 MHz, the more critical the filter gets.

I don't know how much the filter will effect the triangle. However one can relatively easy check that in a spice simulation. Low frequencies like less than 100 kHz schould be still acceptable with the filter in place.
The trouble is phase shift in the higher frequncy componets. High frequency triangle will not not be good anyway, as no filter can extrapolate missing the peaks. So for a good trinagle at more than about 100 kHz, analog integration of a rectangle signal may be the best option anyway. A similar solution would be a PLL with a triangular VCO - here one could copy from old analog generators. If there already is a VCA the integration method might be easier though.
 

Offline branadic

  • Super Contributor
  • ***
  • Posts: 2379
  • Country: de
  • Sounds like noise
Re: Waveform Generator Project
« Reply #19 on: September 02, 2015, 09:58:05 am »
There has been a project "DDS based function generator with AD5930" and a corresponding wiki on how to design the reconstruction filter etc.

http://www.mikrocontroller.net/topic/168134#1606968

It uses an elliptic filter followed by a sinc-filter to compensate for frequency response, one of the most important parts to get nearly flat output characteristics of the amplitude.

www.hit.bme.hu/~papay/edu/Conv/pdf/FlatResponse.pdf

An amp stage is also available in this thread.
The board is controlled via FT232 and a small program called "Siggy" with a computer.

AD593x was chosen because it includes sweep functionality.
« Last Edit: September 02, 2015, 05:50:38 pm by branadic »
Computers exist to solve problems that we wouldn't have without them. AI exists to answer questions, we wouldn't ask without it.
 

Offline void_errorTopic starter

  • Frequent Contributor
  • **
  • Posts: 673
  • Country: ro
  • I can transistor...
Re: Waveform Generator Project
« Reply #20 on: September 03, 2015, 07:16:09 pm »
I would suggest a rather high filter cur off frequency, though not more than 10 MHz, but more like 8-10 MHz. The closer one is to the theoretical llimit of 12.5 MHz, the more critical the filter gets.
Used a program I found using google (Elsie) to get the exact values for the circuit, then I rounded them up or down to the closest standard values. The results are in:

The Cauer filter was a bit of a pain in the arse to get the right response out of  for standard component values but it was doable. The Butterworth filter is much simpler in that respect. All filter components are available in 0603 size.



Quote
I don't know how much the filter will effect the triangle. However one can relatively easy check that in a spice simulation. Low frequencies like less than 100 kHz schould be still acceptable with the filter in place.
The trouble is phase shift in the higher frequncy componets. High frequency triangle will not not be good anyway, as no filter can extrapolate missing the peaks. So for a good trinagle at more than about 100 kHz, analog integration of a rectangle signal may be the best option anyway. A similar solution would be a PLL with a triangular VCO - here one could copy from old analog generators. If there already is a VCA the integration method might be easier though.
It should be able to go to up to 200-250kHz. At 500kHz the edges go blunt and there's some phase shift but it could still be usable since the attenuation is not very high.
Not much difference between Cauer and Butterworth either, they both affect the triangle input the same way.
Please excuse the inconsistency of the screenshot sizes, I forgot I was on my second monitor... :scared: Oh, and inductors and capacitors are ideal, will add the parasitics later. (because I forgot... I think I should sleep more) ::)

Triangle @ 100kHz:


Triangle @ 500kHz:


Hopefully whoever looks at this thread finds this useful...

There has been a project "DDS based function generator with AD5930" and a corresponding wiki on how to design the reconstruction filter etc.

http://www.mikrocontroller.net/topic/168134#1606968

It uses an elliptic filter followed by a sinc-filter to compensate for frequency response, one of the most important parts to get nearly flat output characteristics of the amplitude.
Sinc filter... never heard of it, looked it up and seen what it does. I'll most likely skip that for my first DDS waveform generator.

Quote
www.hit.bme.hu/~papay/edu/Conv/pdf/FlatResponse.pdf

An amp stage is also available in this thread.
The board is controlled via FT232 and a small program called "Siggy" with a computer.

AD593x was chosen because it includes sweep functionality.
I'll take a look at that as well. Thanks for the info!

EDIT: It's probably not a good idea to take the triangle above 250kHz which corresponds to 100 discrete steps at 25MHz clock.
« Last Edit: September 03, 2015, 08:12:01 pm by void_error »
Trust me, I'm NOT an engineer.
 

Offline Kleinstein

  • Super Contributor
  • ***
  • Posts: 14080
  • Country: de
Re: Waveform Generator Project
« Reply #21 on: September 03, 2015, 08:25:09 pm »
The filter to keep the triangle in shape would be a bessel type filter. But I am not sure its really worth it, because of the limited number of sample in the triangle. At odd frequencies this will cause some kind of jitter, as from the DDS not all periodes will look the same. A filter might also help at the very low frequencies (e.g. < 10 kHz), to avoid the discrete step appearance - though 10 Bits is allready quite high resolution. This filter could than likely be a active filter with OPs.

With the elliptc filter, the first zero should be somewhere near 12,5 MHz - so 10 MHz Limit might be a little high.

The sinc filter is a correction for the normal sin(f)/f fall of a sampled signal. It might help, but amplitude setting by the µC could compensate for this as well. The corrective filter may not be that complicated possibly just part of an amplification stage - so I would keep it in mind. the Link provides by brandic is really good an this.
 

Offline SaabFAN

  • Frequent Contributor
  • **
  • Posts: 735
  • Country: de
Re: Waveform Generator Project
« Reply #22 on: September 04, 2015, 02:12:00 am »
Have you thought about using an FPGA like the Altera MAX 10 instead of the AD9832?
The cheapest one can be found for 6,46€ on Digikey in quantities of 1.
Configured as a fast 4Kbyte RAM + Address-Counter and using the internal PLL to make the Output-Clock Variable, these FPGAs would add full arbitrary waveform capability to your design. With 2000 Logic-Elements, the cheapest MAX 10 should also be able to generate Sine, Square, Triangle and Sawtooth from mathematical formulas in real-time.
The output of the signal could be a simple Resistor-Ladder, which effectively would give you a DAC that can run at about 400MS/s!
With a half-decent analog part, this system could easily beat these cheap chinese signal-generators you can find on ebay. Maybe not in terms of price, but definitely in terms of quality :)

The disadvantages though: These devices come in 144pin TQFP-Packages, which basically can only be reflow soldered (A 20€ Pizza-Oven, Multimeter Temperature-Sensor and some solder-paste can take care of that), and their configuration has to be developed and programmed.

Offline SundayProgrammer

  • Contributor
  • Posts: 33
  • Country: fi
Re: Waveform Generator Project
« Reply #23 on: September 04, 2015, 08:23:07 am »
Have you thought about using an FPGA like the Altera MAX 10 instead of the AD9832?

I have been pre-designing the next generator release based on FPA. Are you aware how many datapoints are typically used for example sinewave? Adjusting PLL based on target frequency it means that for example 10 datapoints per wave means 100MHz if target freq is 10MHz. I assume that commercial devices have several wave maps (?)

I have used solder friendly boards like this for FPGA projects:
http://www.ebay.com/itm/XC3S500E-XILINX-Spartan-3E-FPGA-JTAG-Dev-Core-Board-XCF04S-FLASH-Module-Kit-/271309942384?hash=item3f2b552e70

Cheaper ones can be found - this was the first hit of a quick search.

Axel.

 

Offline SaabFAN

  • Frequent Contributor
  • **
  • Posts: 735
  • Country: de
Re: Waveform Generator Project
« Reply #24 on: September 04, 2015, 02:51:49 pm »
I can only speak from my experiences with the MHS-5200A (12Mhz Model): It uses 1K-Point Maps for the arbitrary Waveforms at a samplerate of 250MS/s max. With that, the most expensive version can produce up to 25Mhz Sine-Wave. Other waveforms are available too, but beyond 3 to 4 Mhz they begin to look more and more like sine-waves because of the shortcomings in the analog part.
The 250Mhz Master-Clock for the DAC is most likely generated by an internal PLL that derives this clock from the Main Clock (There is only 1 Crystal on the PCB).

To generate several waveforms, the MHS-5200A has 5 Preinstalled Waveforms, as well as 15 save-slots that can be used to store custom waveforms uploaded via USB. These are stored inside the Lattice Mach X02 CPLD (has to be, there is no RAM/ROM attached to it).
My guess is that the 4 standard waveforms (Sine, Square, Triangle, Sawtooth, Reverse Sawtooth) are created by an algorithm configured into the CPLD-Hardware, and the arbitrary waveforms are generated by directly connecting the Memory-Output Port to the 8 Pin-Drivers that form the DAC with the R2R-Ladder attached to them.

As I said, I don't know about the design of more expensive units, but I guess they are rather similar: MCU handles User-Interface, USB-Communication, configuration of Waveforms, Frequency, DC-Offset, Amplitude, etc. And the FPGA handles the actual creation of the waveform. Either by using an R2R-Ladder or a dedicated parallel Input DAC with a high Sample-Rate. The way the FPGA gets the Waveform-Data might be different though: On a less capable unit the Waveform is most likely stored inside the FPGA, while more expensive units use DDR2/DDR3-RAM to allow huge amounts of Samplepoints to be stored.

That little board you posted looks interesting btw. Hopefully there is something similar for Altera Devices, as I'm already familiar with their Software and have the USB-Blaster cable available here.
Once I'm done with University-Stuff for this year (early October), I'll do some experiments with the MAX V I have bought a while ago.


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf