Generates RLC circuit diagrams from text descriptions using Schemdraw...
This skill generates professional circuit diagrams from natural language descriptions using Python's Schemdraw library.
Users can describe circuits in natural language:
Preferred layout: Vertical component arrangement on the right side.
┌───────────────────┐
│ │
(+) [R₁]
(SRC) │
(-) [L₁]
│ │
└────────⏚────────[C₁]
(GND) │
│
.down()Use the bundled references for syntax:
references/schemdraw-guide.md - Component elements and methodsreferences/circuit-patterns.md - Common topology templatesImportant: The ground must be connected to the source negative terminal to form a complete circuit.
Labeling: Use .label('text') without specifying loc - Schemdraw's default positioning handles placement intelligently based on element orientation.
import schemdraw
import schemdraw.elements as elm
with schemdraw.Drawing() as d:
d.config(unit=3, fontsize=12)
# Start with power source (vertical, positive up)
source = d.add(elm.SourceV().up().label('V₁\n12V'))
# Top rail to the right
d += elm.Line().right().length(5).at(source.end)
# Components arranged vertically using .down()
d += elm.Resistor().down().label('R₁ 100Ω')
d += elm.Inductor().down().label('L₁ 10mH')
d += elm.Capacitor().down().label('C₁ 1μF')
# Return path with ground
d += elm.Line().left().length(3)
d += elm.Ground()
# Connect back to source negative terminal
d += elm.Line().left().tox(source.start)
d += elm.Line().up().toy(source.start)
d.save('circuit.svg')
After generating the Schemdraw code, save it to a .py file and render:
python scripts/render_circuit.py circuit_code.py output.svg
Or run the generated Python directly if Schemdraw is installed.
| Component | Element | Typical Values |
|---|---|---|
| DC Source | elm.SourceV() |
1V - 24V |
| AC Source | elm.SourceSin() |
120V, 60Hz |
| Battery | elm.Battery() |
1.5V, 9V, 12V |
| Resistor | elm.Resistor() |
Ω, kΩ, MΩ |
| Capacitor | elm.Capacitor() |
pF, nF, μF |
| Inductor | elm.Inductor() |
μH, mH, H |
| Ground | elm.Ground() |
- |
See assets/examples/ for working templates:
simple-resistive.py - Basic resistor circuitrc-series.py - RC series circuitrl-series.py - RL series circuitrlc-series.py - Full RLC series circuitrlc-parallel.py - Parallel RLC circuit