Inverting Op-amp signals and Sawtooth waveform generation

In summary: Okay, that's fair. The quote of mine that you used was agreeing with the catch by @Joshy about the incorrect connection of the 2nd opamp. The question about the inversion or whatever of the signal was in a different...In summary, the question wanted a sawtooth wave form that ranges from 0v – 5v, and the circuit created by the expert is close, but the second op-amp "flipped" the wave form.
  • #1
Callum Plunkett
27
8
I’ve been asked to create a sawtooth wave form with four input voltages. After doing this I then added a second op-amp to both change the range of the wave form from -/+5v to -/+2.5 and DC offset of 2.5v to create a wave form that ranges from 0v – 5v as required by the question. For the most part I think I’m close enough with my result apart from the second op-amp seems to of “flipped” the wave form and I can’t quite figure out why and how to solve the issue.

I've included a picture of my circuit, wave form after the first op-amp and after the second op-amp.

Any help would be appreciatedhttps://www.physicsforums.com/attachments/286448https://www.physicsforums.com/attachments/286449https://www.physicsforums.com/attachments/286450
 
Physics news on Phys.org
  • #2
Hi Callum,

I moved your thread to the schoolwork forums from the EE forum, and something about that move messed up your attachments. Could you please re-attach them or add a new reply with them? Also, they were pretty hard to read (when they still existed) -- Is there some way to make the bigger and darker? Thanks.
 
  • #3
Could you redo your pictures. I can't read them.
More resolution is required - and the pictures only occupy the top left 10% of the available canvas.
 
  • #4
.Scott said:
Could you redo your pictures. I can't read them.
More resolution is required - and the pictures only occupy the top left 10% of the available canvas.
Yeah sorry about that by the i tried to change it but it would not up date. Ae these better?

pic1.png
fiststage opamp.png
Secondstageopamp.png
 
  • Like
Likes Delta2, berkeman and .Scott
  • #5
Whew, much better, thanks!

So you mention synthesizing a "sawtooth" waveform with the 4 voltage sources. You've done a good initial job of doing that, but do they want it to be more like a straight sawtooth instead of stepped? Can you say what you could change/add to the circuit to make it more like a traditional sawtooth?

1627062467090.png
 
  • #6
berkeman said:
Whew, much better, thanks!

So you mention synthesizing a "sawtooth" waveform with the 4 voltage sources. You've done a good initial job of doing that, but do they want it to be more like a straight sawtooth instead of stepped? Can you say what you could change/add to the circuit to make it more like a traditional sawtooth?

View attachment 286459
This is the full question as i was given.

Untitleds.png
 
  • #7
Ah, in that case it looks like you are doing the correct synthesis.
 
  • Like
Likes Callum Plunkett
  • #8
Yeah i think I am on the right track with it, so I am quite relieved someone else thinks I am some where near.
Cheers.
 
  • #9
The last op-amp has positive feedback. Isn't that going to be a problem?
 
  • Like
Likes berkeman
  • #10
Joshy said:
The last op-amp has positive feedback. Isn't that going to be a problem?
Good catch! I saw that the simulation output for X2 looked reasonable, so didn't check the schematic in detail. But yeah, with the opamp inputs inverted like that I don't see how the simulation isn't just hitting the rails...
 
Last edited:
  • #11
berkeman said:
Good catch! I saw the simulation output for X2 looked reasonable, so didn't check the schematic in detail. But yeah, with the opamp inputs inverted like that I don't see how the simulation isn't just hitting the rails...
Op amps invert the signal so you can just use one more with a unity gain to flip it back.
 
  • Haha
  • Skeptical
Likes DaveE and berkeman
  • #12
bob012345 said:
Op amps invert the signal so you can just use one more with a unity gain to flip it back.
I'm pretty sure you're kidding. An opamp with the inputs reversed so that the feedback is postive is a comparator, not a linear amplifier.
 
  • #13
berkeman said:
I'm pretty sure you're kidding. An opamp with the inputs reversed so that the feedback is postive is a comparator, not a linear amplifier.
A summer gives the negative of the sum. You add another op amp stage to invert that signal.
 
  • #14
A comparator slams to the +/- power supply rails when the difference between its inputs is positive or negative. Are you suggesting that a comparator can be used as a linear amplifier like an opamp that uses negative feedback?
 
  • #15
berkeman said:
A comparator slams to the +/- power supply rails when the difference between its inputs is positive or negative. Are you suggesting that a comparator can be used as a linear amplifier like an opamp with negative feedback?
No. I just thought the issue was the signal was flipped as in multiplied by a minus sign. I was telling how to make it positive.
 
  • #16
bob012345 said:
No. I just thought the issue was the signal was flipped as in multiplied by a minus sign. I was telling how to make it positive.
Okay, that's fair. The quote of mine that you used was agreeing with the catch by @Joshy about the incorrect connection of the 2nd opamp. The question about the inversion or whatever of the signal was in a different post.
 
  • #17
berkeman said:
Okay, that's fair. The quote of mine that you used was agreeing with the catch by @Joshy about the incorrect connection of the 2nd opamp. The question about the inversion or whatever of the signal was in a different post.
That's fine. Sorry for the misunderstanding.
 
  • Like
Likes berkeman
  • #18
Callum Plunkett said:
This is the full question as i was given.

View attachment 286461
Does the output have to be just like fig 2b (going between 0 and 5V) or just similar in shape? Are other DC biases allowed? I take it the input biases all have to be 5V as given. I ran it in LTSpice and got what you got but it's not clear how literal they want it.
 
  • #19
Did you consider simply adding a DC current to the AC harmonic currents at the summing input?
That way it provides the offset without needing a second op-amp.
 
  • Like
Likes Callum Plunkett
  • #20
bob012345 said:
A summer gives the negative of the sum. You add another op amp stage to invert that signal.
Op-amps have nearly infinite gain, so they will always have a circuit wrapped around them. It is easy to make a summer with positive gain, negative gain or any mixture you like, as in a differential configuration. They can do lots of different things. For example:

20210723_211547~2.jpg


This allows you to easily figure out how to do all sorts of summing, subtracting, level shifting, inverting with 1 amp and nearly zero effort. You just need to keep it balanced for the zero algebra option.

edit: also, IF IT'S BALANCED, the ground for the output is the ground at the lower R4, which can be different from the grounds for the inputs (with some common mode limitations, of course). However, "balanced" is relative; variations in the real resistor values will degrade the CMRR, sometimes significantly. There are other configurations which have much better CMRR, like instrumentation amps.
 
Last edited:
  • Like
Likes Callum Plunkett, bob012345 and Delta2
  • #21
Here is my version of it. I can't get a decent, readable screenshot of the output but it goes between 0 and 5V.
Screen Shot 2021-07-24 at 4.39.28 PM.png


output.png
 
Last edited:
  • #22
Good work!

A couple of comments: These aren't corrections, more like refinements, like how the pros would do it slightly differently.

1) It is considered bad design practice* to use the power supply voltages for anything except to power devices. Any connection into the signal path like the offset function you needed in this problem is a bad idea. The power supply voltages (usually) aren't intended to be very precise, they are noisy, and can create some really annoying cross coupling between different parts of the system. For example, if this circuit was used in an audio synthesizer, you would probably have lots of hum, pops & clicks, or and other noise at the output (in addition to your triangle wave) that was injected into your signal path through R6. So, in practice you would add a voltage reference of some sort (Zener diode, IC, etc.) to provide a clean and stable reference voltage for your offset.

* In the real world "bad design practice" means a circuit that mostly works but may have problems like low reliability, poor performance, hard to build, expensive, etc. (i.e there are better ways to do it).

2) It's much harder to buy a 3.5KΩ resistor than a 3.48KΩ resistor. Same for many other common values. Resistors are most often supplied with EIA standard values (usually the 1% tolerance for analog designs, in my experience). This really doesn't matter for homework problems or understanding. Theoretically useless, but how the real world works. Similar to choosing nut and bolt sizes. As an aside, I can usually immediately tell if a schematic was drawn by a very experienced engineer by things like this. You really wouldn't learn about these details until you had to choose resistors from a standard list (your stock room, distributors, etc.). For example, go online to your favorite distributor (I like https://www.digikey.com/en/products/filter/chip-resistor-surface-mount/52) and search for a 3.5KΩ 1% 0805 SMT resistor, see how many choices there are. Then do the same for 3.48KΩ.

3) If you adjusted your offset so that the output didn't go below 0V ever, then there would be no need for a negative power supply, you could replace it with a ground connection. You would have to choose an op-amp that can output 0V though, but these are common.

If you have lots of free time and you want a puzzle to solve, try this design using an LM10 op-amp with it's built-in reference and single supply capability. That might be how I would do it.

edit: These are especially not corrections, since this is clearly an unrealistic exercise. No one actually makes triangle waves by starting with 4 synchronized sinewaves. Even if those sinewaves already existed in my design, I wouldn't use them for this.
 
Last edited:
  • Informative
Likes bob012345
  • #23
Fourier synthesis of the sawtooth waveform is a difficult exercise because there are so many harmonics, and they fall off too slowly. Saw = f1/1 + h2/2 + h3/3 + h4/4 + h5/5 + , , ,

Notice how, each time another harmonic is added to the synthesis, it inverts and attenuates the error function. Since the number of harmonics is sharply limited, I would attenuate the higher given harmonics so as to eliminate the reversals in slope on the rising ramp. That would slightly increase the fall-time, but it would significantly reduce the error function.

That error function minimisation could also be achieved by including a Miller integrator capacitor across the op-amp feedback resistor, but that might be break the rules of the exercise.
 
  • Like
Likes DaveE
  • #24
Here I have replaced the coefficients {10k, 20k, 30k, 40k} with {10k, 22k, 40k, 70k} to take the bumps out of the ramp.
Sawtooth_Synthesis.png
 
  • Like
Likes bob012345
  • #25
3k7=3700?
 
  • #26
bob012345 said:
3k7=3700?
Yes. The decimal point is replaced by the multiplier in circuit schematics.
 
  • Informative
Likes bob012345
  • #27
DaveE said:
If you have lots of free time and you want a puzzle to solve, try this design using an LM10 op-amp with it's built-in reference and single supply capability. That might be how I would do it.
What would be the advantage of using this?
 
  • #28
bob012345 said:
What would be the advantage of using this?
Maybe none, but it's a good exercise.

Operation from a single power supply is often very desirable. For example, suppose your design operates off of a single battery. If you can design your circuits to only use that single power supply voltage you will save lots of complexity, cost, size, etc. If not, you may also be designing a negative output switching power supply as part of your solution. I would wager that nearly every circuit in your average car operates off of a single +12V power supply.

The value of using a dedicated reference for your offset I previously discussed.

Also, buying fewer components with the features you need integrated within them saves lots of space, cost, and can increase reliability.
 
  • #29
Sorry for the late reply I've been busy with work the past few days and have not had a chance to get back to anyone.
 
  • #30
There is a lot of information here and its a massive help. Electronics isn't something I do that much of at home or at work so it does not come that natural to me.

Thank you guys.
 
  • Like
Likes DaveE and bob012345
  • #31
Baluncore said:
Did you consider simply adding a DC current to the AC harmonic currents at the summing input?
That way it provides the offset without needing a second op-amp.
I did that in an earlier attempt at the question, I can't remember why now but I decided to ty a different method. Might have to reconsider going back to it.
 
  • #32
DaveE said:
Maybe none, but it's a good exercise.

Operation from a single power supply is often very desirable. For example, suppose your design operates off of a single battery. If you can design your circuits to only use that single power supply voltage you will save lots of complexity, cost, size, etc. If not, you may also be designing a negative output switching power supply as part of your solution. I would wager that nearly every circuit in your average car operates off of a single +12V power supply.

The value of using a dedicated reference for your offset I previously discussed.

Also, buying fewer components with the features you need integrated within them saves lots of space, cost, and can increase reliability.
I need a spice model for the LM10. It's not in LTspice. An equivalent part in LTspice would suffice. Thanks.
 
  • #33
bob012345 said:
I need a spice model for the LM10. It's not in LTspice. An equivalent part in LTspice would suffice. Thanks.
I think you could use any single supply rail-to-rail op-amp model. Then wire it to be like what's inside the LM10.

edit: Use LT1635 it should be in there.
 
  • Like
Likes Averagesupernova
  • #34
I just want to add to this thread that I wish I had gotten to know spice a lot sooner than I did. Anyone who tinkers with electronics should try it. Nothing to be afraid of.
 
  • Like
Likes Baluncore and bob012345
  • #35
DaveE said:
I think you could use any single supply rail-to-rail op-amp model. Then wire it to be like what's inside the LM10.

edit: Use LT1635 it should be in there.
Well, here it is with the LT1635. I could not get to 5V because of the limitations of the op amp I believe. I had to add the capacitor also. I tweaked the resistors further but I think it is not in the spirit of the exercise. Looking at the literature, this class of op amps has a lot of sophisticated uses and using it for a simple problem such as this I think is overkill. Still, it's fun to try.

Also, I'm working on a completely different approach so please don't spill the beans just yet.
Thanks.

Screen Shot 2021-07-26 at 5.55.16 PM.png
Screen Shot 2021-07-26 at 5.55.00 PM.png
 
Last edited:
<h2>1. What is an inverting op-amp?</h2><p>An inverting op-amp is a type of operational amplifier that produces an output signal that is the opposite polarity of the input signal. This means that when the input voltage increases, the output voltage decreases, and vice versa. It is commonly used in electronic circuits to amplify and invert signals.</p><h2>2. How does an inverting op-amp work?</h2><p>An inverting op-amp works by using a negative feedback loop. The input signal is fed into the inverting input terminal, while the non-inverting input terminal is connected to a fixed voltage (usually ground). The op-amp amplifies the difference between the two inputs and produces an output signal that is the opposite polarity of the input signal.</p><h2>3. What is the purpose of inverting op-amp signals?</h2><p>The purpose of inverting op-amp signals is to amplify and invert a signal. This can be useful in a variety of applications, such as audio amplifiers, signal generators, and filters. Inverting op-amps can also be used to create a negative feedback loop, which can stabilize and control the output signal.</p><h2>4. What is a sawtooth waveform?</h2><p>A sawtooth waveform is a type of non-sinusoidal waveform that resembles the teeth of a saw. It has a linear rise and a sudden drop, creating a triangular shape. Sawtooth waveforms are commonly used in electronic circuits for signal generation and timing applications.</p><h2>5. How is a sawtooth waveform generated using an inverting op-amp?</h2><p>A sawtooth waveform can be generated using an inverting op-amp by using a feedback loop with a capacitor and a resistor. The capacitor charges and discharges at a constant rate, creating a linear rise and a sudden drop in the output voltage. By adjusting the values of the capacitor and resistor, the frequency and amplitude of the sawtooth waveform can be controlled.</p>

1. What is an inverting op-amp?

An inverting op-amp is a type of operational amplifier that produces an output signal that is the opposite polarity of the input signal. This means that when the input voltage increases, the output voltage decreases, and vice versa. It is commonly used in electronic circuits to amplify and invert signals.

2. How does an inverting op-amp work?

An inverting op-amp works by using a negative feedback loop. The input signal is fed into the inverting input terminal, while the non-inverting input terminal is connected to a fixed voltage (usually ground). The op-amp amplifies the difference between the two inputs and produces an output signal that is the opposite polarity of the input signal.

3. What is the purpose of inverting op-amp signals?

The purpose of inverting op-amp signals is to amplify and invert a signal. This can be useful in a variety of applications, such as audio amplifiers, signal generators, and filters. Inverting op-amps can also be used to create a negative feedback loop, which can stabilize and control the output signal.

4. What is a sawtooth waveform?

A sawtooth waveform is a type of non-sinusoidal waveform that resembles the teeth of a saw. It has a linear rise and a sudden drop, creating a triangular shape. Sawtooth waveforms are commonly used in electronic circuits for signal generation and timing applications.

5. How is a sawtooth waveform generated using an inverting op-amp?

A sawtooth waveform can be generated using an inverting op-amp by using a feedback loop with a capacitor and a resistor. The capacitor charges and discharges at a constant rate, creating a linear rise and a sudden drop in the output voltage. By adjusting the values of the capacitor and resistor, the frequency and amplitude of the sawtooth waveform can be controlled.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
34
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
13
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
21
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
4
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
6
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
4
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
3
Views
2K
  • Electrical Engineering
Replies
3
Views
745
  • Engineering and Comp Sci Homework Help
Replies
1
Views
977
Replies
9
Views
4K
Back
Top