ESim/C2/Simulating-an-Astable-Multivibrator/English

From Script | Spoken-Tutorial
Revision as of 17:27, 30 August 2019 by Saurabhbansode (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Simulating Astable Multivibrator

Author: Saurabh Bansode

Keywords: video tutorial, eSim, EDA, schematic, simulation, Design, Spice models, ngspice, kicad, analysis, transient


Visual cue Narration
Show Slide:

Opening Slide


Welcome to the spoken tutorial on “Simulating Astable Multivibrator in eSim”.
Show Slide:

Learning Objectives

In this tutorial, we will -


  • Create and simulate an Astable Multivibrator.
  • Understand .cir and .cir dot out files.
  • Observe and understand the Ngspice terminal.


Show Slide:

Systems Requirements

To record this tutorial, we will use-*
Ubuntu Linux OS 16.04
  • eSim version 1.1.2


Show Slide:

Prerequisites

To practice this tutorial, basic knowledge of electronics is required.
Show Slide:

Circuit Diagram

Earlier, we learnt how to create a schematic for an RC circuit.


Now I am going to reinforce the idea with an Astable Multivibrator circuit.


The Astable Multivibrator circuit is as shown.


Watch me for the next one minute as I create this circuit in eSim.

<<FAST-FORWARD>> A considerable part of this activity has been fast forwarded.


I am placing a few components and making a few connections.


It is expected that you know how to create a schematic in eSim.


In case you do not know, please watch the prerequisite tutorials.

Show Slide:

Download Code File

The partially made circuit schematic is available in the Code files link.


Pause the video to download and extract the code files on your Desktop.


We will use the downloaded code file to practice the rest of the tutorial.

eSim Main Window: Launch eSim on your machine.


I have already opened eSim.

Click on Open Project >>Browse To Desktop >>click on AstableMultivibrator>>click on Open Click on Open Project on the left toolbar.



Browse to Desktop and click on AstableMultivibrator.


Then click on the Open button.

eSim Main Window:

Click on Open Schematic

Click on the Open Schematic button on the left toolbar.
Schematic Editor Window:

Press F1 to zoom in.





Press Esc key >> click on View >> select Fit on Screen

Press the F1 key to zoom into the schematic.


If you have zoomed in or zoomed out too much, fit the schematic back to default.


To do this, press the Esc key, and click on the View option on the top left toolbar.


Select the Fit on Screen option.


It will fit the schematic back to its default resolution.

Point to the connections Several connections are already made.
Let us connect the remaining components.
eSim Schematic Window:

Hover the mouse over the end points of eSim_LED and eSim_R present on the right hand side of the schematic.

The wires should be connected end-to-end for the components, not external outlines.
I will demonstrate a common mistake now.
eSim Schematic Editor:

Select the Place Wire tool from right toolbar.


Click on unconnected resistor, on the right side of the schematic.


Drag cursor till the horizontal line of the eSim_LED

Select the Place Wire tool from right toolbar.



I have clicked on one end of eSim_R.



I will drag it to the exterior outline of the eSim_LED and double click to end the wire.

eSim Schematic Editor:

Zoom and point to the empty square block.


Press Ctrl+Z

The empty green box shows that the connection is not proper.



Press Ctrl and Z keys simultaneously to undo the changes just made.

Let us properly connect the eSim_LED present on the right side of the schematic.
Schematic Editor Window:

Click on Place Wire:

Click on Place Wire tool on the right toolbar.
Click on unconnected node of the resistor

>>

Drag cursor till the Node 1 of eSim_LED>>

Click on the unconnected node of the resistor.

Then drag the cursor till node 1 of eSim_LED

click once on the eSim_R node



Press Esc key

Click once on the eSim_LED node to place the wire.

Press Esc key.

Schematic Editor Window:

Click on Place Wire:

>>Click on Node 2 of eSim_LED

>> Drag the cursor till the wire connecting adjacent transistor and capacitor>>Click once on the existing wire >> press the Esc key

Select the Place Wire tool and click on the node 2 of eSim_LED.

Drag the cursor till the wire connecting the adjacent transistor and capacitor.



Click once on the existing wire.

Now press the Esc key.

Schematic Editor:

Zoom into the junction and hover the mouse over it.

If the wires are placed properly, you will see a green dot where the wires intersect.

This is called a junction.

Schematic Editor:

Right click on plot_v1

>>Select Copy Component >>

Click once on the editor.

Right-click on plot_v1 and select the Copy component option.

Plot_v1 will be tied to the cursor.

Drag the cursor near the LED on the right side>>click once to Place it next to the LED Drag the cursor near the LED on the right side.

Place it next to the LED by clicking once on the editor.

Schematic Editor:

Select Place Global Label option from the right toolbar >>click once on editor>>

Enter LED2>>Click OK>>

Click on Place Global Label on the right toolbar to place a global label.

Click once on the editor.

Type the text LED2 and click on OK.

LED2 global label will be tied to the cursor.

Click once near the LED. Place the LED2 global label near the LED on the right side by clicking on the editor once.

Rotate the Global label if required.

Schematic Editor:

Right click on eSim_CP1>>

Choose Edit Component>>

choose Value >>

erase eSim_CP1 and type 22u

>>Click on OK

Right-click on eSim_CP1.


Choose the Edit Component option, and select Value.


Erase the value eSim_CP1 using Backspace key and type 22u.


Click on OK.


Note that we are using polarised capacitor.

Schematic Editor:

Place cursor on eSim_R>>

Press the key V >> erase eSim_R and type 1k

>>

Click on OK

Right-click on eSim_R.


Place the cursor on Edit Component, and select the value option.


Erase the value eSim_R using Backspace key and type 1k.


Click on OK.

Schematic Editor:

Hover mouse over DC source

We will assign a value to the DC source later.
Schematic Editor:

Select Place wire tool>> Click on plot_v1, drag till junction>>click once>>click once on LED2>>drag till junction and click once


Connect plot_v1 and LED2 global label to the junction as shown.
Schematic Editor:

Click on Annotate Schematic>>

Click on Annotate >> Click OK>> Press Ctrl and S keys simultaneously


Click on Annotate Schematic tool on the top toolbar.


Click on Annotate option, and then on OK.

Schematic Editor:

Click on Perform electrical Rules check >>Click on Run

Click on Perform electrical Rules check on the top toolbar.


Then click on Run.

ERC Window:

Click Delete markers>>

Click Close

We can see three warnings regarding Global label, which can be ignored.


Click on Delete Markers and click on Close.


Press Ctrl and S keys simultaneously to save the work.


More information on ERC errors is given in the Additional Reading Material of this tutorial.

Schematic Editor WIndow:

Click Generate netlist >>

Click on Generate Netlist on the top toolbar.
Generate Netlist WIndow:

spice tab >> check Default >> click on Generate >> Click Save.

Click on Spice tab, and check the Default Format option.


Then click on Generate option, and click on Save.

Now I will switch back to eSim main window.
eSim Main window:

Double click on AstableMultivibrator>>

Click on KicadtoNgspice

Double-click on AstableMultivibrator.


Click on Convert kicad to ngspice convertor.

Kicad to Ngspice Converter:

Analysis Tab

Show:


Highlight the values entered.

Start Time 0

Step Time 10 milliseconds

Stop Time 12

Type the values for transient parameters as shown.
Kicad to ngspice convertor

Window: Click on source details tab

Click on source details tab.
Kicad to ngspice convertor

Window:

Source Details Tab

Type the value of DC source as 9.


You should enter only numeric values of voltages.

Kicad to Ngspice Converter:

Device Modeling tab:


Click on Add >> Double click on Diode folder >> select LED.lib >> click on Open

Click on Device Modeling tab.


Click on the Add button under d1:esim_led.


Double-click on Diode folder, select LED.lib file and click on the Open Button.

Similarly add the library files for d2:esim_led
Kicad to Ngspice Converter:

Device Modeling tab:

Click on Add >> Double click on Transistor folder >> select BC547B.lib >> click on Open

Click on the Add button under q1:esim_npn.


Double-click on Transistor folder, select BC547B.lib and click on the Open button.

Similarly add the library files for q2:esim_npn
Kicad to Ngspice Converter:

Device Modeling tab:

Click on Convert >> Click OK

Now press the Convert button to convert the KiCad netlist to Ngspice netlist.


A confirmation dialog box appears, click on OK.

eSim Main Window:

Click on Simulation.

Click on simulation on the eSim toolbar to simulate the example.
Ngspice Terminal:


Highlight the LED1 node and its voltage value.

Ngspice terminal and plot windows open along with a python plot window.


Ngspice terminal shows the values of the voltages at the nodes.



Type plot v(LED1)+v(LED2) >> press Enter.

Ngspice commands can be entered to see plots in this terminal.


Type the following text in the ngspice terminal as shown and press the Enter key.

Hover the mouse over LED1+LED2 voltage plots. We can see the voltage at nodes LED1 and LED2 combined in a single plot.
Any error will be displayed on the terminal or the value will be replaced with a question mark.
I will switch to Python Plot window now.
Python Plot Window:

Click on LED1, LED2 and IN.

>>Click on plot.

Click on LED1, LED2 and IN checkboxes in the python plot window.


Scroll down and click on plot button.

If analysis time parameters are not set properly, Python Plotting error will be generated.


For this particular circuit, step time is in milliseconds.

eSim Main Window:


Right click on AstableMultivibrator>> select the refresh option>>Double-click on AstableMultivibrator.cir

Right click on AstableMultivibrator and select the refresh option


The .cir file shows the netist file of the schematic.


It contains the information about the node connection and values of components.

eSim Main Window:

Double click on AstableMultivibrator.cir.out





Highlight the .tran 10e-03 12e-00 0e-00 text

The cir.out file is passed to ngspice for running simulations.


It contains information about the device and subcircuit models used in the KiCad to Ngspice conversion tool.


It also contains the analysis time parameters.

Let us summarize.
Show Slide:

Summary

In this tutorial, we learnt to-*
Create and simulate an Astable Multivibrator.
  • Understand .cir and .cir dot out files.
  • Observe and understand the Ngspice terminal.


Show Slide:

Forum

Please post your timed queries in this forum.
Show Slide:

FOSSEE Forum

Please post your general queries on eSim in this forum.
Show Slide:

Lab Migration

FOSSEE team coordinates the Lab Migration project.
Show Slide:

Circuit Simulation Project

FOSSEE team coordinates the Circuit Simulation Project.
Show Slide:

Acknowledgment


https://spoken-tutorial.org

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


For more details, visit this website.

Previous slide


This is Saurabh from IIT Bombay, signing off.

Thank you.

Contributors and Content Editors

Nancyvarkey, Saurabhbansode