I'm having trouble with making an integrator that outputs what I'm looking for. I have a PWM signal going into the inverting input.
I want to generate triangular pulses with a rising and falling slope of 2.8 volts per millisecond. The square wave pulses I'm using are 0 to 8.4 volts.
I can't seem to get a clean triangle wave. I have this weird negative dip before the start of the triangle wave:
The voltage divider on the on-inverting input is actually a 10k pot. The capacitor is 178nF and the resistor is a 10k. These were the values I calculated, but it seems to work better with a 1k and 100nF
With just a resistor between the input and the opamp, the input must directly affect the output. As soon as you start the negative pulse, it immediately changes the output. You want it to 'ignore' rapid changes in the input and only slowly change.
I suspect the timing capacitor must be on the input side, possibly after a buffer opamp to clean up the input and give a consistent impedance (consistent ability to source or sink current.)
MorganS:
With just a resistor between the input and the opamp, the input must directly affect the output. As soon as you start the negative pulse, it immediately changes the output. You want it to 'ignore' rapid changes in the input and only slowly change.
How exactly do I do that?
MorganS:
I suspect the timing capacitor must be on the input side, possibly after a buffer opamp to clean up the input and give a consistent impedance (consistent ability to source or sink current.)
My input signal is coming from a 555 timer. I think it should be able to source whatever small current is needed, but the signal is distorted slightly, see the third and fourth picture after the trigger (blue line).
I did not study the circuit deeply but I don't think the 10MOhm resistor is the cause of your problem. I think the problem is caused because you are driving the op-amp into saturation. Also used op amp is not rail-to-rail so you must make sure you are not driving the inputs out of their range.
It is said 555s are very noisy. It is possible the fast spikes when the 555 switches are caused by poor decoupling (you may look at power rails with the scope) or simply it is an artifact on your scope.
I connected the V+ rail to +12v so now it should be fine with the 8.4v input signal. Now tho output is just saturated with small ripples as the 0v dip comes around, which probably makes more sense.
Here's a more detailed sketch of what I'm aiming for:
An LM358 is an ancient device and is not rail to rail. That's most of what you're fighting.
Image 1: your circuit with pin 3 of 358 at 4V
Image 2: pin 3 of 358 at 3.6V, note the slight clipping, that's the best you can do.
Image 3: pin 3 of 358 at 3V bottom half clipped
Image 4: pin 3 of 358 at 5V top clipped
Image 5: pin 3 at 3.6V with a rail-to-rail opamp (AD8676)
The LM358 also has very asymmetric output drive current capability, which might come into
play here. You are driving it fairly close to its slew limit, its an incredibly slow opamp (too
slow for audio, for instance, as large signal clipping starts around 4 or 5kHz, or lower with
a heavy output load.
I recently discovered there's an SGM358 device with similar low power consumption, but about 2
orders of magnitude faster...
If you want a better true R2R opamp there are plenty of modern devices out there that are far better.