SPICE Shell

SPICE Shell #

The SPICE Shell in Breadpad provides direct access to the industry-standard SPICE (Simulation Program with Integrated Circuit Emphasis) simulation engine. This powerful feature allows advanced users to run custom simulations, modify circuit parameters, and perform analyses beyond what’s available in the standard oscilloscope interface.

What is SPICE? #

SPICE is a general-purpose, open-source analog electronic circuit simulator that models circuit behavior. It was originally developed at the University of California, Berkeley, and has become the foundation for most commercial circuit simulation software. Breadpad uses ngspice, a modern, open-source implementation of SPICE.

When to Use the SPICE Shell #

The SPICE Shell is ideal for:

  • Running custom analyses not available in the standard interface
  • Modifying component models for specialized behavior
  • Creating parametric or Monte Carlo simulations
  • Adding custom sources or waveforms
  • Defining and using subcircuits
  • Setting up complex simulation conditions
  • Accessing advanced convergence controls
  • Importing or exporting netlist files

Using the SPICE Shell in Breadpad #

Accessing the SPICE Shell #

  1. Build your circuit on the breadboard
  2. Open the oscilloscope and select “SPICE Shell” from the oscilloscope menu

Understanding the Interface #

The SPICE Shell interface consists of:

  • Netlist Editor: Shows the SPICE representation of your circuit
  • Command Input: Enter SPICE commands here
  • Results Area: Displays simulation output and messages
  • Plot Controls: Configure how simulation results are displayed

Working with Netlists #

A netlist is a text description of your circuit’s components and their connections:

  • Each component is defined by a name, nodes, and parameters
  • Component names start with a letter indicating the type (R for resistor, C for capacitor, etc.)
  • Nodes are identified by numbers or names
  • Comments start with an asterisk (*) or semicolon (;)

Example netlist line: R1 1 2 1k ; 1k resistor between nodes 1 and 2

Common SPICE Commands #

Here are some useful SPICE commands you can use in Breadpad:

  • .op - Perform operating point analysis
  • .tran <step> <stop> [<start> [<max-step>]] - Transient analysis
  • .dc <source> <start> <stop> <step> - DC sweep analysis
  • .ac <type> <points> <start> <stop> - AC small-signal analysis
  • .temp <temp1> [<temp2> ...] - Set simulation temperature(s)
  • .save <variables> - Specify outputs to save
  • .print <analysis> <variables> - Print specific variables
  • .plot <analysis> <variables> - Plot variables
  • .include <filename> - Include external files

Running Simulations #

  1. Review the automatically generated netlist for your circuit
  2. Add or modify SPICE commands as needed
  3. Click “Run Simulation” to execute
  4. View results in the plot area or text output

Advanced SPICE Features #

Component Models #

SPICE uses models to define component behavior. Breadpad includes many built-in models, but you can also define custom ones:

.model 2N2222 NPN(Is=1e-14 Bf=100 Cjc=5pF Cje=10pF Rb=10)

Subcircuits #

Define reusable circuit blocks with subcircuits:

.subckt opamp in+ in- out
* op-amp subcircuit definition
...
.ends

Analysis Controls #

Fine-tune simulation parameters:

.options reltol=1e-4 abstol=1e-9 itl1=100

Parametric Analysis #

Use parameters to easily modify and sweep values:

.param R1=1k
.step param R1 1k 10k 1k

Tips for Effective SPICE Shell Use #

  • Start with the auto-generated netlist and make small changes
  • Use comments to document your netlist for future reference
  • Save successful netlists for reuse in similar designs
  • Check node connections carefully when troubleshooting
  • Use .save all to capture all circuit variables
  • Review convergence options for difficult-to-simulate circuits
  • Use subcircuits to organize complex designs

Exporting and Importing Netlists #

  • Export: Save your netlist as a .spice file for use in other simulators
  • Import: Load existing SPICE files to simulate in Breadpad

Learning More About SPICE #

SPICE has a rich set of features beyond what can be covered here. For further learning:

The SPICE Shell gives you the full power of a professional circuit simulator directly within Breadpad, allowing for sophisticated analyses and custom simulations.