3
\$\begingroup\$

I'm trying to get a 1kHz, 15V triangle wave on LTSpice. For that, I'm using the following design:

1

So far, my Square Wave has the desired frequency and amplitude, but my triangle wave has a lower amplitude. How can I correct this so both waves match at +15v and -15v?

I'm using the following specs, sorted out by some formulas but also trying. There are some values that I don't see how affect what I get.

  • Vcc=15v
  • R1=150k
  • C1=3.03361n F
  • R2=R3=100k
  • R4=R5=1k
  • C2=1000n F
  • R6=3k

Thanks a lot for your help.

EDIT: [UPDATED] here's a caption of the actual simulation i'm running on LTSpice:

enter image description here

\$\endgroup\$
2
  • 4
    \$\begingroup\$ Please use the built-in schematic editor (Use control-M to start it) to enter your schematic. The LM741 can't get its output closer than 2.5 volts or so to the supply rails. \$\endgroup\$ Commented Nov 30, 2016 at 22:55
  • \$\begingroup\$ You are right, and that explains that my square wave was peaking at 13.4 V, but the triangle wave is moving just between -3 and 3v. \$\endgroup\$ Commented Dec 1, 2016 at 1:36

3 Answers 3

4
\$\begingroup\$

There a few problems with your circuit:

1) The second stage will generate an exponential rather than a triangle. 2) The resistor values for feedback on the second stage are much too low - the amplitude may be limited by the output current capability of the 741. You can use something in the range 10k-100k. 3) The actual amplitude of the output will be limited by the opamp. The 741 os a very ancient opamp and is not as good as more modern ones - as Peter mentioned the output cannot get closer than ~2.5v to the rail.

This configuration should give better results:

Triangle Wave generator

It still uses two opamps and only needs one capacitor to set the timing.

The first stage is arranged as a schmitt trigger to detect when the output of the second stage reaches voltages determined by resistors R1 and R2. The second stage is configured as an integrator and will produce a triangular wave with linear slopes.

The square wave output is still determined by the saturation of the opamp as before, an opamp with rail to rail output will get very close to the supply rails.

\$\endgroup\$
1
  • \$\begingroup\$ This was very helpful. With this circuit i'm able to create a square signal and a triangle signal of the same amplitude. I'm just trying to figure out how to set the parameters to get the desired frequency. About the LM741, I've seen they're not the best available option but I'm required to work with them. \$\endgroup\$ Commented Dec 1, 2016 at 15:34
4
\$\begingroup\$

Dan,

There is two components to your the generator ±15 V Triangle Wave Generator you are trying to generate, the first stage is the Schmitt Trigger Oscillator then the Integrator so I think it would be appropriate to discuss them separately first.

Regarding Schmitt Trigger Oscillator:

First, let's discuss how it operates to aid the understanding let's refer to the figure below. Schmitt Trigger Oscillator Waveforms Image source here.

Step 1: The Excitation

An excitation -- namely the intrinsic noise in your system will go into the Op Amp, and will be amplified by the "Closed Loop Gain" which approaches the "Open Loop Gain" much like it does in an basic Op Amp integrator circuit.

Step 2: The Saturation

Ideally it would be amplified forever, however the Op Amp has Output Limitations which causes the output to saturate at VCC or a voltage close to it, depending on the Op Amp. Your output will look similar to this at the beginning:

enter image description here

Image source here.

This is important because you might not be able to achieve an output of ±15 V due to the Op Amp Output "Voltage Swing" Limitations. Note that as other commenters have noted this depends on your load, which in your current set up is around 1 kOhm.

The Texas Instruments LM741 Datasheet specs between ±10 V and ±13 V for a 2 kOhm load, so as the other commenters have suggested you might want to increase the Integrator's resistor values.

For more details on Output Limitations check this.

Step 2: The Switching

You can use the following definition to determine the Output Voltage of your comparator, given the current state:

$$ V_{OUT} ≈ \ \left\{ \begin{array}{ll} -V_{CC} \quad \to \quad V_{OUT(new)} ≈ +V_{CC} \quad when \quad V_{IN-} > V_{IN+}\\ +V_{CC} \quad \to \quad V_{OUT(new)} ≈ -V_{CC} \quad when \quad V_{IN+} > V_{IN-}\\ \end{array} \right. \ $$

For example, if your output voltage is around +15 V, it will go to around -15 V when the voltage in the negative input of the Op Amp (i.e. the voltage accross C1) is greater than the voltage in the position input of the Op Amp (i.e. the voltage accross R3).

This is important because understanding this helps you determine your RC time constant, with some algebra and assuming R2 = R3 you can find the following relationship between frequency and your RC Constant:

$$ f_0 = {1 \over T} = {1 \over {2 \cdot RC \cdot \ln{(3)}}} $$

Note that the rise and fall times of the output will be limited by the "Slew Rate" which will get worst the bigger your load is (the smaller your resistive load is).

Finally, a word of caution about using an Op Amp as Comparator

Some Op Amps implement Input Overvoltage Protection by using "Clamping Diodes", which limits the Op Amp's differential input voltage (the voltage measured between the two Op Amp inputs) to diodes' voltage (usually ~0.7 V).

The LM741 is OK to use, other options would be TL084 and OPA192, ranked as follows:

LM741 - OK, TL084 - Better, OPA192 - Best

For more details on Op Amps as Comparators, check this.

Regarding the Integrator:

Let's first look at the simple OpAmp Integrator:

enter image description here

The dotted line represents the "Open Loop Gain" of the Op Amp (the internal gain of the Op Amp) and the Solid Line represents the "Closed Loop Gain" of the Op Amp (the gain set by R5 and R6).

The issue with this implementation is that unlike an Ideal Op Amp and current going into and out of the Op Amp inputs is not zero, another non-ideality is "Offset Voltage" which is modeled as as small voltage source at the input of the Op Amp.

The point is that both of these are DC imperfections, and because the "Closed Loop Gain" is so high at DC (i.e. Frequency = 0 Hz), they will be amplified causing a DC offset in your output voltage.

Adding R6 limits the "Close Loop Gain" at lower frequencies and it goes from beging like the figure below (in the left) to the figure below (in the right), effectively creating a Low-Pass Filter.

Limited Closed Loop Gain by adding RF, creating Low Pass Filter

where:

$$ f_C = f_{Cut-Off} = f_{-3 dB} = {1 \over {2 \cdot \pi \cdot R5 \cdot C2}} $$

and,

$$ f_L = f_{Unity-Gain} = f_{0 dB} = {1 \over {2 \cdot \pi \cdot R4 \cdot C2}} $$

Note: having R5 being 100 times bigger than R4 allows for enough separation between 'fC' and 'fL' to allow for the circuit to behave as a "good" integrator.

This is important because the frequency of the signal that you want to integrate should be above 'fC' but before reaching 'fL'. In other words should be in the yellow shaded area in the figure above.

Solving your Triangle Amplitude Issue

First C2:

Your first problem is that C2 is too big... think of a Capacitor as a Variable Resistor (or Frequency Controlled Resistor) that decreases under two conditions:

  • Increasing Frequency.
  • Increasing the Capacitance value.

Remember that a Capacitor is a "Frequency Controlled Resistor" and having C2 = 1 uF, at 1 kHz looks like a ~160 Ohm Resistor, that means that if R5 = 1 kOhm then 'fL' < 1 kHz, so your signal will get attenuated significantly.

Decreasing C2 to somewhere between 100 nF and 220 nF should be a good starting point to increase 'fL' enough.

Then R5:

R5 is too small, that means that you will have an very small area where your circuit will behave as a good integrator (i.e. 'fC' and 'fL' are too close to each other).

Increasing R5 to 100 kOhm (that is 100⋅R4), puts 'fC' at a lower frequency, increasing the range of frequencies for which your circuit will behave as a good integrator.

About R6:

As I mentioned before, one of the disadventages of the non-ideal Op Amp for an Integrator is that the "Bias Current" (i.e. current coming and going out of the Op Amp input pins).

R6 is meant to aid with this issue and it should be R6 = R4||R5, however, this method it is not always effective because it depends on the Op Amp.

For more details on Input Bias Cancelation Resistors, check this.


EDIT: Dan, to address your comment:

Yes, you should have an off-set due the DC Op Amp non-idealities being amplified by the DC 'Closed Loop Gain', adding a "coupling" capacitor (between the Schmit Trigger Oscillator and R4) has two results:

  1. The DC error introduced by the Schmit Trigger Oscillator no longer affects the Integrator. This is because the Capacitor is like a "Frequency Controlled Resistor" and at DC / low frequencies it looks like an open circuit, given you choose the appropiate capacitor size.

  2. The second result is a change in the "Closed Loop Gain", remember how introducing R5 made the Gain "flat" (i.e. 0 dB slope) at lower frequencies?, well adding the coupling capacitor would make lower frequencies have a slope of +20 dB (coming from minus infinity), the result would be the following:

enter image description here

What is going on in that triangle thing, anyways?

The reason the DC error is improved is that you can think of the area under the + 20 dB slope as a differentiator, and the derivative of a Constant (i.e. DC) is zero!

In the figure above, the circuit would be a Differentiator at frequencies below 1 kHz and Integrator above that.

You need to be keep in mind that:

  • A lower C will give you the better DC perfomance (less offset), but your AC peformance (Integration) is affected.

  • A higher C will not necesarily give you better performance, because your impedance is limited by C2.

enter image description here

Some simulations on TINA-TI show that 0.47uF and 1.0uF are your best option, because you will get the DC benefits and still have a good enough slope for integration.

Just a note:

1st order Low-Pass has a slope of -20 dB, and acts as an Integrator

1st order High-Pass has a slope of +20 dB, and acts as an Differentiator

1st order Band-Pass is an integrator at lower frequencies and differentiator higher frequencies (like the figure above).


To learn more about, Slew Rate, Output Limitations, and other Op Amp non-idealities go here.

\$\endgroup\$
4
  • \$\begingroup\$ Wow, very nice first answer! Welcome to EE.SE! \$\endgroup\$
    – Wesley Lee
    Commented Dec 1, 2016 at 13:17
  • \$\begingroup\$ I was required to achieve this through an astable multivibrator configuration, using only LM741 opamps. However, the Schmitt triger configuration gives a better square wave and a better triangle wave (same amplitude, and actually triangle and not exponential). This was meant to create a Pulse With Modulation, comparing the triangle wave with a lower frequency, same amplitude, sine wave, which I did. Supposedly, my triangle wave should have an offset, so i should use a copling capacitor, but I don't see any offset. \$\endgroup\$ Commented Dec 1, 2016 at 15:55
  • \$\begingroup\$ @DanBerezin, I added to my post to address your comment about the Coupling Capacitor. \$\endgroup\$
    – Victor S
    Commented Dec 1, 2016 at 18:31
  • \$\begingroup\$ Thanks a lot for your help. I updated the circuit I'm using. As you can see, after the Triangle Wave, I'm using a comparator between that wave and a 100Hz Sine to get a PWM, and then a Low Pass Filter. I still can't figure out about the coupling capacitor. A DC offset of my triangle wave would mean that it should have a DC component? Because I don't see it has any. When I add a capacitor on the triangle wave, then its mean value is not zero anymore. I guess that could be solver with a resistive voltage divisor, but I still don't get how the triangle wave would benefit from the capacitor. \$\endgroup\$ Commented Dec 2, 2016 at 13:59
2
\$\begingroup\$

The simplest approach is to reduce C2. Since you need an amplitude about 4 times larger, try a 220 nF cap. You can make fine adjustments by tweaking R5 on your original schematic.

However, as Kevin White has noted, using 1k resistors is running right on the ragged edge of what a 741 can drive, so you'd be better off with a nominal 10k resistor and a 22 nF cap. Plus, the feedback resistor needs increasing to 10k also. Also note that, since your square wave is produced by driving the 741 into saturation, trying to get the same amplitude on your triangle wave will probably produce distortion at the peaks, as the op amp starts running out of juice at the high output amplitudes. This will tend to round or clip your peaks, and you'll probably need to run your triangle wave at slightly lower amplitude than your square wave.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.