reox8637 downloadsDraw SPICE netlists in spice code blocks as circuit schematics, with a button to flip each one between the schematic and its source.
Turn SPICE netlists in your notes into circuit schematics. Write a spice code block and the
schematic appears in its place, in Reading view and Live Preview. The plugin only draws circuits;
it never simulates them. Desktop only.
```spice
* RC low-pass driving an emitter follower
V1 in 0 AC 1
R1 in mid 10k
C1 mid 0 100n
Q1 vcc mid out 2N3904
R2 out 0 1k
VCC vcc 0 5
.model 2N3904 NPN
```
.include and .lib.To install by hand instead, download main.js, manifest.json and styles.css from the
latest release into
<your vault>/.obsidian/plugins/spice-schematic-preview/, then enable the plugin.
Put the netlist in a code block tagged spice. Placement and wiring are automatic: the netlist
says what's connected, not where it goes. The first line of a SPICE file is its title, but a code
block has none, so start a title line with * to make it a comment.
| Element | Drawn as |
|---|---|
R, C, L |
Resistor, capacitor, inductor, with the value |
D |
Diode, with its model |
V, I |
Voltage or current source |
Q |
NPN or PNP transistor, from its .model |
M |
NMOS or PMOS transistor, from its .model |
X |
A box named after the subcircuit, with its pin names |
| Other elements | A box saying what the element is |
Every connection to ground (0 or gnd) gets its own ground symbol, and global nodes get net
labels. Simulation commands such as .tran are skipped.
Blocks are read as ngspice unless you choose otherwise, either for all blocks with the Dialect
setting or for one block with the dialect option:
```spice {dialect="ltspice"}
V1 in 0 PULSE(0 5 0 1n 1n 5u 10u)
R1 in out 1k
C1 out 0 1n
```
The dialect names are ngspice, ltspice, pspice, hspice, xyce and spectre. The
spice-renderer documentation lists what
each one reads.
.include, .inc and .lib read files from your vault, as SPICE does:
```spice
.include models/opamp.inc
X1 0 inv out opamp
R1 in inv 10k
R2 inv out 47k
```
../ reaches other folders of the vault..) aren't found, because Obsidian doesn't index
them.Add options in braces after spice:
```spice {caption="Figure 1: CMOS inverter" align="center" alt="A CMOS inverter"}
M1 out in vdd vdd pch
M2 out in 0 0 nch
.model nch NMOS
.model pch PMOS
```
| Option | What it does |
|---|---|
dialect |
The SPICE dialect of this block, as above. |
caption |
Text shown under the schematic. |
align |
left, center or right. |
alt |
A description read aloud by screen readers. |
class |
A CSS class, for styling the schematic with a CSS snippet. |
Put each value in quotes. Values are plain text, not Markdown. If an option is misspelled, it's ignored and the schematic still appears; an unknown dialect is shown as an error that lists the six.
In Reading view, the button beside </> shows a block's parts as a table, a bill of materials (BOM). Identical parts share a row with their quantity and references. Select it again to see the schematic. Like a netlist view, a BOM view is remembered, and Show every schematic in this note switches it back.
| Qty | References | Type | Value |
|---|---|---|---|
| 1 | VAC | voltage source | SIN(0 12 50) |
| 4 | D1, D2, D3, D4 | diode | 1N4007 |
| 1 | C1 | capacitor | 1000u |
| 1 | RL | resistor | 1k |
10k and 10K share a row; 10k and 10000 don't.m=2 stays in the Value column and doesn't change the quantity..subckt definition aren't listed, as they aren't drawn.Choose how the table looks with BOM table style: Plain uses your theme's table styling, Compact is a dense full-width table, and Card puts the table on the schematic's card with a part count.
Schematics follow your theme. In a dark theme, wires, symbols and labels take your theme's text colour on the page. In a light theme, schematics appear on a white card.
To always show schematics on a white card, turn off Follow dark themes in the plugin's settings.
| Setting | What it does |
|---|---|
| Dialect | The dialect for blocks without a dialect option. ngspice by default. |
| Layout timeout | How long laying out a schematic may take before it's shown as an error. 3 seconds by default, from 0.5 to 60. |
| Follow dark themes | On by default. Turn off to keep every schematic, and the Card table, on a white card. |
| BOM table style | How the BOM view's table looks: Plain (the default), Compact or Card. |
| Debug logging | Writes ignored options and notes from the netlist reader, such as an undefined transistor model, to the developer console. |
| Command | What it does |
|---|---|
| Refresh included files | Reads every included file again and redraws every schematic. |
| Show every schematic in this note | Switches every block in the note back to its schematic, from its netlist or its BOM view. |
| Restart renderer | Starts the schematic engine afresh and redraws open notes. |
Schematics are drawn on your device, inside Obsidian. The plugin doesn't connect to the internet and doesn't collect any data. It reads only the files your netlists include, and only from your vault, through Obsidian. It never writes files.
Schematics are laid out by the Eclipse Layout Kernel through elkjs, with symbols from netlistsvg. The licenses of the software built into this plugin are listed in THIRD_PARTY_NOTICES.md.
Released under the MIT License. To build or change the plugin, see DEVELOPMENT.md.