The EE Software Toolchain and a First SPICE Deck
Electrical engineers spend as much time at a keyboard as at a bench. Before you solder anything, you calculate it, simulate it and draw it; after you measure it, you process the data, compare it with the prediction and keep all of it under version control. This lesson is a map of the free tools the Electrical Engineering track uses, what each one is for and when you will need it, followed by your first circuit simulation: a voltage divider in ngspice, cross-checked by hand and in Python.
The toolchain
The list follows the owner's roadmap (§2.1). Every tool here has a free version; commercial alternatives (MATLAB/Simulink, Altium Designer, Ansys, CST, COMSOL, PLECS) are common in industry but not needed to learn. Platforms and licences below are as of 2026; check each project's site for current versions.
| Tool | Main use | When in the track | Notes |
|---|---|---|---|
| Python with NumPy, SciPy, Matplotlib | calculations, data processing, plots, small solvers | from this course on | runs in your browser on this site (Pyodide); see A Python Toolkit for EE Calculations |
| GNU Octave or MATLAB | matrix work, control, signal processing | intermediate courses | Octave is free and largely MATLAB-compatible; see the MATLAB course |
| ngspice | SPICE circuit simulation, scriptable from the command line | from circuits on | open source; the SPICE sessions on this site run ngspice 42 |
| LTspice | schematic-entry SPICE for analog and power circuits | from circuits on | free from Analog Devices, Windows and macOS (no Linux build; the Windows version runs under Wine) |
| KiCad | schematics and printed circuit boards | from electronics on | open source; includes an ngspice-based simulator |
| Qucs-S | circuit and RF simulation with a schematic editor | RF courses | front end for ngspice and other engines |
| FEMM | 2-D magnetic, electrostatic and thermal field analysis | electromagnetics | free; Windows (runs under Wine elsewhere) |
| openEMS | 3-D electromagnetic simulation (FDTD) | advanced RF | open source, scripted from Octave or Python |
| FreeCAD | mechanical parts and enclosures | project work | open source 3-D CAD |
| Git | version control for code, decks, data and reports | from day one | see the Git course |
| Linux command line | automation, running simulators in batch | from day one | see the Linux & Bash course |
A typical design loop moves through several of them:
Each step checks the previous one. If the hand calculation, the simulation and the measurement agree within their uncertainties, you understand the circuit. If they do not, one of them is wrong, and finding out which one is where most of the learning happens.
What SPICE does
SPICE (Simulation Program with Integrated Circuit Emphasis, first released at UC Berkeley in the 1970s) reads a netlist: a text list of components and the nodes they connect. It writes Kirchhoff's current law at every node, solves the resulting equations (by modified nodal analysis, which the Circuit Theory course builds by hand) and reports node voltages and branch currents. Analyses include op (DC operating point), dc (sweeps), ac (frequency response) and tran (time response).
The circuit for today: a source and a divider of and .
Worked example: the divider by hand
Given: , , , no load on node out.
Find: , and the power in each resistor.
Solve:
Check: is between and and less than half, because . The voltages add up: , and (Kirchhoff's voltage law).
Your first SPICE deck
cat > divider.cir <<'EOF'
* First deck: a 12 V source and a 10k/4.7k voltage divider
V1 in 0 DC 12
R1 in out 10k
R2 out 0 4.7k
.control
op
print v(in) v(out) i(V1)
.endc
.end
EOF
ngspice -b divider.cir 2>&1 | grep -E '^(v\(|i\()'v(in) = 1.200000e+01
v(out) = 3.836735e+00
i(v1) = -8.16327e-04
Line by line:
- The first line is always the title, whatever it says. A real component on line one is silently ignored, a classic first mistake.
V1 in 0 DC 12: the element name's first letter is its type (V source, R resistor, C capacitor, L inductor), then the nodes (positive first), then the value. Node0is ground and must exist.- Values take suffixes:
k= ,meg= ,u= ,n,p.mmeans milli, so1mis , not a megohm: write1meg. .control … .endcholds commands:opcomputes the operating point,printshows the values..endends the deck.ngspice -bruns in batch mode;grepkeeps only the lines we asked for.
SPICE agrees with the hand calculation to every digit shown. The current is negative because SPICE reports the current flowing into the source's positive terminal: a source that delivers power has negative current by this convention.
A Python check, which also asks a design question: how far can move if both resistors are parts?
V1, R1, R2 = 12.0, 10e3, 4.7e3
I = V1 / (R1 + R2)
print(f"I = {I * 1e3:.4f} mA, V(out) = {I * R2:.4f} V")
print(f"P(R1) = {I**2 * R1 * 1e3:.2f} mW, P(R2) = {I**2 * R2 * 1e3:.2f} mW")
corners = [V1 * R2 * b / (R1 * a + R2 * b) for a in (0.99, 1.01) for b in (0.99, 1.01)]
print(f"with 1 % resistors: {min(corners):.4f} V to {max(corners):.4f} V")I = 0.8163 mA, V(out) = 3.8367 V
P(R1) = 6.66 mW, P(R2) = 3.13 mW
with 1 % resistors: 3.7847 V to 3.8891 V
Guided lab: hand, SPICE, bench
Hand calculation. , .
Simulation. The deck above. Change R2 to 4.7meg and to 4.7m and explain both results (the second is the milli trap).
What you would measure. Build the divider on a breadboard with resistors, fed from a bench supply at with a current limit. Measure on a multimeter: expect somewhere between about and (the resistor corners above, widened by the example meter's at ); a typical pair of resistors lands much closer to . Measure the supply voltage too, because scales with it. Then measure each resistor out of circuit and recompute: the agreement should tighten to the meter's uncertainty. Record the deck, the measurements and the comparison in your notebook and commit the deck to Git (The Lab Notebook and the Lab Report).
Hazards and safe setup.
- DC from a current-limited bench supply (limit ); the resistors dissipate milliwatts.
- Set the supply before connecting and switch the output on last (The Bench Power Supply).
- No mains-powered circuit is simulated and then built in this course; simulation never makes mains work safe.
Pitfalls
- A component on the title line, or no node
0. Mfor mega: SPICE is case-insensitive and reads it as milli.- Trusting a simulation without a sanity check: SPICE solves the circuit you typed, not the one you meant.
- Forgetting the sign convention of source currents.
- Simulated parts are ideal unless you give them models: a SPICE resistor has no tolerance, temperature drift or power limit.
Practice
- Change to . What does
print v(out)show? - Write the element line for a capacitor between nodes
outand0. - A deck has
R1 in out 1M. What resistance does SPICE use?
Answer
- , printed as
v(out) = 6.000000e+00. C1 out 0 100n.- (milli). Write
1megfor a megohm.
Test yourself
Which tool is meant for drawing schematics and laying out printed circuit boards?
- FEMM
- KiCad
- openEMS
- Octave
What does SPICE do with the first line of a deck?
- Reads it as the first component
- Treats it as the title and ignores it as a circuit line
- Uses it as the ground node
- Runs it as a command
In SPICE, 2.2M is
- an error
The divider deck prints i(v1) = -8.16327e-04. Why negative?
- The source is connected backwards
- SPICE reports current into the positive terminal, and a delivering source has current flowing out of it
- Rounding error
- Resistors have negative resistance in SPICE