OpAMPs simulation

Hi everybody,
I have to simulate a circuit for one-channel EEG signal conditioning. Basically I have to use a band pass filter, a notch filter and an instrumentation amplifier.
I was able to simulate a bandpass filter response, and I have used two Sallen Key filters in series (the first high pass and the second low pass). I expect that outside the bandpass (set to 0.1-70 Hz) the slope of the V(bandpass) magnitude is -40dB/dec, instead is like 5dB/dec. Can you understand why?
Here there is my schematic:


This is my SPICE Netlist:
.title KiCad schematic
.include “/Users/giuliacrocioni/Desktop/Advanced_circuit_project/EEG/LF356 2.MOD”
XU2 Net-C3-Pad1 /bandpass NC_01 NC_02 /bandpass LF356/NS
C3 Net-C3-Pad1 0 1n
R5 Net-C3-Pad1 Net-C4-Pad2 230k
R4 Net-C4-Pad2 /highpass 230k
C4 /bandpass Net-C4-Pad2 1n
Vin /Vin1 0 dc 0 ac 100m
C1 Net-C1-Pad1 /Vin1 159u
R2 /highpass Net-C1-Pad1 10k
R1 0 Net-C2-Pad1 10k
C2 Net-C2-Pad1 Net-C1-Pad1 159u
XU3 Net-C2-Pad1 /highpass NC_03 NC_04 /highpass LF356/NS
.save @c3[i]
.save @r5[i]
.save @r4[i]
.save @c4[i]
.save @vin[i]
.save @c1[i]
.save @r2[i]
.save @r1[i]
.save @c2[i]
.save V(/Vin1)
.save V(/bandpass)
.save V(/highpass)
.save V(0)
.save V(GND)
.save V(Net-C1-Pad1)
.save V(Net-C2-Pad1)
.save V(Net-C3-Pad1)
.save V(Net-C4-Pad2)
.save V(Net-U2-Pad1)
.save V(Net-U2-Pad4)
.save V(Net-U2-Pad5)
.save V(Net-U2-Pad7)
.save V(Net-U2-Pad8)
.save V(Net-U3-Pad1)
.save V(Net-U3-Pad4)
.save V(Net-U3-Pad5)
.save V(Net-U3-Pad7)
.save V(Net-U3-Pad8)
.ac dec 10 0.001 1000k
.end

And this is the obtained plot:

The weird thing is that if I put a resistor between the negative input of the first OpAmp and ground, the slope of the first part of the graph increases and I obtain this plot:


This does not make sense to me!

It may help if you apply power to the power pins of your opamps.

Also:
Where do your opamps come from?
Do they have the right spice model attached?
It is very common for opamps, that the pin numbers on your schematic do not coincide with the pins of the spice simulation, you will have to look into that too.

1 Like

I tried powering the Opamps with 5 and -5 V, but it wasn’t working at all. Maybe because I was using the same power supplies for both the Opamps?
Anyway, I also tried using 4 different power supplies, 2 of 5 V and 2 of -5 V. I obtained the same plot. I took the model from here http://www.ti.com/lit/zip/snom255 (from this tutorial, example 4 http://ngspice.sourceforge.net/ngspice-eeschema.html). I rearranged the pins in the right order using an option in Kicad which allows to put them by hand.
Also, if I try a simple opamp Circuit with only resistances trying to have a gain of 10, I obtain something with no sense (like 4000 gain). So I think that there is something that I’m missing about the Opamps.

Using a different simulator, I get this result:

The slopes on the filter skirts appear to be correct.

(I used the TL071 opamp instead of the LF356 because its model was in my default library on this machine, and the LF356 was not. There are other reasons for preferring the TL071, and an Astute Student may ask about them.)

I would say your circuit design is usable. Your problem is likely to be in your use of the simulation tool, or possibly in your model for the LF356.

Are you a student? (Either formally enrolled in a course, or an autodidact?) This design is what I would expect from a slightly above-average student in an introductory Devices course, or Circuits sequence.

Dale
Sallen_Key_BPF1.asc (5.0 KB)

There is a Sallen-Key filter coming with KiCad install, in Windows at C:\Program Files\KiCad\share\kicad\demos\simulation\sallen_key

Thank you so much @dchisholm!
At the end I used LTSpice and I had no problems at all (using the same Spice models). I have no idea of the reason why in Kicad it wasn’t working.

I have a Mac and I didn’t find the demos\simulation folder.

A bandpass filter with two Sallen-Key filters is now part of the eeschema-ngspice tutorial at http://ngspice.sourceforge.net/ngspice-eeschema.html#multi