Author Topic: Bandpass filter - ltspice vs real life  (Read 2113 times)

0 Members and 1 Guest are viewing this topic.

Offline injbTopic starter

  • Regular Contributor
  • *
  • Posts: 64
Bandpass filter - ltspice vs real life
« on: April 20, 2020, 01:51:40 am »
I'm learning LTSpice, and I am confused about why this simulation gives different results from real life.

The circuit is an opamp bandpass filter for an engine knock sensor. I believe that knocking on this engine would be in the 5.7Khz range. I hooked up a function generator to the input and swept the frequency from a few Khz up to around 12Khz, and what I found was that at around 5.5 the response suddenly goes up quickly, and keeps increasing until around 7Khz, and then drops off very quickly above that.

So, it seems to be centered around 5.5 - 7 Khz, which is a tad higher than I expected, but close enough.

But the spice simulation of the circuit shows that the filter should be most sensitive around 4Khz. So I'm trying to understand what other factors affect this that I haven't taken into account. The capacitors are marked only as "0.01", but I think it has to be uF because otherwise I'd be off by a factor of 1000 which could not work. The resistor values, I measured.


I'm attaching screenshots of both decibel and linear scales (I find the linear one clearer)

Any ideas where I've gone wrong?

EDIT: changed the screenshots to correct a mistake (which didn't make any difference to where the filter is centered)


« Last Edit: April 20, 2020, 01:57:22 am by injb »
 

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 22436
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: Bandpass filter - ltspice vs real life
« Reply #1 on: April 20, 2020, 03:06:09 am »
Huh, what type of "0.01" capacitors?

What supply?  Also, what supply and GBW is the amp in the simulation?  Don't tell me you used the three-terminal ideal amp! :palm:

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 

Offline Mechatrommer

  • Super Contributor
  • ***
  • Posts: 11714
  • Country: my
  • reassessing directives...
Re: Bandpass filter - ltspice vs real life
« Reply #2 on: April 20, 2020, 03:08:46 am »
every wire is an inductance, no perfect capacitor without ESR, and no exact value of 0.01uF and 9K ohm in real life.
Nature: Evolution and the Illusion of Randomness (Stephen L. Talbott): Its now indisputable that... organisms “expertise” contextualizes its genome, and its nonsense to say that these powers are under the control of the genome being contextualized - Barbara McClintock
 

Offline injbTopic starter

  • Regular Contributor
  • *
  • Posts: 64
Re: Bandpass filter - ltspice vs real life
« Reply #3 on: April 20, 2020, 03:32:47 am »
Huh, what type of "0.01" capacitors?

What supply?  Also, what supply and GBW is the amp in the simulation?  Don't tell me you used the three-terminal ideal amp! :palm:

Tim

every wire is an inductance, no perfect capacitor without ESR, and no exact value of 0.01uF and 9K ohm in real life.

Yes I did use the 3-pin amp - is that a no-no? The actual one wasn't in the list (LM2902).

The caps are marked as "0.01 100-WIMA VN" and "5%". The resistor - I checked using a color code calculator (https://www.allaboutcircuits.com/tools/resistor-color-code-calculator/). It's white-black-white-brown-brown which comes out at 9.09k. I also measured it and got approximately that value.
 

Offline JimRemington

  • Regular Contributor
  • *
  • Posts: 210
  • Country: us
Re: Bandpass filter - ltspice vs real life
« Reply #4 on: April 21, 2020, 12:43:26 am »
The LM2902 is not even audio quality; performance starts to degrade abruptly at 5 kHz.
« Last Edit: April 21, 2020, 01:02:41 am by JimRemington »
 

Offline SilverSolder

  • Super Contributor
  • ***
  • Posts: 6126
  • Country: 00
Re: Bandpass filter - ltspice vs real life
« Reply #5 on: April 21, 2020, 01:10:49 am »
Code: [Select]
* LM2902 Spice Model
*
* WARNING : please consider following remarks before usage
*
* 1) All models are a tradeoff between accuracy and complexity (ie. simulation time).
*
* 2) Macromodels are not a substitute to breadboarding, they rather confirm the
*    validity of a design approach and help to select surrounding component values.
*
* 3) A macromodel emulates the NOMINAL performance of a TYPICAL device within
*    SPECIFIED OPERATING CONDITIONS (ie. temperature, supply voltage, etc.).
*    Thus the macromodel is often not as exhaustive as the datasheet, its goal
*    is to illustrate the main parameters of the product.
*
* 4) Data issued from macromodels used outside of its specified conditions
*    (Vcc, Temperature, etc) or even worse: outside of the device operating
*    conditions (Vcc, Vicm, etc) are not reliable in any way.
*
*
** Standard Linear Ics Macromodels, 1993.
** CONNECTIONS :
* 1 INVERTING INPUT
* 2 NON-INVERTING INPUT
* 3 OUTPUT
* 4 POSITIVE POWER SUPPLY
* 5 NEGATIVE POWER SUPPLY
.SUBCKT LM2902 1 2 3 4 5
***************************
.MODEL MDTH D IS=1E-8 KF=3.104131E-15 CJO=10F
* INPUT STAGE
CIP 2 5 1.000000E-12
CIN 1 5 1.000000E-12
EIP 10 5 2 5 1
EIN 16 5 1 5 1
RIP 10 11 2.600000E+01
RIN 15 16 2.600000E+01
RIS 11 15 2.003862E+02
DIP 11 12 MDTH 400E-12
DIN 15 14 MDTH 400E-12
VOFP 12 13 DC 0
VOFN 13 14 DC 0
IPOL 13 5 1.000000E-05
CPS 11 15 3.783376E-09
DINN 17 13 MDTH 400E-12
VIN 17 5 0.000000e+00
DINR 15 18 MDTH 400E-12
VIP 4 18 2.000000E+00
FCP 4 5 VOFP 3.400000E+01
FCN 5 4 VOFN 3.400000E+01
FIBP 2 5 VOFN 2.000000E-03
FIBN 5 1 VOFP 2.000000E-03
* AMPLIFYING STAGE
FIP 5 19 VOFP 3.600000E+02
FIN 5 19 VOFN 3.600000E+02
RG1 19 5 3.652997E+06
RG2 19 4 3.652997E+06
CC 19 5 6.000000E-09
DOPM 19 22 MDTH 400E-12
DONM 21 19 MDTH 400E-12
HOPM 22 28 VOUT 7.500000E+03
VIPM 28 4 1.500000E+02
HONM 21 27 VOUT 7.500000E+03
VINM 5 27 1.500000E+02
EOUT 26 23 19 5 1
VOUT 23 5 0
ROUT 26 3 20
COUT 3 5 1.000000E-12
DOP 19 25 MDTH 400E-12
VOP 4 25 2.242230E+00
DON 24 19 MDTH 400E-12
VON 24 5 7.922301E-01
.ENDS
« Last Edit: April 21, 2020, 01:13:02 am by SilverSolder »
 
The following users thanked this post: injb

Online Jay_Diddy_B

  • Super Contributor
  • ***
  • Posts: 2766
  • Country: ca
Re: Bandpass filter - ltspice vs real life
« Reply #6 on: April 21, 2020, 01:32:06 am »
Hi,

Using the generic 3 terminal opamp you adjust the parameters including GBW.

Here I have setup the model to step the GBW of the opamp from 100kHz to 10MHz in a logarithmic fashion:




Results



The results show that the circuit is relatively insensitive to the opamp GBW.

This is the expected result. The filter should be defined by the passive components not some parameter of the opamp.

Regards,
Jay_Diddy_B

 
The following users thanked this post: injb

Online Jay_Diddy_B

  • Super Contributor
  • ***
  • Posts: 2766
  • Country: ca
Re: Bandpass filter - ltspice vs real life
« Reply #7 on: April 21, 2020, 01:38:10 am »
Hi,

The LM2902 is very similar to an LM324. It has a 1.3MHz GBW product.

The LT1013 is has similar GBW,but much better offset voltage.

Use the LT1013 in place of the LM2902.

Regards,
Jay_Diddy_B
 

Offline injbTopic starter

  • Regular Contributor
  • *
  • Posts: 64
Re: Bandpass filter - ltspice vs real life
« Reply #8 on: April 21, 2020, 01:41:45 am »
Thanks for the replies. I discovered I made a few mistakes in my schematic - there is actually a resistor between R1 and C1 that goes to the noninverting input, and the noninverting input is biased to 5v. Adding that missing resistor made a big difference, but it was still noticeably off where the actual circuit is, this time much higher. I downloaded an LM2902 spice model from TI and that seems to have fixed it - now it's giving me a very good match to what I see in the real circuit.

To everyone giving advice about the quality of the 2902: thanks, I'll keep that in mind, but I'm not building anything in this case, I'm just trying to understand an existing circuit that uses the 2902. It was designed in the mid 80s.
 

Offline Wimberleytech

  • Super Contributor
  • ***
  • Posts: 1134
  • Country: us
Re: Bandpass filter - ltspice vs real life
« Reply #9 on: April 21, 2020, 01:51:28 am »
Hi,

Using the generic 3 terminal opamp you adjust the parameters including GBW.

Here I have setup the model to step the GBW of the opamp from 100kHz to 10MHz in a logarithmic fashion:


Thanks for sharing...until now, I did not know about the "step" feature.  Cool!
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf