Author Topic: Linux Circuit Simulator Advice like CircuitLab for Course  (Read 2567 times)

0 Members and 1 Guest are viewing this topic.

Offline edyTopic starter

  • Super Contributor
  • ***
  • Posts: 2387
  • Country: ca
    • DevHackMod Channel
Linux Circuit Simulator Advice like CircuitLab for Course
« on: June 10, 2020, 03:31:38 pm »
Hi folks,

I'm currently working my way through this newbie course:

https://www.thegreatcoursesplus.com/understanding-modern-electronics

I'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_simulators

I'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, like Circuitlab.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.
« Last Edit: June 10, 2020, 03:38:02 pm by edy »
YouTube: www.devhackmod.com LBRY: https://lbry.tv/@winegaming:b Bandcamp Music Link
"Ye cannae change the laws of physics, captain" - Scotty
 

Offline edyTopic starter

  • Super Contributor
  • ***
  • Posts: 2387
  • Country: ca
    • DevHackMod Channel
Re: Linux Circuit Simulator Advice like CircuitLab for Course
« Reply #1 on: June 10, 2020, 07:42:18 pm »
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.
YouTube: www.devhackmod.com LBRY: https://lbry.tv/@winegaming:b Bandcamp Music Link
"Ye cannae change the laws of physics, captain" - Scotty
 

Offline Weston

  • Regular Contributor
  • *
  • Posts: 221
  • Country: us
Re: Linux Circuit Simulator Advice like CircuitLab for Course
« Reply #2 on: June 10, 2020, 08:00:25 pm »
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.
« Last Edit: June 11, 2020, 06:25:18 am by Weston »
 

Offline MarkL

  • Supporter
  • ****
  • Posts: 2270
  • Country: us
Re: Linux Circuit Simulator Advice like CircuitLab for Course
« Reply #3 on: June 10, 2020, 09:51:01 pm »
...
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.
I 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.
« Last Edit: June 10, 2020, 09:52:59 pm by MarkL »
 
The following users thanked this post: edavid

Offline tggzzz

  • Super Contributor
  • ***
  • Posts: 20951
  • Country: gb
  • Numbers, not adjectives
    • Having fun doing more, with less
Re: Linux Circuit Simulator Advice like CircuitLab for Course
« Reply #4 on: June 10, 2020, 10:02:00 pm »
I'll second LTSpice under WINE. A well known simulator with many models and many people to help.
There are lies, damned lies, statistics - and ADC/DAC specs.
Glider pilot's aphorism: "there is no substitute for span". Retort: "There is a substitute: skill+imagination. But you can buy span".
Having fun doing more, with less
 

Offline edyTopic starter

  • Super Contributor
  • ***
  • Posts: 2387
  • Country: ca
    • DevHackMod Channel
Re: Linux Circuit Simulator Advice like CircuitLab for Course
« Reply #5 on: June 11, 2020, 06:10:50 am »
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?
« Last Edit: June 11, 2020, 06:23:25 am by edy »
YouTube: www.devhackmod.com LBRY: https://lbry.tv/@winegaming:b Bandcamp Music Link
"Ye cannae change the laws of physics, captain" - Scotty
 

Offline edyTopic starter

  • Super Contributor
  • ***
  • Posts: 2387
  • Country: ca
    • DevHackMod Channel
Re: Linux Circuit Simulator Advice like CircuitLab for Course
« Reply #6 on: June 11, 2020, 06:54:00 am »
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.
YouTube: www.devhackmod.com LBRY: https://lbry.tv/@winegaming:b Bandcamp Music Link
"Ye cannae change the laws of physics, captain" - Scotty
 

Offline RoGeorge

  • Super Contributor
  • ***
  • Posts: 6848
  • Country: ro
Re: Linux Circuit Simulator Advice like CircuitLab for Course
« Reply #7 on: June 11, 2020, 10:15:58 am »
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.


Offline edyTopic starter

  • Super Contributor
  • ***
  • Posts: 2387
  • Country: ca
    • DevHackMod Channel
Re: Linux Circuit Simulator Advice like CircuitLab for Course
« Reply #8 on: June 14, 2020, 10:34:04 pm »
I've been continuing with the course simulations and encountered some frustrating idiosyncracies in Qucs-SPICE.  :scared:   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  |O  , looking over the schematic, restarting Qucs-SPICE, trying to figure out what the heck is going on, I finally figure it out.  :palm:  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]


« Last Edit: June 14, 2020, 11:22:43 pm by edy »
YouTube: www.devhackmod.com LBRY: https://lbry.tv/@winegaming:b Bandcamp Music Link
"Ye cannae change the laws of physics, captain" - Scotty
 

Offline MarkL

  • Supporter
  • ****
  • Posts: 2270
  • Country: us
Re: Linux Circuit Simulator Advice like CircuitLab for Course
« Reply #9 on: June 15, 2020, 05:02:01 pm »
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.
 
The following users thanked this post: edy

Offline edyTopic starter

  • Super Contributor
  • ***
  • Posts: 2387
  • Country: ca
    • DevHackMod Channel
Re: Linux Circuit Simulator Advice like CircuitLab for Course
« Reply #10 on: June 16, 2020, 01:53:12 pm »
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.

Yes, 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.

YouTube: www.devhackmod.com LBRY: https://lbry.tv/@winegaming:b Bandcamp Music Link
"Ye cannae change the laws of physics, captain" - Scotty
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf