Inverting Op-amp signals and Sawtooth waveform generation

44 replies · 7K views · last reply
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.
 
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.
 
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   Reactions: Averagesupernova
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   Reactions: Baluncore and bob012345
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.

LTspice schematic of an op-amp summing circuit: five sine sources (V3 to V6) feed weighted input resistors R3 to R6 with parameter a, into the inverting input of an LT1635 op-amp with feedback resistor R1 and capacitor C2, plus a 2.3 V reference and 5 V supply.
LTspice simulation plot of V(out) against time from 0 to 2.0 ms, showing a rising sawtooth-like waveform that drops sharply, repeating about every 0.8 ms and ranging roughly from 0.4 V to 4.6 V.
 
Last edited:
bob012345 said:
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.

View attachment 286620View attachment 286622
Yes. "Rail-to Rail" is always a lie. Those saturation characteristics graphs are one of the most important parts of the data sheet for a part like this. For a high impedance load you should be able to get within <0.1V or so if you're careful (i.e. don't make it source much current).

I'm not sure the exercise wants it to get to 5V. That would be the peak voltage for lots of harmonics, but with only 4 I think the top will be rounded off below that.

That cap isn't necessary if you choose the right resistor values. You seem to have missed the point about using a part with a built in reference to make the offset. The circuit below does this job with a single power supply, 1 IC and 7 resistors (although in the real world, I'd add a couple of caps too).

LTspice schematic of a summing amplifier: four sine sources V1 to V4 feed resistors R1 to R4 into an LT1635 op-amp stage with R5 to the output, a 6V Vcc supply, and a reference divider of R7 and R6 on the non-inverting input.
 
bob012345 said:
Also, I'm working on a completely different approach so please don't spill the beans just yet.
Do you mean the one with a 555 timer and a current source? That would be the standard approach for sawtooth generation. Or just buy a SMPS PWM IC and only use the ramp generator in it.
 
Averagesupernova said:
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.
And no one should be afraid to ask us for help during their initial learning curve.
 
A better version, 1 less resistor:
Circuit schematic of an inverting summing amplifier with four sine sources V1 to V4 (SINE(0 {A} {f}), {2*f}, {3*f}, {4*f}) feeding R1 to R4 and R6 into an LT1635 op-amp, with R5 3.01K feedback to Out and a 6V Vcc supply.
 
Attachments
  • LTspice schematic of an inverting summing amplifier: four sine voltage sources V1 to V4 at frequencies f, 2f, 3f and 4f feed resistors R1 to R4, summed into the inverting input of op-amp U1 (LT1635) through R6, with feedback resistor R5 to Out.
    Tri_210726-2_sch480.jpg
    26.6 KB · Views: 214
Last edited:
bob012345 said:
Here is my version of it. I can't get a decent, readable screenshot of the output but it goes between 0 and 5V.View attachment 286511

View attachment 286513
How did you come up with the coefficients of 10,20,30,40 and RF of 3.5?

I’ve arbitrarily used 10kohms for my RF with coefficients of 10kΩ, 13.3kΩ, 20kΩ and 40kΩ which should give me gains of 1.25, 2.5, 3.75 and 5.

I was hoping as there are 4 inputs at 5volts each that 5/4=1.25 and multiples of, would give a smoother wave form. However not quite the case.
Simulation screenshot of a summing inverting op-amp circuit with four sine sources and resistors, beside a red plot of X1 out in volts against time in mSecs, showing a repeating sawtooth-like waveform with steps.
 
Callum Plunkett said:
How did you come up with the coefficients of 10,20,30,40 and RF of 3.5?

I’ve arbitrarily used 10kohms for my RF with coefficients of 10kΩ, 13.3kΩ, 20kΩ and 40kΩ which should give me gains of 1.25, 2.5, 3.75 and 5.

I was hoping as there are 4 inputs at 5volts each that 5/4=1.25 and multiples of, would give a smoother wave form. However not quite the case.
View attachment 286657
Are you asking why the output solution for your circuit is the equation below?
$$ V_o = -R2( \frac{V5}{R4} + \frac{V4}{R3} + \frac{V3}{R1} + \frac{V6}{R5} ) $$

Or are you asking how to choose each of those gain terms (i.e. the resistor values)?
 
Callum Plunkett said:
How did you come up with the coefficients of 10,20,30,40 and RF of 3.5?

I’ve arbitrarily used 10kohms for my RF with coefficients of 10kΩ, 13.3kΩ, 20kΩ and 40kΩ which should give me gains of 1.25, 2.5, 3.75 and 5.

I was hoping as there are 4 inputs at 5volts each that 5/4=1.25 and multiples of, would give a smoother wave form. However not quite the case.
View attachment 286657
I just used the given formula with ratio's 1, 1/2, 1/3 and 1/4.

##ν(t) = \frac {2}{π} (sin(wt) + \frac {1}{2} sin(2wt) + \frac {1}{3} sin(3wt) + \frac {1}{4} sin(4wt) )##

Rf should have been exactly ##10k * 2/pi *1/2## which should have been 3.183k in keeping with the exercise but I did not realize that then. Here, I made it simpler using 1k for the lowest resistor. I think this is in keeping with the original exercise.

LTspice schematic of an inverting summing amplifier with four sine sources (SINE(0 5 4k), SINE(0 5 3k), SINE(0 5 2k), SINE(0 5 1k)) through resistors R1 to R4 of 4k, 3k, 2k and 1k, a -2.5 V offset source V6 through R5, feedback resistor Rf, op-amp U4 with +12 V and -12 V supplies. Parameter line .param pi=3.1415927 Rf=(2/pi)*1k/2 and .tran 2m.
 
Last edited:
  • Like
Likes   Reactions: Callum Plunkett and DaveE
DaveE said:
Are you asking why the output solution for your circuit is the equation below?
$$ V_o = -R2( \frac{V5}{R4} + \frac{V4}{R3} + \frac{V3}{R1} + \frac{V6}{R5} ) $$

Or are you asking how to choose each of those gain terms (i.e. the resistor values)?
I was wondering how you came up with the gain values for each channel. But it seems I over looked the equation as mentioned by bob012345.

Cheers guys.
 
Callum Plunkett said:
I was wondering how you came up with the gain values for each channel. But it seems I over looked the equation as mentioned by bob012345.

Cheers guys.
That's an equation you will want to be able to derive on your own. It's not that difficult with the ideal op-amp assumptions.
 
  • Like
Likes   Reactions: Callum Plunkett
Callum Plunkett said:
I was hoping as there are 4 inputs at 5volts each that 5/4=1.25 and multiples of, would give a smoother wave form. However not quite the case.
This animation shows how it works. As the number of terms grows the approximation to a sawtooth wave gets better.

https://kconrad.math.uconn.edu/math1132s10/sawtooth.htmlOf course, if one is forced to use only four terms, one can get a better fit by optimizing the values as was done in some of the previous posts.