LM358N Integrator Problem - Page 1
Forum section: electronics / beginners

author: SteveUK
author_rank: Contributor
timestamp: January 26, 2012, 04:11:18 am
content: I have a 1.2 kHz square wave going into the attached integrator circuit. I'm supplying +/-9v with two 9v batteries and the incoming signal ground is going to 0v (between the two batteries).Instead of the expected triangle wave output, I'm getting something down at about -9v. I can't even trigger on it. The inverting input does have a triggerable signal and is also attached. Any ideas?Ultimately I want a single supply integrator, but I thought I'd start with the simpler case of dual supply first.Time Scale for all traces is 0.5ms/div.Voltage Scale is 0.5 V/DIV (but I'm using x10 probes)

author: Rufus
author_rank: Super Contributor
timestamp: January 26, 2012, 05:21:40 am
content: Looks like your input is all +ve and with a dc gain of ten the integrator is bouncing off the bottom rail. Your input needs to be symmetrical about 0v.

author: amspire
author_rank: Super Contributor
timestamp: January 26, 2012, 05:43:36 am
content: Rufus is right. Add a 1uF capacitor in series with the 4k7 resistor to eliminate the DC from the input.

author: IanB
author_rank: Super Contributor
timestamp: January 26, 2012, 07:05:44 am
content: @SteveUK: Regarding the above comments, look carefully at how the square wave is drawn on the circuit diagram picture with regard to the dotted line 0 V reference point.

author: JorgeCarbajal
author_rank: Contributor
timestamp: January 26, 2012, 09:54:56 am
content: Hi, I think that the problem is the DC gain, wich is set to -10, Rf=47k and Ri=4.7k, if u want to mantain the dc level from the input change the feedback resistor to 4.7k

author: Rufus
author_rank: Super Contributor
timestamp: January 26, 2012, 02:30:30 pm
content: Quote from: IanB on January 26, 2012, 07:05:44 amThe "Looks like" came from the input scope trace and assumption the trace wasn't offset, and it fits the other observations.

author: IanB
author_rank: Super Contributor
timestamp: January 26, 2012, 03:41:47 pm
content: Quote from: Rufus on January 26, 2012, 02:30:30 pmRight. My comment was addressed to Steve, that the problem is evident from a close examination of the original circuit diagram. You need an upward push (negative voltage due to inverting input) to ramp up, and a downward push (positive voltage) to ramp down. Zero volts is no push at all, so the output won't ramp in either direction. The input square wave must therefore cycle above and below zero (dotted line) in order to produce the desired output.

author: JorgeCarbajal
author_rank: Contributor
timestamp: January 26, 2012, 04:54:00 pm
content: Quote from: IanB on January 26, 2012, 03:41:47 pmi think the correct way to see it is as a square wave input with offset, as its on inverting input and dc gain of -10 as i said and the opamp is clipped to the -9 sourcethe circuit should work for that signal, just make R2=R1 and recalculate the cap if needed

author: IanB
author_rank: Super Contributor
timestamp: January 26, 2012, 06:38:52 pm
content: Quote from: JorgeCarbajal on January 26, 2012, 04:54:00 pmI don't know. The integration function is G Int(V, dt) where G is the gain applied to the integral and V is the constant input voltage. The result of this integration is GVt (+ constant). If V is zero, then the GVt term will be zero and the output of the integrator will be a constant voltage, neither ramping up nor down.How will you cause the integration circuit to have a changing output when the input voltage is zero? It seems you would need to apply some compensating offset on the input and I don't see where your suggested modification does that.

author: siliconmix
author_rank: Frequent Contributor
timestamp: January 26, 2012, 06:52:49 pm
content: the schematic is from forest m mimms 111 opamp book i beleive.

author: siliconmix
author_rank: Frequent Contributor
timestamp: January 26, 2012, 06:56:58 pm
content: did you use a buffer ?

author: JorgeCarbajal
author_rank: Contributor
timestamp: January 26, 2012, 07:59:30 pm
content: Quote from: IanB on January 26, 2012, 06:38:52 pmwell, first the output can change at no input, capacitor discharging but isnt the case, what if theres a little input offset(opamp), that causes the cap to charge and thats why it gets clipped after some time.try it, simulated if u want but my suggestion fixes that clipping, just the signal is always below 0 V

author: w2aew
author_rank: Super Contributor
timestamp: January 27, 2012, 02:50:07 pm
content: Silly question - you mentioned you are using two 9V batteries in series to create +/-9V. Did you connect the common connection between the batteries to ground in your circuit?

author: SteveUK
author_rank: Contributor
timestamp: January 28, 2012, 06:37:59 am
content: QuoteYes, that was it. I'd tried a few other integrator circuits without luck, and had been eliminating DC with a capacitor, but when I used the Forest M Mims circuit, I forgot. Although, don't have 1uF, so I'm using 0.47uF.The square wave gets a bit distorted going through the capacitor. The output from the integrator looks ok though, although Higher audio frequencies get quite badly attenuated. This is a problem since the next stage is to use a comparator to turn the triangle/sawtooth into an adjustable duty cycle square wave.This circuit is going to look like an inverting amplifier at low frequencies, right? So with the values in the circuit, the low frequency gain is 10. I don't really want low frequencies being boosted at all, so I suppose I can change R2 to 4.7k.Thinking about it though, my plan seems poor. Since we get the triangle wave from the fact that the voltage rises on the capacitor as it charges up (although it looks much more linear than the normal charging of a capacitor), so for higher frequency square waves, there is less time for this charging to take place, and therefore a lower voltage is reached, resulting in a triangle wave with lower amplitude. Is my reasoning sound there?

author: SteveUK
author_rank: Contributor
timestamp: January 28, 2012, 06:48:33 am
content: QuoteThinking about that statement, I suppose it only looks linear as long as the capacitor doesn't charge up to anywhere near the voltage of the signal being supplied to it.

author: amspire
author_rank: Super Contributor
timestamp: January 28, 2012, 07:07:28 am
content: With a constant squarewave voltage input, the output of an integrator is proportional to the period of the waveform.So double the frequency and halve the integrator output.To get the variable period, the easier way is to use a sinewave frequency generator, as it will have a constant output amplitude for all frequencies. Here is a typical voltage controlled Sinewave oscillator. This is taken from the LM324 data sheet, but it would probably work better with a rail-to-rail output opamp for the second opamp (or a comparitor is even better) as the output balance and level is affected by the saturation voltage of the second opamp.+VCis the input voltage to control the frequency. It can vary from 0V to almost double the positive supply voltage for the maximum frequency.The output voltage is proportional to the positive supply rail voltage, so a second comparator comparing the triangular wave to a potentiometer from 0V to the positive rail will give a stable adjustment of duty cycle across the whole frequency range.You should find exactly the same circuit in your LM358 data sheet.Richard

author: IanB
author_rank: Super Contributor
timestamp: January 28, 2012, 07:47:08 am
content: Quote from: SteveUK on January 28, 2012, 06:37:59 amIt's more linear in this case because it is not the normal charging of a capacitor. The op amp in the feedback loop is adjusting the output to eliminate the voltage difference on the input. As a result of the active feedback there is a constant current being fed into the capacitor and a constant rate of change of voltage at the capacitor terminals.If you had a perfect square wave going in you would in theory get a perfectly straight edged sawtooth coming out.(In mathematical terms the equation of a capacitor is a differential equation:I = C dV/dtBy clever use of the op amp we can use this to turn the capacitor into an integrator, by observing that the voltage on a capacitor comes from integrating the current passing through it. We essentially get:V = (1/C) x (Integral of) I dtOf course, as you observe, the circuit can't integrate forever. Once the voltage on the capacitor reaches one of the voltage rails the whole thing will come grinding to a halt.)