# Mean value of square signal between 0 and 15 V in LTspice

I would like to get a signal that is the mean value of a square signal going from 0 to 15 V using an integrator op-amp. Here is what I'm getting so far (the op-amp I have put is the UniversalOpAmp2):

For now I can only get an output voltage close to zero, here is a zoom showing that it oscillates very close to zero:

These things are really new to me so I'm probably missing some crucial points, maybe you could enlighten me?

maybe you could enlighten me?

The integrator circuit you have used also inverts the output. This means that the output would need to be negative for a positive input. This cannot happen with your circuit because the op-amp's negative supply is 0 volts.

I would like to get a signal that is the mean value of a square signal going from 0V to 15V using an integrator op amp

An integrator will not produce a mean value. If you want a mean value use a low-pass filter.

it oscillates very close to zero

That is just the input signal passing through the 10 k resistor and integrator capacitor forming a potential divider with the op-amps output impedance hence, you see a waveform that is very close to 0 volts and small in amplitude.

• This explains why I had negative value when I powered it with -15 and 15V :) And so there would be a way to get something close to 7.5V in my case with an integrator ? Feb 20 at 17:57
• An integrator integrates, a low pass filter produces a mean value with some ripple. Choose the low pass filter cut-off frequency to reduce ripple to an acceptable level. Use a simple low pass filter using the 10 k resistor and 100 uF capacitor if you wish. Feb 20 at 17:59
• @c.leblanc If you want to turn your current structure into a low pass, simply add a resistor in parallel to your capacitor and play around with the values to get what you want. However, it will still invert your signal. If you want to not invert, you can do what Andy is suggesting and do something like this: electronics-tutorials.ws/wp-content/uploads/2013/08/fil20a.gif Feb 20 at 18:07
• An integrator integrates; it doesn't average anything. Your advisor is incorrect. A low pass filter averages (as I previously advised). @c.leblanc Feb 20 at 18:09
• @c.leblanc Your integrator will keep adding areas "under the curve" but nothing will "reset" it to tell it start over again at the beginning of each cycle of the square wave. So it will keep adding and adding and adding until it saturates at the rail of the opamp and get stuck there. Feb 20 at 18:13