Shop OBEX P1 Docs P2 Docs Learn Events
Ultrasonic Sinewaves — Parallax Forums

Ultrasonic Sinewaves

CoronaKidCoronaKid Posts: 25
edited 2010-05-11 03:44 in Propeller 1
Newbie...Analog man struggling with digital spin!
I·been scanning the Forums and Opjects for ways to generate ultrasonic sinewaves (up to 60khz).·
Methods found so far are duty mode & pwm with R/C filter, delta-modulation, and·8-16 bit Ladder & IC DACs.
I'm thinking·a 8 or 12 bit dac IC would work best for my project.
Can anyone recommend a good·dac IC·model/brand·or have a simple spin example they could share.
Any advice would be appreciated.




▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
________________________________

Fred
Work:www.vhf.ca··Play:www.Costalegre.ca
«1

Comments

  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2010-04-03 02:05
    What requirements of your project are causing you to shun the DUTY mode output?

    -Phil
  • AleAle Posts: 2,363
    edited 2010-04-03 08:26
    Use a DDS... AD9834 or 5... Or do it via software, the DDS I mean, then a DAC. I'd use (and did) a monolithic DDS. The thing is that via software every step would be some 4 or so instructions then your effective clock would be 5 or less MHz. Check the datasheet of those parts to see how they work, they may give you some more ideas. (Be aware of the current outputs!)

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Visit some of my articles at Propeller Wiki:
    MATH on the propeller propeller.wikispaces.com/MATH
    pPropQL: propeller.wikispaces.com/pPropQL
    pPropQL020: propeller.wikispaces.com/pPropQL020
    OMU for the pPropQL/020 propeller.wikispaces.com/OMU
    pPropellerSim - A propeller simulator for ASM development sourceforge.net/projects/ppropellersim
  • LeonLeon Posts: 7,620
    edited 2010-04-03 10:25
    Many years ago I used a software DDS on a little AVR and a DAC for an ultrasonic system, it worked very well. I think it's still in use.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Leon Heller
    Amateur radio callsign: G1HSM

    Post Edited (Leon) : 4/3/2010 10:32:57 AM GMT
  • CoronaKidCoronaKid Posts: 25
    edited 2010-04-04 00:41
    Phil Pilgrim (PhiPi) said...
    What requirements of your project are causing you to shun the DUTY mode output?

    -Phil
    Hi Phil,
    I have not ruled out using Duty Mode, especially after trying caskaz's corrected code:
    http://forums.parallax.com/showthread.php?p=888280

    I changed the R/C network to 2K7/0.001 for 59khz lowpass cutout, but have not yet figured out how to move the freq up to 55Khz.

    The simplicity of using a counter in single-ended Duty Mode to output a frequency signal on one pin is very attractive.· Also·the differential mode adds more·output options.· Very interesting!··I see this code is well documented in Propellers Educational Kit Labs pages 130-134.

    My projects first requirement it to have the propeller output a stable, high resolution sinewave with a frequency accuracy of 0.1% or better.

    As a Prop/Spin beginner I appreciate the helpful advice/information found on this forum.
    Thanks, Fred

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ________________________________

    Fred
    Work:www.vhf.ca··Play:www.Costalegre.ca
  • CoronaKidCoronaKid Posts: 25
    edited 2010-04-04 00:59
    Ale said...
    Use a DDS... AD9834 or 5... Or do it via software, the DDS I mean, then a DAC. I'd use (and did) a monolithic DDS. The thing is that via software every step would be some 4 or so instructions then your effective clock would be 5 or less MHz. Check the datasheet of those parts to see how they work, they may give you some more ideas. (Be aware of the current outputs!)

    Hi Ale,
    Checked out both data sheets for the AD8934/35. WOW!
    These IC's are state of the art, with precision oscillator, cos table, modulator and 10 bit dac in one small package.

    Unfortunately they are overkill for my·basic project, as the frequency range &·accuracy is more than I need.
    They also need to be individually programmed, and their TSSOP package is beyond my breadboarding capabilities.

    I'm trying to base my design around the propeller chip with maybe a few outboard support IC's.
    Thanks,

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ________________________________

    Fred
    Work:www.vhf.ca··Play:www.Costalegre.ca
  • DroneDrone Posts: 433
    edited 2010-04-04 18:23
    Take a look here www.myplace.nu/avr/minidds/index.htm

    Port to Propeller assembler-PASM (you will need a re-entrant call).
    You will get similar results with a propeller at 80MHz vs. an AVR at 20MHz
    as an AVR runs at (typically) 1 clock per instruction vs. (typically) four
    clocks per instruction for PASM. There is lots about this on this forum
    but unfortunately, searching this forum is a nightmare (when Parallax
    are you going to fix this?)

    Short reply, gotta-run, sorry...

    David

    Post Edited (Drone) : 4/4/2010 6:30:45 PM GMT
  • Tracy AllenTracy Allen Posts: 6,656
    edited 2010-04-04 18:56
    If CLKFREQ=80MHz and with a target of 60 kHz (as an example), there will be jitter at the output. Each complete period can consist of either 1333 or 1334 units of 12.5 ns, which correspond to exact frequencies of close to 60015 Hz and 59970 Hz, so the jitter in the period is about 0.025%. That is within your 0.1% spec. It is possible to obtain frequencies of 60015 Hz and 59970 Hz without much jitter, but not so frequencies in between. You can improve the performance by clocking the Prop at say 100 MHz. DDS chips use the same principle, but clock at near GHz so that the jitter is correspondingly less.

    Here is another tutorial example in both Spin and PASM. The PASM program there would update the phase of a 60kHz sine wave about 16 times per second. so it is not to hard to filter.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • LeonLeon Posts: 7,620
    edited 2010-04-04 19:21
    Here is my version of that MiniDDS system:

    webspace.webring.com/people/jl/leon_heller/minidds.html

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Leon Heller
    Amateur radio callsign: G1HSM
  • TonyWaiteTonyWaite Posts: 219
    edited 2010-04-05 09:24
    Hi,

    I've followed this thread with interest, because I'm thinking about a DC-to-RF DDS system.

    Those dedicated DDS hardware chips look attractive. But how high a frequency can you get to just
    using a Propeller DDS in software?


    Regards,

    T o n y

    Post Edited (TonyWaite) : 4/5/2010 9:35:01 AM GMT
  • DroneDrone Posts: 433
    edited 2010-04-05 13:38
    Hi Tony,

    Some time ago I did a DDS in PASM with an 8-bit R2R ladder output DAC. The sine version uses a 256 sample look-up table in cog RAM and a 24-bit accumulator. The PASM routine takes 40 clocks, so with the propeller running at 80MHz theoretically you can get output through 1MHz but without a low-pass filter on the output the real usable output frequency is around 150-200kHz max. Step size is 0.119Hz. A square wave or triangle wave implementation would be a bit faster as no look-up table is needed, a triangle wave output theoretically has no odd-order products. The PASM stuff takes around 290 longs including the look-up table so there is some cog RAM left for a higher-resolution look-up table. The current eight-bit sine samples are stored in longs to minimize look-up time. You can store any sampled waveform data in cog RAM, so this approach really makes a sort-of arbitrary waveform generator. With a 24-bit accumulator high bit-width calculations are required for small step sizes, something the propeller is not good at IMHO given the available running math stuff I've seen so far. (Maybe someone can make the high-precision math examples on the Propeller Wiki work in the real-World, not just in simulation.)

    I really need to dig this project up and clean it for release; one of those things that never gets done. For radio use, this DDS might be useful for something like a BFO or perhaps a clock for switched-capacitor filters in the audio stages. I strongly suspect the jitter (phase-noise) is not acceptable for mixing up to higher frequencies for use as an L.O. in a receiver; e.g. target is around -140dBc/Hz at 10kHz for a good HF receiver. You are likely to never get this with a general purpose micro-controller with an internal PLL clock, especially with 8-bit resolution over a broad range of frequencies. Theoretically when you multiply a source in frequency phase-noise increases, when you divide it decreases. I forget the amount (this is a complex subject).

    The PropScope from Parallax ($249 USD) has an 8-bit arbitrary waveform generator built-in that supposedly goes to something like 25MHz. I've asked how this is being done only to be told the method is proprietary, so be-it. Perhaps someone else can shed light on this.

    Here are some DDS links (they are working at post-time):

    1. Analog Devices, A Technical Tutorial on Digital Signal Synthesis, Analog Devices

    www.analog.com/static/imported-files/tutorials/450968421DDS_Tutorial_rev12-2-99.pdf

    2. Analog Devices, MT-085: Fundamentals of Direct Digital Synthesis (DDS)

    www.analog.com/static/imported-files/tutorials/MT-085.pdf

    Gotta run... Best Regards, David
  • lonesocklonesock Posts: 917
    edited 2010-04-05 18:21
    Drone said...
    ...
    The PropScope from Parallax ($249 USD) has an 8-bit arbitrary waveform generator built-in that supposedly goes to something like 25MHz. I've asked how this is being done only to be told the method is proprietary, so be-it. Perhaps someone else can shed light on this...
    If you only need 8 or fewer bits of output, and use a resistive-ladder output (as opposed to the DUTY mode of a counter), you could use the video hardware to stream out the waveform. Set up the output frequency, then feed the video HW 4 samples at a time.

    Jonathan

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    lonesock
    Piranha are people too.
  • DroneDrone Posts: 433
    edited 2010-04-06 06:04
    Hi Johnathan,

    I'm not familiar with the video hardware. Do you know of any examples of doing what you describe in your post?

    Regards, David
  • DroneDrone Posts: 433
    edited 2010-04-06 06:07
    I posted my sine wave DDS object to the forum for comments. This little object will easily do 60kHz sine waves with 0.119Hz/bit of resolution. You just call the DDS from Spin and provide a tuning word. Here is my post:

    http://forums.parallax.com/showthread.php?p=896364

    Regards, David
  • K2K2 Posts: 691
    edited 2010-04-06 08:07
    I don't know if Corona Kid found everything he needed in this little discussion, but it was absolutely perfect for me!

    Thanks to CK for the question, and everyone who answered. Particular thanks to Tracy Allen.

    Answers I need appear on this forum before I get around to asking the questions. [noparse]:)[/noparse]

    Heater and his Prop implementation of ZPU is another absolute miracle that fell into my lap today.

    "Thanks" hardly suffices.
  • CoronaKidCoronaKid Posts: 25
    edited 2010-04-07 03:06
    David Jensen said...
    I don't know if Corona Kid found everything he needed in this little discussion, but it was absolutely perfect for me!

    Thanks to CK for the question, and everyone who answered. Particular thanks to Tracy Allen.

    Answers I need appear on this forum before I get around to asking the questions. [noparse]:)[/noparse]

    Heater and his Prop implementation of ZPU is another absolute miracle that fell into my lap today.

    "Thanks" hardly suffices.
    David,
    Most discussions·flew quickly over my head, but I managed to gleen a few good points.

    Currently I'm digesting Drone's excellent DDS code and related docs & tech pdfs.
    I had previously made an R2R network on a small pc board that plugs into·the Demo Boards black 13 pin header.· Code·generated·good quality sines up the 10khz, but I could not figure out the Tuning_Word to test it at 55khz.· More reading necessary....

    I had previously tested single-ended Duty mode code graciously provided by caskaz, but it only worked to about 60hz,·and·the sine had some·jitter.··Signal·was accurate on my frequency counter to 0.01hz, but I could not figure out how to up the freq to Ultrasound.
    Thanks to all posters!
    Keep it comming......


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ________________________________

    Fred
    Work:www.vhf.ca··Play:www.Costalegre.ca
  • DroneDrone Posts: 433
    edited 2010-04-07 15:33
    Hi Fred,

    I hope this helps...

    N.B., Keep in-mind the numbers used below are for with the V1.02 DDS object and may change if we can reduce the number of clock cycles used. Re-visit the sine wave DDS post for updates, new constants will be included in the documentation, spreadsheet and objects as the object (hopefully) evolves. Link again to the DDS post:

    http://forums.parallax.com/showthread.php?p=896364

    For V1.02 of the sine wave DDS, to obtain 55kHz just enter 55000 in cell C19 of the spreadsheet included with the archive .zip file (you can enter a rational frequency too, not just an integer). Your tuning word in cell c21 should read 0004ED91. Just use the tuning word $4ED91 as the constant in the CON section of the DDS demo object when starting the DDS PASM object. Like this:

    Tuning_Word = $4ED91

    Make sure there is only ONE Tuning_Word line uncommented in the CON area.

    Alternatively you can start the 55kHz DDS with a tuning word in the line calling the DDS in the PUB area of the DDS demo object like this:

    ddscog := DDS.start($4ED91)

    After doing this, the DDS tuning word line uncommented in the CON area won't do anything until you restore the line in the PUB area to:

    ddscog := DDS.start(Tuning_Word)

    With $4ED91 as the tuning word your actual output will be 54,999.93Hz. With V1.02 of the DDS object there is a 0.170Hz step size, this is shown in the included spreadsheet. Increasing the tuning word by one will increase the frequency by 0.170Hz.

    To manually calculate the tuning word for the DDS V1.02 object, use the equations shown in the spreadsheet and in the object's documentation header. For example, for 55kHz:

    M = Fout * 2^Lacc / (Fcpu / Nclks)

    M = 55000 * 2^24 / (80000000 / 28) = 322961.408

    2^24 means 2 raised to the power 24, the accumulator length in bits. 2^24 = 16777216

    Round M to 322961 (only integer tuning word values are valid).

    Convert M to hex using a calculator or an online decimal to hex converter.

    For an online example, in a Google search enter "0x4ED91 in decimal" WITHOUT the quotes, Google will respond with 0x4ED91 = 322961. Yay!

    Formatted for the Propeller Tool, M is now $4ED91

    The actual output frequency is:

    Fout = M * Smin (From the spreadsheet equations, I will add this to the documentation as well and embellish the spreadsheet as well.)

    Where Smin is the minimum frequency step, in this case 0.170Hz. So...

    Fout = 322961 * 0.17 = 54,999.93Hz

    Post Edited (Drone) : 4/9/2010 4:31:15 PM GMT
  • CoronaKidCoronaKid Posts: 25
    edited 2010-04-08 23:11
    Drone said...
    Hi Fred,

    I hope this helps...

    N.B., Keep in-mind the numbers used below are for with the V1.02 DDS object and may change if we can reduce the number of clock cycles used. Re-visit the sine wave DDS post for updates, new constants will be included in the documentation, spreadsheet and objects as the object (hopefully) evolves. Link again to the DDS post:

    http://forums.parallax.com/showthread.php?p=896364

    For V1.02 of the sine wave DDS, to obtain 55kHz just enter 55000 in cell C19 of the spreadsheet included with the archive .zip file (you can enter a rational frequency too, not just an integer). Your tuning word in cell c21 should read 0004ED91. Just use the tuning word $4ED91 as the constant in the CON section of the DDS demo object when starting the DDS PASM object. Like this:

    Tuning_Word = $4ED91

    Make sure there is only ONE Tuning_Word line uncommented in the CON area.

    Alternatively you can start the 55kHz DDS with a tuning word in the line calling the DDS in the PUB area of the DDS demo object like this:

    ddscog := DDS.start($4ED91)

    After doing this, the DDS tuning word line uncommented in the CON area won't do anything until you restore the line in the PUB area to:

    ddscog := DDS.start(Tuning_Word)

    With $4ED91 as the tuning word your actual output will be 54,999.93Hz. With V1.02 of the DDS object there is a 0.170Hz step size, this is shown in the included spreadsheet. Increasing the tuning word by one will increase the frequency by 0.170Hz.

    To manually calculate the tuning word for the DDS V1.02 object, use the equations shown in the spreadsheet and in the object's documentation header. For example, for 55kHz:

    M = Fout * 2^Lacc / (Fcpu / Nclks)

    M = 55000 * 2^24 / (80000000 / 28) = 322961.408

    2^24 means 2 raised to the power 24, the accumulator length in bits. 2^24 = 16777216

    Round M to 322961 (only integer tuning word values are valid).

    Convert M to hex using a calculator or an online decimal to hex converter.

    For an online example, in a Google search enter "0x4ED91 in decimal" WITHOUT the quotes, Google will respond with 0x4ED91 = 322961. Yay!

    Formatted for the Propeller Tool, M is now $4ED91

    The actual output frequency is:

    Fout = M / Smin (From the spreadsheet equations, I will add this to the documentation as well and embellish the spreadsheet as well.)

    Where Smin is the minimum frequency step, in this case 0.170Hz. So...

    Fout = 322961 / 0.17 = 54,999.93Hz
    ·Thanks David,·for the excellent explanation on how to compute the TW, etc.
    ·I had to·upgrade to·OpenOffice V3 and then your spreadsheet code worked great.

    ·The sine at 100k had a little jitter, but what concerned me most was the drop in dac output voltage as·the freq increased.
    ·1khz=3.15v,· 10khz=2.70v,· 50khz=0.95v,· 100k=0.50v.
    ·Is this normal or are my (5%)·R2R dac resistors not accurate enough?

    ·I am looking for·the best·way to step the Tuning_Word, thus the frequency over a start/stop range and step.
    ·Basic example: 500hz step (decimal 2936, 0XB78 hex)·with a 52k start·& 53k stop.

    ·FREQ·····M HEX··· DECIMAL
    ·52k ····· 4A8C1··· 305245
    ·52.5k····4B439···· 308281
    ·53k······ 4BFB1···· 311217

    ·Anyone up for a challenge?


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ________________________________

    Fred
    Work:www.vhf.ca··Play:www.Costalegre.ca
  • CoronaKidCoronaKid Posts: 25
    edited 2010-04-09 14:38
    Think I found the answer to the voltage drop problem......

    It is due to the sin(x)/x rolloff at the dac output. In fact the voltage is down 3.92dB at the nyquist freq (fc/2).
    This is outlined in Analog Devices MT-085 Tutoral on page 5:
    www.analog.com/static/imported-files/tutorials/MT-085.pdf

    It appears that the voltage response can be flattend with careful design of the antialiasing filter. (another topic)

    I'm still working on the freq change item if anyone has any ideas they want to share.

    Fred

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ________________________________

    Work:www.vhf.ca··Play:www.Costalegre.ca
  • DroneDrone Posts: 433
    edited 2010-04-09 16:02
    Yesss... Fred, You jogged my whiskey-soaked memory. Indeed, I reference the MT-085 ADI paper in the DDS source documentation header. I will include your findings in the docs. Never mind what I said about this level change thing in the PM I just sent you.

    An update...

    I've done a quick cut-and-paste of Kuroneko's counter-based 20 clock-cycle idea. At first glance it seems to work (Yay!) But I'm having some test equipment problems right now, my Tek2465B is acting up intermittently.

    Regards, David
  • ghost2ghost2 Posts: 9
    edited 2010-04-09 16:13
    Drone said...

    Fout = 322961 / 0.17 = 54,999.93Hz

    Shouldn't it be a multiplication there instead?
  • DroneDrone Posts: 433
    edited 2010-04-09 16:31
    Thanks ghost2... Yup, you are correct. Fixed my post above.

    Post Edited (Drone) : 4/9/2010 4:47:54 PM GMT
  • Tracy AllenTracy Allen Posts: 6,656
    edited 2010-04-09 17:35
    Fred,

    One way to resolve the filter Fo problem would be a digital filter chip, such as the LTC1065 (5th order lowpass bessel filter, 8 pin DIP). The Fo is set by an input clock, not by passive components, so you would only have to program a Prop counter NCO to provide the cutoff frequency to track your input frequency. The filter clock has to be 100x the desired filter cutoff. So for 50kHz cutoff, you feed the chip 5mHz. For 55kHz cutoff, feed it 5.5 mHz. etc. Doing that, the amplitude should not change much with frequency. There may be a better chip out there than the LTC1065 for higher frequencies.

    If you need to calculate the tuning word in real time, you need a little code like the following. This math solves a ratio equation:
    tuning_word / accumulator_length = desired_frequency / clock_frequency
    


    Same as Drone's equations above. Drone's accumulator is 24 bits, length 2^24. The tuning_word is the amount of phase that is added on each clocking. So you enter the following PRI with
    a = desired frequency
    b = clock_frequency = clkfreq/28 ' clkfreq=80MHz, 28 is the number of Prop clocks per cycle.
    bits = 24
    The result f is the tuning word.

    PRI frqVal(a, b, bits) : f            ' calculate a/b * 2^bits
      repeat bits                      ' approximation f: a/b = f/(2^bits)
        a <<= 1
        f <<= 1
        if a => b
          a -= b
          f++
    

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • DroneDrone Posts: 433
    edited 2010-04-10 06:11
    Howdy,

    A switched capacitor analog filter (SCAF) like the LTC1065 might be a bit overkill for this plus SCAF's typically max out out at around 50kHz (see 8th order MAX295/296, and the rather versatile LMF100 from National). If you do use a SCAF, remember that they are sampled systems too. As such they also need an anti-aliasing filter. But the SCAF filter problem is simplified because the sample rate is typically 50 or 100 times the SCAF cutoff frequency, so a simple one or two pole filter will work. At 50kHz you will typically have to clock the SCAF at 50MHz. A crystal or MEMS oscillator device with CMOS compatible output will set you back three or four USD in unit quantity. Most SCAF's are happiest with dual-rail power supplies, the MAX295/296 are OK with single-rail. SCAF's aren't cheap, figure roughly ten dollars a-pop in unit quantity - if you can find one in stock. Then again you could just beg for a sample.

    Regards, David
  • Tracy AllenTracy Allen Posts: 6,656
    edited 2010-04-10 17:20
    With a ratio of 100:1, the filter would have to be clocked at 5 MHz (not 50MHz) for Fo=50kHz. The LMF100 would be a good choice for its wider bandwidth for signals up to 100kHz. I've used its predecessor, the MF10, which is limited to less than 30kHz. Those chips are nice because you get two complete filters with multiple configurable outputs in one package. The LMF100 is only available in soic20 though.

    Point well taken about anti-aliasing at the input to the filter. It is being fed a stepped sine wave, which of course has high frequency components, but how do you think an SC filter would react to those? My hunch is that it would interpolate without aliasing, but I'm not sure about that. At the output, the filtering is easy due to the 100:1 ratio.

    Another way to use the SC filter chip like the LMF100 is with feedback as an oscillator, to hook its bandpass output back via a comparator/limiter to the input. There is a nice diagram and description of this concept in "The Art of Electronics". Clock the chip with a Prop NCO frqa at 100x the desired output frequency. The filter turns the square-wave feedback into a stepped sine, the output being quadrature sine and cosine at the center frequency.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • DroneDrone Posts: 433
    edited 2010-04-11 08:30
    Hi Tracy,

    You are right, 50kHz at 100:1 clocks at 5MHz not 50MHz - my mistake.

    I'm not sure how the SCAF responds to products above the Nyquist frequency. I have not used one of these chips before. I'll have to give it some thought. However in reading the data sheets and app notes, it is clear the vendors are driving the designer to include a Nyquist filter. The MAX295/296 for-example has an uncommitted op-amp on the chip that the data-sheet says can be specifically used for this purpose.

    CoronaKid is working around 50kHz, so you are right, the LMF100 might be a better part as it goes to 100kHz. The MAX295/296 goes only to 50kHz. But the MAX295/296 works well on a single rail.

    I've bee in direct contact with CoronaKid, the originator of this thread. He's beta testing my sine DDS PASM object which, thanks to Kuroneko's tweaking, is now down to 20 clock cycles (200kHz sampling rate at 80MHz clock). The output is usable without filtering through around 300kHz.

    Below is an excerpt from an Email I sent CoronaKid today. In it there may be some stuff related to this discussion...

    Regards, David


    Don't forget the anti-aliasing filter on the input to the MAX295 SCAF. For a 50kHz DDS signal and a 50kHz SCAF cutoff frequency, the sampling rate is 50:1 or 2.5MHz, you need to eliminate anything after 5MHz. Use a single RC filter LPF. If R=10k in your R2R DAC the output impedance is 10k. Put a 160pF cap to ground across the DAC output. The output impedance of the DAC (10k) forms the resistor in the RC LPF. With this arrangement, at 50kHz you will be down 1dB, at 5MHz you will be down about 34dB. This should be sufficient. The -3dB corner frequency for this filter is 99.47kHz. For any single RC low-pass filter:

    F@-3dB = 1/(2*PI*R*C), Slope is -6dB per pole per octave (an octave is doubling of frequency).

    There is also an on-chip uncommitted op-amp on the MAX295 you can use as an active input filter or as a gain stage to make up for passive input filter loss.

    The MAX295 has a built-in clock (nice) but you might want to consider an external clock if you want to make the SCAF more agile. See Maxim Application Note 724, "Generating Switched-Capacitor-Filter Clocks" at the link below (heck I'll just attach a copy of AN-724):

    www.maxim-ic.com/app-notes/index.mvp/id/724

    The MAX295 clocks at 50:1, so at 50kHz you will clock at 2.5MHz. Linear makes some nice little resistor-set clocks. Look at the LTC6907, it covers 40kHz to 4MHz.

    The MAX295 is an 8th order Butterworth LPF with 6dB per octave per pole slope, the MAX296 is a Bessel filter with 3dB per octave per pole. The Butterworth has better rejection, but the phase response is not as good as the Bessel filter, especially at the corner freqency. This should not be a concern if your application is covering a relatively small bandwidth. I would give the MAX295 a try if I were dealing with only a relatively narrow band of frequencies and I'm not going to be using digital modulation methods that are phase/group-delay sensititve like PSK.
  • CoronaKidCoronaKid Posts: 25
    edited 2010-04-12 04:35
    Hello all,
    I have never read so many data sheets in one week! Whew!

    Love the idea of an input clock setting the corner frequency on the filter.· (K.I.S.S. - parts count to a min.)
    My·top freq is near 50khz, so a·fixed·corner at 60 or 70khz would suffice for me.· Preference is butterworth, as the frequency response is flatter.

    Both the MAX295 and the LMF100 have dip versions but Digikey is out of stock on both.
    I have never soldered a SOIC layout chip, but·Digi has both·chips available.
    What a surprise...·the better LMF100 is $2 cheaper.· I will be ordering some of each.

    I may not actually need these SCF's as·my bandwith is·only·5khz·in a frequency range of 25 - 50Khz.··I may be able to live with·the minimal voltage fluxuations I measured the other day,·so will be trying them for their filtering attributes alone.

    In the mean time, I'm looking forward to testing code version 1.03 which was improved down to 20 clock cycles by Kuroneko, and implemented by David.· Ditto for code & filter·recommendations by Tracy.

    One question that came up on the data sheets which I could not asertain, was the SCF's input threshold compatibility with the propellers output pins (to drive the clock).·
    Sorry, I have not had time to respond to everyone who followed up...
    Fred

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ________________________________

    Work:www.vhf.ca··Play:www.Costalegre.ca

    Post Edited (CoronaKid) : 4/12/2010 5:30:23 AM GMT
  • Tracy AllenTracy Allen Posts: 6,656
    edited 2010-04-12 16:54
    Both National and Maxim are generous with samples, easy to request from their web sites.

    The LMF100 has options that encompass both single 5V supply and dual supply operation. Read the "pin descriptions" and notes carefully, as it applies to the clock signal and the sine signal from the Prop. For example, if you want to operate the SC filter on a single 5 volt supply, the ANGD will need a 2.5V supply, and the Lh and Vd+ pins need to be connected to ground. The outputs can only swing in the range of 1 to 4 volts, not all the way to 0 to 5, so the input signal amplitude has to be limited so that none of the outputs will clip. If the Prop sine output is a full 0 to 3.3 volt swing, that might have to limited and capacitor coupled to the SC filter.

    If the clock to the SC filter tracks the sine wave frequency, then the flatness of the frequency response is irrelevant and the output amplitude will be constant vs frequency. If the SC operates with a fixed frequency instead of tracking, you will revisit the problem of output amplitude varying with the sine frequency.

    My random intuition comes from experience with driving the SC filter with a square wave, which it turns into a nice sine wave with 100 or more steps, no evidence of aliasing. Is below the Nyquist frequency up to the 5th harmonic of the input square wave. If a stepped sine is already the input to the filter, the steps are smaller but much more frequent. I don't know, and I'd be inclined to experiment a little bit with and without an anti-aliasing filter on the input just to see what would happen.

    A tangential idea is that SC filter stages are quite often cascaded to make higher order filters, and the output from the earlier stage is already a stepped waveform at the SC clock frequency. Nyquist theory is funny and has special cases when the ratio of frequencies is an integer (like unity) or even a rational number, instead of a continuous bandwidth.

    Note also the the precaution about over-driving the input, don't allow an intermediate stage to clip the waveform, which can really lead to strange looking outputs. That is more a problem with high-Q filters.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com

    Post Edited (Tracy Allen) : 4/12/2010 5:07:36 PM GMT
  • CoronaKidCoronaKid Posts: 25
    edited 2010-04-15 04:27
    OK Tracy,
    I will try for samples of the LMF100, as it has perfect specs for my application.
    The MAX295 is also a very cool chip, but does not quite have the bandwidth I need.

    Drone emailed me V1.3Beta for me to test, and it works flawlessly for my project.· I ran it from 100hz up to 400khz with good frequency stability.· My frequency counter would not count after 200khz, as the level from my R2R dac was only 0.22vp-p.
    Here is a table of my results in case anyone is interested.
    PROGRAMED FREQ···· VOLTS P-P···· MEASURED FREQ
    100hz·····················2.80············· 100
    1khz······················ 2.80··············1,000
    10khz···················· 2.325··········· 10,001
    28khz···················· 1.35··············28,001
    40khz···················· 0.98··············40,002
    50khz·····················0.82··············50,002
    60khz···················· 0.68············· 60,003
    100khz·················· 0.44············· 100,005
    200khz·················· 0.22··············No Count
    300khz·················· 0.09··············No Count
    400khz·················· 0.06············· No Count

    The frequency is stable & accurate enough form me!· I am hoping the LMF100 switched capacitor filter will flatten the 0.75 volt difference in the freqs I need, as well as filter out freqs above 100khz.

    I appreciate everyones comments on this subject.
    Happy in Sineland,
    Fred
    yeah.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ________________________________

    Work:www.vhf.ca··Play:www.Costalegre.ca
  • CoronaKidCoronaKid Posts: 25
    edited 2010-04-21 20:12
    DDS TEST UPDATES

    I finally received some 1% resistors·and put together a new dac board with a OPA350 op-amp as a voltage follower with a gain of 1.· Loaded up Drone's DDS V1.3Beta code and re-measured & posted here in case anyone was interested.

    PROGRAMED FREQ··· VOLTS P-P··· VOLTS RMS··· MEASURED FREQ
    100hz····················3.3·············· 1.16·············100·
    1khz····················· 3.25·············1.15·············1000
    10khz····················3.0···············1.08············ 10,001
    28khz··················· 2.3·············· 0.80·············28,001·················
    40khz··················· 1.8·············· 0.64············ 40,002
    50khz··················· 1.6·············· 0.55·············50,002/3
    60khz··················· 1.37·············0.48·············60,002/3
    100khz···················0.87············ 0.31····· ···· 100,004/5
    200khz·················· 0.46············ 0.15·········· 200,009/10
    300khz·················· 0.34·············0.11·········· 300,013/14
    400khz·················· 0.22············ 0.07·········· No Count

    Peak-peak readings were taken visually·on 20Meg scope, and Rms on Leader LMV-181A dB meter.

    Two things now puzzle me.
    1) Why the higher end freqs were not reduced more by my 1st order RC filter set to 63,917Hz?
    2) Why the waveform off top of the dac resistors was clean right up to 400khz, but the op-amp output had·slight chopping noise on the signal, especially past 100khz?

    CK in wonderment.....

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ________________________________

    Work:www.vhf.ca··Play:www.Costalegre.ca

    Post Edited (CoronaKid) : 4/21/2010 10:47:17 PM GMT
  • tdlivingstdlivings Posts: 437
    edited 2010-04-21 23:48
    Thank's for the update.
    I have been following Drone's DDS and your project.

    As far as your wonderment what comes to mind is what type
    of power supply bypassing do you have on your op amp. For
    the higher frequencys you will need a type of capacitor that
    still looks like a capacitor at the hundreds of kilohertz.

    Could also be the reason your filter is running out of gas.

    Tom

    ·
Sign In or Register to comment.