NEED FORMULA TO FINS FREQ. OF OSCILLATOR

This is the place for any magazine-related discussions that don't fit in any of the column discussion boards below.
User avatar
Craig Kendrick Sellen
Posts: 32
Joined: Thu Jan 25, 2007 1:01 am
Location: Carbondale Pennsylvania USA
Contact:

NEED FORMULA TO FINS FREQ. OF OSCILLATOR

Post by Craig Kendrick Sellen » Sun Jun 03, 2007 7:52 pm

Inclosed is a circuit for a op-amp oscillator that puts out triangle and squire waves. My question is what is the FORMULA for this circuit? Ignore R3, & R4, both pins are grounded. I just need the correct formula for this.
Image :grin: :smile: :???:

User avatar
MrAl
Posts: 3862
Joined: Fri Jan 11, 2002 1:01 am
Location: NewJersey
Contact:

Post by MrAl » Mon Jun 04, 2007 1:34 pm

Hi there,


If you make R1=10k and R2=20k you can use the following formula:

R=(1/f-d)/K/C

where
R is the pot setting you have labeled "TR1", in ohms
C is the parallel combination of C1 and C2 in your schematic, in farads
K is a constant, equal to 1.989
d is a delay constant, equal to 5.11e-6
f is the frequency of the oscillation, in Hertz

The max frequency is probably around 40kHz or so. This is because
the triangle output peaks round as frequency increases because
of the delayed response of one of these op amps. If the frequency is
set too high, the second op amp can not respond fast enough to
maintain a triangle output out of the first op amp.
The triangle output with the values shown for R1 and R2 ends up being
roughly plus and minus 3 volts about ground. This will actually go
slightly lower for lower frequencies and slightly higher for higher
frequencies. You can set R1 and R2 for other values to get a different
triangle peak output, but the formulas will have to be modified so
unless you have a specific peak for the triangle stick with the values
given. The max possible peak with LF353 op amps is 5.5 volts anyway
using a plus and minus 9v power supply.

The formula was based on the following facts:

1. A given RC time constant will produce a wave with a period very
roughly equal to some constant k times R times C, but only
approximately.
2. For any op amp type there will always be some delay period where
the second op amp takes some small time to respond to the output of the
first. Since this occurs twice per period, the delay constant 'd' is roughly
twice the time delay of one op amp.
3. Using the above two facts and extracting some data using a more
elaborate method of calculation, the formula is fit using the extracted
data during which constants K and d are determined.

-----------------------------------------------------------------------------------

Design example: 5kHz output frequency
_________________________________

Since the desired frequency is below 40kHz we should not have
any problem.

Here, f=5000, and if we set C=0.01uf (a good value) then
R=(1/f-d)/K/C
R=(1/5000-5.11e-6)/1.989/0.01e-6
so doing the calculation, R comes out to about:
R=9798 ohms
which is close to 10k so we would probably go with 10k ohms.

To check our work we can use the following formula for the frequency f:
f=1/(R*K*C+d)

and if we plug in the values for R=10000 and C=0.01e-6 we get
f=4901.72 Hz
The reason we dont get exactly 5000Hz is because we rounded R to
a value that can actually be purchased. In practice, C will not be
exact either and will have some tolerance and also drift with temperature.
LEDs vs Bulbs, LEDs are winning.

User avatar
Bob Scott
Posts: 1192
Joined: Wed Nov 20, 2002 1:01 am
Location: Vancouver, BC
Contact:

Post by Bob Scott » Mon Jun 04, 2007 1:56 pm

Craig!

This is a really interesting oscillator..... I designed one virtually identical to it about 4 years ago, because I needed the perfectly linear triangular wave that comes off the output of the first stage to use as a carrier frequency for a pulse width modulator. However I initially used the TL084 quad op amp IC which has almost identical specs as the LF353.

The first stage is an integrator. The second stage is a toggle with a square wave output of +/-9V. It was a good idea to ground pins 3 and 6 because the LF353 has FET inputs. You don't need to add the R3 and R4 resistors to balance input offset current. (There is virtually none)

May I suggest 10K as a value for R1 and 20K as a value for R2? This way, the second stage will toggle when the triangle wave output of the first stage reaches about 4.5V and -4.5V.

Since the voltage across TR1 will always be about +/-9V and the voltage across C1 will vary 9V between + and - 4.5V, the time for 1/2 cycle will simply be RC (value of TR1 multiplied by value of C1). a full cycle will take a time of 2 half cycles. So the formula for frequency will be:

f=1/(2RC)

In practise you will find that because the LF353 is not an "ideal" op-amp.

-The voltage output of the LF353 is not rail-to-rail, so the frequency may be a few percent lower than calculated, and because the output voltage of the LF353 goes closer to the - rail than the + rail, the square wave output will not be perfectly 50% but better than 45-55. I found that I really needed a better duty cycle so I switched to an op-amp type with rail-to-trail output... I used the quad LMC660.

-The output of these LF353/TL084/LM348/LF347/TL074 type devices is current limited to about 20mA. This is a very wide spec according to an app note I once read, so keep the load less than 10mA...Keep TR1 minimum adjustment resistance value above about 1K.

Bob :cool:

User avatar
Bob Scott
Posts: 1192
Joined: Wed Nov 20, 2002 1:01 am
Location: Vancouver, BC
Contact:

Post by Bob Scott » Mon Jun 04, 2007 2:02 pm

Mr. Al,
MrAl wrote:Hi there,


If you make R1=10k and R2=20k you can use the following formula:

R=(1/f-d)/K/C
Must be a full moon! We both suggested identical values for R1 and R2. You posted your reply while I was writing mine.

Weird.

Cheers, Bob :shock:

User avatar
Craig Kendrick Sellen
Posts: 32
Joined: Thu Jan 25, 2007 1:01 am
Location: Carbondale Pennsylvania USA
Contact:

triangle-squarewave generator

Post by Craig Kendrick Sellen » Mon Jun 04, 2007 7:06 pm

To, Mr. AI, Bob Scott; Thanks for answering my request for help. Heres the frequency I need. First C1, C2 can be one componnet. The pot. only needs to vary a little, so a small range say 500 ohms. Inore R3, R4. The frequency if from 1Hz to 18.5Hz If you can plug in the values, it will be a big help.
P. S. maybe to 20Hz :grin: :smile: :???:

User avatar
MrAl
Posts: 3862
Joined: Fri Jan 11, 2002 1:01 am
Location: NewJersey
Contact:

Post by MrAl » Tue Jun 05, 2007 11:41 am

Hello again,

Bob, perhaps you can tell us what made you choose 10k and 20k
also?

Craig, for very very low frequencies like that K=1.953 is a better
estimate.
Repeating the formula i presented,

R=(1/f-d)/K/C

and with K=1.953 and d=5.11e-6, in order to get some
reasonable values for R we choose C=10uf for now. This
gives us the following two values of resistance for R for
the two frequencies of interest:

R(1Hz)=51203 ohms
R(20Hz)=2560 ohms

There is one catch with this circuit however, and that is that
the voltage across the cap goes both positive and negative,
so if you want to use electrolytics you would need to use
two 20uf units back to back. Since 22uf is a common value
for an electrolytic, and this would lead to C=11uf, if we redo
the formula for the two resistances we get:

R(1Hz)=46548 ohms (two back to back 22uf caps for C)
R(20Hz=2327 ohms (using two back to back 22uf caps for C)

Note you could use a non polarized electrolytic, or perhaps a
larger value ceramic. Whatever is used for the cap though it
must allow both voltage polarities or it could screw up the frequency
badly or even blow out completely.
Going to a small cap (like say 1uf instead of 10uf) results in resistances
ten times higher than those shown here. This might not work once
you get to 20Hz were you would need around 500k for one of the
resistors.
LEDs vs Bulbs, LEDs are winning.

User avatar
Bob Scott
Posts: 1192
Joined: Wed Nov 20, 2002 1:01 am
Location: Vancouver, BC
Contact:

Post by Bob Scott » Wed Jun 06, 2007 1:00 am

MrAl wrote: Bob, perhaps you can tell us what made you choose 10k and 20k
also?
Most of my op-amp designs start out using 10K resistors wherever possible. 10K is a nice round number is high enough that it will not dramatically load an op-amp's output, and low enough that the circuitry's impedance will not be easily susceptible to noise and hum pick-up. Also, isn't 10K a value used in all available tolerances?

I chose 20K for R2 so that the second stage would toggle at a convenient +/-4.5 volts, halfway to the supply rails. By the way, the triangular wave on the output of the first stage will then be +/-4.5V, or 9Vp-p. (It will look perfectly shaped and not rounded off on your oscilloscope.) And the reason I made it 9Vp-p is because the voltage across TR1 is always 9V so that when you calculate the current flowing through TR1, which is identical to the current flowing through C1, and plugging in the formulas V=IR, Q=IT and Q=CV you end up with the voltage on C1 changing voltage by 9V in time T where T=RC. (wheez) And since T is half a cycle, a full cycle will take the time of 2T or 2RC. Since frequency is 1/T then F=1/(2RC)

f=1/(2RC) and R=1/(2fC) and C=1/(2fR)

where f is in cycles per second, R is in Ohms, and C is in Farads.

I say he should use a 1uF ceramic or mylar cap for C1. C2 is not required.
Go with the 500K trimmer for TR1. Using my formula or Al's the parts values come out pretty close, except I think slewing rate and time delay are insignificant enough to ignore.

If there is a problem sourcing parts, you could check out or mail order from this place in Santa Clara:

http://www.demoboard.com/Anchor_Pricelist_Jan07B.pdf

Cheers, Bob :grin:

User avatar
MrAl
Posts: 3862
Joined: Fri Jan 11, 2002 1:01 am
Location: NewJersey
Contact:

Post by MrAl » Wed Jun 06, 2007 11:58 am

Hi again Bob,

Yes a 1uf or mylar cap should work fine i agree.

Using an LF353 however, the output voltage can not reach as high
as 9v because of it's internal circuitry. The data sheet says
+/- 12v for a +/- 15v supply, and with +/- 9v supplies that would
mean 6v or less. This means the triangle goes from -3 volts to
+3 volts and back down again with R1=10k and R2=20k. You may wish
to make a note of this. There are op amps out there that can
work rail to rail, but many of the common types can not do this.

Also note i added the delay factor (d) to help improve the accuracy
of the formula for somewhat higher frequencies than we are talking
about here.
LEDs vs Bulbs, LEDs are winning.

User avatar
Craig Kendrick Sellen
Posts: 32
Joined: Thu Jan 25, 2007 1:01 am
Location: Carbondale Pennsylvania USA
Contact:

Post by Craig Kendrick Sellen » Wed Jun 06, 2007 1:18 pm

I worked out the resistor network. (see attachment)
Image

rshayes
Posts: 1286
Joined: Tue Mar 04, 2003 1:01 am
Contact:

Post by rshayes » Thu Jun 07, 2007 1:41 am

The approximate formula for frequency would be:

f= (R2/R1)*(1/(2*R*C))

R2 has to be greater than R1 to insure that the integrator output can reach the thresholds of the schmidt trigger. A two to one ratio is probably a good choice since it will allow for some differences in the positive and negative output capabilities of the op amp.

With R0 = 100K, R1 = 10K, and R2 = 20k, the frequency would be about 100 Hz. The frequency can be brought down to 20 Hz by increasing R0 to 470K. To further lower the frequency, I would connect the variable resistor as a potentiometer from the schmidt trigger output to ground. The wiper would then be connected to R0. If R0 were 470K, the maximum frequency would be slightly over 20 Hz, and would go lower as the potentiometer wiper is moved toward ground. The frequency would have an approximately linear relationship to wiper position with a linear pot. An audio taper pot might be easier to set at lower frequencies. A pot in the 10K range would be suitable, and probably easier to get than a 500K pot.

User avatar
Bob Scott
Posts: 1192
Joined: Wed Nov 20, 2002 1:01 am
Location: Vancouver, BC
Contact:

Post by Bob Scott » Thu Jun 07, 2007 12:47 pm

Mr. Al,

The beauty of this circuit is that the output frequency is independent of power supply voltage. Notice that there is no "V" variable in any of our equations. I'm also saying that the frequency is also independent of the output voltage of the op-amp. Notice that if the output voltages of stage 2 don't go rail-to-rail, the voltage sag also effects the charging current of the capacitor. They track, and the circuit stays on frequency.

Conveniently, as long as R1:R2 stay at a ratio of 1:2 then there is no fraction to be added to the equation and it stays simple.

I am analyzing Mr. Hayes equation which takes into account variation of the values of R1 and R2:

f= (R2/R1)*(1/(2*R*C) which can be rewritten as:

f= R2/(R1*2*R*C) where R is the adjusted value of TR1

I think it is out by a factor of 2, but my head is starting to hurt. I think possibly, maybe, the 2 should be changed to a 4.

Bob :cool:

User avatar
Bob Scott
Posts: 1192
Joined: Wed Nov 20, 2002 1:01 am
Location: Vancouver, BC
Contact:

Post by Bob Scott » Thu Jun 07, 2007 1:12 pm

Craig Kendrick Sellen wrote:I worked out the resistor network. (see attachment)
Great, we can all quit now. :wink:

Bob

User avatar
MrAl
Posts: 3862
Joined: Fri Jan 11, 2002 1:01 am
Location: NewJersey
Contact:

Post by MrAl » Thu Jun 07, 2007 7:35 pm

Hi again,

Craig:
I have to wonder what that network is going to be used for?

rshayes:
I think your formula needs to be revised? Like divide by 2 more?

Bob:
I had asked about R1 and R2 because
I thought i could enlighten you about why the values of R1 and
R2 should be 10k and 20k, rather than just pick them out of
the air or to merely avoid some formulatic complications.
There is a specific reason why R1 and R2 should be those
values, when optimized in one specific way, and i was hoping you
would see why this is so. I dont want to come off as Mr Teacher,
but seeing that your interest is already what it is, i would
ask you to take another look at the circuit and try to come up
with a prefectly good reason why the values should be 10k and
20k, because there is a very very good reason why, not just a
matter of convenience, and it is fairly crucial to the operation
of the entire circuit.
When optimized for other reasons (other than general operation)
although R1 may stay at 10k R2 would most likely change drastically.
Lets stick with general operation for now though.

In closing, there is a tiny bit of change in frequency for a change in
voltage. It appears to work out to about 1 percent change in frequency
for every 10 percent change in voltage, or 0.1 percent per volt.
This is fairly good.
LEDs vs Bulbs, LEDs are winning.

User avatar
Bob Scott
Posts: 1192
Joined: Wed Nov 20, 2002 1:01 am
Location: Vancouver, BC
Contact:

Post by Bob Scott » Thu Jun 07, 2007 8:14 pm

MrAl wrote:Bob:
I had asked about R1 and R2 because
I thought i could enlighten you about why the values of R1 and
R2 should be 10k and 20k, rather than just pick them out of
the air or to merely avoid some formulatic complications.
There is a specific reason why R1 and R2 should be those
values, when optimized in one specific way, and i was hoping you
would see why this is so.
Of course. R1 cannot be greater than R2 because the toggle will fail to function. The voltage necessary for the toggle will be out of power supply range. I thought I had made this clear earlier. I also made R1:R2 a ratio of 1:2 so that wierd fractions would be necessary in the formula.
I dont want to come off as Mr Teacher,
Not with an equation like "R=(1/f-d)/K/C". The equation is in an ambiguous format. What do you divide by what first? I assume you mean "R=1/((f-d)*K*C)

You talk down to people. As I said, I have already designed and used an identical, except for exact parts values, integrator/toggle circuit 4 years ago in a commercial thermal servo circuit. There have been a few thousand sold. My analysis has been proven in the field.
but seeing that your interest is already what it is, i would
ask you to take another look at the circuit and try to come up
with a prefectly good reason why the values should be 10k and
20k, because there is a very very good reason why, not just a
matter of convenience, and it is fairly crucial to the operation
of the entire circuit.
I know. See above.
In closing, there is a tiny bit of change in frequency for a change in voltage. It appears to work out to about 1 percent change in frequency
for every 10 percent change in voltage, or 0.1 percent per volt.
This is fairly good.
Prove it. Explain please. Use math.

Bob :cool:

User avatar
MrAl
Posts: 3862
Joined: Fri Jan 11, 2002 1:01 am
Location: NewJersey
Contact:

Post by MrAl » Thu Jun 07, 2007 8:54 pm

Hi again,

First of all, Bob, it's nice to see your interest in these
kinds of circuits. It is not that often that you see that
sort of thing anymore these days. I have to say that by
far, before anything else, that i greatly appreciate your
interest, and that is a large part of this kind of problem.

With this circuit in particular, there is an optimization
that can be had by making R1=10k and R2=20k, but that is
not the only sort of optimization...there are others.
I am not trying to talk 'down' to people, but i have found
that my experience in circuit design has helped a multitude
of people in the past, so i strive to help others as well.
This is not so much talking down to people as it is conveying
information that i have been able to pick up along my
journey into the circuit analysis world. Years ago i would
have greatly appreciated someone who could provide this
wealth of information to me, upon the mere asking.
Sometimes this involves the simple de-mystifying of certain
component values. Even today i invite people who could
show me better ways of doing things, in models, circuit
methods, etc., that could make calculations for me and
others faster or more accurate, to show me the way.

Today we talk about the oscillator circuit using R1=
10k and R2=20k, and the reason for choosing these values.
After reading the above, can you tell me why?
Also, can you tell me what advantage, if any, is there to
using R1=10k and R2=50k ?
Also, can you tell me what might be a problem if we use
R1=10k, and R2=10k, which would be very 'convenient' values
since we would be able to order two resistors of 10k
instead of 1 of 10k and 1 of 20k?
LEDs vs Bulbs, LEDs are winning.

Post Reply

Who is online

Users browsing this forum: No registered users and 35 guests