Basic Elements

See Electrical Elements for complete class definitions for these elements.

Two-terminal

Two-terminal devices subclass schemdraw.elements.Element2Term, and have leads that will be extended to make the element the desired length depending on the arguments. All two-terminal elements define start, end, and center anchors for placing, and a few define other anchors as shown in blue in the tables below. Some elements have optional parameters, shown in parenthesis in the table below.

Resistors

Resistors elements change style based on IEEE/U.S. vs IEC/European style configured by schemdraw.elements.style(). Selectable elements, such as Resistor, point to either ResistorIEEE or ResistorIEC, for example.

IEEE Style

IEEE style, common in the U.S., is the default, or it can be configured using

elm.style(elm.STYLE_IEEE)

Resistor

../_images/electrical_2_0.svg

ResistorVar

../_images/electrical_3_0.svg

Potentiometer

../_images/electrical_4_0.svg

Photoresistor

../_images/electrical_5_0.svg

Fuse

../_images/electrical_6_0.svg

IEC/European Style

IEC style can be enabled using

elm.style(elm.STYLE_IEC)

Resistor

../_images/electrical_8_0.svg

ResistorVar

../_images/electrical_9_0.svg

Potentiometer

../_images/electrical_10_0.svg

Photoresistor

../_images/electrical_11_0.svg

Fuse

../_images/electrical_12_0.svg

All Resistors

Either IEEE or IEC styles are always available with these Elements.

ResistorIEEE

../_images/electrical_13_0.svg

ResistorIEC

../_images/electrical_14_0.svg

ResistorVarIEEE

../_images/electrical_15_0.svg

ResistorVarIEC

../_images/electrical_16_0.svg

PotentiometerIEEE

../_images/electrical_17_0.svg

PotentiometerIEC

../_images/electrical_18_0.svg

PhotoresistorIEEE

../_images/electrical_19_0.svg

PhotoresistorIEC

../_images/electrical_20_0.svg

FuseUS

../_images/electrical_21_0.svg

FuseIEEE

../_images/electrical_22_0.svg

FuseIEC

../_images/electrical_23_0.svg

Rshunt

../_images/electrical_24_0.svg

Capacitors and Inductors

Capacitor

../_images/electrical_25_0.svg

Capacitor(polar=True)

../_images/electrical_26_0.svg

Capacitor2

../_images/electrical_27_0.svg

Capacitor2(polar=True)

../_images/electrical_28_0.svg

CapacitorVar

../_images/electrical_29_0.svg

CapacitorTrim

../_images/electrical_30_0.svg

Inductor

../_images/electrical_31_0.svg

Inductor2

../_images/electrical_32_0.svg

Inductor2(loops=2)

../_images/electrical_33_0.svg

Diodes

All diodes may be filled by passing fill=True.

Diode

../_images/electrical_34_0.svg

Diode(fill=True)

../_images/electrical_35_0.svg

Schottky

../_images/electrical_36_0.svg

DiodeTunnel

../_images/electrical_37_0.svg

DiodeShockley

../_images/electrical_38_0.svg

Zener

../_images/electrical_39_0.svg

DiodeTVS

../_images/electrical_40_0.svg

Varactor

../_images/electrical_41_0.svg

LED

../_images/electrical_42_0.svg

LED2

../_images/electrical_43_0.svg

LED(fill=’red’)

../_images/electrical_44_0.svg

Photodiode

../_images/electrical_45_0.svg

Diac

../_images/electrical_46_0.svg

Triac

../_images/electrical_47_0.svg

SCR

../_images/electrical_48_0.svg

Pathological

Nullator

../_images/electrical_49_0.svg

Norator

../_images/electrical_50_0.svg

CurrentMirror

../_images/electrical_51_0.svg

VoltageMirror

../_images/electrical_52_0.svg

Miscellaneous

Breaker

../_images/electrical_53_0.svg

Crystal

../_images/electrical_54_0.svg

CPE

../_images/electrical_55_0.svg

Josephson

../_images/electrical_56_0.svg

Josephson(box=True)

../_images/electrical_57_0.svg

Motor

../_images/electrical_58_0.svg

Lamp

../_images/electrical_59_0.svg

Lamp2

../_images/electrical_60_0.svg

Neon

../_images/electrical_61_0.svg

Thermistor

../_images/electrical_62_0.svg

Memristor

../_images/electrical_63_0.svg

Memristor2

../_images/electrical_64_0.svg

Jack

../_images/electrical_65_0.svg

Plug

../_images/electrical_66_0.svg

Terminal

../_images/electrical_67_0.svg

SparkGap

../_images/electrical_68_0.svg

Sources and Meters

Source

../_images/electrical_69_0.svg

SourceV

../_images/electrical_70_0.svg

SourceI

../_images/electrical_71_0.svg

SourceSin

../_images/electrical_72_0.svg

SourcePulse

../_images/electrical_73_0.svg

SourceSquare

../_images/electrical_74_0.svg

SourceTriangle

../_images/electrical_75_0.svg

SourceRamp

../_images/electrical_76_0.svg

SourceControlled

../_images/electrical_77_0.svg

SourceControlledI

../_images/electrical_78_0.svg

SourceControlledV

../_images/electrical_79_0.svg

BatteryCell

../_images/electrical_80_0.svg

Battery

../_images/electrical_81_0.svg

MeterV

../_images/electrical_82_0.svg

MeterA

../_images/electrical_83_0.svg

MeterI

../_images/electrical_84_0.svg

MeterOhm

../_images/electrical_85_0.svg

Solar

../_images/electrical_86_0.svg

Switches

Button

../_images/electrical_87_0.svg

Button(nc=True)

../_images/electrical_88_0.svg

Switch

../_images/electrical_89_0.svg

Switch(action=’open’)

../_images/electrical_90_0.svg

Switch(action=’close’)

../_images/electrical_91_0.svg

SwitchReed

../_images/electrical_92_0.svg

Lines and Arrows

Line

../_images/electrical_93_0.svg

Arrow

../_images/electrical_94_0.svg

Arrow(double=True)

../_images/electrical_95_0.svg

DataBusLine

../_images/electrical_96_0.svg

Also see Connecting Elements.

Single-Terminal

Single terminal elements are drawn about a single point, and do not move the current drawing position.

Power and Ground

Ground

../_images/electrical_97_0.svg

GroundSignal

../_images/electrical_98_0.svg

GroundChassis

../_images/electrical_99_0.svg

Vss

../_images/electrical_100_0.svg

Vdd

../_images/electrical_101_0.svg

Antennas

Antenna

../_images/electrical_102_0.svg

AntennaLoop

../_images/electrical_103_0.svg

AntennaLoop2

../_images/electrical_104_0.svg

Connection Dots

Dot

../_images/electrical_105_0.svg

Dot(open=True)

../_images/electrical_106_0.svg

DotDotDot

../_images/electrical_107_0.svg

Arrowhead

../_images/electrical_108_0.svg

NoConnect

../_images/electrical_109_0.svg

Switches

The standard toggle switch is listed with other two-terminal elements above. Other switch configurations are shown here.

Single-pole double-throw

Two options for SPDT switches can be also be drawn with arrows by adding action=’open’ or action=’close’ parameters.

SwitchSpdt

../_images/electrical_110_0.svg

SwitchSpdt2

../_images/electrical_111_0.svg

SwitchSpdt(action=’open’)

../_images/electrical_112_0.svg

SwitchSpdt2(action=’open’)

../_images/electrical_113_0.svg

SwitchSpdt(action=’close’)

../_images/electrical_114_0.svg

SwitchSpdt2(action=’close’)

../_images/electrical_115_0.svg

Double-pole

DPST and DPDT switches have a link parameter for disabling the dotted line lnking the poles.

SwitchDpst

../_images/electrical_116_0.svg

SwitchDpdt

../_images/electrical_117_0.svg

SwitchDpst(link=False)

../_images/electrical_118_0.svg

SwitchDpdt(link=False)

../_images/electrical_119_0.svg

Rotary Switch

The rotary switch schemdraw.elements.switches.SwitchRotary takes several parameters, with n being the number of contacts and other parameters defining the contact placement.

SwitchRotary(n=6)

../_images/electrical_120_0.svg

DIP Switch

A set of switches in a dual-inline package, where can show each switch flipped up or down. See schemdraw.elements.switches.SwitchDIP for options.

SwitchDIP

../_images/electrical_121_0.svg

SwitchDIP(pattern=[0, 0, 1])

../_images/electrical_122_0.svg

Audio Elements

Speakers, Microphones, Jacks

Speaker

../_images/electrical_123_0.svg

Mic

../_images/electrical_124_0.svg

AudioJack

../_images/electrical_125_0.svg

AudioJack(ring=True)

../_images/electrical_126_0.svg

AudioJack(switch=True)

../_images/electrical_127_0.svg

AudioJack(switch=True, ring=True, ringswitch=True)

../_images/electrical_128_0.svg

Labels

The Label element can be used to add a label anywhere. The Gap is like an “invisible” element, useful for marking the voltage between output terminals.

Gap(label=[‘+’, ‘Gap’, ‘-‘])

../_images/electrical_129_0.svg

Label(label=’Hello’)

../_images/electrical_130_0.svg

Tag(label=’Tag’)

../_images/electrical_131_0.svg

Operational Amplifiers

The schemdraw.elements.opamp.Opamp element defines several anchors for various inputs, including voltage supplies and offset nulls. Optional leads can be added using the leads parameter, with anchors exteded to the ends of the leads.

Opamp

../_images/electrical_132_0.svg

Opamp(sign=False)

../_images/electrical_133_0.svg

Opamp(leads=True)

../_images/electrical_134_0.svg

Transistors

Bipolar Junction Transistors

Bjt

../_images/electrical_135_0.svg

BjtNpn

../_images/electrical_136_0.svg

BjtPnp

../_images/electrical_137_0.svg

Bjt(circle=True)

../_images/electrical_138_0.svg

BjtNpn(circle=True)

../_images/electrical_139_0.svg

BjtPnp(circle=True)

../_images/electrical_140_0.svg

BjtPnp2c

../_images/electrical_141_0.svg

BjtPnp2c(circle=True)

../_images/electrical_142_0.svg

NpnSchottky

../_images/electrical_143_0.svg

PnpSchottky

../_images/electrical_144_0.svg

IgbtN

../_images/electrical_145_0.svg

IgbtP

../_images/electrical_146_0.svg

NpnPhoto

../_images/electrical_147_0.svg

PnpPhoto

../_images/electrical_148_0.svg

Field-Effect Transistors

NFet

../_images/electrical_149_0.svg

PFet

../_images/electrical_150_0.svg

NFet(bulk=True)

../_images/electrical_151_0.svg

PFet(bulk=True)

../_images/electrical_152_0.svg

JFet

../_images/electrical_153_0.svg

JFetN

../_images/electrical_154_0.svg

JFetP

../_images/electrical_155_0.svg

JFetN(circle=True)

../_images/electrical_156_0.svg

JFetP(circle=True)

../_images/electrical_157_0.svg

Hemt

../_images/electrical_158_0.svg

Hemt(split=False)

../_images/electrical_159_0.svg

Hemt(arrow=False)

../_images/electrical_160_0.svg

NMos

../_images/electrical_161_0.svg

PMos

../_images/electrical_162_0.svg

NMos(diode=True)

../_images/electrical_163_0.svg

PMos(diode=True)

../_images/electrical_164_0.svg

NMos(circle=True)

../_images/electrical_165_0.svg

PMos(circle=True)

../_images/electrical_166_0.svg

AnalogNFet

../_images/electrical_167_0.svg

AnalogPFet

../_images/electrical_168_0.svg

AnalogBiasedFet

../_images/electrical_169_0.svg

AnalogNFet(bulk=True)

../_images/electrical_170_0.svg

AnalogPFet(bulk=True)

../_images/electrical_171_0.svg

AnalogBiasedFet(bluk=True)

../_images/electrical_172_0.svg

AnalogBiasedFet(arrow=False)

../_images/electrical_173_0.svg

AnalogPFet(arrow=False)

../_images/electrical_174_0.svg

AnalogBiasedFet(arrow=False)

../_images/electrical_175_0.svg

AnalogNFet(offset_gate=False)

../_images/electrical_176_0.svg

AnalogPFet(offset_gate=False)

../_images/electrical_177_0.svg

AnalogBiasedFet(offset_gate=False)

../_images/electrical_178_0.svg

“Two-Terminal” Transistors

Another set of transistor elements subclass schemdraw.elements.Element2Term so they have emitter and collector (or source and drain) leads extended to the desired length. These can be easier to place centered between endpoints, for example.

BjtNpn2

../_images/electrical_179_0.svg

BjtPnp2

../_images/electrical_180_0.svg

BjtPnp2c2

../_images/electrical_181_0.svg

NFet2

../_images/electrical_182_0.svg

PFet2

../_images/electrical_183_0.svg

JFetN2

../_images/electrical_184_0.svg

JFetP2

../_images/electrical_185_0.svg

NMos2(diode=True)

../_images/electrical_186_0.svg

PMos2(diode=True)

../_images/electrical_187_0.svg

NMos2(circle=True)

../_images/electrical_188_0.svg

PMos2(circle=True)

../_images/electrical_189_0.svg

Two-ports

Twoport elements share the interface defined by schemdraw.elements.twoports.ElementTwoport, providing a set of anchors and various styling options. The terminals and box can be enabled or disabled using the terminals and box arguments. In addition, the boxfill, boxlw, and boxls provide the option to style the outline separately from other elements.

TwoPort

../_images/electrical_190_0.svg

TwoPort(terminals=False, boxlw=3)

../_images/electrical_191_0.svg

Generic

TwoPort

../_images/electrical_192_0.svg

TwoPort(reverse_output=True)

../_images/electrical_193_0.svg

TwoPort(arrow=False)

../_images/electrical_194_0.svg

TwoPort(sign=False)

../_images/electrical_195_0.svg

Transactors (ideal amplifiers)

Like the generic twoport, the transactors provide the option to reverse the direction of the output or current using the reverse_output argument.

VoltageTransactor

../_images/electrical_196_0.svg

TransimpedanceTransactor

../_images/electrical_197_0.svg

TransadmittanceTransactor

../_images/electrical_198_0.svg

CurrentTransactor

../_images/electrical_199_0.svg

Pathological

Nullor

../_images/electrical_200_0.svg

VMCMPair

../_images/electrical_201_0.svg

Custom

The schemdraw.elements.twoports.ElementTwoport class can be used to define custom twoports by specifying an input_element and output_element. The bpadx, bpady, minw, unit, width can be used to tune the horizontal and vertical padding, minimum width of the elements, length of components, and width of the twoport respectively.

elm.ElementTwoport(
    input_element=elm.Inductor2,
    output_element=elm.SwitchReed,
    unit=2.5, width=2.5)
../_images/electrical_202_0.svg
elm.ElementTwoport(
    input_element=elm.Lamp,
    output_element=partial(elm.Photodiode, reverse=True, flip=True),
    width=3)
../_images/electrical_203_0.svg

Cables

schemdraw.elements.cables.Coax and schemdraw.elements.cables.Triax cables are 2-Terminal elements that can be made with several options and anchors. Coax parameters include length, radius, and leadlen for setting the distance between leads and the shell. Triax parameters include length, radiusinner, radiusouter, leadlen, and shieldofststart for offseting the outer shield from the inner guard.

Coax

../_images/electrical_204_0.svg

Triax()

../_images/electrical_205_0.svg

Coax(length=5, radius=0.5)

../_images/electrical_206_0.svg

Triax(length=5, radiusinner=0.5)

../_images/electrical_207_0.svg
../_images/electrical_208_0.svg
../_images/electrical_209_0.svg

CoaxConnect

../_images/electrical_210_0.svg

Transformers

The schemdraw.elements.xform.Transformer element is used to create various transformers. Anchors p1, p2, s1, and s2 are defined for all transformers. Other anchors can be created using the taps method to add tap locations to either side.

Transformer

../_images/electrical_211_0.svg

Transformer(loop=True)

../_images/electrical_212_0.svg

Transformer(core=False)

../_images/electrical_213_0.svg

Here is a transformers with anchor “B” added using the tap method. Note the tap by itself does not draw anything, but defines a named anchor to connect to.

with schemdraw.Drawing(fontsize=10) as d:
    x = elm.Transformer(t1=4, t2=8).tap(name='B', pos=3, side='secondary')
    elm.Line().at(x.s1).length(d.unit/4).label('s1', 'rgt').color('blue')
    elm.Line().at(x.s2).length(d.unit/4).label('s2', 'rgt').color('blue')
    elm.Line().at(x.p1).length(d.unit/4).left().label('p1', 'lft').color('blue')
    elm.Line().at(x.p2).length(d.unit/4).left().label('p2', 'lft').color('blue')
    elm.Line().at(x.B).length(d.unit/4).right().label('B', 'rgt').color('blue')
../_images/electrical_214_0.svg