|00:01||Welcome to the spoken tutorial on Subcircuit Builder in eSim.|
|00:08||In this tutorial, using eSim we will learn to-|
|00:13||Create a Subcircuit and|
|00:17||Create a Component Schematic.|
|00:19||To record this tutorial, we will use-
Ubuntu Linux OS version 16.04
|00:28||eSim version 2.0|
|00:32||To practice this tutorial, you should know how to create and simulate a circuit in eSim.|
|00:40||If not, watch the prerequisite eSim tutorials on this website.|
|00:46||The subcircuit file always begins with the dot SUBCKT statement.|
|00:53||Subname is the subcircuit component name.|
|00:58||N1,N2 are the nodes.|
|01:02||The subcircuit ends with dot Ends followed by the subcircuit name.|
|01:09||To launch eSim, you need to double-click on the eSim icon on your Desktop.|
|01:16||I have already opened eSim.|
|01:20||Let us now create a Subcircuit for a Half adder.|
|01:25||On the eSim window, click on the Subcircuit button from the left toolbar.|
|01:32||A subcircuit tab will open up.|
|01:36||In the Subcircuit tab, click on the 'New Subcircuit Schematic' button.|
|01:43||A New Schematic pop up window appears.|
|01:47||Enter Schematic Name as Halfadder underscore new.|
|01:54||Click on the OK button.|
|01:57||Now, click the Yes button in the confirmation dialog box.|
|02:02||The schematic editor window opens up.|
|02:06||The user can create a schematic or import an existing schematic.|
|02:13||We will use the latter method.|
|02:16||To create a new schematic, you can refer to the previous tutorials in this series.|
|02:23||I have already created a Half adder circuit using basic gates in eSim.
Pause the video here.
|02:32||Download the Half Adder Basic Gates project file from the Code file section.|
|02:38||Extract and save the project file on the Desktop.|
|02:43||On eeschema, click on the File option from the top menu.|
|02:49||Select Append Schematic Sheet option.|
|02:54||In the Confirmation dialog box, click on the Yes button.
Click on Desktop.
|03:01||Double-click on Half adder basic gates folder.|
|03:06||The schematic file, sch will be selected.|
|03:11||Click on the Open button in the file window.|
|03:15||You can see the schematic of the Half adder is added to the editor.|
|03:22||Press the F1 key, to zoom in the schematic.|
|03:25||Now we will connect ports to the input and output terminals of the gates.|
|03:32||Click on the Place component tool from the right toolbar.
Click on the editor.
|03:40||In the Filter field, type eSim underscore Miscellaneous.|
|03:46||Select PORT and press the drop-down arrow.|
|03:52||Click on Unit A and click on the OK button.|
|03:58||Port Unit A will be tied to the cursor.|
|04:02||Place it near the input pin 1 of the XOR gate.|
|04:07||Similarly, place Port Unit B, near the input pin 1 of the AND gate.|
|04:14||Place Port Unit C and Port Unit D near the output pin of the XOR gate and AND gate respectively.|
|04:24||Here the Port unit indicates pins of the subcircuit.|
|04:30||Unit A is pin 1, Unit B, C and D are the pin number 2, 3, 4 of the subcircuit respectively.|
|04:41||To rotate the Port C, place the cursor on Port Unit C and press the R key.|
|04:49||A clarify selection pop-up window appears.|
|04:53||Select Port U and press the R key.
Similarly, rotate Port D.
|05:02||Connect the ports to the pins with wires.|
|05:06||Place the cursor on the pin1 of PORT A and press the W key to start the wire.|
|05:15||Drag it to the wire connecting the pin 1 of XOR gate and AND gate.|
|05:22||Click once to end the wire.|
|05:26||A junction will be placed on the wire.|
|05:30||Similarly, connect all the ports to the pins as shown here.|
|05:36||Let us now Annotate the schematic.|
|05:40||Click on the Annotate schematic components icon from the top toolbar.|
|05:47||Keep the default settings.|
|05:50||Click on the Annotate button.
Click on the OK button.
|05:56||Save the schematic by pressing Ctrl+S keys together.|
|06:02||Let us generate a netlist for the schematic.|
|06:06||Click on the Generate netlist icon from the top toolbar.|
|06:11||Select the Spice tab and check the Default format.|
|06:17||Click on Generate button and then click the Save button.|
|06:23||This creates a KiCad netlist file.|
|06:27||Now, let us go back to the eSim window.|
|06:31||In the Subcircuit tab, click on the Convert Kicad to Ngspice button.|
|06:38||You can specify the transient analysis parameters or leave it blank.|
|06:45||I am leaving these values blank.|
|06:49||If any Device model or Subcircuit is used, specify them under Device modeling or Subcircuit tab.|
|06:58||In the KiCad to Ngspice tab, press the Convert button.|
|07:03||Click on the OK button in the Information dialog box.|
|07:08||This creates a Ngspice netlist of the subcircuit created.|
|07:14||You can see, the subcircuit Half Adder new is added to the subcircuit library in the eSim directory.|
|07:23||Now, let us create a component schematic for the Half Adder subcircuit.|
|07:29||The components are also referred to as Parts or symbols.|
|07:34||Go back to the eSim editor of Half Adder schematic.|
|07:39||Click on the Library Editor icon from the top toolbar.|
|07:44||The schematic window of the Part Library Editor opens up.|
|07:49||You can also find the Library Editor option from the Tools option on the top menu.|
|07:56||Click on the File option from the top menu.|
|07:59||Click on the Current Library option.|
|08:03||Choose eSim underscore Subckt option.|
|08:08||Click on the OK button.|
|08:11||The current library path of the library selected is displayed at the top of the Part Library editor window.|
|08:20||To create a new component, click on Create a new Component icon from the top toolbar.|
|08:28||A Component Properties window opens up.|
|08:32||Enter the following.
Component name as HA underscore new.
|08:39||Default Reference Designator as X.|
|08:43||The designator is different for each eSim component.|
|08:48||D is used for Diode.|
|08:51||Q is used for BJT and so on.|
|08:55||Keep the default settings.|
|08:57||Click on the OK button in the window.|
|09:01||Press F1 key to zoom in the schematic name and designator.|
|09:07||You can add a rectangle, circle, arc or polygons as the component body.|
|09:15||I will add a rectangle as a component body.|
|09:20||Click on Add graphic rectangle to component body tool from the right toolbar.|
|09:27||Click on the editor.|
|09:30||Click and drag the rectangle.|
|09:34||Click again to end the rectangle body.|
|09:38||Arrange the designator and name of the component.|
|09:42||Place the cursor on the name and designator and press the key M.|
|09:48||Now add input and output pins.|
|09:53||Click on Add pins to component tool from the right toolbar.|
|09:59||Click on the Editor.
Pin Properties window will appear.
|10:04||Enter: Pin name as A.|
|10:09||Pin Number as 1.|
|10:11||Orientation as Right.|
|10:14||Electrical Type as Input.|
|10:17||Graphic Style as Line.|
|10:20||Click on the OK button in the window.|
|10:24||The pin is tied to the cursor. Connect it as shown.|
|10:30||Click on the editor again.
In a similar way, add Pin number 2 with Pin name as B.
|10:40||Click again on the editor.
Enter the following.
|10:45||Pin name as Sum.|
|10:48||Pin Number as 3.|
|10:51||Orientation as left.|
|10:54||Electrical Type as output.|
|10:57||Graphic Style as Line.|
|11:00||Click on the OK button.|
|11:04||In a similar way add Pin number 4 with Pin name Cy.|
|11:11||Let us save the schematic symbol.|
|11:15||Click on File option from the top menu.|
|11:19||Click on the Save Current Library option.|
|11:23||Click the Yes button in the confirmation box.|
|11:28||You can see here, the component is added to eSim underscore Subcircuit library.|
|11:36||Click once again the Yes button in the confirmation box.|
|11:41||Close the Part Library editor window.|
|11:45||This will save the new component to the current library eSim underscore Subcircuit .|
|11:52||The eSim underscore Subckt library file is found in the Kicad library as shown here.|
|12:00||As you can see the component HA underscore new is defined here.|
|12:06||If you want to delete any component, you can also delete the component in this file.|
|12:13||Now we can verify the created Subcircuit and its component schematic.|
|12:20||You can use the Half Adder example project from the eSim Examples folder or create a new project.|
|12:27||You can also download the example HA underscore Test from the Code file section.|
|12:36||You can verify the component and subcircuit created.|
|12:41||I have created a new project HA underscore Test.|
|12:46||The project is already added to eSim window under the Project section.|
|12:52||Select HA test and click on the Open schematic button from the left toolbar.|
|13:00||It directs us to the eSim schematic window.|
|13:04||You can see, the HA underscore new component will be present under eSim_Subckt library.|
|13:13||Let us go back to the eSim window.|
|13:16||In the Kicad to Ngspice analysis tab, I have already specified transient parameters.|
|13:23||In the Source details tab, the voltage sources are assigned as 5 volts.|
|13:29||In the Subcircuit tab, the path of the Halfadder underscore new is added.|
|13:36||You can see the Ngspice plots and terminal.|
|13:41||Since both the inputs are 5 volts, Sum will be 0 and carry will be 5 volts.|
|13:48||You can also see the values in the Ngspice terminal.|
|13:53||Close the Ngspice terminal and plots.|
|13:57||In the Python plot window, check the Sum and Cy node.|
|14:03||Click on the Plot button.|
|14:06||The sum is 0 volts and Carry is 5 volts.
Close the Python plot window.
|14:14||In this tutorial, we learnt how to,|
|14:17||Create a Subcircuit and Create a Component Schematic.|
|14:24||Do you have questions in this Spoken Tutorial?
Please visit this site.
|14:31||For any general or technical questions on eSim, visit the FOSSEE forum and post your question.|
|14:39||The FOSSEE team coordinates the Circuit Simulation project.|
|14:44||We give Certificates and Honorarium to the contributors.
For more details, please visit this site.
|14:53||The FOSSEE team coordinates the Lab Migration project.
For more details, please visit this site.
|15:02||Spoken Tutorial Project is funded by NMEICT, MHRD, Govt. of India.
For more details, visit this site.
|15:11||This is Gloria N from IIT Bombay signing off.