comparator/integrator oscillator symmetry question

Started by knutolai, November 05, 2013, 06:39:33 PM

Previous topic - Next topic

knutolai

I'm working on a ring modulator design and need a oscillator with 'perfect-ish' symmetrical waveform (e.g. triangle, square, sine..). So I found this comparator/integrator circuit which produces triangle and square waveforms:


(full webpage: http://www.sdiy.org/colbecklabs/circuits/triangle_oscillator.html)

Would this waveform be symmetrical over a large range of frequencies?
The desired values for my implementation is:
R1 = 10k
R2 = 4k7
R3 = 1k + 100k pot
C = 150n + 10u in parallel (switchable on and off)

the frequency range would be 0,5Hz - 50Hz and 33Hz - 3k3Hz.

QuoteIt is also necessary for the resistor values to be within a reasonable range for correct operation of the op amps. There is no restriction on the value of C.
quote from this webpage: http://www.play-hookey.com/analog/generators/triangle_waveform_generator.html

Could my values be considered to be inside such a reasonable range? I find this statement rather vague as I haven't found any formula for calculating the symmetry of the waveform produced by this circuit and I don't own, nor know anyone who own, a oscilloscope  ???

R.G.

#1
Quote from: knutolai on November 05, 2013, 06:39:33 PM
Would this waveform be symmetrical over a large range of frequencies?
Yes. Schmitt-trigger/integrators are symmetrical for most of their range. They run into asymmetry at the very lowest ranges.

QuoteThe desired values for my implementation is:
R1 = 10k
R2 = 4k7
R3 = 1k + 100k pot
C = 150n + 10u in parallel (switchable on and off)

the frequency range would be 0,5Hz - 50Hz and 33Hz - 3k3Hz.

Could my values be considered to be inside such a reasonable range? I find this statement rather vague as I haven't found any formula for calculating the symmetry of the waveform produced by this circuit and I don't own, nor know anyone who own, a oscilloscope  ???
Let's think a bit.

We know that the integrator does. When the input voltage at the front of R3 is greater than the DC voltage at the + input, the output ramps up; when it's lower than the + input, it ramps down. How fast it ramps up comes from the fact that the opamp output will do anything it can to keep the - and +  inputs within millivolts of each other. So the - input gets a current through R3 of Vin/R3. This same current be pulled away from the - input through the cap, and the only way the output can do this is to keep moving the output voltage. The current through a cap is I = C dv/dt, so to keep a constant current I = Vin/R3 coming from the - input, the output must ramp down at a rate of dv/dt = Vin/RC.

That's for a variable input voltage. The input voltage on this circuit is not variable. It's always equal to most positive or most negative output of the first opamp. And here we get into asymmetry. Some opamps don't have symmetrical most-positive and most-negative  outputs, especially with any current loading. And different opamps have different ones. The TL072 will only go to about 1.5-2.0V close to the positive or negative supplies. Rail to rail opamps will go within tens of millivolts for low-current loads. Single-supply opamps like the LM324 will pull to within 50mV of the minus supply, but only about 2V of the positive supply.

So if you want symmetry, you must make the positive and negative excursions of the "square out" be symmetrical about ground. The opamp does not guarantee this unless you select an opamp that does this.

Then there's magnitude. Imagine that the first opamp has R1 = infinity, an open circuit. Nothing happens because the tiniest bit of noise makes it flip above and below ground. But if we take the suggested values of R1 and R2, in that R1 = 2*R2, let's watch what happens. Let's say the square out is positive, and the triangle is ramping negative.

The voltage on the triangle keeps going down until the voltage at the + of the square opamp is more negative than the - input. One end of R1 is pulled to the most positive output level of the square opamp; the + input is pulled down by voltage divider action until + is at ground, so the voltage across R1 has to be the full output voltage of the square opamp.The voltage at the triangle side of R2 has to make the same current flow through R2 as flows through R1 to get the input to ground. Current in R1 is Vout/R1, current in R2 is Vtriangle/R2, and when those are equal, the square opamp flips state. So Vtriangle/R2 = Vout/R1, or Vtriangle = -Vout*R2/R1.

When the square opamp flips from having +Vout to -Vout, the triangle opamp starts integrating the other way, and flips when it hits a similar condition on the opposite polarity. So the triangle peak to peak value has to be twice Vout*R2/R1.

And here's why R1 has to be bigger than R2: R2 has to be able to pull out slightly more current than R1 provides, and it can only do that if Vtriangle is LESS than the most positive and most negative output voltages for the triangle opamp. The smaller the ratio of R2/R1, the smaller the triangle output voltage.

And again note, you only get symmetry for cases where +Vout and -Vout are identical for the square opamp.  All the parts except the opamps are purely symmetrical, except the opamps, and the invisible part - the power supply. If your power supply is not perfectly symmetrical around ground, you can't usually get symmetrical outputs if you rely on the output of the square opamp to get you there.

If I need symmetry on things like this, I usually put a resistor after the "square out" and a symmetrical clipper after that, and feed that clipped square wave into R3. Now the symmetry is not dependent on the power supply or the opamp characteristics, only the clipper.

As for parts values being "reasonable", that all depends on how much current the opamps can drive out their outputs, as noted above.
R.G.

In response to the questions in the forum - PCB Layout for Musical Effects is available from The Book Patch. Search "PCB Layout" and it ought to appear.

Mark Hammer

I recommend the Stompboxology newsletter on tremolo ( http://moosapotamus.net/files/stompboxology-mo-tremlo.pdf ), that explains the slightly modified LFO circuit that Boss and others uses.  This makes the initial square wave juuuuusssstttt a little trapezoidal.  The additional rise and fall time does not impair the circuit's ability to produce a trianglke wave, via the integrator, but it does reduce the audible tick that would normally result from the sudden rise of the square wave and the instant sucking of current on the power line.  Worth a read.

knutolai

Damn R.G. you're the best! I'm truly amazed by the time you take to make replies to, seemingly, every thread. (thankyouthankyouthankyou)

Nice article Mark, will definitely add that modification to my oscillator!

Onto the next question (which might be a minor one, as I might just not be able to wrap my mind around attenuator and voltage dividers). I wish to add a "depth parameter which changes the offset and the amplitude of the waveform at the same time. (as illustrated in the figure below)

More specifically changing the offset from Vref (could be 4,5 volt) to Vref - (Vpp/2), Vpp being the max Vpp, and changing the Vpp from max to 0v.

Is there any easy tricks to achieve this? I've looked at some other "depth" implementations (John Hollis Ring Frobnicator, 4ms Trem. Lune) and from how I understand their implementation they change only the offset until Offset +/-  Vpp/2 = Supply or Ground. At which point, from my understanding, the waveform would go asymmetrical.

Link to schems:
http://fuzzcentral.ssguitar.com/tremulus/tremulusschematic.gif Trem Lune
http://www.hollis.co.uk/john/frobnicator.jpg Ring Frob

R.G.

Quote from: knutolai on November 06, 2013, 12:34:15 PM
Damn R.G. you're the best! I'm truly amazed by the time you take to make replies to, seemingly, every thread. (thankyouthankyouthankyou)
Well, I'm certainly long winded. But you're welcome to any help that was in that gust.  :)

QuoteOnto the next question (which might be a minor one, as I might just not be able to wrap my mind around attenuator and voltage dividers). I wish to add a "depth parameter which changes the offset and the amplitude of the waveform at the same time. (as illustrated in the figure below)
More specifically changing the offset from Vref (could be 4,5 volt) to Vref - (Vpp/2), Vpp being the max Vpp, and changing the Vpp from max to 0v.

Is there any easy tricks to achieve this? I've looked at some other "depth" implementations (John Hollis Ring Frobnicator, 4ms Trem. Lune) and from how I understand their implementation they change only the offset until Offset +/-  Vpp/2 = Supply or Ground. At which point, from my understanding, the waveform would go asymmetrical.
You're actually off into some fairly subtle grounds. You've hit on one of the issues with LFOs - the peak/valley height and center of the peak-to-valley being different, and the need for figuring out whether the thing you're driving needs the valleys to be nailed to some level (that is, depth increases from a minimum), the peaks to be nailed to some maximum (and the depth increasing downwards) or the peaks and valleys being centered around a middle that stays fixed.

You're asking for a depth that starts at a minimum and increases up wards as you turn up depth.

The Schmitt trigger does several things for you all at the same time. We can decompose what it does and make the output of the triangle generator do some tricks in several ways.

First, the Schmitt has two different voltage levels it puts out. These need to be tinkered to be symmetrical if you force the output of the Schmitt trigger to be the only thing that makes the up/down levels. But you can use something like a couple of CMOS gates for putting the "ramp up/down" signal into the integrator. This forces the signal to be symmetrical fully up or fully down, and anything that drives the gates only has to get them over their input edges to make this true. You can also use transistors, etc. to force fully up/down levels. By doing this, you separate the signal into the integrator from what the direction determining stuff does, and eliminate a dependency on the direction generating stuff.

As long as the direction signal to the triangle integrator is an equal amount above/below the bias point of the triangle integrator, the triangle sides will integrate symmetrically. So you could make the integrator work on something like one diode drop above/below the bias voltage of the integrator, and you'll get symmetrical ramps from non-symmetrical drive signals out of the level sensors.

The Schmitt operation is an integrated setup to sense two voltage levels above and below its own bias voltage. To the extent that its output is symmetrical, these two points are symmetrical around its bias voltage too. Note that the switch points are the voltages ON THE TRIANGLE WAVE that the Schmitt switches. So you can replace the Schmitt with two different voltage level switches that are independent, and have independent control of the switch points. Or you can vary the ratio of R1 and R2, and have completely variable size of the peaks of the triangle wave as symmetrically as the Schmitt plus its output stuff can do it.

So - with that as background, you can make the integrator make any triangle wave you want, symmetrical or non-symmetrical, at any DC level by (1) varying the trip points of the sensor circuit that tells it which way to go, up or down, and (2) varying the bias level of the triangle wave in concert with varying the voltage trip points.

The Schmitt trigger/integrator is an elegant way to do all of that stuff at the same time with only one dual opamp.

R.G.

In response to the questions in the forum - PCB Layout for Musical Effects is available from The Book Patch. Search "PCB Layout" and it ought to appear.

knutolai

#5
Thanks again! eeerrr... I just realized I could rearrange my buffer circuit allowing me to (I think) control the presence of the effect in a much simpler way as well as (again, I think) feed the circuit a asymmetrical modulator. So here's the first draft of the buffer circuit:


In a ideal world, with ideal components, this circuit, coupled with a oscillator, is able to produce true ring modulation (bipolar carrier * bipolar modulator), even though the only visible modulator is unipolar. The only part of the circuit I really feel unsure about is P1. Its supposed to function as a volume control for the signal coming from U2. Im unsure whether connecting R3 to Vref is gonna have a impact on the other input signal (from R2) feed into U3.
Now in the real world I guess this circuit would require matched or 1% resistors for R2 - R8, low-noise/high CMRR op amps, and a very stable Vref to operate relatively noiseless with minimal modulator or carrier bleedthrough. Resistor values for R2-R8 could probably be even lower as the NE5532, which I'm considering to use, has a typical output impedance of 0,3 ohm (according to texas instuments datasheet).
I could probably also add parallel capacitors in the feedback loops of U2 - U4 to tame supersonic frequencies.

What do you guys think? Anything vital I've missed?!.. there probably is, though I've gone over the math for this 50 times or so by now. I'll breadboard this tomorrow and post my results here. I'ts getting late in Norway...

PRR

> 'perfect-ish' symmetrical waveform (e.g. triangle

Unless there's some gross flaw in the Schmitt, this is all about the Integrator.

If current in the integrator's resistor is "much-much-more" than opamp and etc leakage DC, the ramps will be symmetrical. EDIT-- Also the integrator reference has to be MID-way between Schmitt's trip-points. I think.

That plan shows a polarized integrator cap. This is a dubious plan because electrolytic caps are not symmetrical. You may consider a low-current opamp (TL072) and R3 up to 1 Meg, so that C can be in the range of poly-plastic caps.

> add a "depth" parameter which changes the offset and the amplitude of the waveform at the same time.

You diagram shows the negative tip "nailed to Zero voltage".

IF you can get the Schmitt's negative trip to be AT zero voltage, then your amplitude+offset control is indeed a simple pot, one end to zero.

To get the Schmitt's trip to be AT zero you may need a more complicated Schmitt. Getting your mind inside the 555 timer chip will show one way: two comparators, different reference voltages (one may be zero), banging a flip-flop. There's other ways. There's one simple plan which gives a tip-trip "near zero", but I think it may be many milliVolts off, and drifty.

> 'perfect-ish'

Any non-theoretical discussion should probably start with "how un-perfect can we accept?" 45%-55%? 49.995%-50.005%? Is tolerance itself symmetric, or is the real goal to *never* go less than 50.000...%?
  • SUPPORTER