Tutorial: Introduction to Modeling with Spice

Learn how to design a Band Pass Filter with components from the Spice block library and simulate the model with the Spice solver.

Attention: Available only with Activate commercial edition.

Files for This Tutorial

SpiceBandPassFilter.scm

A finished version of the models you build in the tutorials along with any files required to complete the tutorials are available at this location: <installation_directory>/tutorial_models/

Overview of the Band Pass Filter

Band pass filters are widely used in wireless transmitters and receivers to pass and block frequencies within a certain range. The main purpose of the filter is to refine a noisy signal into an ideal signal within a set of frequencies.



The model that you build for this tutorial includes a low-pass filter (passive) and amplifier. Your goal is to remove the high-frequency signal and keep only frequencies in the pass band. You will set the cut frequency (fc) to 50hz and amplify the signal by 10x.



Design the Low Pass Filter

Construct the low-pass filter portion of your band-pass filter model. Include a resistor and capacitor.

  1. From Activate, select File > New.
  2. Select File > Save. Navigate to your working directory. For File name, enter SpiceBandPassFilter.
    Your model is saved as SpiceBandPassFilter.scm in the specified directory.
  3. In the Palette Browser, from Spice > Analog > Basic, drag one Resistor block into the current diagram and double-click the block.
  4. For Resistance, enter 256000 Ohm, then click OK.
  5. On the model, select the Resistor block to change its orientation.
  6. On the ribbon, select the left arrow on the Orient tool:


    The resister rotates to the left:



  7. In the Palette Browser, from Spice > Analog > Basic, drag one Capacitor block into the current diagram, then double-click the block.
  8. For Device capacitance, enter 1.2e-8, then click OK.
  9. In the Palette Browser, from Spice > Analog > Basic, drag one Ground block into the current diagram.
  10. Connect the components as follows:


    The low-pass filter of the electrical schematic of the BandPassFilter model is complete.

Design the Non-Inverting Unity Amplifier

Create a non-inverting unity amplifier with a Voltage Controlled Voltage Source (VCVS).

  1. In the Palette Browser, from Spice > Analog > Basic, drag one VCVS block into the current diagram and double-click the block.


  2. In the block dialog, for Gain, enter 10.0, then click OK.
  3. Connect the amplifier to the low-pass filter.


    Your model should look something like this:


    Next define the source for the excitation by combining the three sinusoidal signals at different frequencies.

  4. Add the following blocks to your model from the Palette Browser:
    • From Activate > SignalGenerators, drag three SineWaveGenerator blocks into the diagram.
    • From Activate > MathOperators, drag one Sum block into the diagram.
      Note: Choose the Sum block that has ports on the left side.


  5. Double-click the Sum block and define these parameters:
    • For Number of inputs, enter 3.
    • For each input port, select the '+' operator.
    • Keep the default values for all other parameters.


  6. Connect the blocks you just added to the model. Note that the converter is automatically added between the Sum block and the Resistor.


  7. Define each of the SineWaveGenerator blocks as follows:
    For this block Enter this value for Frequency (rad/s)
    SineWaveGenerator 1 62.8 rad/s (=10Hz)
    SineWaveGenerator 2 62.8 e3 rad/s (=10Hz)
    SineWaveGenerator 3 62.8 e6 rad/s (=1MHz)
    Keep the defaults for any remaining parameters.
  8. In the Palette Browser, from Activate > SignalViewers, drag one Scope block into the current diagram and double-click the block.
  9. For Number of inputs, enter 2.
  10. Connect the Scope block to the model. Note that the converters from the model to the Scope are automatically added to the model.


  11. Save your model.

Simulating the Diagram

  1. On the ribbon, select Setup.


  2. On the dialog that appears, select the Simulation Time tab.
  3. For Final Time, enter .25 seconds. This simulation run time should be sufficient to capture the lowest frequency (10Hz) of the model two times.

    Your model is complete, and you are ready to simulate it!

  4. On the ribbon, select Run.


    The Scope block in the model should generate a plot that looks something like this:

    The plot shows that the low-pass filter removed the high-frequency signal and passed only the frequencies that were less than 50 Hz. The signal in the pass band was amplified by 10.

  5. Experiment with the diagram by modifying the block parameters and evaluating their effect on the simulation results.