Yet another triangle wave generator

Thread Starter

cmartinez

Joined Jan 17, 2007
8,760
I don't see why you still want to try the OP747 since you need a higher frequency op amp, but if you still want to play with it just download the new version of LTspice.
Will do. Thanks. What's the relation between the opamp's frequency and the maximum attainable frequency of this circuit?
 

crutschow

Joined Mar 14, 2008
38,504
What's the relation between the opamp's frequency and the maximum attainable frequency of this circuit?
It's not a simple relation, since the triangle-wave has many frequency components and it depends upon how sharp you want the triangle corners to be.
It's also related to the op amps slew rate as well as its frequency response.

Here's a simulation with the OP747.
I had to significantly reduce to value of R3 to get the high frequency wave to look okay, but this reduced the amplitude of the low frequency wave.
So the amplitude is no longer stable with frequency.
I'm not sure why, but it may be related to the reduced rise-time of the square-wave or other circuit delays.

upload_2017-9-27_17-36-34.png
 

RichardO

Joined May 4, 2013
2,270
So the amplitude is no longer stable with frequency.
I'm not sure why, but it may be related to the reduced rise-time of the square-wave or other circuit delays.
Yes on both counts. The slow rise and fall times cause flattening of the peaks of the triangle and the delays of the comparator and its input resistors cause the amplitude to increase with frequency. Part of the delay of the comparator is that some of the op-amp stages go into saturation and are slow to come back into the linear region. I think this is exacerbated by the internal frequency compensation capacitance.

Try an LT1800 for the comparator and a 22pf cap in parallel with the 98K resistor and see what happens.
 

Thread Starter

cmartinez

Joined Jan 17, 2007
8,760
Yes on both counts. The slow rise and fall times cause flattening of the peaks of the triangle and the delays of the comparator and its input resistors cause the amplitude to increase with frequency. Part of the delay of the comparator is that some of the op-amp stages go into saturation and are slow to come back into the linear region. I think this is exacerbated by the internal frequency compensation capacitance.

Try an LT1800 for the comparator and a 22pf cap in parallel with the 98K resistor and see what happens.
Thanks, Richard. But I think I already have the circuit working the way I want it to. What I really want is to generate a PWM 0-5V signal, with the capability of also varying its output frequency.

upload_2017-9-28_11-39-42.png

My only regret is that I'll have to use a 200K pot to control frequency, which is a non-standard value.
 

Attachments

RichardO

Joined May 4, 2013
2,270
Thanks, Richard. But I think I already have the circuit working the way I want it to. What I really want is to generate a PWM 0-5V signal, with the capability of also varying its output frequency.
If the comparator portion of the circuit is not fast enough then the amplitude will vary with frequency and so will your PWM duty cycle.

I also noticed that you are thinking of using a LM2903 as your voltage comparator for the PWM. Note that it dose not have a common mode input range that goes to the positive power supply. You need a voltage comparator that has rail-to-rail input.

Alternatively you can generate a triangle that goes from 0 to 3 volts and use your PWM pot to adjust between o and 3 volts. No rail-to- rail parts needed anywhere that way.
 

Thread Starter

cmartinez

Joined Jan 17, 2007
8,760
Also, my sim is using an LT1018 which is labeled as "general purpose", while the LM2903 is "differential". Is that what you're referring to when you say the LM2903 is not rail-to-rail?
 

crutschow

Joined Mar 14, 2008
38,504
Also, my sim is using an LT1018 which is labeled as "general purpose", while the LM2903 is "differential". Is that what you're referring to when you say the LM2903 is not rail-to-rail?
No.
It will tell you in the data sheet (not necessarily in the simulation label).
For example this is from the LM339/2903 data sheet:
upload_2017-9-29_10-23-5.png
upload_2017-9-29_10-24-26.png
So the input is not totally rail-to-rail but will serve for most purposes.

Below is the simulation of a high frequency PWM generator which uses the 339/393/2903 comparator.
(Note that it uses a comparator as an integrator, so in real-life it could possibly be unstable, although a Bode plot of the amp looks okay. Just be aware of that if you build the circuit, and if there's a problem, you will need to use a high-speed op amp for U4).

upload_2017-9-29_10-30-9.png
 

Thread Starter

cmartinez

Joined Jan 17, 2007
8,760
Update.

I need to make this circuit to work so as to output a triangle wave of a variable frequency from 20KHz to 200KHz, but I just can't wrap my head around it. Yes, I'm running its output through a comparator so as to generate PWM in the end, but that part can be ignored.

So far, I've been able to obtain a range of 2.4KHz to 22KHz, which is 1/10th of what I need. What gives? Am I using the wrong type of circuit for this task?

upload_2019-5-14_19-25-27.png

 

Attachments

ronv

Joined Nov 12, 2008
3,770
I don't see why you still want to try the OP747 since you need a higher frequency op amp, but if you still want to play with it just download the new version of LTspice.
If you download the new version don't you lose your third party saved models?
 

Thread Starter

cmartinez

Joined Jan 17, 2007
8,760
This indeed is working much better. And I was able to obtain a range of between 21 and 189 KHz by adjusting the values of C1, R2 and R3. But the triangle wave generated is too distorted (or do not cover the entire 0-5V scale) and that results in very low quality PWM at the output.

upload_2019-5-15_0-14-58.png
 

Attachments

Top