Linux Circuit Simulator Advice like CircuitLab for Course - Page 1
Forum section: electronics / general

author: edy
author_rank: Super Contributor
timestamp: June 10, 2020, 03:31:38 pm
content: Hi folks,I'm currently working my way through this newbie course:https://www.thegreatcoursesplus.com/understanding-modern-electronicsI'm enjoying it and finally started to get the hang of circuit simulation as part of the course suggests using Circuitlab.com or Docircuits (which appears to be dead now). Circuitlab seems to be fairly easy but it is web-based and also requires a membership after 10 minutes of use. I'm looking for a stand-alone alternative in Linux that I can take with me anywhere, not need an internet connection and has a nice graphical interface and easy for newbies like me to use but also can grow in time as I learn.The main thing I want to do is enter in some of the circuits introduced in the course and measure parameters in the circuit as I simulate, like voltages and currents at certain nodes. Also I would like to do frequency sweeps and see the response (let's say simulating RC filters), create rectifiers, power circuits and various other basic introductory concepts.I found this list here but I notice many require a core package to be installed and a GUI to be installed on top:https://en.wikipedia.org/wiki/List_of_free_electronics_circuit_simulatorsI'm feeling a bit intimidated by some of these packages and thought it would be a good idea to ask someone here who has some experience and can recommend something easy to start with, likeCircuitlab.com. I'm going to take a crack at qucs-spice and hope it is not overwhelming for my learning curve. Thanks for any suggestions.

author: edy
author_rank: Super Contributor
timestamp: June 10, 2020, 07:42:18 pm
content: Ok, I looked up some packages in the Software store of Ubuntu and found qucs-spice had high user ratings and an integrated GUI/simulator option. It was a bit confusing to use at first... the variables wouldn't update on the graphs after I would update the schematic or relabel things. I have managed to do some basic stuff in it but having a lot of trouble learning.I figured out how to make a voltage divider with some resisters and do a DC simulation to a table. I also made a simple circuit (AC source, diode, smoothing cap, etc) and plot the output over time (transient simulation) to get a basic chart showing power output.What I am having trouble with and trying to learn now is a frequency sweep of the AC source so I can see how it attenuates through an RC filter. I want to try some low and high-pass configurations and different values to see what happens. Having it sweep through to give me a frequency response curve would be nice.

author: Weston
author_rank: Regular Contributor
timestamp: June 10, 2020, 08:00:25 pm
content: I usually always try to use FOSS software, but LTSpice is a widely used simulator that is free (as in beer) and runs quite well under Wine. I use it for all my simulation work and so do most other people I know that use circuit simulators.I know that kicad uses ngspice (which is FOSS) but I have no clue what the stand alone interface is like, if it even exists.

author: MarkL
author_rank: Unknown
timestamp: June 10, 2020, 09:51:01 pm
content: Quote from: edy on June 10, 2020, 07:42:18 pmI use plain qucs as opposed to qucs-spice, but I think the setup should be the same.You should be able to drop "ac simulation" onto the schematic and provide the start and stop frequencies. That will override the static frequency setting of your AC source. On the plot tab, select what you want to plot as usual, and optionally you can select log scales for X (frequency), Y left, and/or Y right.Simple example below.You can also have qucs perform frequency sweeps for multiple component values (like the resistor) by adding the "parameter sweep" simulation block to the schematic.

author: tggzzz
author_rank: Super Contributor
timestamp: June 10, 2020, 10:02:00 pm
content: I'll second LTSpice under WINE. A well known simulator with many models and many people to help.

author: edy
author_rank: Super Contributor
timestamp: June 11, 2020, 06:10:50 am
content: Thanks, I tried to duplicate the results from MarkL and figured it out (see my attachments).My curves were all looking different as well until I started using LOG plots:I will give LTSpice a shot as well. I remember installing it a while back on another Linux machine with WINE, and it did work. While CircuitLab is easier to start with, I can see it hitting a limit much sooner than QUCS-Spice or LTSpice. I don't think CircuitLab is as scalable and the fact that it is entirely web-based is annoying.I also can't understand how QUCS-Spice is still at version 0.0.16 and was last updated in 2016?

author: edy
author_rank: Super Contributor
timestamp: June 11, 2020, 06:54:00 am
content: I'm starting to get the hang of this software. Building on the previous schematic, I've linked a low-band and high-band RC filter and produced a crappy but simple band-pass filter and managed to plot the frequency response.I followed another example in the course and built a band-stop filter using the Twin T design.I'm still getting the hang of it but this is definitely going to help me with the relatively simple examples in the course and guidebook for now.

author: RoGeorge
author_rank: Super Contributor
timestamp: June 11, 2020, 10:15:58 am
content: Nice.Also try a parameter instead of a fixed value, then add a "Parametric Sweep" with a few value steps for that parameter.For example, put a parameter name instead of a fixed C value in a filter, and set the Parametric Sweep with a list of 5-10 distinct values. That will run the simulation many times, once for each parameter value, then display a trace for each parameter step.It will add extra fun and help building some intuition about how a filter's response changes with the value of a component.

author: edy
author_rank: Super Contributor
timestamp: June 14, 2020, 10:34:04 pm
content: I've been continuing with the course simulations and encountered some frustrating idiosyncracies in Qucs-SPICE.For example, take this schematic:I put it in exactly like the course instructions and labelled it according to what they labelled it in CircuitLab. I run the simulation and get the following error:So after bashing my head against a wall for a number of minutes, looking over the schematic, restarting Qucs-SPICE, trying to figure out what the heck is going on, I finally figure it out.And it turns out to be one of the dumbest things I've ever encountered. I don't know if this is in the documentation but it drives me crazy.Can anyone figure out why? I'll let you study the above schematic before I give you the answer below.... don't cheat! When you are ready, scroll down and compare the schematic below with the first one above and see if you can spot the difference! [HINT:It has nothing to do with the components or the values or the wiring connections! They are exactly the same! Only one thing has changed... and line #8, the error, has to do with the transistor. Look carefully]

author: MarkL
author_rank: Unknown
timestamp: June 15, 2020, 05:02:01 pm
content: Component names can't start with a number.Also, it's picky about unit names. For example, it only likes "Ohm", and not "ohm" or "Ohms".Unfortunately, the error messages are often not very helpful. If you haven't found it, "Simulation-->Show Last Netlist" shows you the file it's referring to for the line number(s) related to the error.

author: edy
author_rank: Super Contributor
timestamp: June 16, 2020, 01:53:12 pm
content: Quote from: MarkL on June 15, 2020, 05:02:01 pmYes, the error message wasn't very helpful... however it did point to the line for the transistor so I could narrow things down. The electronics course uses both CircuitLab and DoCircuits and they had no issues with a name like "2N2222". I guess they wanted to give an example of something you could buy and use to model on the bench as well, since they ask to try and build these circuits too. I would have thought the name is treated as a string, so even if there is a number at the start it wouldn't matter. I'll have to be more careful about naming units as well. For example, does it have problems with "5k Ohm", or "5 k Ohm", or "5 kOhm" and so on. I'll have to read the documentation and see what format it expects exactly.