Author Topic: MFB Filter Schematic Generator for KiCAD  (Read 1217 times)

0 Members and 1 Guest are viewing this topic.

Online bson

  • Supporter
  • ****
  • Posts: 1317
  • Country: us
MFB Filter Schematic Generator for KiCAD
« on: June 14, 2018, 04:36:23 pm »
I spent tonight putting together a Multiple-Feedback filter generator.  Currently it's limited to low-pass (Rauch) filters, and only knows how to cascade Bessel and Butterworth.  It can also output single stages with a specific Q.  The output is in the form of a KiCAD .SCH file that can be appended (see the readme on github for more details).

Still has some bugs and needs more work... but I thought some of you folks might either find it useful, like to add to it, or just have ideas. :)

It's GPL 3.

https://github.com/bson/filtergen
 

Offline Gibson486

  • Regular Contributor
  • *
  • Posts: 193
  • Country: us
Re: MFB Filter Schematic Generator for KiCAD
« Reply #1 on: June 28, 2018, 11:46:35 pm »
 :-+

Will keep this in my tool bag!
 

Offline awallin

  • Frequent Contributor
  • **
  • Posts: 461
Re: MFB Filter Schematic Generator for KiCAD
« Reply #2 on: June 29, 2018, 01:56:28 am »
does it find standard E-series resistor and capacitor values also? some kind of error-analysis is also nice where you get a range of transfer functions plotted depending on the tolerances of the components you choose.
 

Online bson

  • Supporter
  • ****
  • Posts: 1317
  • Country: us
Re: MFB Filter Schematic Generator for KiCAD
« Reply #3 on: June 30, 2018, 12:50:59 am »
It doesn't; I'm planning do that using ngspice simulation as it's added to KiCAD, by outputting a specific simulation project that has everything needed for a proper Monte Carlo analysis.  This should help select actual component values (and tolerances!).  The project will also include a near-ideal op amp model to sanity check against since there so many scary models out there that yield insanely bad results.
 

Online bson

  • Supporter
  • ****
  • Posts: 1317
  • Country: us
Re: MFB Filter Schematic Generator for KiCAD
« Reply #4 on: June 30, 2018, 11:48:31 pm »
I added basic output to do ngspice simulations from within KiCAD v5.  Turns out it can all be embedded in the schematic.  It doesn't do MC yet, and doing so isn't hard in ngspice (there's an excellent example on page 430 of the ngspice manual; basically use the scripting frontend command 'alter' to change component values and rerun the analysis, outputting plot data each time through, repeat a statistically significant number of times) - but I need to make sure it works correctly from KiCAD.  This is pretty neat, because the schematic can be left as is and the nominal E values with a gaussian tolerance distribution are then repeatedly set inside the loop.  The original baseline can then perhaps be plotted in a different color or stroke to make it stand out... need to experiment with this.

I also made it output Bessel filters with the smallest Q first (doh) and front load all gain in the first stage for any cascade.  There's no reason not to for simple, uniform filters like this.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf