Online Twin T calculator with variable pots and sweep graphs?

Started by cspar, January 14, 2023, 04:17:24 PM

Previous topic - Next topic

cspar

Is there such a thing as an online Twin T calculator that has variable pots and sweep graphs like the Duncan TSC?

All that I've come across is calculators for fixed filters with no sweep.

Rob Strand

Can I suggest using LTSpice.   For simple circuits the learning curve isn't too steep.   Once you get started you can use this program for just about anything!    You might fumble a bit getting started.

- Enter the circuit
- Set up a .step for the part you want to adjust
- Do an AC analysis
- Run the simulation

It will produce plots with the part being adjusted.

https://www.analog.com/en/technical-articles/ltspice-ac-analysis-using-the-step-command.html

When you start I only recommend one .step command.

LTspice doesn't come with a pot built in.

For a pot wired with two terminals you can just use a resistor.   Stepping the resistor value makes the resistance adjustable.



For three terminal pots here's the recipe:

For a three wire pot you can download a library part.   The pot position is set with a parameter which varies from 0 (counter clockwise) to 1 (clockwise).  Something has to tell LTSpice the position of the pot.

You can also just build a pot out of two resistors connected at the wiper point:
Resistor 1, for pot terminals 1 (ccw) and 2 (wiper) and Resistor 2 for pot terminals 2 (wiper) and 3 (cw).

When you adjust the pot in LTSpice you want both Resistor 1 and Resistor 2 to vary at the same time but in a way that makes the sum of Resistor 1  Resistor 2 equal to the pot value.

For example a 100k pot.

Position Resistor 1     Resistor  2
0            0k             100k
0.3         30k             70k
0.5         50k             50k
0.7         70k             30k
1.0         100k            0k

The way you set this up is with a variable x which sets the position of the pot (no different to a knob with settings 1 to 10, LTSpice will do weird things at 11).

.param  x  0.5
.step param x LIST 0.0001 0.3 0.5 0.7 0.9999

For the value of resistor 1 you enter {100k*x}
For the value of resistor 2 you enter {100k*(1-x)}

If you have more than one pot you set up a parameter say y for the position of the second pot.

Use .step with x to vary the first pot and use .step y to vary the second.   (To start don't have two steps varying both x and y.)

.param value is the default position of pot.  So if you step x the y-pot will be set to the position according to .param y 0.5.  Similarly if you step y the x-pot will be set to the position according to .param x 0.5

Lastly LTSPICE doesn't like zero value resistors that's why the .step uses 0.0001 and 0.9999 for the ends.   There's many way to do this.
Send:     . .- .-. - .... / - --- / --. --- .-. -
According to the water analogy of electricity, transistor leakage is caused by holes.

ElectricDruid

+1 agree that LTSpice is the tool for this job.

Unfortunately it's got a UI from the dark ages and is one of the most counter-intuitive bits of software to ever grace my harddrive, but despite that I actually love it and use it a lot. The saving grace is that (since it's so "quirky") lots of other people have already had whatever problem you find yourself having with it, and answers are generally pretty easy to search for and find. The people here are helpful with sharing what they know about it too. If you think you'll keep having questions like this, it's a great tool to learn.

HTH,
Tom

FSFX

This is a getting started tutorial for LTSpice.

https://www.analog.com/en/education/education-library/videos/video-series/ltspice-getting-started-tutorial.html 

There are many others available on YouTube and written tutorials that explain how to do the many thing that LTSpice can do.
As LTSpice is used extensively by many people, they have posted 'how to' tutorials on the Internet.
The easiest way to find what you want and how to do it is to Google for terms like 'ltspice fft', ltspice potentiometer', ltspice models', etc., etc.

I am quite sure that there are many people on this forum who use LTSpice on a regular basis and who have lots of experience using it.
Many would be willing to help others learn how to use it and share models and schematics of common pedal circuits to analyse in LTSpice.
I have personally done interactive video tutorials with some wishing to learn how to use it for circuit analysis and developing their designs.
I have also shared many additional models of things like JFETs and germanium transistors and diodes that are missing from the standard LTSpice libraries.

If anyone wants help with LTSpice then please ask.

Here is a very good introduction to LTSpice from MIT.

https://web.mit.edu/6.101/www/s2020/handouts/LTSpiceIntro.pdf

A word of caution: Most of the tutorials relate to the Windows version of LTSpice.
Although LTSpice is available to run on the Apple Mac, its user interface is very different as are the file locations.

ElectricDruid

Quote from: FSFX on January 15, 2023, 05:01:03 AM
A word of caution: Most of the tutorials relate to the Windows version of LTSpice.
Although LTSpice is available to run on the Apple Mac, its user interface is very different as are the file locations.
This is a good point. I'm running it on a Mac. The interface stuff is not so bad, but trying to install models or understand what other people are doing when they describe their process of getting new stuff into it is frequently a nightmare.

cspar

I've got LTspice installed on linux through wine and made it over the little hurdles of part values and rotating parts to build a twin t schematic.

No sweep yet, I'm looking into the process a bit more first. Basically the stuff you explained Rob but seeing it a bit more firsthand.

It's funny how a little thing like this got me to finally actually start learning how to use LTspice . I definitely need to watch a few tutorials and read up on it.

GibsonGM

You can find working pot models out there, too....we have a simulation section of the forum, and there are some good 'helps' in there...maybe we could add to it a little more?   Some basic tut's like adding models for pots and new BJTs and so on might be useful, stickied.   I got my 'extras' way back from the Yahoo group, don't know if that's even an option anymore.  Tho the info Is out there if you search.

After you get past LT's clunky GUI, it's really invaluable!  Don't forget youtube vids.
  • SUPPORTER
MXR Dist +, TS9/808, Easyvibe, Big Muff Pi, Blues Breaker, Guv'nor.  MOSFace, MOS Boost,  BJT boosts - LPB-2, buffers, Phuncgnosis, FF, Orange Sunshine & others, Bazz Fuss, Tonemender, Little Gem, Orange Squeezer, Ruby Tuby, filters, octaves, trems...

FSFX

Quote from: GibsonGM on January 15, 2023, 02:28:20 PM
...we have a simulation section of the forum, and there are some good 'helps' in there..
Can you point me to it please. I can't see any simulation section.

Thanks

GibsonGM

Here ya go, FS...  https://www.diystompboxes.com/smfforum/index.php?board=41.0

Once in a while there's a good discussion in there on how to do specific things. Would be great if there was an "LT Sticky" to get ppl started or to remind us how to do things like  adding models to the BJT/other lists and so on. 
  • SUPPORTER
MXR Dist +, TS9/808, Easyvibe, Big Muff Pi, Blues Breaker, Guv'nor.  MOSFace, MOS Boost,  BJT boosts - LPB-2, buffers, Phuncgnosis, FF, Orange Sunshine & others, Bazz Fuss, Tonemender, Little Gem, Orange Squeezer, Ruby Tuby, filters, octaves, trems...

FSFX

Quote from: GibsonGM on January 15, 2023, 02:47:32 PM
Here ya go, FS..
Thanks,

I was looking for it as a top level section, I didn't expect to find it under 'Building your own Stompbox'.

GibsonGM

There are a few, and they can pass you right by, I know!  :)   
  • SUPPORTER
MXR Dist +, TS9/808, Easyvibe, Big Muff Pi, Blues Breaker, Guv'nor.  MOSFace, MOS Boost,  BJT boosts - LPB-2, buffers, Phuncgnosis, FF, Orange Sunshine & others, Bazz Fuss, Tonemender, Little Gem, Orange Squeezer, Ruby Tuby, filters, octaves, trems...

Rob Strand

QuoteI've got LTspice installed on linux through wine and made it over the little hurdles of part values and rotating parts to build a twin t schematic.
I use it under Windows and Linux/Wine and it virtually identical.

QuoteNo sweep yet, I'm looking into the process a bit more first. Basically the stuff you explained Rob but seeing it a bit more firsthand.

For the input source,
The easy way is:
- click the ".op" button
- type .ac into the box   ; make sure the "Spice Directive" radio button is selected
- place it somewhere on the schematic
- right click on the .ac text on the schematic
   then it will pop-up with a box will all the parameters for the ac analysis
- fill out the box

In the older versions of LTSpice I don't remember the right click thing working, so you had to
type in all the .ac parameters manually and in the right order - which you can still do.

One thing you will need is an input source:
- place a "voltage" part and connect it to the circuit input.
- right click on the source
- click on the advanced button
- enter a value of 1 for the "small signal AC" value.  That means 1V in.

QuoteIt's funny how a little thing like this got me to finally actually start learning how to use LTspice . I definitely need to watch a few tutorials and read up on it.
It's always the way.  Once you get started you will go nuts if you are interested in this stuff.
If you keep you old files as examples you can apply it to other problems very quickly.
Send:     . .- .-. - .... / - --- / --. --- .-. -
According to the water analogy of electricity, transistor leakage is caused by holes.

GibsonGM

Before I understood spice analysis well (or at least 'somewhat' ha ha) I'd just click "Simulate > Run" and the various options come up in tabs.  You can put in the basic stuff for transient analysis such as "5s" duration, click 'start at zero V' box and 'skip initial operating point', and off you go.

Or do an AC analysis, pick start/end freqs and number of steps, and the scale (decade, octave...)   

Noobs, please find a Youtube vid on getting started, it will save you a lot of time and frustration!   But like Rob said, you place the directive on the schematic, and save it, so it's there next time ready to go.  Over a short time, how you set up analyses becomes 2nd nature as you learn exactly what these things mean.

Once you set up and save an inverting and non-inverting opamp, and BJT & FET gain stages and so on, you'll have the building blocks to use to make most things we play with here.
  • SUPPORTER
MXR Dist +, TS9/808, Easyvibe, Big Muff Pi, Blues Breaker, Guv'nor.  MOSFace, MOS Boost,  BJT boosts - LPB-2, buffers, Phuncgnosis, FF, Orange Sunshine & others, Bazz Fuss, Tonemender, Little Gem, Orange Squeezer, Ruby Tuby, filters, octaves, trems...

Rob Strand

QuoteBefore I understood spice analysis well (or at least 'somewhat' ha ha) I'd just click "Simulate > Run" and the various options come up in tabs.  You can put in the basic stuff for transient analysis such as "5s" duration, click 'start at zero V' box and 'skip initial operating point', and off you go.

Or do an AC analysis, pick start/end freqs and number of steps, and the scale (decade, octave...)
Actually, there is something like that.   (I don't use it but I've seen it when do something stupid like click the Run button instead of Save  :icon_mrgreen:)
Send:     . .- .-. - .... / - --- / --. --- .-. -
According to the water analogy of electricity, transistor leakage is caused by holes.

GibsonGM

The nice part is that once you run from the menu, the spice command drops into the schematic, for later use or whatever.  So the user gets to see what the command really looks like.  This seemed to help me understand the command structure better, before there were all these vids about it.
  • SUPPORTER
MXR Dist +, TS9/808, Easyvibe, Big Muff Pi, Blues Breaker, Guv'nor.  MOSFace, MOS Boost,  BJT boosts - LPB-2, buffers, Phuncgnosis, FF, Orange Sunshine & others, Bazz Fuss, Tonemender, Little Gem, Orange Squeezer, Ruby Tuby, filters, octaves, trems...

ElectricDruid

Quote from: Rob Strand on January 15, 2023, 03:35:41 PM
- enter a value of 1 for the "small signal AC" value.  That means 1V in.
It took me several years to discover the importance of this detail.

If you start with a 1V input, the output is in decibels. This is useful since you can see the gain/attenuation straight away. If you start with something else, you have to correct for it later. Since for an AC analysis the level isn't important (it might be for a transient analysis where clipping and similar things come into play) it makes sense to always use a 1V AC level, unless you have some good and specific reason not to.

T.

PRR

In SPICE, "1V" on a Sine is 1V peak. Easy to overlook if you grew up in audio, where "1V" unstated is average/RMS.

> it's got a UI from the dark ages

My copy of PSpice is copyright 1997-1999 and is miles ahead of LTspice for usability. (Not just because I have used PS since it came on a floppy and graphed with -+-*--- characters.) But it can be hard to find that version and its little bits and make it work in newer machines. Just saying that LTspice doesn't have to be so "special".

> <i>For three terminal pots here's the recipe:</i>

There's a good tutorial in Kuehnel's System Design. The one tip is not worth the price of the book, true. There's other good stuff about LTspice that I never found blind-poking LT's undiscoverable interface. (ISBN 978-0999674239 is $38-48.)

From my own notes about pot crashing on 1/0: SPICE (generally) does not have infinite resolution, and has "magic numbers" to prevent it iterating to infinity (or micro-infinity). RELTOL is one but for some reason I used GMIN: 

"...the cheat to avoid the /0 error for A 0 or 1 is:
R1 top wip {((1-A)*r)+gmin}
R2 wip bot {(A*R)+gmin}
(gmin is a very small number, default 1e-12.)
Alternatively for "real" pots it would be realistic MIN/MAX to 0.99 or 0.01, since pot end effect runs about 1%. But for "ideal" potwork this leads to mystery discrepancy ("why is it 0.99 instead of 1.0?"). Using gmin puts the error in the numeric noise. ("0" makes wiper -300dB, which is quiet enough.)

  • SUPPORTER

Rob Strand

QuoteMy copy of PSpice is copyright 1997-1999 and is miles ahead of LTspice for usability. (Not just because I have used PS since it came on a floppy and graphed with -+-*--- characters.) But it can be hard to find that version and its little bits and make it work in newer machines. Just saying that LTspice doesn't have to be so "special".
After using all incantations of PSpice over 30 years I made a point of using LTspice alone for about 2 years.   For 95% of work, and close to 99% of common problems, I no longer feel a difference.

For me at least, redefining all the function keys to Ctrl + <letter> made an enormous improvement to the usability  (eg. Ctrl + G = get part, Ctrl + R = rotate, Ctrl+E = Flip (since Ctrl+F used) Ctrl+V = move, Ctrl+B Drag, ... yada yada yada ... and the normal things like Ctrl+C, X, Y).   Since doing that I have no frustration with the user interface and I can do things with equal fluency to PSpice.

The people that did the MicroSim PSpice were really switched on.  The design of the package is extremely comprehensive and professional.  There's a whole lot of stuff under the hood which I would say 99% of users don't even know exist, and never use.  Some of that stuff isn't so refined in LTSpice but on the whole you can still do similar things.

The things that bug me most about LTSpice:
- Monte Carlo analysis and Worst Case Analysis.   That was really nice in PSpice but almost has to be done manually in LTSpice.
- The Laplace transforms in PSpice were quite quick and efficient however in LTspice things grind to a real halt.
   In LTspice I rarely use Laplace, I use filter circuits (LCR, or RC, Sallen and Key)
- The waveform math has a few things missing - you can work around them but for some problems it's annoying.
   Certain manipulations individual results in conjunction with the .step function aren't possible.

Enormous pluses for LTspice:
- Built-in Window functions on the FFT's.  On PSpice I had functions for those, sometimes I used a multiplier block with the Window function implemented as a time domain waveform - so I the FFT came out directly.  As any DSP person knows, FFT without windowing is asking for trouble.
- Handles wavefiles as input and outputs. (Pspice is very old and only supports raw row/column input and output files.)

Quote"...the cheat to avoid the /0 error for A 0 or 1 is:
R1 top wip {((1-A)*r)+gmin}
R2 wip bot {(A*R)+gmin}
I made a point of not putting down that method, it opens up a whole can of worms.

I know there's posts on both of these topics in the forum archives.   After making LTspice "work for me" so to speak my criticisms of LTSpice are definitely fading, by the same token I'm not going to bag out Pspice because it's a great program.


Oh...  the free version of PSpice was limited to 50 parts on the schematic, maybe 20 transistors (that includes transistors inside of models).    There are quite a number of specific/obscure limitations.
Send:     . .- .-. - .... / - --- / --. --- .-. -
According to the water analogy of electricity, transistor leakage is caused by holes.

Rob Strand

Quote"...the cheat to avoid the /0 error for A 0 or 1 is:
R1 top wip {((1-A)*r)+gmin}
R2 wip bot {(A*R)+gmin}
(gmin is a very small number, default 1e-12.)

Here's a post which shows the minimum resistance issue in SPICE:

https://www.diystompboxes.com/smfforum/index.php?topic=130052.0
Send:     . .- .-. - .... / - --- / --. --- .-. -
According to the water analogy of electricity, transistor leakage is caused by holes.