Lab 1
Lab 1
A.1 Installation
Introduction: Ngspice is a mixed-level/mixed-signal circuit simulator based on three open source software
packages: Spice3f5, Cider1b1 and Xspice. Spice3 is the most famous and used circuit simulator developed
University of California at Berkeley (UCB).
We will be using the latest version, viz. NGSPICE, Ver 34 (Jan 2021). In case you have an earlier version of
NGSPICE, it should be ok, since we will be using only the basic commands.
In the above webpage, see the section <Ngspice installation (quick intro)= for the link for MS Windows (64 bit,
Windows 10) version. Expand the contents of the zip file to an arbitrary location on your computer, e.g. to D:\.
For installing ngspice on Linux, macOS and other OSs please see:
http://ngspice.sourceforge.net/packages.html
Download the following NGSPICE resources (Tutorial Slide and SPICE files)
http://wel.ee.iitb.ac.in/teaching_labs/WEL%20Site/ee236_temp/ngspice.html
Download NGSPICE Video Tutorial for NGSPICE Linux version (see under Expt 1, Download links)
http://wel.ee.iitb.ac.in/teaching_labs/WEL%20Site/ee236_temp/labsheets_2019.html
WEL Lab resources on NGSPICE are copied in the following Google drive
https://drive.google.com/drive/folders/19tCwquDaB4wkwRbvcO-GF_t6GAC4S0vB?usp=sharing
Downloaded by D ([email protected])
lOMoARcPSD|52618558
1. Windows 10 version:
Run NGSPICE (from Spice64/bin folder) by double-clicking 8ngspice.exe9. You will see the following.
Downloaded by D ([email protected])
lOMoARcPSD|52618558
3. Familiarize yourself with the basic functions of NGSPICE, by creating and running all the examples
given in the Tutorial video. You need to be familiar with the commonly used analysis commands (.op,
.dc, .tran, .ac). You need not do the last example in the Tutorial video (Opamp integrator).
4. Experiment 1 requires the use of sine and pulse waveforms. Familiarize yourself with the correct
format for these waveforms.
5. Experiment 1 comprises the following RC and RLC circuits: RC integrator, RC differentiator, RC Low-
pass filter, RC high-pass filter, RC bandpass filter and RLC bandpass filter.
Hint: Choose square pulse waveform with amplitudes as shown and use .tran analysis. Choose pulse width and
square waveform period as per the requirement. (T = input pulse width, and τ = RC time constant).
B.2 RC Differentiator
Simulate and plot time response of the RC differentiator circuit shown below for the indicated cases. Choose R
= 10 kΩ and C = 0.1 μF. Your plots should show both Vin and Vout. Ensure that Vout waveform has at least two or
three cycles of the steady state waveform.
.
Cases: i) T = 10 τ ; ii) T = 5 τ ; iii) T = 1 τ ; iv) T = 0.5 τ ; v) T = 0.1 τ ; vi) T = 0.05 τ
Downloaded by D ([email protected])
lOMoARcPSD|52618558
Specify an AC source with zero dc and ac amplitude 1V(Example: vin between nodes 1,0): vin 1 0 dc 0 ac 1
Note its peak amplitude, centre frequency(f0), and the lower (fL) and the upper(fH) -3 dB points. Compare your
simulation results with theory.
Downloaded by D ([email protected])
lOMoARcPSD|52618558
Note its peak amplitude, centre frequency(f0), and the lower (fL) and the upper(fH) -3 dB points. Compare your
simulation results with theory.
Measurements: First of all you need to decide the parameter to be measured. We shall use the DMM
primarily for measuring voltages and resistances. Choose the Voltage or Resistance function and the
appropriate range (based on the maximum expected magnitude) for the parameter. Choose the ranges
carefully.
Note: Resistance mode of the DMM assumes that there is no current flowing in the resistor. Take extra care
when using the resistance mode.
You may think of DMM essentially as a voltage measuring equipment. Resistances and currents are
converted into voltages by the DMM circuitry. AC voltages need to be < 400 Hz.
Input resistance of the DMM is 10 Mohms.
CROs/DSOs are useful in measuring signals up to their rated bandwidth. TDS 1002B has bandwidth of
60 MHz. However, DSOs cannot measure DC/AC voltages as accurately as a DMM. ADC Resolution for the
DSO vertical signal is typically 8 bits (as compared to 12 bits or more in a DMM).
Downloaded by D ([email protected])
lOMoARcPSD|52618558
For high frequency signals, and also for measuring fast rising waveforms, the 10X mode should be used. It is
best not to use 1X except when the input signal is < 20 mV.
CRO probe (10X mode) and the DSO input equivalent circuit
See the CRO schematic diagram shown. The input equivalent circuit of a CRO/DSO inputs is 1 MΩ (say R2) in
parallel with a capacitor (say C2). CRO probe is essentially a 8compensated attenuator9 used for compensating
the CRO/DSO input capacitance. In the 10X mode the probe introduces a 9 MΩ resistance (say R1) in series
with the signal. The probe has an adjustable Capacitor (say C1) connected parallel to R1. If the input resistance
of the DSO is R2 (= 1 MΩ) and the input capacitance is C2, then the signal at the DSO input (i.e. appearing
across R2) would be (Vin R2/(R1+R2)), when R1 C1 = R2 C2. In order to achieve this condition, the capacitor C1 in
the CRO probe is made adjustable. DSO front panels are provided with a 1 kHz Probe CAL Pulse signal.
Note: Students often mistake the CRO probe to a useful BNC cable, and are often tempted to use it in the
1X mode, and treat it like a BNC cable. This is a wrong practice as in the 1X mode the probe introduces an
LC circuit in series with the signal (to partially compensate for C2) which distorts the signal.
Downloaded by D ([email protected])
lOMoARcPSD|52618558
Lab Report
Due on July 31 (Sat) 8pm
• Your report should be written, section by section for each of the circuits of this experiment with circuit
diagrams, plots obtained using NGSPICE and your NGSPICE programs.
• Lab reports have to be submitted individually by all of you. We expect all of you to do your Lab report
work independently. Any copying and other malpractices will attract mark penalty.
• Line 1 of your NGSPICE programs should have your Roll no., Name and the Title of the program
• All the circuit diagrams should be drawn neatly with X-circuit or other electronic software for circuit
diagrams.
Downloaded by D ([email protected])