# Working of a Comparator based Oscillator Circuit

I was trying to understand the working of this circuit, but couldn't figure out, how does it generate a square wave.

Here is what I figured out by looking at this. The Op-Amp behaves as a comparator. Assuming output to be +3V initially, the capacitor will charge. Once it charges the output will be -3V.

The bottom circuit, looks like a divider giving -1.5V at the non-inverting input.

What happens next?

• It is called a "relaxation oscillator". Commented Dec 24, 2013 at 7:23

Definitions:

• The inverting input of the opamp will be indicated by V-;
• The non-inverting input of the opamp will be indicated by V+;

Analysis

Initial state:

1. The opamp has positive feedback through the two 10kΩ resistors and is configured as a comparator as a result. It's output will be either HIGH or LOW. When the opamp output is HIGH V+ = +1.5V and when the output is LOW V+ = - 1.5V.
2. A good start to analyze the circuit is to assume the capacitor is discharged. The voltage across the capacitor is 0V and therefore V- will be at 0V too;

Continuous cycle:

1. Let's asume the opamp output is HIGH, V+ = +1.5V. With V- = 0V, the capacitor will be charged through the 100Ω and with that V- slowly rises until V- reaches the same voltage as V+ = +1.5V.
2. At that moment the opamp/comparator flips LOW and with that it pulls its own V+ input to -1.5V.
3. Now the capacitor starts to discharge slowly, down until the point where it reaches -1.5V.
4. At that moment the opamp/comparator flips HIGH again, pulling its V+ input up to 1.5V and the capacitor is being charged again.
5. The cycle continues like that.
• The initial state is an unstable equilibrium. Ideal comparators (like those found in simulation software) will stay in this state unless disturbed. Real-life comparators generally have enough noise at their inputs to push them into continuous cycle. Commented Oct 19, 2015 at 15:57

Although the above explanation seems ok, I tried both simulating the circuit and actually building it on LM339 quad Comparator. Both did not give me a square wave at the output. I guess the above circuit lacks a power source to start the oscillations. The aquare wave oscillator circuit here: http://www.interfacebus.com/voltage-comparator-opamp-design.html does work though. It gave me the square wave output I was looking for.

• Tried building circuit above in question as you did, but hit same problem, no oscillation. Thanks for posting circuit you found, which worked with vcc equal to+Vcc supply to opamp, many thanks.
– tom
Commented Nov 16, 2017 at 21:14

As others have said, this is a relaxation oscillator. However, the OP's circuit WILL NOT work with an LM339 comparator as the 339 has an open collector output. That means that the comparator output will be connected to the negative supply when V- > V+, but float when V+ > V-. The circuit posted by Siddd includes a 4.3k pull-up resistor allowing the circuit to properly oscillate.