# Understanding triangle generator circuit

#### andy24691

Joined Nov 25, 2010
42
Could someone explain to me how this circuit works, it produces a triangle wave of 250 kHz. Please make replies as simple as you can.

cheers

#### Attachments

• 7.4 KB Views: 232

#### Wendy

Joined Mar 24, 2008
22,381
I'm going to let you do some of your own research, the 1st part is an inverting Schmitt Trigger made with an op amp.

The second half is this is a classic Hysteretic Oscillator. It so happens a 555 can be made into a inverting Schmitt Trigger with ease, so this article will explain the oscillator section...

555 Hysteretic Oscillator

The triangle wave is more of a ramp function, it is not linear like a classic triangle wave generator, which is a kissing cousin of the Hysteretic oscillator (actually it is also a hysteretic oscillator, with a slight twist).

#### SgtWookie

Joined Jul 17, 2007
22,221
Hello Andy,
Bill got to you first, but I'd already re-created the simulation to show you the wave forms.

Have a look at the attached.

1) When power is first applied to the circuit, C1 has no charge on it, and the junction of R1/R2 is ~1/2 of the supplied battery voltage - so the output goes high, pulling the junction of R1/R2/R3 aka "ref" even higher.

2) Capacitor C1 charges through R4.

3) Once C1 charges to the point where the - input is higher than the + input, the output goes low, so "ref" gets pulled lower, and the capacitor now starts discharging through C4.

4) Once it discharges to the point where the - input is lower than the + input, the output goes high again, pulling "ref" up again, and we go back to step 2), repeating until the power gets turned off or something breaks.

#### Attachments

• 123.8 KB Views: 141

#### Yako

Joined Nov 24, 2011
245
The slew rate of the square is a shocker on that simulation.

This would be close to real world though I guess.

That circuit is called a Twin Tee I believe.

#### SgtWookie

Joined Jul 17, 2007
22,221
I decreased the value of R3 to obtain closer to a 1/3 - 2/3 swing for the feedback; 500k was pretty ridiculous, and made for a very low-voltage triangle wave.

The simulation with the original values was operating around 360kHz, which I'd take with a pound of salt. Changing R3 brought it down to ~100kHz.

If you really want a square wave generator to operate in the 250kHz region, you really need a faster opamp than the TL07x/TL08x family.

#### andy24691

Joined Nov 25, 2010
42
Thank you that's very helpful, I simulated it with the 500K resistor and the amplitude was only 1V. I'm using a CA314DE op amp, would you say that this waveform would be sufficient for pwm of audio signals? Which is what I intend it to be used for.

#### SgtWookie

Joined Jul 17, 2007
22,221
Did you mean a CA3140?

When you say "PWM of audio signals", do you mean that you are considering making a Class D amplifier? Or what did you have in mind?

The larger R3 is in relation to R1 & R2, the more triangular the wave will be, but it will also be of lower amplitude.

The smaller R3 will be, the greater the amplitude of the triangular wave - but it starts to resemble a sharks' dorsal fin instead of a triangle. The RC time is much more pronounced.

If you want a real triangle wave, you will need a different circuit.

#### Wendy

Joined Mar 24, 2008
22,381

#### andy24691

Joined Nov 25, 2010
42
Yes I would be using it as part of a class D amplifier, I'm not sure whether the waveform produced by this circuit is linear enough for this purpose though. Also I'm not sure what sort of amplitude I need it to be.

#### SgtWookie

Joined Jul 17, 2007
22,221
Andy,
If you have Java installed on your computer, have a look at this simulation:

It's a rather simple triangle wave generator that actually generates a triangle wave.
This simulator can be handy, as you can see how the current flows and what the relative voltages are as the simulation is running. It makes it easy to understand the basic functioning of a circuit. However, one really needs to use a more accurate version of SPICE to simulate a circuit before building a test circuit to see how it works with real parts.

#### crutschow

Joined Mar 14, 2008
27,024
The circuit SW referenced will work with a fast comparator and op amp connected as an integrator to generate a very linear triangle wave.

Here's a simulation of the circuit in LTspice with a high speed comparator and op amp, and modified for a single 5V supply.

View attachment Triangular Linear Gen 2.asc

Last edited:

#### Audioguru

Joined Dec 20, 2007
11,249
Almost any half-decent opamp like a TL081 or TL071 produces a triangle-wave if fed a high frequency square-wave due to slew rate limiting.

#### thatoneguy

Joined Feb 19, 2009
6,359
You may want more of a precision triangle wave generator if this is for audio.

There are several audio in, Class D output amplfier ICs available at low cost TI TPA3125D2 is an example of a stereo 10 Watt version contained within a 20 pin DIP

Mono versions with external MOSFET switching for more power are also available, cost is $2-$3 ish.

#### Audioguru

Joined Dec 20, 2007
11,249
School teachers do not know about modern class-D amplifiers and amplifier ICs. The teachers want the students to design them like they did 20 years ago.

#### thatoneguy

Joined Feb 19, 2009
6,359
School teachers do not know about modern class-D amplifiers and amplifier ICs. The teachers want the students to design them like they did 20 years ago.
I imagine that's why they are still suffering through the 16F84 in uC classes, it's the 741 of the micro world.

#### andy24691

Joined Nov 25, 2010
42
Thanks for all the input guys

I simulated the circuit sgt.wookie suggested but I struggled to get a frequency higher then 100kHz without unacceptable distortion. Below is the circuit I simulated as well as the generated triangle wave.

If anyone has any other suggestions on how I could obtain a 250kHz triangle wave I would be most grateful.

#### thatoneguy

Joined Feb 19, 2009
6,359
Try changing to TL074 op amps, they will be better with noise and higher frequencies.

If the models are correct in Multisim.

13v/uS slew rate, 15nV/Hz noise

#### SgtWookie

Joined Jul 17, 2007
22,221
You really need a faster opamp, and to use a comparator on the left side.

The TL07x/TL08x/LF35x series of opamps will have a hard time keeping up.

#### Audioguru

Joined Dec 20, 2007
11,249
The TL071 and TL074 have exactly the same high frequency response and slew rate as the TL081.
Their datasheets show that they have trouble above 100kHz.

#### Attachments

• 54.2 KB Views: 41

#### Ron H

Joined Apr 14, 2005
7,014
The circuit SW referenced will work with a fast comparator and op amp connected as an integrator to generate a very linear triangle wave.

Here's a simulation of the circuit in LTspice with a high speed comparator and op amp, and modified for a single 5V supply.

View attachment 36978
View attachment 36979
This may generate some controversy:
I haven't done the math, but my gut tells me that the PWM from an exponential triangle generator will be as accurate as that from a linear triangle. This assumes that the rising and falling time constants are identical, and that the comparator's propagation delay is independent of input slew rate. I am referring to the comparator that generates the PWM, not the one involved in generating the triangle wave.
OTOH, maybe I'm the only one who thinks that this might be controversial.
I am not implying that, with real-world parts, the exponential triangle is as good as the linear triangle for generating PWM.

EDIT: My guts and my memory failed me. See post #23.

Last edited: