Low frequency (~25kHz-30kHz) oscillator design

Discussion in 'The Projects Forum' started by ChateauduChillon, Jan 28, 2014.

  1. ChateauduChillon

    Thread Starter New Member

    Jan 28, 2014
    Hi All,

    New here to all about circuits, was hoping I could get some feedback about an oscillator design I'm working on.

    Ultimately, I need a 25-30kHz triangle wave. I've assumed I'll be generating a square wave and integrating to get my triangle wave.

    Unlike most oscillator designs I've read about, neither the initial precision nor the variance of the frequency are critical for me.

    The very critical aspect is that the duty cycle remain very very close to 50%, ideally with less than 1% deviation.

    Anyone know of any good oscillator topologies to accomplish this?
  2. MikeML

    AAC Fanatic!

    Oct 2, 2009
    Do you have a spare opamp or two?
  3. Brevor

    Active Member

    Apr 9, 2011
    If you generate a square wave at 2X the frequency you need then put it through a flip-flop to divide the frequency by 2 you will have exactly 50% duty cycle.
  4. MrChips


    Oct 2, 2009
    ...only if the 2x square wave is of stable frequency. I would use a crystal oscillator.
  5. ChateauduChillon

    Thread Starter New Member

    Jan 28, 2014
    Sure do. I've been using a 2 op-amp schmitt trigger oscillator like this one:


    except I've been intercepting my crapppy non RRO comparator (OPA2) output with an SPDT so I can give the integrating op amp a precise leveled square wave, but duty cycle issues persist... could it be simply a matter of offset voltage of the integrating op amp? might I need to go for a low offset amplifier here?

    I like this idea, although it seems it would depend on the stability of the frequency of the source as Mr Chips mentioned.

    I've been looking at some crystal based oscillators too.
  6. t_n_k

    AAC Fanatic!

    Mar 6, 2009
    If the OP has no particular requirements for frequency accuracy why does this matter? A well designed & constructed R/C based oscillator short-term stability should be sufficient to keep the overall long-term duty cycle stability within the 50±1% requirement.
  7. maitchy

    New Member

    Jan 22, 2010
    You need OPA2 being Rail-Rail Output,
    AND with fast/symmetrical slew rates and no ringing,
    AND you need the power supplies to be exactly balanced (to better than 1% of course, better than most cheap regulators, but you can improve the balance by attaching the ground of one 3-terminal regulator to an opamp with extra frequency compensation sensing and correcting the imbalance),
    AND you need the opamp's offset voltages to be low (not likely to generate a 1% error though),
    AND... the big one, probably... the frequency response (especially slew rate/power-bandwidth) is likely to be a limiting factor at this frequency for most jelly-bean (i.e. cheap/popular) opamps... look at the square-wave output on a scope; it will probably have >>1% of the period taken up with (nonlinear) slewing time and there will be delays between the triangle wave going over the trigger point and the Schmitt trigger (OPA2) switching. Oh, and there could be non-linear capacitances in the input to the opamps adding to the complications.

    I like the circuit you suggested in general; it should keep the average output voltage of the square-wave at zero volts (which will mean 1:1 mark;space ratio if the above details are met), but at high audio frequencies and above you have to watch out for so many things that can muck it up. If the integrator isn't getting a crisp square-wave the averaging process applied to a misshapen input could result in an incorrect (and unstable) pulse width.

    The alternative mentioned of feeding a (stable) 2x freq signal into a divide-by-two circuit is good (except you may have some fuss getting a dc-accurate triangle wave plus a few other problems with the integrator circuit that are common to the first idea's problems); a CMOS 555 timer with an integrator made from a medium-quality opamp can be made pretty stable at the frequencies you are interested in for what its worth (I know some people turn their noses up at the 555, but it isn't too bad).
    Last edited: Jan 28, 2014
  8. AnalogKid

    Distinguished Member

    Aug 1, 2013
    Since you have two independent problems (duty cycle and offset drift) to solve, what about two independent solutions? Use a 555 in true symmetrical mode to drive the SPDT analog switch that sources integrator A1, guaranteeing 50% duty cycle, and servo the DC level with A2 as an integrator in the feedback loop, injecting a small DC offset current to keep the long term average value of the output at 0 V. This is a common trick in high end audio gear that shun coupling capacitors.

  9. maitchy

    New Member

    Jan 22, 2010
    I assumed the Rail-rail squaring you applied to the opamp output didn't just feed the integrator but also OPA2's own trigger circuit... is that correct?

    Otherwise the square-wave can have a perfect 1:1 but the triangle wave could be anything. Simply integrating a good square-wave will not ensure a good triangle-wave... integrators will drift and you need the feedback circuit to correct for that by switching the square-wave output at perfectly symmetrical points, which will not happen if its own trigger circuit is based on non-RR being compared with the triangle-wave input.

    Drift in the integrator's output implies a change in the mark-space ratio of its output (if you take zero-crossings to define that). Drift is not a fault of the opamp but of the nature of integrator circuits. Easiest solution is to use your circuit with good, fast R-R opamps for OPA1 and OPA2, and make sure the supplies are okay. Following opamps with switching circuits is only second-best.
  10. ChateauduChillon

    Thread Starter New Member

    Jan 28, 2014
    what do you mean by long-term duty cycle stability? I may be misunderstanding you, but the duty cycle being 50% is important in a short term sense as well (from period to period)

    now suppose I were to generate my square wave in some open loop fashion (555 timer or crystal+comparator) + (divide by 2 FF circuit), couldn't I fix my integrator drift issues with DC stabilization (R in parallel with C in feedback path) just as well as the feedback aspect of the trigger circuit?

    could you elaborate on this? I'm don't think I'm picturing the setup as you are, and I'm missing the connection with coupling capacitors.

    So ultimately, I will somehow end up with a triangle wave which has precise duty cycle and offset. No matter how I go about it, I will definitely have a phase difference between the final triangle wave and the square wave source. Now, the last demand I have comes into play . . . I need a square wave at double the frequency of the %50 DC triangular wave, precisely in phase with it.. My initial reaction is (comparator) +(PLL x2 circuit), any thoughts here?