Difference between revisions of "ESim/C2/Subcircuit-Builder/English"

From Script | Spoken-Tutorial
Jump to: navigation, search
 
(One intermediate revision by one other user not shown)
Line 32: Line 32:
 
||'''Show Slide:'''
 
||'''Show Slide:'''
 
Pre-requisites
 
Pre-requisites
||To practice this tutorial, you should know how to create and simulate a circuit in'''eSim'''.
+
||To practice this tutorial, you should know how to create and simulate a '''circuit''' in '''eSim'''.
  
 
If not, watch the prerequisite '''eSim''' tutorials on this website.
 
If not, watch the prerequisite '''eSim''' tutorials on this website.
Line 40: Line 40:
 
General form of Subcircuit
 
General form of Subcircuit
  
||The subcircuit file always begins with the dot '''subckt''' statement.
+
||The '''subcircuit''' file always begins with the '''dot SUBCKT''' statement.
  
'''Subname''' is the subcircuit component name.
+
'''Subname''' is the '''subcircuit component''' name.
  
 
'''N1''','''N2'''  are the nodes.
 
'''N1''','''N2'''  are the nodes.
  
The subcircuit ends with dot '''ENDS''' followed by the subcircuit name.
+
The '''subcircuit''' ends with '''dot Ends''' followed by the '''subcircuit''' name.
  
 
|-
 
|-
Line 64: Line 64:
 
Creating Subcircuit
 
Creating Subcircuit
  
|| Let us now create a ''Subcircuit'' for a ''Half adder''.
+
|| Let us now create a '''Subcircuit''' for a '''Half adder'''.
  
 
|-
 
|-
Line 82: Line 82:
 
click '''OK'''
 
click '''OK'''
 
   
 
   
||In the '''Subcircuit''' tab, click on the ''''New Subcircuit Schematic''' button.
+
||In the '''Subcircuit''' tab, click on the ''''New Subcircuit Schematic'''' button.
  
 
A '''New Schematic''' pop up window appears.
 
A '''New Schematic''' pop up window appears.
  
Enter '''Schematic Name''' as '''Halfadder''' underscore '''new'''.
+
Enter '''Schematic Name''' as '''Halfadder underscore new'''.
  
 
Click on the '''OK''' button.
 
Click on the '''OK''' button.
Line 96: Line 96:
 
||Now, click the '''Yes''' button in the '''confirmation''' dialog box.
 
||Now, click the '''Yes''' button in the '''confirmation''' dialog box.
  
The ''schematic editor'' window opens up.
+
The '''schematic editor''' window opens up.
  
The user can create a schematic or import an existing schematic.  
+
The user can create a '''schematic''' or import an existing '''schematic'''.  
  
 
We will use the latter method.
 
We will use the latter method.
  
To create a new schematic, you can refer to the previous tutorials in this series.
+
To create a new '''schematic''', you can refer to the previous tutorials in this series.
  
 
|-
 
|-
Line 109: Line 109:
 
Adding  '''Half_adder_basic_gates'''  from the '''Code''' file section.
 
Adding  '''Half_adder_basic_gates'''  from the '''Code''' file section.
  
||I have already created a ''half adder'' circuit using basic ''gates'' in '''eSim'''.
+
||I have already created a '''Half adder circuit''' using basic '''gates''' in '''eSim'''.
  
 
Pause the video here.
 
Pause the video here.
Line 134: Line 134:
 
click '''Open'''
 
click '''Open'''
  
||On ''eeschema'',  click on the  '''File''' option from the top menu.
+
||On '''eeschema''',  click on the  '''File''' option from the top menu.
  
 
Select '''Append Schematic Sheet''' option.
 
Select '''Append Schematic Sheet''' option.
  
In the '''confirmation''' dialog box, click on the '''Yes''' button.
+
In the '''Confirmation''' dialog box, click on the '''Yes''' button.
  
 
Click on '''Desktop'''.
 
Click on '''Desktop'''.
Line 144: Line 144:
 
Double-click on '''Half adder basic gates''' folder.
 
Double-click on '''Half adder basic gates''' folder.
  
The schematic file, '''sch''' will be selected.
+
The '''schematic''' file, '''sch''' will be selected.
  
 
Click on the '''Open''' button in the file window.
 
Click on the '''Open''' button in the file window.
  
You can see the ''schematic'' of the ''half adder'' is added to the ''editor''.
+
You can see the '''schematic''' of the '''Half adder''' is added to the '''editor'''.
  
 
|-
 
|-
Line 154: Line 154:
 
Zoom in the schematic
 
Zoom in the schematic
  
||Press the '''F1''' key, to zoom in the schematic.
+
||Press the '''F1''' key, to zoom in the '''schematic'''.
  
 
|-
 
|-
 
||'''eSim Schematic Window:'''
 
||'''eSim Schematic Window:'''
  
||Now we will connect ''ports'' to the input and output ''terminals'' of the ''gates''.
+
||Now we will connect '''ports''' to the '''input''' and '''output terminals''' of the '''gates'''.
  
 
|-
 
|-
Line 182: Line 182:
 
Click on the '''editor'''.
 
Click on the '''editor'''.
  
In the '''Filter''' field, type '''eSim''' underscore '''Miscellaneous'''.
+
In the '''Filter''' field, type '''eSim underscore Miscellaneous'''.
  
 
Select '''PORT''' and press the drop-down arrow.
 
Select '''PORT''' and press the drop-down arrow.
Line 194: Line 194:
 
Adding '''PORT A''' and '''PORT B'''
 
Adding '''PORT A''' and '''PORT B'''
  
||Place it near the input '''pin 1''' of the '''XOR''' gate.
+
||Place it near the '''input pin 1''' of the '''XOR gate'''.
  
Similarly, place '''Port Unit B''', near the input '''pin 1''' of the '''AND''' gate.
+
Similarly, place '''Port Unit B''', near the '''input pin 1''' of the '''AND gate'''.
  
 
|-
 
|-
Line 202: Line 202:
 
Adding '''PORT C''' and '''PORT D'''
 
Adding '''PORT C''' and '''PORT D'''
  
||Place '''Port Unit C'''  and '''Port Unit D''' near the output ''pin'' of the '''XOR''' gate and '''AND''' gate respectively.
+
||Place '''Port Unit C'''  and '''Port Unit D''' near the '''output pin''' of the '''XOR gate''' and '''AND gate''' respectively.
  
Here the ''Port unit'' indicates ''pins'' of the subcircuit.
+
Here the '''Port unit''' indicates '''pins''' of the '''subcircuit'''.
  
'''Unit A''' is '''pin 1''', '''Unit B''', '''C''' and '''D''' are the pin number ''2'', ''3'',''4'' of the subcircuit respectively.
+
'''Unit A''' is '''pin 1, Unit B, C''' and '''D''' are the '''pin''' number '''2, 3, 4''' of the '''subcircuit''' respectively.
  
 
|-
 
|-
Line 224: Line 224:
 
Place cursor on '''Port A''', pin1>>
 
Place cursor on '''Port A''', pin1>>
  
press '''W''' key, to start the ''wire''
+
press '''W''' key, to start the '''wire'''
  
connect it to the ''wire'' connecting '''Pin 1''' of '''Xor''' gate and  '''And''' gate>>
+
connect it to the '''wire''' connecting '''Pin 1''' of '''Xor''' gate and  '''And''' gate>>
  
Click once to end the ''wire''
+
Click once to end the '''wire'''
  
||Connect the ''ports'' to the ''pins'' with ''wires''.
+
||Connect the '''ports''' to the '''pins''' with '''wires'''.
  
Place the cursor on the '''pin1''' of '''PORT A''' and press the '''W''' key to start the wire.
+
Place the cursor on the '''pin1''' of '''PORT A''' and press the '''W''' key to start the '''wire'''.
  
Drag it to the ''wire'' connecting the '''pin 1''' of '''XOR''' gate and '''AND''' gate.
+
Drag it to the '''wire''' connecting the '''pin 1''' of '''XOR gate''' and '''AND gate'''.
  
Click once to end the wire.
+
Click once to end the '''wire'''.
  
A ''junction'' will be placed on the wire.
+
A '''junction''' will be placed on the '''wire'''.
  
Similarly, connect all the ''ports'' to the ''pins'' as shown here.
+
Similarly, connect all the '''ports''' to the '''pins''' as shown here.
  
 
|-
 
|-
Line 248: Line 248:
 
click '''OK'''
 
click '''OK'''
  
||Let us now ''Annotate'' the schematic.
+
||Let us now '''Annotate''' the '''schematic'''.
  
 
Click on the '''Annotate schematic components''' icon from the top toolbar.
 
Click on the '''Annotate schematic components''' icon from the top toolbar.
Line 262: Line 262:
 
Press '''Ctrl+S'''  keys together
 
Press '''Ctrl+S'''  keys together
  
||Save the schematic by pressing '''Ctrl+S'''  keys together.
+
||Save the '''schematic''' by pressing '''Ctrl+S'''  keys together.
  
 
|-
 
|-
Line 276: Line 276:
 
Click '''Save'''
 
Click '''Save'''
  
||Let us generate a ''netlist'' for the schematic.
+
||Let us generate a '''netlist''' for the '''schematic'''.
  
 
Click on the '''Generate netlist''' icon from the top toolbar.
 
Click on the '''Generate netlist''' icon from the top toolbar.
Line 284: Line 284:
 
Click on '''Generate''' button and then click the '''Save''' button.
 
Click on '''Generate''' button and then click the '''Save''' button.
  
This creates a ''KiCad'' netlist file.
+
This creates a '''KiCad netlist''' file.
  
 
|-
 
|-
Line 297: Line 297:
 
|-
 
|-
 
||'''Subcircuit tab:'''
 
||'''Subcircuit tab:'''
Point to '''transient''' analysis  parameters
+
Point to '''transient analysis  parameters'''
  
||You can specify the '''transient''' analysis  parameters or leave it blank.  
+
||You can specify the '''transient analysis  parameters''' or leave it blank.  
  
 
I am leaving these values blank.
 
I am leaving these values blank.
Line 307: Line 307:
 
Highlight '''Device modeling''' and '''Subcircuit''' tab.
 
Highlight '''Device modeling''' and '''Subcircuit''' tab.
  
||If any ''Device model'' or ''Subcircuit'' is used, specify them under '''Device modeling''' or '''Subcircuit''' tab.
+
||If any '''Device model''' or '''Subcircuit''' is used, specify them under '''Device modeling''' or '''Subcircuit''' tab.
  
 
|-
 
|-
Line 317: Line 317:
 
||In the '''KiCad to Ngspice''' tab, press the '''Convert''' button.
 
||In the '''KiCad to Ngspice''' tab, press the '''Convert''' button.
  
Click on the '''OK''' button in the '''information''' dialog box.
+
Click on the '''OK''' button in the '''Information''' dialog box.
  
This creates a ''Ngspice'' netlist of the subcircuit created.
+
This creates a '''Ngspice netlist''' of the '''subcircuit''' created.
  
 
|-
 
|-
 
||'''eSim Subcircuit Library:'''
 
||'''eSim Subcircuit Library:'''
  
||You can see, the subcircuit '''Half Adder new''' is added to the '''subcircuit''' library in the '''eSim''' directory.
+
||You can see, the '''subcircuit Half Adder new''' is added to the '''subcircuit library''' in the '''eSim''' directory.
  
 
|-
 
|-
 
||'''eSim Schematic Window:'''
 
||'''eSim Schematic Window:'''
  
||Now, let us create a component schematic for the ''Half Adder'' subcircuit.
+
||Now, let us create a '''component schematic''' for the '''Half Adder subcircuit'''.
  
The components are also referred to as ''Parts'' or ''symbols''.
+
The '''components''' are also referred to as '''Parts''' or '''symbols'''.
  
 
|-
 
|-
 
||eSim Schematic Window:
 
||eSim Schematic Window:
Go back to the '''eSim''' editor of '''Half Adder''' schematic.
+
Go back to the '''eSim''' editor of '''Half Adder schematic'''.
  
 
Click on '''Tools'''>>  
 
Click on '''Tools'''>>  
  
click on '''Library Editor'''
+
Click on '''Library Editor'''
  
 
||Click on the '''Library Editor''' icon from the top toolbar.
 
||Click on the '''Library Editor''' icon from the top toolbar.
  
The schematic window of the '''Part Library''' Editor opens up.
+
The '''schematic''' window of the '''Part Library Editor''' opens up.
  
 
You can also find the '''Library Editor''' option from the '''Tools''' option on the top menu.
 
You can also find the '''Library Editor''' option from the '''Tools''' option on the top menu.
Line 361: Line 361:
 
Click on the '''Current Library''' option.
 
Click on the '''Current Library''' option.
  
Choose '''eSim''' underscore '''Subckt''' option.
+
Choose '''eSim underscore Subckt''' option.
  
 
Click on the '''OK''' button.
 
Click on the '''OK''' button.
Line 369: Line 369:
 
Hover the mouse on the top of the '''Part library''' editor window pointing '''/usr/share/kicad/library/eSim_Subckt'''
 
Hover the mouse on the top of the '''Part library''' editor window pointing '''/usr/share/kicad/library/eSim_Subckt'''
  
||The current library path of the library selected is displayed at the top of the '''Part Library''' editor window.
+
||The current '''library path''' of the '''library''' selected is displayed at the top of the '''Part Library editor''' window.
 
+
  
 
|-
 
|-
Line 376: Line 375:
 
Click on '''Create a new Component'''
 
Click on '''Create a new Component'''
  
Enter the component details
 
  
||To create a new component, click on '''Create a new Component''' icon from the top toolbar.
+
||To create a new '''component''', click on '''Create a new Component''' icon from the top toolbar.
 
   
 
   
 
A '''Component Properties''' window opens up.
 
A '''Component Properties''' window opens up.
 +
|-
 +
||Enter the component details
 +
||Enter the following.
  
Enter the following.
+
'''Component name''' as '''HA underscore new'''.
 
+
'''Component name''' as '''HA''' underscore '''new'''.
+
  
 
'''Default Reference Designator''' as '''X'''.
 
'''Default Reference Designator''' as '''X'''.
  
The ''designator''is different for each '''eSim''' component.  
+
The '''designator''' is different for each '''eSim component'''.  
''D'' is used for ''Diode''.  
+
'''D''' is used for '''Diode'''.  
''Q'' is used for ''BJT'' and so on.
+
'''Q''' is used for '''BJT''' and so on.
  
 
Keep the default settings.
 
Keep the default settings.
Line 400: Line 399:
 
Place the cursor on text and press '''F1'''
 
Place the cursor on text and press '''F1'''
  
||Press '''F1''' key to zoom in the ''schematic name'' and ''designator''.
+
||Press '''F1''' key to zoom in the '''schematic name''' and '''designator'''.
  
You can add a '''rectangle''', '''circle''', '''arc''' or '''polygons''' as the component body.
+
You can add a '''rectangle, circle, arc''' or '''polygons''' as the '''component body'''.
  
 
|-
 
|-
Line 414: Line 413:
 
click and end
 
click and end
  
||I will add a ''rectangle'' as a component body.
+
||I will add a '''rectangle''' as a '''component body'''.
  
 
Click on '''Add graphic rectangle to component body''' tool from the right toolbar.
 
Click on '''Add graphic rectangle to component body''' tool from the right toolbar.
  
Click on the ''editor''.
+
Click on the '''editor'''.
  
Click and drag the ''rectangle''.
+
Click and drag the '''rectangle'''.
  
Click again to end the ''rectangle'' body.
+
Click again to end the '''rectangle body'''.
  
 
|-
 
|-
Line 428: Line 427:
 
Place cursor on '''Ha_new''' and press ''M'' >>  
 
Place cursor on '''Ha_new''' and press ''M'' >>  
  
||Arrange the designator and name of the component.
+
||Arrange the '''designator''' and name of the '''component'''.
  
Place the cursor on the ''name'' and ''designator'' and press the key '''M'''.
+
Place the cursor on the '''name''' and '''designator''' and press the key '''M'''.
  
 
|-
 
|-
Line 436: Line 435:
 
Click on '''Add pins to component''' >>  
 
Click on '''Add pins to component''' >>  
  
click on the ''editor''.
+
Click on the '''Editor'''.
  
||Now add input and output pins.
+
||Now add '''input''' and '''output pins'''.
  
 
Click on '''Add pins to component''' tool from the right toolbar.
 
Click on '''Add pins to component''' tool from the right toolbar.
  
Click on the ''editor''.
+
Click on the '''Editor'''.
  
 
'''Pin Properties''' window will appear.
 
'''Pin Properties''' window will appear.
Line 464: Line 463:
 
Click on the '''OK''' button in the window.
 
Click on the '''OK''' button in the window.
  
The pin is tied to the cursor. Connect it as shown.
+
The '''pin''' is tied to the cursor. Connect it as shown.
  
 
|-
 
|-
 
||Part Library Editor:
 
||Part Library Editor:
Click on editor
+
Click on '''editor'''
  
 
Add '''Pin 2''' properties.
 
Add '''Pin 2''' properties.
  
||Click on the ''editor'' again.
+
||Click on the '''editor''' again.
  
 
In a similar way, add '''Pin number 2''' with '''Pin name''' as '''B'''.
 
In a similar way, add '''Pin number 2''' with '''Pin name''' as '''B'''.
Line 479: Line 478:
 
||'''Part Library Editor:'''
 
||'''Part Library Editor:'''
  
Click on editor
+
Click on '''editor'''
  
 
Add '''Pin 3''' properties.
 
Add '''Pin 3''' properties.
  
||Click again on the ''editor''.
+
||Click again on the '''editor'''.
  
 
Enter the following.
 
Enter the following.
Line 516: Line 515:
 
Click '''Yes'''
 
Click '''Yes'''
  
||Let us ''save'' the schematic symbol.
+
||Let us save the '''schematic symbol'''.
  
 
Click on '''File''' option from the top menu.
 
Click on '''File''' option from the top menu.
Line 524: Line 523:
 
Click the '''Yes''' button in the '''confirmation''' box.
 
Click the '''Yes''' button in the '''confirmation''' box.
  
You can see here, the component is added to '''eSim''' underscore '''Subcircuit''' library.
+
You can see here, the '''component''' is added to '''eSim underscore Subcircuit library'''.
  
 
Click once again the '''Yes''' button in the '''confirmation''' box.
 
Click once again the '''Yes''' button in the '''confirmation''' box.
Line 534: Line 533:
 
choose '''Quit'''
 
choose '''Quit'''
  
||Close the '''Part Library''' editor window.
+
||Close the '''Part Library editor''' window.
 
+
  
 
|-
 
|-
 
||'''eSim_Subciruit library file:'''
 
||'''eSim_Subciruit library file:'''
  
||The '''eSim''' underscore '''Subckt''' library file is found in the '''Kicad''' library as shown here.
+
||The '''eSim underscore Subckt library''' file is found in the '''Kicad''' library as shown here.
  
As you can see the component '''HA''' underscore '''new''' is defined here.  
+
As you can see the '''component HA underscore new''' is defined here.  
  
If you want to ''delete'' any component, you can also delete the component in this file.
+
If you want to delete any '''component''', you can also delete the '''component''' in this file.
  
 
|-
 
|-
 
||'''eSim Main Window:'''
 
||'''eSim Main Window:'''
  
||Now we can verify the created ''Subcircuit'' and its component schematic.
+
||Now we can verify the created '''Subcircuit''' and its '''component schematic'''.
  
You can use the '''Half Adder''' example project from the '''eSim''' ''Examples'' folder or create a new project.
+
You can use the '''Half Adder''' example project from the '''eSim Examples''' folder or create a new project.
  
 
|-
 
|-
Line 557: Line 555:
 
Code File
 
Code File
  
||You can also download the example '''HA''' underscore '''Test''' from the '''Code''' file section.
+
||You can also download the example '''HA underscore Test''' from the '''Code''' file section.
  
You can verify the component and subcircuit created.
+
You can verify the '''component''' and '''subcircuit''' created.
  
 
|-
 
|-
Line 565: Line 563:
 
Adding '''HA''' underscore '''Test'''.
 
Adding '''HA''' underscore '''Test'''.
  
||I have created a new project '''HA''' underscore '''Test'''.
+
||I have created a new project '''HA underscore Test'''.
  
The project is already added to '''eSim''' windows under the '''Project''' section.
+
The project is already added to '''eSim''' window under the '''Project''' section.
  
 
Select '''HA test''' and click on the '''Open schematic''' button from the left toolbar.
 
Select '''HA test''' and click on the '''Open schematic''' button from the left toolbar.
Line 575: Line 573:
 
Open the schematic of '''HA''' underscore '''Test'''
 
Open the schematic of '''HA''' underscore '''Test'''
  
||It directs us to the '''eSim''' schematic window.
+
||It directs us to the '''eSim schematic''' window.
  
You can see, the '''HA''' underscore '''new''' component will be present under '''eSim_Subckt''' library.
+
You can see, the '''HA underscore new component''' will be present under '''eSim_Subckt library'''.
 
   
 
   
 
|-
 
|-
Line 585: Line 583:
 
||Let us go back to the '''eSim''' window.
 
||Let us go back to the '''eSim''' window.
  
In the '''Kicad to Ngspice''' analysis tab, I have already specified '''transient''' parameters.
+
In the '''Kicad to Ngspice analysis''' tab, I have already specified '''transient parameters'''.
  
 
In the '''Source details''' tab, the '''voltage sources''' are assigned as '''5''' volts.
 
In the '''Source details''' tab, the '''voltage sources''' are assigned as '''5''' volts.
  
In the '''Subcircuit''' tab, the path of the '''Halfadder''' underscore '''new''' is added.  
+
In the '''Subcircuit''' tab, the path of the '''Halfadder underscore new''' is added.  
  
 
|-
 
|-
 
||'''Ngspice window:'''
 
||'''Ngspice window:'''
  
||You can see the '''Ngspice''' ''plots'' and ''terminal''.
+
||You can see the '''Ngspice plots''' and '''terminal'''.
  
Since both the inputs are '''5''' volts, '''Sum''' will be '''0''' and '''carry''' will be '''5''' volts.
+
Since both the '''inputs''' are '''5''' volts, '''Sum''' will be '''0''' and '''carry''' will be '''5''' volts.
  
You can also see the values in the '''Ngspice''' terminal.
+
You can also see the values in the '''Ngspice terminal'''.
  
Close the '''Ngspice''' terminal and plots.
+
Close the '''Ngspice terminal''' and '''plots'''.
  
 
|-
 
|-
 
||'''Python window:'''
 
||'''Python window:'''
  
||In  the '''Python''' plot window, check the '''Sum''' and '''Cy''' node.
+
||In  the '''Python plot''' window, check the '''Sum''' and '''Cy''' node.
  
 
Click on the '''Plot''' button.
 
Click on the '''Plot''' button.
Line 611: Line 609:
 
The '''sum''' is '''0''' volts and '''Carry''' is '''5''' volts.
 
The '''sum''' is '''0''' volts and '''Carry''' is '''5''' volts.
  
Close the '''Python''' plot window.
+
Close the '''Python plot''' window.
  
 
|-
 
|-

Latest revision as of 16:57, 7 August 2020

Subcircuit Builder in eSim

Author: Gloria N

Keywords: eSim, Subcircuit, KiCad, Eeschema, Subcircuit, Part library, Schematic, Half adder, Subcircuit, Pin, Port


Visual cue Narration
Show Slide:

Opening Slide

Welcome to the spoken tutorial on Subcircuit Builder in eSim.
Show Slide:

Learning Objectives

In this tutorial, using eSim we will learn to-
  • Create a Subcircuit and
  • Create a Component Schematic.
Show Slide:

Systems Requirements

To record this tutorial, we will use-
  • Ubuntu Linux OS version 16.04
  • eSim version 2.0
Show Slide:

Pre-requisites

To practice this tutorial, you should know how to create and simulate a circuit in eSim.

If not, watch the prerequisite eSim tutorials on this website.

Show Slide:

General form of Subcircuit

The subcircuit file always begins with the dot SUBCKT statement.

Subname is the subcircuit component name.

N1,N2 are the nodes.

The subcircuit ends with dot Ends followed by the subcircuit name.

System Computer:

Desktop icon

To launch eSim, you need to double-click on the eSim icon on your Desktop.
System Computer:

eSim startup window

I have already opened eSim.
eSim Main Window:

Creating Subcircuit

Let us now create a Subcircuit for a Half adder.
eSim Main Window:

Click on Subcircuit

On the eSim window, click on the Subcircuit button from the left toolbar.

A subcircuit tab will open up.

Subcircuit tab:

Click on New Subcircuit Schematic >>

Enter Schematic Name as Halfadder_new>>

click OK

In the Subcircuit tab, click on the 'New Subcircuit Schematic' button.

A New Schematic pop up window appears.

Enter Schematic Name as Halfadder underscore new.

Click on the OK button.

eSim Schematic Window:

Click Yes

Now, click the Yes button in the confirmation dialog box.

The schematic editor window opens up.

The user can create a schematic or import an existing schematic.

We will use the latter method.

To create a new schematic, you can refer to the previous tutorials in this series.

Slide show:

Adding Half_adder_basic_gates from the Code file section.

I have already created a Half adder circuit using basic gates in eSim.

Pause the video here.

Download the Half Adder Basic Gates project file from the Code file section.

Extract and save the project file on the Desktop.

eSim Schematic Window:

Click on File>>

Click on Append Schematic Sheet>>

Click Yes

Click on Desktop>>

Double click on 'Half_adder_basic_gates >>

Select 'Half_adder_basic_gates.sch >>

click Open

On eeschema, click on the File option from the top menu.

Select Append Schematic Sheet option.

In the Confirmation dialog box, click on the Yes button.

Click on Desktop.

Double-click on Half adder basic gates folder.

The schematic file, sch will be selected.

Click on the Open button in the file window.

You can see the schematic of the Half adder is added to the editor.

eSim Schematic Window:

Zoom in the schematic

Press the F1 key, to zoom in the schematic.
eSim Schematic Window: Now we will connect ports to the input and output terminals of the gates.
eSim Schematic Window:

Click on Place Component Tool >>

click on editor>>

In the Filter field, type eSim_Miscellaneous >>

Select PORT >>

click on the Port drop-down>>

choose Unit A >>

click OK

Click on the Place component tool from the right toolbar.

Click on the editor.

In the Filter field, type eSim underscore Miscellaneous.

Select PORT and press the drop-down arrow.

Click on Unit A and click on the OK button.

Port Unit A will be tied to the cursor.

eSim Schematic Window:

Adding PORT A and PORT B

Place it near the input pin 1 of the XOR gate.

Similarly, place Port Unit B, near the input pin 1 of the AND gate.

eSim Schematic Window:

Adding PORT C and PORT D

Place Port Unit C and Port Unit D near the output pin of the XOR gate and AND gate respectively.

Here the Port unit indicates pins of the subcircuit.

Unit A is pin 1, Unit B, C and D are the pin number 2, 3, 4 of the subcircuit respectively.

eSim Schematic Window:

Rotating PORT C and PORT D

To rotate the Port C, place the cursor on Port Unit C and press the R key.

A clarify selection pop-up window appears.

Select Port U and press the R key.

Similarly, rotate Port D.

eSim Schematic Window:

Place cursor on Port A, pin1>>

press W key, to start the wire

connect it to the wire connecting Pin 1 of Xor gate and And gate>>

Click once to end the wire

Connect the ports to the pins with wires.

Place the cursor on the pin1 of PORT A and press the W key to start the wire.

Drag it to the wire connecting the pin 1 of XOR gate and AND gate.

Click once to end the wire.

A junction will be placed on the wire.

Similarly, connect all the ports to the pins as shown here.

eSim Schematic Window:

Click on Annotate >>

click OK

Let us now Annotate the schematic.

Click on the Annotate schematic components icon from the top toolbar.

Keep the default settings.

Click on the Annotate button.

Click on the OK button.

eSim Schematic Window:

Press Ctrl+S keys together

Save the schematic by pressing Ctrl+S keys together.
eSim Schematic Window:

Click Generate netlist>>

select Spice tab >>

check Default format>>

click on Generate.

Click Save

Let us generate a netlist for the schematic.

Click on the Generate netlist icon from the top toolbar.

Select the Spice tab and check the Default format.

Click on Generate button and then click the Save button.

This creates a KiCad netlist file.

Subcircuit tab:

Click on Convert Kicad to Ngspice

Now, let us go back to the eSim window.

In the Subcircuit tab, click on the Convert Kicad to Ngspice button.

Subcircuit tab:

Point to transient analysis parameters

You can specify the transient analysis parameters or leave it blank.

I am leaving these values blank.

Subcircuit tab:

Highlight Device modeling and Subcircuit tab.

If any Device model or Subcircuit is used, specify them under Device modeling or Subcircuit tab.
Subcircuit tab:

Press Convert >>

Click OK

In the KiCad to Ngspice tab, press the Convert button.

Click on the OK button in the Information dialog box.

This creates a Ngspice netlist of the subcircuit created.

eSim Subcircuit Library: You can see, the subcircuit Half Adder new is added to the subcircuit library in the eSim directory.
eSim Schematic Window: Now, let us create a component schematic for the Half Adder subcircuit.

The components are also referred to as Parts or symbols.

eSim Schematic Window:

Go back to the eSim editor of Half Adder schematic.

Click on Tools>>

Click on Library Editor

Click on the Library Editor icon from the top toolbar.

The schematic window of the Part Library Editor opens up.

You can also find the Library Editor option from the Tools option on the top menu.

Part Library Editor window:

Click on File>>

click on Current Library>>

choose eSim_Subckt>>

click OK

Click on the File option from the top menu.

Click on the Current Library option.

Choose eSim underscore Subckt option.

Click on the OK button.

Part Library Editor window:

Hover the mouse on the top of the Part library editor window pointing /usr/share/kicad/library/eSim_Subckt

The current library path of the library selected is displayed at the top of the Part Library editor window.
Part Library Editor window:

Click on Create a new Component


To create a new component, click on Create a new Component icon from the top toolbar.

A Component Properties window opens up.

Enter the component details Enter the following.

Component name as HA underscore new.

Default Reference Designator as X.

The designator is different for each eSim component. D is used for Diode. Q is used for BJT and so on.

Keep the default settings.

Click on the OK button in the window.

Part Library Editor window:

Place the cursor on text and press F1

Press F1 key to zoom in the schematic name and designator.

You can add a rectangle, circle, arc or polygons as the component body.

Part Library Editor window:

Click on Add graphic rectangle to component body from right toolbar>>

click on editor

Click and drag >>

click and end

I will add a rectangle as a component body.

Click on Add graphic rectangle to component body tool from the right toolbar.

Click on the editor.

Click and drag the rectangle.

Click again to end the rectangle body.

Part Library Editor window:

Place cursor on Ha_new and press M >>

Arrange the designator and name of the component.

Place the cursor on the name and designator and press the key M.

Part Library Editor window:

Click on Add pins to component >>

Click on the Editor.

Now add input and output pins.

Click on Add pins to component tool from the right toolbar.

Click on the Editor.

Pin Properties window will appear.

Part Library Editor window:

Enter properties of pin A

Enter:

Pin name as A.

Pin Number as 1.

Orientation as Right.

Electrical Type as Input.

Graphic Style as Line.

Click on the OK button in the window.

The pin is tied to the cursor. Connect it as shown.

Part Library Editor:

Click on editor

Add Pin 2 properties.

Click on the editor again.

In a similar way, add Pin number 2 with Pin name as B.

Part Library Editor:

Click on editor

Add Pin 3 properties.

Click again on the editor.

Enter the following.

Pin name as Sum.

Pin Number as 3.

Orientation as left.

Electrical Type as output.

Graphic Style as Line.

Click on the OK button.

Part Library Editor:

Add Pin 4 properties.

In a similar way add Pin number 4 with Pin name Cy.
Part Library Editor window:

Click on File >>

click on Save Current Library

Click Yes >>

Click Yes

Let us save the schematic symbol.

Click on File option from the top menu.

Click on the Save Current Library option.

Click the Yes button in the confirmation box.

You can see here, the component is added to eSim underscore Subcircuit library.

Click once again the Yes button in the confirmation box.

Part Library Editor window:

Click on File from top menu>>

choose Quit

Close the Part Library editor window.
eSim_Subciruit library file: The eSim underscore Subckt library file is found in the Kicad library as shown here.

As you can see the component HA underscore new is defined here.

If you want to delete any component, you can also delete the component in this file.

eSim Main Window: Now we can verify the created Subcircuit and its component schematic.

You can use the Half Adder example project from the eSim Examples folder or create a new project.

Slide Show:

Code File

You can also download the example HA underscore Test from the Code file section.

You can verify the component and subcircuit created.

eSim Main Window:

Adding HA underscore Test.

I have created a new project HA underscore Test.

The project is already added to eSim window under the Project section.

Select HA test and click on the Open schematic button from the left toolbar.

eSim Schematic editor:

Open the schematic of HA underscore Test

It directs us to the eSim schematic window.

You can see, the HA underscore new component will be present under eSim_Subckt library.

eSim Main Window:

Analyzing the HA_test project

Let us go back to the eSim window.

In the Kicad to Ngspice analysis tab, I have already specified transient parameters.

In the Source details tab, the voltage sources are assigned as 5 volts.

In the Subcircuit tab, the path of the Halfadder underscore new is added.

Ngspice window: You can see the Ngspice plots and terminal.

Since both the inputs are 5 volts, Sum will be 0 and carry will be 5 volts.

You can also see the values in the Ngspice terminal.

Close the Ngspice terminal and plots.

Python window: In the Python plot window, check the Sum and Cy node.

Click on the Plot button.

The sum is 0 volts and Carry is 5 volts.

Close the Python plot window.

Show Slide:

Summary

In this tutorial, we learnt how to,
  • Create a Subcircuit and
  • Create a Component Schematic.
Show Slide:

Forum to answer questions

https://forums.spoken-tutorial.org/

Do you have questions in this Spoken Tutorial?

Please visit this site.

Show Slide:

FOSSEE Forum

https://forums.fossee.in/

For any general or technical questions on eSim, visit the FOSSEE forum and post your question.
Show Slide:

Circuit Simulation

https://esim.fossee.in/circuit-simulation-project

The FOSSEE team coordinates the Circuit Simulation project.

We give Certificates and Honorarium to the contributors.

For more details, please visit this site.

Show Slide:

Lab Migration

https://esim.fossee.in/lab-migration-project

The FOSSEE team coordinates the Lab Migration project.

For more details, please visit this site.

Show Slide:

Acknowledgment

http://spoken-tutorial.org

Spoken Tutorial Project is funded by NMEICT, MHRD, Govt. of India.

For more details, visit this site.

Thank you slide This is Gloria N from IIT Bombay signing off.

Thank you

Contributors and Content Editors

Glorianandihal, Nancyvarkey