# Difficulty Generating Triangle Wave with Wide Frequency Range

#### lucumon

Joined Nov 25, 2023
10
Hi,

I'm seeking assistance with designing a circuit that generates a triangle wave with a variable frequency spanning from 20Hz to 10kHz. Upon scouring the internet, I encountered numerous instances where a circuit comprising two operational amplifiers (op-amps) was recommended for this application. One op-amp is configured as a Schmitt trigger, followed by an integrator. A relevant forum post utilizing this circuit can be found at link.

Given the broad frequency range, I'm encountering challenges in making this circuit function effectively at high frequencies. I've experimented with various op-amps, assuming that slew rate limitations might be the culprit (UA741, LM324, LM311 as Schmitt trigger, TL082 with high slew rate). However, none of them yielded satisfactory results.

Additionally, I attempted employing a 555 timer to generate the initial square wave.

Any constructive guidance would be immensely appreciated. This issue has become quite perplexing.

• I'm utilizing PSpice for TI for my simulations.

Cheers.

#### sghioto

Joined Dec 31, 2017
5,369
Check out the XR2206.

#### AnalogKid

Joined Aug 1, 2013
10,944
Why does it have to be in a single range? For a single integrator capacitor, that is a 500:1 change in resistance. It also is a change of 500:1 for the integrator opamp output stage current.

ak

#### lucumon

Joined Nov 25, 2023
10
Check out the XR2206.
I'm supposed to only use the components stated on this table.

Why does it have to be in a single range? For a single integrator capacitor, that is a 500:1 change in resistance. It also is a change of 500:1 for the integrator opamp output stage current.

ak
It's a school work. We're required to design it like that :/

We're also required to design the circuit with variable amplitude from ±1V to ±5V. I was thinking of doing this after obtaining the triangle wave, using an inverting op-amp with variable gain, as we are required to power our circuit with ±15V.
Maybe, I should atenuate the power supply output at first, and then power my circuit from that, to avoid passing the signal through more op-amps than needed.

Cheers.

#### sghioto

Joined Dec 31, 2017
5,369
Moderator will probably move this to the Homework Help forum.

#### drjohsmith

Joined Dec 13, 2021
850
I'm supposed to only use the components stated on this table.
View attachment 308405

It's a school work. We're required to design it like that :/

We're also required to design the circuit with variable amplitude from ±1V to ±5V. I was thinking of doing this after obtaining the triangle wave, using an inverting op-amp with variable gain, as we are required to power our circuit with ±15V.
Maybe, I should atenuate the power supply output at first, and then power my circuit from that, to avoid passing the signal through more op-amps than needed.

Cheers.
What technique have you talked about in the classes ?

#### AnalogKid

Joined Aug 1, 2013
10,944
It is clear from post #1 that you are aware of the standard approach to this design. Work up your own schematic with parts values and unique reference designators (!!!) for each component, and we will advise.

Hint: Based on the datasheets, I would use only the 311 and TL082 for the active devices. Nothing else is fast enough to handle the transitions at the triangle wave peaks without noticeable distortion at 10 kHz.

ak

#### lucumon

Joined Nov 25, 2023
10
First of all, here's an image of the circuit in Pspice for TI

Now, I will introduce the equations involving this circuit:
$V_o = \frac{R_4}{R_3} \cdot V_{cc}$
$f = \frac{R_3}{4R_4 \cdot (R_5 + R_{POT}) \cdot C_1}$

Here is the procedure that I have followed in order to calculate the pasive components.
As I'm required to have an output of ±1V to ±5V, I decided to reduce the output to ±5V here:
$\frac{R_4}{R_3} = \frac{1}{3}$

Using a potentiometer of 10kΩ:
$\begin{cases} f = 20 \text{ Hz} \text{ when } R_{POT} = 10 \text{ k\Omega} \\ f = 10 \text{ kHz} \text{ when } R_{POT} = 0 \text{ \Omega} \end{cases}$

Using the equation for calculating the frequency:
$\begin{cases} 20 \text{ Hz} = \frac{3}{4 \cdot (R_5+10 \text{ k\Omega}) \cdot C_1}\\ 10 \text{ kHz} = \frac{3}{4 \cdot R_5 \cdot C_1} \end{cases}$

Solving, I obtain $$C_1$$ and $$R_5$$:
$\begin{cases} C_1 = \frac{1497}{400 \cdot 10^6} = 3.7425 \text{ \muF}\\ R_5 = \frac{10000}{499} = 20.0401 \text{ \Omega} \end{cases}$

Simulating with LM311 is very slow for me for some reason, maybe It's a Pspice limitation. Using UA741 for both the Schmitt trigger and integrator, I get correct results for 20Hz, but an awfull mess for 10kHz.
Here are screenshots of simulations for both frequencies using LM311 as Schmitt trigger and TL082 as integrator. I don't understand why I'm getting this.

Note: R2 is a very high resistor to simulate that strob isn't connected to anything.

#### Attachments

• 15.2 KB Views: 2

#### crutschow

Joined Mar 14, 2008
34,044
You are using the LM311 output as an emitter follower which likely gives the slow response.
I've never seen a application where it was used in that manner.

Try grounding the emitter out from the LM311 and use the collector out for your signal.
You may need to adjust the values of R1, Rpot, and R5 accordingly.

That, of course, will invert the output signal polarity, so you will need to also reverse the inputs.

#### Papabravo

Joined Feb 24, 2006
20,994
Is there anything that prevents you from using constant current sources and sinks to charge and discharge different capacitors?

#### lucumon

Joined Nov 25, 2023
10
You are using the LM311 output as an emitter follower which likely gives the slow response.
I've never seen a application where it was used in that manner.

Try grounding the emitter out from the LM311 and use the collector out for your signal.
You may need to adjust the values of R1, Rpot, and R5 accordingly.

That, of course, will invert the output signal polarity, so you will need to also reverse the inputs.
If I understood correctly, this will make the Smitch trigger oscilate always over 0V. Using the same pasive componets for testing the circuit without adjusting the frequency yet, gives me the following results:

There's definetly something that I'm missing. I will do all the calculations again for this new circuit hoping that's the problem.

Is there anything that prevents you from using constant current sources and sinks to charge and discharge different capacitors?
The only power supply we are allowed tu use is ±15V DC. I don't know if this answers your question.

Last edited:

#### Papabravo

Joined Feb 24, 2006
20,994
If I understood correctly, this will make the Smitch trigger oscilate always over 0V. Using the same pasive componets for testing the circuit without adjusting the frequency yet, gives me the following results:
View attachment 308460

There's definetly something that I'm missing. I will do all the calculations again for this new circuit hoping that's the problem.

The only power supply we are allowed tu use is ±15V DC. I don't know if this answers your question.
No, it is unrelated to my suggestion. I might be able to give you a reference to a potential strategy.

Last edited:

#### crutschow

Joined Mar 14, 2008
34,044
If I understood correctly, this will make the Smitch trigger oscilate always over 0V.
Yes, my mistake.
For your circuit, the emitter should be connected to the minus supply voltage.

#### MisterBill2

Joined Jan 23, 2018
17,790
Read articles by BOB PEASE about voltage to frequency circuits. You will not find better information anywhere else.

#### lucumon

Joined Nov 25, 2023
10
No, it is unrelated to my suggestion. I might be able to give you a reference to a potential strategy.

View attachment 308478

View attachment 308477
Thanks for the suggestion but I think that this is too complex of a solution for what we are learning in classes. The only type of oscillators we are working with are simple 555 circuits and op-amp oscillator with no more than 3 operationals (I'm not saying that we should only use that).

As for the circuit I'm using, I found that the pull up resistor R1 affects the output signal, how can I calculate the apropiate value for my circuit?

#### crutschow

Joined Mar 14, 2008
34,044
As for the circuit I'm using, I found that the pull up resistor R1 affects the output signal, how can I calculate the apropiate value for my circuit?
The comparator output impedance is R1 when then output is high, and close to zero (output transistor saturation resistance) when the output is low.
That makes the integrator equivalent input resistance different for the high and low comparator output state by the value of R1.

A way to make the comparator output impedance close to symmetrical for the high and low states is to add a resistor and parallel Schottky diode at the comparator output (below):
Make the value of R4 equal to R1.

Last edited:

#### drjohsmith

Joined Dec 13, 2021
850
Thanks for the suggestion but I think that this is too complex of a solution for what we are learning in classes. The only type of oscillators we are working with are simple 555 circuits and op-amp oscillator with no more than 3 operationals (I'm not saying that we should only use that).

As for the circuit I'm using, I found that the pull up resistor R1 affects the output signal, how can I calculate the apropiate value for my circuit?
A suggestion,
Look at the 555
Make the circuit for say 20 and 200 hz
And then think how you would make that variable.
Then make the circuit fir say 200 hz to 2 kHz the same way,
Then think what you would have to switch in and out to make one into the other,
The clue is it has to cover a range, but does not have to be continuous.

#### Papabravo

Joined Feb 24, 2006
20,994
Thanks for the suggestion but I think that this is too complex of a solution for what we are learning in classes. The only type of oscillators we are working with are simple 555 circuits and op-amp oscillator with no more than 3 operationals (I'm not saying that we should only use that).

As for the circuit I'm using, I found that the pull up resistor R1 affects the output signal, how can I calculate the apropiate value for my circuit?
I'll be interested to see what you come up with. Personally, I'm not a fan of the 555, and never had occasion to use one, but that's me.

#### AnalogKid

Joined Aug 1, 2013
10,944
I'm also not a fan; I think it is way over-prescribed. Sometimes it is the right part for the job, but this definitely ain't that time.

ak

#### MisterBill2

Joined Jan 23, 2018
17,790
I'm also not a fan; I think it is way over-prescribed. Sometimes it is the right part for the job, but this definitely ain't that time.

ak
Certainly true!!
BUT when the only tool that an individual has is a hammer, suddenly everything starts to look like a nail. Or something like that.
When the only electrical thing a guy knows how to use is an arduino, suddenly every project needs a processor.