Will this triangle generator work with an LM339 as an integrator?

eetech00

Joined Jun 8, 2013
4,709
So those were needed to suppress the noise/oscillations?
they were needed for it to work at all.

How does the triangle wave look?
From what I can see it doesn't look symmetrical, noisey, and more of a sawtooth.
My breadboard isn't the best, I'm gong to redo parts of it.

Here is the circuit I've bread boarded. Its shows 339's but on the breadboard I used 393's. I used 20K+1K for 21K (R6)

1770956972999.png
 
Last edited:

Jony130

Joined Feb 17, 2009
5,598
For me, this circuit does not work.
I breadboarded one using LM393 and another one using LM339
1771181718233.png
And this is the output voltage (LM393) at the integrator output:
1771181794934.png

This is what I observed on the LM339 outputs.
1771181862527.png
Yellow - integrator output
Blue - comparator output

Zooin version (LM339)
1771181934513.png

And this is the simulation result using Bordodynov's LM393_AB model:

1771182267350.png
And this is what I saw when I replaced LM393 with TL072
1771182506409.png
 

Jony130

Joined Feb 17, 2009
5,598
After adding the compensation network 10R + 100nF
This is what I saw in the simulation using Bordodynov's LM393_AB model
1771186792768.png

And the real-world version LM339 from TI:
1771183142622.png
1771183155404.png

And LM393 (ST version) 10R+ 100nF
1771183789617.png
 
Last edited:

hrs

Joined Jun 13, 2014
534
Out of curiosity I tried with an LM319. Adding C3 cleaned it right up. Iwasn't expecting that.
*_noise.jpg is before adding C3. *_clean.jpg is after.

edit: the frequency counter said it runs at 6358Hz.
 

Attachments

Thread Starter

crutschow

Joined Mar 14, 2008
38,563
So it would appear that trying to use a LM339/393 or other comparator as an integrator is flaky at best, and shouldn't be done.
 

eetech00

Joined Jun 8, 2013
4,709
So it would appear that trying to use a LM339/393 or other comparator as an integrator is flaky at best, and shouldn't be done.
My scope output is the same as Jony130
After adding the compensation network 10R + 100nF
This is what I saw in the simulation using Bordodynov's LM393_AB model
View attachment 363519

And the real-world version LM339 from TI:
View attachment 363516
View attachment 363517

And LM393 (ST version) 10R+ 100nF
View attachment 363518
My scope output is the same as yours (using the circuit I posted in #21) but the triangle wave is about 700mv PP. Square is about 8.8v Pk. Both wave forms are symmetrical. Almost exactly as my LTspice simulation model.:)

I'm having trouble with my scope's PC interface software though...
 
In principle, comparators are not even supposed to work as integrators. Just out of curiosity, what is the barrier in using op-Amp for the right side of the circuit? Is compactness/ cost/ energy efficiency the issue?
 

ronsimpson

Joined Oct 7, 2019
4,716
Op-amps are built to be amplifiers, run in their linear range. (inputs at the same voltage) Their outputs should not be at the supply voltage.
Comparators have outputs that are built to be in more of a digital thing. The output is on or off and not in the middle of the supplies. Most of the time they don't pull up at all. (some do have pull up transistors) The input is at different voltages most of the time)
Yes, you can use them in a mode they were not designed for. They may not work as you think.
 

Ian0

Joined Aug 7, 2020
13,158
In principle, comparators are not even supposed to work as integrators. Just out of curiosity, what is the barrier in using op-Amp for the right side of the circuit? Is compactness/ cost/ energy efficiency the issue?
SLEW RATE and input protection diodes.
1) You can't make a good triangle wave unless you have a good squarewave to start with. Unless it is a very low frequency, the op-amp slew rate won't be quick enough.
2) Many op-amps have two diodes back to back across the inputs. That circuit won't work with that type of op-amp.
 
SLEW RATE and input protection diodes.
1) You can't make a good triangle wave unless you have a good squarewave to start with. Unless it is a very low frequency, the op-amp slew rate won't be quick enough.
2) Many op-amps have two diodes back to back across the inputs. That circuit won't work with that type of op-amp.
LM393 has a Pdt of 1.3usx2=2.6us. that makes 384kHz with no time left for the top of your "square" wave, in reality, It is probably 100kHz at best, if you want to use it for square wave. Now this is snippet from TL072 datasheet and you see for yourself the 500kHz I marked on the graph and the gain. Not to mention that someone actually implemented TL072 anf fixed the issue, tho i do not know why they worked with 30kHz, but even in that screenshot you can see that the top left corner of the square is curved ( we are talking 28KHz!!)
Casssspture.JPG
 

Ian0

Joined Aug 7, 2020
13,158
Gain and phase are not the important parameters here. It's SLEW RATE that matters. Although slew rate does depend on the compensation components which control the gain and phase.
13V/us for a TL071. So for a 9V supply it will spend 1.4us slewing, so at 724kHz its attempt at a squarewave will be a triangle.
If you assume that a decent squarewave needs to have slopes that take up less than 5% of the time, then 35kHz is its maximum, but a proper comparator can do better than that - sub-microsecond response times and rise times in nanoseconds are common
 
Top