fritzing / fritzing-parts

Electronic components for use in the Fritzing app (aka the parts library)
http://fritzing.org/parts
Other
513 stars 359 forks source link

changed NAND gate model to use MOS transistors #360

Open failiz opened 1 year ago

failiz commented 1 year ago

to be used in the example in the fritzing-app repository

failiz commented 11 months ago

Hi Kjell, the NAND gate would be very interesting to be used in examples in the transitory branch. Currently, the NAND gate that is in the core uses BJT transistors and cannot drive LEDs (and the sketch that I made does not work well). The NAND gate with multiple subparts has a problem that you identified and it should not be merged yet. Is it Ok if I add the changes to the spice model of the NAND gate (single part) in the ac branch and close this PR?

KjellMorgenstern commented 11 months ago

Maybe we can add a buffered/driver NAND as additional part? With a quick search I only found this CD40107BE , which is only 2 Gate, but still THT.

And the logic level NAND gate would then be a good example to build the same, using additional transistors to drive the LEDs?

failiz commented 11 months ago

Context: I did not model any NAND gate, I just copied the models from the ngspice manual. And there are two of them, the one based on BJT transistors and the one using MOSFETs. I made the NAND example (https://github.com/fritzing/fritzing-app/pull/4004) and I realized the BJT NAND model was giving problems, so I changed to the MOSFET version. We should not create two parts, one more "logic level" and another able to drive/sink more current. Any IC with NAND gates will have enough capability to drive an LED. Probably, the BJT NAND gate could also be modified to drive LEDs directly by tuning the model of the BJT transistor used (but I am nor an expert in SPICE modeling and it could take a while and most gates are based on MOSFT technology nowadays). So, I just think we should merge the new version of the single NAND part (not the multipart NAND gate) and the NAND example. It is a nice example and I could use the NAND gate to create interesting examples for the transitory branch.

failiz commented 1 month ago

@KjellMorgenstern , could you merge this PR? It will make my life easier and I think this spice code should be faster (4 transistors versus 5 transistors and 3 diodes of the previous spice) and more representative of the current technologies (I doubt that the gates now are using BJT transistors)