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

0 Members and 1 Guest are viewing this topic.

Offline bsonTopic starter

  • Supporter
  • ****
  • Posts: 2269
  • Country: us
MFB Filter Schematic Generator for KiCAD
« on: June 14, 2018, 06:36:23 am »
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

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

Will keep this in my tool bag!
 

Offline awallin

  • Frequent Contributor
  • **
  • Posts: 694
Re: MFB Filter Schematic Generator for KiCAD
« Reply #2 on: June 28, 2018, 03:56:28 pm »
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.
 

Offline bsonTopic starter

  • Supporter
  • ****
  • Posts: 2269
  • Country: us
Re: MFB Filter Schematic Generator for KiCAD
« Reply #3 on: June 29, 2018, 02:50:59 pm »
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.
 

Offline bsonTopic starter

  • Supporter
  • ****
  • Posts: 2269
  • Country: us
Re: MFB Filter Schematic Generator for KiCAD
« Reply #4 on: June 30, 2018, 01: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