ngspice in KiCad 8 for circuit simulation
ngspice in KiCad 8 for circuit simulation
  • 8
  • 40 388
ngspice in KiCad 8: oscillators, taming an astable
Oscillators are sometimes difficult to simulate, they don't have a stable operating point (astable ...), they sometimes, depending on the device models, oscillate with difficulty, or the simulator finds a stable operating point, and then the oscillation does not start. In this video some means to get around these issues are presented.
Переглядів: 6 685

Відео

Ngspice in KiCad 8: mixed signal simulation (analog + digital)
Переглядів 2,7 тис.9 місяців тому
We use a digital device (XOR 74HC86) plus analog delays created by RC (resistor capacitor) circuits to create a pulse each time the input sgnal changes from 0 to 5 or 5 to 0. Setting up such a circuit is described in ua-cam.com/video/fOIllW_XNeo/v-deo.html .
ngspice in KiCad 8: Logic simulation, divide by 4 with 7474
Переглядів 2,6 тис.9 місяців тому
A fast logic simulation, event-based, is set up and run. A divide-by-4 circuit is provided, using the 74HC74 dual D flipflop. Digital models for some 74xxx devices are available at ngspice.sourceforge.io/model-parameters/74HCxxxM.7z. In a previous video (ua-cam.com/video/TEfvVOEF0e0/v-deo.html) I have shown how to create such models.
ngspice in KiCad 8: Creating a (digital) subcircuit model for a multipart device (74HC10)
Переглядів 1,5 тис.9 місяців тому
KiCad8/ngspice models for digital devices like the 74xxx series have to serve multi-part units. The IC may contain more than one unit (2 to 6). The device models available typically describe only a single unit, e.g. one NAND gate. So we need to translate a model from single unit to full symbol. For this purpose we create a ngspice subcircuit for the 74HC10 containing 3 NAND gates with each havi...
ngspice in KiCad 8: optimizing a bipolar amplifier
Переглядів 3,8 тис.9 місяців тому
Using Fourier analysis and the "tuner" tool of Eeschema, we improve a bipolar amplifier.
ngspice in KiCad 8: amplifier using the TI OPA1641 audio opamp
Переглядів 10 тис.9 місяців тому
Setting up and simulating an amplifier using the TI OPA1641 audio opamp.
ngspice in KiCad 8: inverting amplifier with generic opamp
Переглядів 4,8 тис.9 місяців тому
Simulating a simple inverting amplifier with a generic operational amplifier
ngspice in KiCad 8: simulation basics
Переглядів 9 тис.9 місяців тому
Introduction to simulation with ngspice in KiCad: simulate the operating point of a resistive divider

КОМЕНТАРІ

  • @giselleformon
    @giselleformon 16 днів тому

    what to do when kicad simulation says error during netlist generation, no sim.name?

    • @holger8105
      @holger8105 7 днів тому

      This something to be discussed in forum.kicad.info/ .

  • @davidtillemans51
    @davidtillemans51 29 днів тому

    This is such a good tutorial. Could you make a tutorial how-to use a switch? Looks like something simple, but I see posts using a relay, which is strange.

  • @mubafaw
    @mubafaw Місяць тому

    Thank you 😊

  • @rich4239
    @rich4239 Місяць тому

    thanks was struggling to get first sim working and this was the key

  • @triantoadifx
    @triantoadifx Місяць тому

    How to simulate transistor with ic 7812 ?

  • @kensmith5694
    @kensmith5694 2 місяці тому

    I recommend against using this circuit in real life but if you do, this version is a good one to use if you have the parts needed. The thresholds on HC parts can vary a lot so the timing will not be the same for rising and falling inputs. Doing 2 stages with the 2nd delay having an inverted signal partly compensates for this. Adding just the right value of inductor in series with the resistor can also help to get the timings more repeatable. Still don't do it in real life if you have another option.

  • @josesaumell2908
    @josesaumell2908 2 місяці тому

    Very helpful video, thank you!

  • @andymouse
    @andymouse 2 місяці тому

    Awesome !

  • @rrsounds
    @rrsounds 3 місяці тому

    This is an excellent series of introductory videos for doing simulation in KiCad. I need to get my feet wet, so to speak, and you have given me the tools to do so!

  • @DonHaig-k9b
    @DonHaig-k9b 3 місяці тому

    I have been following your tutorials. Thank you for posting them! When I get to the transient simulation in this tutorial it throws the following error: Error on line 0 : a.xu1.x_s1.as_s1 %gd xu1.n2992267 xu1.clamp %gd xu1.n2992267 xu1.clamp xu1.x_s1:a_s1 MIF-ERROR - unable to find definition of model xu1.x_s1:a_s1 Error: circuit not parsed. Error: vector time not found! Error: vector time not found! As I am new to using this tool, I am at a loss. What am I missing? (KiCad 8 on Ubuntu 22.04) Thanks again.

    • @DonHaig-k9b
      @DonHaig-k9b 3 місяці тому

      For others who may run into this issue. I upgraded from KiCad 7 to Kicad 8 using: sudo add-apt-repository ppa:kicad/kicad-8.0-releases sudo apt update sudo apt install kicad The following commands resolved the issue: sudo apt remove "*ngspice*" sudo apt install kicad Thank you to dsa-t on the KiCad Info Forum for the answer

    • @yusufferhatyilman6962
      @yusufferhatyilman6962 9 днів тому

      @@DonHaig-k9b ran into the same issue, this fixed the problem. thx

  • @010_teukuzikrifatahillah6
    @010_teukuzikrifatahillah6 3 місяці тому

    your tutorial is insane, great explanation

  • @wahagabdulghani7286
    @wahagabdulghani7286 4 місяці тому

    I want to add DC 12 V to my schematic but after added it it dose not have a simulation model, how can I add a 12V dc sores to my schematic

    • @roborob2570
      @roborob2570 День тому

      I think you can use the pspice dc voltage for the simulation

  • @jcpk2925
    @jcpk2925 4 місяці тому

    Very good, we are waiting for the rest of the tutorial.... Thank you.

  • @stemscience1
    @stemscience1 5 місяців тому

    ua-cam.com/video/_OrjdUVnkdg/v-deo.html KiCAD and SPICE simulations GUIDE

  • @grahamnichols1416
    @grahamnichols1416 6 місяців тому

    Excellent! Liked and subscribed. Please continue with the series. It is invaluable for beginners.

  • @PreludeSon
    @PreludeSon 6 місяців тому

    This is excellent!

  • @PreludeSon
    @PreludeSon 6 місяців тому

    Such a great tutorial, really appreciated this

  • @torpemil6654
    @torpemil6654 7 місяців тому

    hey, thanks for this series. I tried this with the opamp OPA 1602. But the Kicad 8 implemented opamp symbol has not pins for vcc and vee (it has just 3 pins 1=out,2=(-),3=(+)), but in that pineditor text the power supply where mentioned (.SUBCKT OPA160x IN+ IN- VCC VEE OUT ). So i guessed I just follow that text file with the pin editing: (pin1=out,pin2=(-),pin3=(+),pin4=(V-),pin5=(V+)). I even edited the symbol and added Pin 4 and 8 for VEE and VCC. But nothing worked. A Video how to get a OPA1602 or 1678 working would be much appreciated!!! thank you

    • @holger8105
      @holger8105 6 місяців тому

      Indeed the symbol has 8 pins, as the real 1602 circuit has. Select the symbol, then click three times onto the Eeschema canvas: A and B opamp part symbols, C as the power pins. The simulation model has only 5 pins, as is common for opamps. So some translation is required between model and symbol. Currently this has to be done manually by the user, see ngspice.sourceforge.io/ngspice-eeschema.html#multi for an example. Yes, I should do a video about this.

  • @s_s-g4d
    @s_s-g4d 7 місяців тому

    what simulation models did you use for the gates?

  • @HansWurst-bk9sb
    @HansWurst-bk9sb 7 місяців тому

    Hi Holger, how to convert the inputs and outputs of the digital parts then into near-real-life values with input thresholds and output voltages? Is there a handy mechanism for then transition into analog simulation again?

  • @ion1969
    @ion1969 7 місяців тому

    Thanks for a great series of videos! It has the right pace and right level of detail. 🎉🎉🎉

  • @JakePoznanski
    @JakePoznanski 7 місяців тому

    Awesome series for refreshing my memory on SPICE and also making it practical with the great KiCad tools you show. Thank you!

  • @Dunkelwind
    @Dunkelwind 8 місяців тому

    doesn't work 😔 Error: there is no circuit loaded. Warning: Nesting of subcircuits with parameters is only marginally supported! warning, can't find model 1prebar Circuit: KiCad schematic Too few parameters for subcircuit type "74hc74" (instance: xxua) Too few parameters for subcircuit type "74hc74" (instance: xxub) Same problem at a 74HC02 project. Here is a little bug with the pin-nr's: Xnand1 2 2 1 74HC02 But that is not the main problem. Version: 8.0.1-8.0.1-0~ubuntu20.04.1, release build ngspice: 42 Compiler: GCC 9.4.0 with C++ ABI 1013

    • @holger8105
      @holger8105 8 місяців тому

      Hmm, it works, at least for me (using MS Windows). There might be an installation problem (with the code models) on Ubuntu. Could you please post yor question/report at forum.kicad.info/ (where also Ubuntu users are active)?

    • @holger8105
      @holger8105 8 місяців тому

      A working example is available at forum.kicad.info/t/how-do-i-simulate-a-74ls74-flipflop-using-ngspice-41/45571/12

  • @over2there
    @over2there 8 місяців тому

    Can you do a C integration tutorial please? See here: ngspice.sourceforge.io/docs/others/c-process-CoSim.pdf

  • @osha1237
    @osha1237 8 місяців тому

    Thank you very much. Your Videos have been very resourceful to me

  • @lingyai1000
    @lingyai1000 8 місяців тому

    Thank you

  • @mogalagadiphahleng921
    @mogalagadiphahleng921 8 місяців тому

    Thanks you saved my Day

  • @wolpumba4099
    @wolpumba4099 8 місяців тому

    *Abstract* This video tutorial demonstrates how to simulate an audio amplifier circuit using the OPA1641 operational amplifier in KiCad 8 [edited] and NGspice. Key concepts and steps covered in the video include: * *Circuit Design:* Creating a schematic for an inverting amplifier configuration with a gain of 10. * *Component Selection:* Choosing resistors, power supplies, and an input voltage source with appropriate values * *Obtaining Spice Model:* Downloading the OPA1641 Spice model from the Texas Instruments website. * *Model Integration:* Attaching the downloaded spice model to the OPA1641 symbol in the schematic. * *Pin Mapping:* Correctly mapping model pins to symbol pins for accurate simulation. * *Simulations:* Performing both transient and AC simulations to analyze the amplifier's time-domain response and frequency response. *Summary* * *0:00* Create a new KiCad project and name it appropriately. * *0:35* Find, select, and place the OPA 1641 amplifier symbol in the workspace. * *1:43* Add resistors, ground, and power supply symbols to the project. * *2:33* Add necessary power symbols (VCC and VRE). * *3:19* Add labels for input (in) and output (out). * *3:53* Connect power supplies to amplifier. * *5:11* Assign values to power supplies (+15v, -15v) and resistors (10k and 100k for amplification factor of 10). * *5:40* Add input voltage using the Vsin (sinusoidal input symbol). * *6:19* Configure Vsin with DC=0, Amplitude=0.1, Frequency=1khz and set the AC tag to 1 for AC simulation. *Finding and Integrating the Spice Model* * *6:55* TI provides the necessary spice model. Search on their website, download, and extract. * *8:19* Examine the `.lib` file to confirm it contains the OPA 1641 subcircuit model. * *9:14* Save the `.lib` file within the project directory. * *9:45* Attach the model to the OPA 1641 symbol in KiCad. * *10:30* Be aware: Pin layouts in the spice model might not match the symbol. Adjust pin mappings carefully within the model editor. *Setting Up and Running Simulations* * *12:57* Start with a Transient simulation * *13:15* Set appropriate time resolution and final time (example: 10us and 10ms) * *13:36* Mark the in and out voltages for plotting. * *13:44* Run the simulation. Verify the input amplitude of 0.1 and expected output indicating amplification by a factor of 10. * *14:16* Set up an AC Simulation * *14:29* 10 points per decade. Start frequency 10 Hz, end frequency 10 MHz * *14:53* Select the output to observe the gain/phase response. * *15:07* Run the AC simulation. Observe the frequency response. *Saving Your Work* * *15:50* Save the simulation setup for future use. * *16:14* Save the circuit diagram. Disclaimer: I used gemini advanced 1.0 (2024.03.04) to summarize the youtube video transcript. This method may make mistakes in recognizing words

    • @holger8105
      @holger8105 8 місяців тому

      You as the poster are responsible for the correctness of your post, nobody else, with disclaimer or without. Please check your posting. There is no Keysight, what is Keycad, for example.

    • @wolpumba4099
      @wolpumba4099 8 місяців тому

      @@holger8105 Sorry, i will edit it.

  • @BruSilveira0
    @BruSilveira0 8 місяців тому

    Can you explain about FFT? The pure sinusoidal 1khz/1V source, with 100ns timestep and 100ms samples... the graph appears to not have enough samples. In LTspice I use the options plotwinsize=0 and numdgt=24 to improve the graph a lot, but in ngspice I don't know how to apply this, can you help? Thanks!

  • @hyneklos
    @hyneklos 8 місяців тому

    nice, thx !

  • @Leezorc
    @Leezorc 8 місяців тому

    Great! You have a new sub. Good content

  • @yuriy.kostenko
    @yuriy.kostenko 8 місяців тому

    This is very useful for newcamers like. Please continue this series!

  • @arturwiebe7482
    @arturwiebe7482 9 місяців тому

    Very concise. Perfect.

  • @peatmoss4415
    @peatmoss4415 9 місяців тому

    The only reason this circuit oscillates is because of the variance of tolerances of the components. If you pair the transistors and capacitors and resistors it won't oscillate unless you take a wire and short a couple of legs of the transistors for a split second. (or discharge one capacitor and charge the other) This is a sample circuit in electronics training. In that one, an LED is placed above the collector of the transistors. This simulation might have a random variable in the algorithm to resemble the variances in component manufacturing. TinkerCad is another simulation online.

  • @SirGullefjun
    @SirGullefjun 9 місяців тому

    Beginning to use this and it is quite nice! Understanding ngspice syntax is a bonus so I am beginning to study the docs now. Regarding spice model for a custom element. I try using the PARAMS: keyword to make the parameters available in Kicad. It works but I get an error in the beginning of the log. Cannot find the model it says for each parameter. For future it would be better to have the spice model file in the actual element itself and make the box editable…. One less file to keep track of. Thanks for all great work!

  • @ivolol
    @ivolol 9 місяців тому

    How could one learn on their own that to get a better representation for certain simulations they can change an integration method from "trap" to "gear" (both terms I have no clue about)? Would you just have to get really lucky in a google search?

    • @holger8105
      @holger8105 9 місяців тому

      My (old school) advice would be: grab a book about SPICE simulation. A list of books is given here: ngspice.sourceforge.io/books.html . I would recommend the book by Tadej Tuma , Árpád Buermen. Also the book by Kielkowski directly answers your question. Hopefully there is a library near your place which offers such technical books.

  • @hardrocklobsterroll395
    @hardrocklobsterroll395 9 місяців тому

    Thank you for sharing 8 is another step in the FOSS community getting to a full fledged production software

  • @bigbazer
    @bigbazer 9 місяців тому

    Thanks for the video and I’m looking forward to more videos you make on Kicad 8. I found it was easy to follow for a complete novice to Kicad 8 like me.

  • @elirosenberg6603
    @elirosenberg6603 9 місяців тому

    Thank you so much for showing how to use ngspice with KiCad 8. It's also great that we can mix analog and digital. I would recommend reading the app note "Implications of Slow or Floating CMOS Inputs (Rev. E)" when using HC logic with more than 0.1μs input rise times.

  • @djsbriscoe
    @djsbriscoe 9 місяців тому

    Thank you for creating this channel :)

  • @luis11347
    @luis11347 9 місяців тому

    Great content. Thanks

  • @dixsusu
    @dixsusu 9 місяців тому

    Keep it simple and under 20 minutes and your ch will boost ! Great content .

    • @SyntaxSemantic
      @SyntaxSemantic Місяць тому

      BTW he is the original author of ngspice

  • @terrysouthwood4757
    @terrysouthwood4757 9 місяців тому

    Thank you for these videos. They are going to be useful for me as I intend to explore using the analogue simulation in Kicad. Great job, just the right pace, not going to deep and not assuming to much prior knowledge. I just binge watched the videos and I am looking forward to any further videos you have time to produce.

  • @SoundSleuth
    @SoundSleuth 9 місяців тому

    This is one of my goto Op Amps so great to see a simple Spice simulation and with KiCad8. Thank you!

    • @andymouse
      @andymouse 2 місяці тому

      OPA1656 is mine.

  • @splackism
    @splackism 9 місяців тому

    Thanks for the video. It might be nicer to use keyboard shortcuts to speed things up a little.

    • @bigbazer
      @bigbazer 9 місяців тому

      I’m completely new to Kicad 8 and I don’t need things speeding up with keyboard shortcuts or I will get lost, I just need to learn the program and know where to click to find stuff. But I’m finding the shortcuts as I go along and using them when I can remember them.

  • @HUEHUEUHEPony
    @HUEHUEUHEPony 9 місяців тому

    Another question that is less offtopic, how does the models know where ground and power is since you never defined it?, I know that they dont need it, but still, how do they know?, how can they tell that I plugged 7 or 14 at the right place?

    • @holger8105
      @holger8105 9 місяців тому

      They don't make use of 7 and 14, they don't need it, as internally it is a fast 1 and 0 event based logic simulation, like in a logic simulator.

  • @HUEHUEUHEPony
    @HUEHUEUHEPony 9 місяців тому

    dumb question, is it possible for me to edit the schematic of a symbol or footprint, then I could theoretically do the AND gate with nmos and pmos myself and just copy paste from there. Then I would have the subcircuit schematic and simulation of whichever model I wanted. The reason why I ask this is because I wanted to simulate the cd4081 in kicad, but it seems everywhere I look the spice syntax is not compatible with ngspice leaving me with a lot of frustration. Also the naming is confusing 74HC10 is not really a 74HC10 but a NAND(3) gate, they could just mention that instead of false advertising they have the complete package. And that is work to the reader.

    • @holger8105
      @holger8105 9 місяців тому

      Please have a look at forum.kicad.info/t/how-do-i-simulate-a-74ls74-flipflop-using-ngspice-41/45571/11 how to find a model for the 4081.

    • @holger8105
      @holger8105 9 місяців тому

      All these models for other simulators are compatible to ngspice, but not to KiCad/ngspice, as KiCad/ngspice is the only simulator which simulates complete packaged ICs. All the others simulate individual gates, and you may place as many as you like. In KiCad/ngspice the symbol rules, as the whole business stems from PCB design. If you have done your model for your symbol, you may publish it, to help others, and so some day we have all relevant symbol/model combinations available.

  • @Electheo
    @Electheo 9 місяців тому

    Great and detailed walkthrough, thanks!