# SQUARE WAVE OSCILLATOR

I Again had a very simple basic question to all, i was generating a square wave with 50% duty cycle from a lm 358 at 20KHz, But what i got as output was not a square wave infact it was actually somewhat sinusoidal and somewhat like triangular waveform. I mean is this due to the GBW of the opamp(in datasheet it is mentioned to be 700KHz). or is this due to impedance mismatch. any solution to problem please do reply

The circuit you illustrate is a crude triangle wave oscillator.

If it does anything at all, that is - something about it is very wrong.

Square Wave Generator connect in this way

not the as your connection. the capacitor and resistor are switch position.

BillHo:
Square Wave Generator connect in this way

not the as your connection. the capacitor and resistor are switch position.

you mean to say 358 is ok to generate a pure square wave only problem is with my connections. just give me one last confirmaion on 358's frequency performance.

yes

Get a 555 and be done with it.

I agree with KeithRB. How square does it need to be?

The LM358 isn't rail to rail, so you aren't getting full ground to 5V output. A 555 timer will give you that.

If the ratio between Rb and Ra in this circuit is sufficiently large, the output will be very close to a 50% duty cycle.

Make Ra 1k and Rb 100k or more, and the output will be less than 1% from being 50% duty cycle. Then select C for the frequency you need.

All this talk about analog methods!

If you really want a square wave, you use a stable frequency source and feed it into a flip-flop. And the original source can be a much higher frequency such as a crystal oscillator if you also want accuracy.

That is precisely what the 74HC4060 is designed to do. It contains the oscillator (crystal or variable) and the counter chain so you can use it either way.

Paul__B:
All this talk about analog methods!

Aren't all logic circuits built from analogue circuits at some level?

"If you really want a square wave" you'll be disappointed. They always have finite rise and fall times so are closer to trapezoidal wave.

Russell.

Shorter wires have less capacitance, if you want a steep rise.
You can switch a FET a lot faster than 20 KHz, how fast a rise would you get with 12V behind a FET?

How does the steepness of Arduino PWM output look to you?

Google search "simple square wave generator" and get inspired from lots of design ideas.

@Paul__B

That is precisely what the 74HC4060 is designed to do. It contains the oscillator (crystal or variable) and the counter chain so you can use it either way.

Good!