# Problem with a Relaxation Oscillator (using Op Amp)

I'm studying a relaxation oscillator. This wikipedia circuit shows exactly my circuit with the only difference that I'm using different values for each resistor. I called resistor R the one connecting the inverting input of the op amp and its output, R1 the one connecting the non inverting input of the op amp and the ground and R2 the last one.

I've used an oscilloscope to measure the frequency of the output wave. The strange fact is that I measure frequencies always lower than expected. I calculated the expected frequencies using this formula: $$f = \frac{1}{2RCln(\frac{1+k}{1-k})}$$ where $$k = \frac{R1}{R1+R2}$$ Can anybody explain me why I'm always getting lower frequencies than expected? I also tried to change the resistors and capacitor values but I got again lower frequencies than expected. I'm using a TL081 op amp, resistors that go from 500 ohm to 46k ohm and capacitors that go from 45 nF to 1.7 microFarad.

## 2 Answers

Your formula is written such that it assumes that Vdd and Vss are symmetric with respect to ground. If this is not true — e.g., you are using only a single power supply with Vss tied to ground — this formula does not apply.

If you want to use this circuit with a single supply (or asymmetric supplies), you'll need to connect the grounded end of R1 to a "virtual ground" at (Vdd+Vss)/2. In fact, what you can do is simply split R1 into two separate resistors with twice the value, and connect one between R2 and Vss and the other between R2 and Vdd.

• Thank you for the answer. You are right Dave. Because of my laziness I didn't wrote the complete formula that I'have used. This one is the complete one: $$f=\frac{1}{RC(ln(\frac{Vs1-kVs2}{Vs1(1-k)})+ln(\frac{Vs2-kVs1}{Vs2(1-k)}))}$$ where Vs1 is the maximum positive voltage reached by the output wave and Vs2 is the minimum negative voltage reached. Do you think that connecting the oscilloscope to the output of the circuit could have influenced the behavior of the circuit itself? – Daniele Nazzari Sep 8 '12 at 12:18
• Oscilloscope should have no effect. – Russell McMahon Sep 8 '12 at 12:36
• Your second formula doesn't look right to me. I get: $f = \frac{1}{RC(ln(\frac{Vs1-kVs2}{Vs1(1-k)-kVs2})+ln(\frac{Vs2-kVs1}{Vs2(1-k)-kVs1}))}$ – Dave Tweed Sep 8 '12 at 13:26
• are you sure? because if you consider Vs1=-Vs2 you should get the initial formula (the one that I wrote in the question). If you substitute Vs1 with -Vs2 in your formula you get a different result – Daniele Nazzari Sep 8 '12 at 13:37
• Yes, you're right. I found my error. Your version of the complete formula is correct. So, by how much are your measurements off? You never said. – Dave Tweed Sep 8 '12 at 14:15

Using Daniele's convention from comments:

$k = \dfrac{R1}{R1+R2}$

$Vs1$ and $Vs2$ are the maximum and minimum output voltages, resp., and $Vth$ and $Vtl$ the higher and lower threshold, resp., I get the following equations:

$\begin{cases} (Vth - Vs2) e^{-t1/(R C)} = Vtl - Vs2 \\ (Vs1 - Vtl) e^{-t2/(R C)} = Vs1 - Vth \end{cases}$

which, solving for $t1$ and $t2$ gives

$\begin{cases} t1= R C \cdot ln\left(\dfrac{k \cdot Vs1 - Vs2}{(k -1)Vs2} \right) \\ t2 = R C \cdot ln\left(\dfrac{k \cdot Vs2 - Vs1}{(k-1)Vs1} \right) \end{cases}$

Then the frequency is

$f = \dfrac{1}{t1+t2} = \dfrac{1}{RC \left[ ln\left(\dfrac{k \cdot Vs1 - Vs2}{(k -1)Vs2} \right) + ln\left(\dfrac{k \cdot Vs2 - Vs1}{(k-1)Vs1} \right) \right]}$

which is different from Dave got.

Dave mentions 20 % tolerance for capacitors. That's common for electrolytics (their upper tolerance may even be as high as 50 %), but affordable ceramics, like X5R and X7R, exist with 10 % tolerance.

• You set up the problem incorrectly. In the second of your first two equations, the RHS should be Vs1-Vtl, not Vth-Vtl. And I didn't say better-tolerance capacitors don't exist, simply that the jellybean parts likely to be laying around the lab are probably 20%. @Daniele should measure them; most multimeters these days include the ability to measure capacitors. – Dave Tweed Sep 8 '12 at 17:47
• Actually, I misspoke. It should be Vs1-Vth. – Dave Tweed Sep 8 '12 at 18:17