# LM358 Square Wave Oscillator Help

#### RKG

Joined Apr 5, 2011
1
I am going to be using a LM358 as a Square Wave Oscillator for a college project but am having some trouble in calculating what Resistor and Capacitor values I'll need to use to produce a frequency of 1Hz. I'll be using the oscillator on pg 14 of this document: http://www.national.com/ds/LM/LM158.pdf

I've found many equations during my research but am unable to find one that relates to the LM358.

The most common equation I have found is: T=2RC ln[(1+λ)/(1-λ)] Where λ=R1/R1+R2

Of course this does not take into account R3 of the LM358 circuit. Can I leave R3 out of the equation or do I change the equation to this: λ=R1/R1+R2+R3 ?

Any help would be much appreciated.

#### Jony130

Joined Feb 17, 2009
5,244
For your circuit supply form single supply voltage equation for T1 is equal

$$T1=R1*C*\ln \frac{Vcc - VL}{Vcc - Vh}$$

T2 is equal

$$T2=R1*C*\ln \frac{Vh}{VL}$$

$$Vh = Vcc*\frac{R3}{R3 + R4||R2}$$

$$VL = Vcc*\frac{R3||R4}{R3||R4 + R2}$$
Of course I assume that opamp gives VCC in high state and 0V in low state.

So if we assume R2=R3=R4 we have

$$Vh = Vcc*\frac{R3}{R3 + R4||R2} =\frac{2}{3}*Vcc$$

$$VL = Vcc*\frac{R3||R4}{R3||R4 + R2} =\frac{1}{3}*Vcc$$

So finally
$$T1=R1*C*\ln \frac{Vcc - VL}{Vcc - Vh} = R1*C*\ln2 = 0.693*R1*C$$

$$T2=R1*C*\ln \frac{Vh}{VL}=R1*C*\ln2 = 0.693*R1*C$$

Time period

$$T=T1+T2 = R1*C*\ln4 = 1.386 R1*C$$

So for 1Hz R1 = 220K C = 3.3uF

And if you choose R2 = R3 = R and R4 = 0.52*R then

T = 2* R1 *C

For C = 470nF; R1=1M

#### Attachments

Last edited:
• rico1974