Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

LM358 square wave oscillator

Status
Not open for further replies.

okbro

Member
hello,

I had few question regarding LM358 square wave oscillator design. The LM358 datasheet contains circuit diagram for square wave generator which is shown below. I have looked at other square wave generator but they normally don't have the resistor R2 which is connected to V+. What is the reason for including this resistor then? Also without this resistor R2 there is no square wave output?
lm.jpg

I am using single supply +5V and performed simulation in multisim which are shown below.
4.jpg

And the waveforms on oscilloscope,
5.jpg

which shows voltage peak to peak of about 3.8V or so.

How do I calculate the frequency of the square wave generator and what is the best way I can reduce the amplitude of the output square wave. I require output voltage peak to peak of 500mV.

Thank you
 
I think R6 is for bias purposes since you are using single supply.

Some basic calcs here - https://circuitdigest.com/electronic-circuits/astable-multivibrator-circuit-using-op-amp





Regards, Dana.
 
How do I calculate the frequency of the square wave generator
The oscillator has two trigger points at the plus input as determined by R5, R6, and R7.
The high point is when the output is high at about 3.8V for a 5V supply, and the low point is when the output is low at about zero volts.
The voltage at C1 will oscillate between the upper and lower trip points, so you then calculate the time it takes the voltage across C3 to reach the upper trigger point, as determined by the R2-C3 time-constant when the output is high, and the time it takes to reach the lower trip point when the output is low.
Taking the reciprocal of those two times added together will give you the approximate frequency.
what is the best way I can reduce the amplitude of the output square wave. I require output voltage peak to peak of 500mV.
The easiest is just to add a two-resistor voltage divider at the op amp output.
If you need a low impedance output, you can buffer that voltage with an op amp non-inverting follower.
 
The resistors R5,R6 and R7(in my circuit) and the datasheet resistors(R2,R3,R4) are indeed to bias the op-amp to midpoint 2.5V.

I have tried the frequency calculation from the above links also and also from other other sources. The frequency does not match the any equations. The frequency of I get from simulation is around 6.4KHz and depending upon the op-amp used(ideal and other types of LM358) the frequency changes sometimes 7KHz etc.

I just could not find the right equation for calculating the frequency.
 
The frequency you get, the difference between simulation and prototype
board, is affected by accuracy of your components. The R & C tolerances
very much factor into result. The OpAmp and its slew rate affect the frequency.

This circuit is by no means a precision circuit.

1635503199628.png


If you need accuracy consider using a potentiometer to trim frequency for R1.

What accuracy and T and V range do you need for the design ?


Regards, Dana.
 
The frequency of I get from simulation is around 6.4KHz and depending upon the op-amp used(ideal and other types of LM358) the frequency changes sometimes 7KHz etc.
With 100K feedback resistors, things such as the input bias current of the specific opamp will have some effect.

eg. an LM358 can have an input current of anything up to 500nA; 0.5uA. That's going to affect the capacitor charge time and can offset the input by up to 50mV when fed via 100K.

Using lower value resistors, or opamps with lower input bias, should give somewhat more consistent results.
 
hello,

yes totally understandable. So the theoretical frequency equation are quite inconsistent with actual op-amp component made up(slew rate) and external passive components.
- the slew rate must be one thing to look at
- will try the advice on low resistor values

thanks
 
Typical Capacitor tolerance is 10 - 20%, huge contributor to accuracy.

Device to device (OpAmp) slew rate very wide, as current sources internal,
along with compensation capacitor internal tolerance, contribute large
frequency errors. Thats why typically this circuit is done with a comparator which
eliminates the compensation, as slew rate largely not present. LM339 good choice
for this.


Regards, Dana.,
 
If you want accurate value capacitors, polystyrene ones are usually available in 1% tolerance.
(They are also very low loss at high frequencies).

1% resistors are readily available.
 
resistors(R2,R3,R4) are indeed to bias the op-amp to midpoint 2.5V.
For a symmetrical output, you need to bias the op amp at the midpoint of its output voltage swing, not the midpoint of the power supply.
 
Actually a lot of us are guessing as we do not know your goals so :

1) What accuracy do you want, over T & V, for your osc ?
2) Can you trim for accuracy a components value ?
3) Power consumption limitation for design ?
4) Desired output V swing accuracy ?
5) Any jitter requirements ?
6) This schoolwork or a real design ?

To name a few.....

Regards, Dana.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top