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

Inductors have anchors intended for easy positioning of a mutual inductance dot near the element.

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

Inductor(core=True)

../_images/electrical_32_0.svg

Inductor2

../_images/electrical_33_0.svg

Inductor2(loops=2)

../_images/electrical_34_0.svg

Diodes

All diodes may be filled by passing fill=True.

Diode

../_images/electrical_35_0.svg

Diode(fill=True)

../_images/electrical_36_0.svg

Schottky

../_images/electrical_37_0.svg

DiodeTunnel

../_images/electrical_38_0.svg

DiodeShockley

../_images/electrical_39_0.svg

Zener

../_images/electrical_40_0.svg

DiodeTVS

../_images/electrical_41_0.svg

Varactor

../_images/electrical_42_0.svg

LED

../_images/electrical_43_0.svg

LED2

../_images/electrical_44_0.svg

LED(fill=’red’)

../_images/electrical_45_0.svg

Photodiode

../_images/electrical_46_0.svg

Diac

../_images/electrical_47_0.svg

Triac

../_images/electrical_48_0.svg

SCR

../_images/electrical_49_0.svg

Miscellaneous

Breaker

../_images/electrical_50_0.svg

Crystal

../_images/electrical_51_0.svg

CPE

../_images/electrical_52_0.svg

Josephson

../_images/electrical_53_0.svg

Josephson(box=True)

../_images/electrical_54_0.svg

Motor

../_images/electrical_55_0.svg

Lamp

../_images/electrical_56_0.svg

Lamp2

../_images/electrical_57_0.svg

Neon

../_images/electrical_58_0.svg

Thermistor

../_images/electrical_59_0.svg

Memristor

../_images/electrical_60_0.svg

Memristor2

../_images/electrical_61_0.svg

Jack

../_images/electrical_62_0.svg

Plug

../_images/electrical_63_0.svg

Terminal

../_images/electrical_64_0.svg

SparkGap

../_images/electrical_65_0.svg

Nullator

../_images/electrical_66_0.svg

Norator

../_images/electrical_67_0.svg

CurrentMirror

../_images/electrical_68_0.svg

VoltageMirror

../_images/electrical_69_0.svg

Sources and Meters

Source

../_images/electrical_70_0.svg

SourceV

../_images/electrical_71_0.svg

SourceI

../_images/electrical_72_0.svg

SourceSin

../_images/electrical_73_0.svg

SourcePulse

../_images/electrical_74_0.svg

SourceSquare

../_images/electrical_75_0.svg

SourceTriangle

../_images/electrical_76_0.svg

SourceRamp

../_images/electrical_77_0.svg

SourceControlled

../_images/electrical_78_0.svg

SourceControlledI

../_images/electrical_79_0.svg

SourceControlledV

../_images/electrical_80_0.svg

BatteryCell

../_images/electrical_81_0.svg

Battery

../_images/electrical_82_0.svg

BatteryDouble

../_images/electrical_83_0.svg

Solar

../_images/electrical_84_0.svg

MeterV

../_images/electrical_85_0.svg

MeterA

../_images/electrical_86_0.svg

MeterI

../_images/electrical_87_0.svg

MeterOhm

../_images/electrical_88_0.svg

MeterArrow

../_images/electrical_89_0.svg

Box-Style Meters

MeterAnalog

../_images/electrical_90_0.svg

MeterDigital

../_images/electrical_91_0.svg

Oscilloscope

../_images/electrical_92_0.svg

The “Box” style meters have many configuration options. See class definitions for more details. Some examples are shown below.

with schemdraw.Drawing() as d:
    elm.MeterAnalog(needle_percent=30)
    d.move(2)
    elm.MeterAnalog(window_fill='skyblue', input_fill='black').anchor('in1')
    d.move(2)
    elm.MeterAnalog().label('V', loc='name').label('–', loc='in1', fontsize=10).label('+', loc='in2', fontsize=10).anchor('in1')
    d.move(2)
    elm.MeterDigital().label('10 V', loc='display', color='red', fontsize=14).anchor('in1')
    elm.Oscilloscope(signal='sine').at((0, -2))
    d.move(2)
    elm.Oscilloscope(signal='square').anchor('in1')
    d.move(2)
    elm.Oscilloscope(signal='triangle', signal_color='blue').anchor('in1')
    d.move(2)
    elm.Oscilloscope(signal='sine', signal_lw=1, grid=False).anchor('in1')
../_images/electrical_93_0.svg

Switches

Button

../_images/electrical_94_0.svg

Button(nc=True)

../_images/electrical_95_0.svg

Button(contacts=False)

../_images/electrical_96_0.svg

Switch

../_images/electrical_97_0.svg

Switch(nc=True)

../_images/electrical_98_0.svg

Switch(action=’open’)

../_images/electrical_99_0.svg

Switch(action=’close’)

../_images/electrical_100_0.svg

Switch(contacts=False)

../_images/electrical_101_0.svg

Switch(contacts=False, nc=True)

../_images/electrical_102_0.svg

SwitchReed

../_images/electrical_103_0.svg

Lines and Arrows

Line

../_images/electrical_104_0.svg

Arrow

../_images/electrical_105_0.svg

Arrow(double=True)

../_images/electrical_106_0.svg

DataBusLine

../_images/electrical_107_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_108_0.svg

GroundSignal

../_images/electrical_109_0.svg

GroundChassis

../_images/electrical_110_0.svg

Vss

../_images/electrical_111_0.svg

Vdd

../_images/electrical_112_0.svg

Antennas

Antenna

../_images/electrical_113_0.svg

AntennaLoop

../_images/electrical_114_0.svg

AntennaLoop2

../_images/electrical_115_0.svg

Connection Dots

Dot

../_images/electrical_116_0.svg

Dot(open=True)

../_images/electrical_117_0.svg

DotDotDot

../_images/electrical_118_0.svg

Arrowhead

../_images/electrical_119_0.svg

NoConnect

../_images/electrical_120_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_121_0.svg

SwitchSpdt2

../_images/electrical_122_0.svg

SwitchSpdt(action=’open’)

../_images/electrical_123_0.svg

SwitchSpdt2(action=’open’)

../_images/electrical_124_0.svg

SwitchSpdt(action=’close’)

../_images/electrical_125_0.svg

SwitchSpdt2(action=’close’)

../_images/electrical_126_0.svg

Double-pole

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

SwitchDpst

../_images/electrical_127_0.svg

SwitchDpdt

../_images/electrical_128_0.svg

SwitchDpst(link=False)

../_images/electrical_129_0.svg

SwitchDpdt(link=False)

../_images/electrical_130_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_131_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_132_0.svg

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

../_images/electrical_133_0.svg

Audio Elements

Speakers, Microphones, Jacks

Speaker

../_images/electrical_134_0.svg

Mic

../_images/electrical_135_0.svg

AudioJack

../_images/electrical_136_0.svg

AudioJack(ring=True)

../_images/electrical_137_0.svg

AudioJack(switch=True)

../_images/electrical_138_0.svg

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

../_images/electrical_139_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_140_0.svg

Label(label=’Hello’)

../_images/electrical_141_0.svg

Tag(label=’Tag’)

../_images/electrical_142_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_143_0.svg

Opamp(sign=False)

../_images/electrical_144_0.svg

Opamp(leads=True)

../_images/electrical_145_0.svg

Transistors

Bipolar Junction Transistors

Bjt

../_images/electrical_146_0.svg

BjtNpn

../_images/electrical_147_0.svg

BjtPnp

../_images/electrical_148_0.svg

Bjt(circle=True)

../_images/electrical_149_0.svg

BjtNpn(circle=True)

../_images/electrical_150_0.svg

BjtPnp(circle=True)

../_images/electrical_151_0.svg

BjtPnp2c

../_images/electrical_152_0.svg

BjtPnp2c(circle=True)

../_images/electrical_153_0.svg

NpnSchottky

../_images/electrical_154_0.svg

PnpSchottky

../_images/electrical_155_0.svg

IgbtN

../_images/electrical_156_0.svg

IgbtP

../_images/electrical_157_0.svg

NpnPhoto

../_images/electrical_158_0.svg

PnpPhoto

../_images/electrical_159_0.svg

Field-Effect Transistors

NFet

../_images/electrical_160_0.svg

PFet

../_images/electrical_161_0.svg

NFet(bulk=True)

../_images/electrical_162_0.svg

PFet(bulk=True)

../_images/electrical_163_0.svg

JFet

../_images/electrical_164_0.svg

JFetN

../_images/electrical_165_0.svg

JFetP

../_images/electrical_166_0.svg

JFetN(circle=True)

../_images/electrical_167_0.svg

JFetP(circle=True)

../_images/electrical_168_0.svg

Hemt

../_images/electrical_169_0.svg

Hemt(split=False)

../_images/electrical_170_0.svg

Hemt(arrow=False)

../_images/electrical_171_0.svg

NMos

../_images/electrical_172_0.svg

PMos

../_images/electrical_173_0.svg

NMos(diode=True)

../_images/electrical_174_0.svg

PMos(diode=True)

../_images/electrical_175_0.svg

NMos(circle=True)

../_images/electrical_176_0.svg

PMos(circle=True)

../_images/electrical_177_0.svg

AnalogNFet

../_images/electrical_178_0.svg

AnalogPFet

../_images/electrical_179_0.svg

AnalogBiasedFet

../_images/electrical_180_0.svg

AnalogNFet(bulk=True)

../_images/electrical_181_0.svg

AnalogPFet(bulk=True)

../_images/electrical_182_0.svg

AnalogBiasedFet(bluk=True)

../_images/electrical_183_0.svg

AnalogBiasedFet(arrow=False)

../_images/electrical_184_0.svg

AnalogPFet(arrow=False)

../_images/electrical_185_0.svg

AnalogBiasedFet(arrow=False)

../_images/electrical_186_0.svg

AnalogNFet(offset_gate=False)

../_images/electrical_187_0.svg

AnalogPFet(offset_gate=False)

../_images/electrical_188_0.svg

AnalogBiasedFet(offset_gate=False)

../_images/electrical_189_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_190_0.svg

BjtPnp2

../_images/electrical_191_0.svg

BjtPnp2c2

../_images/electrical_192_0.svg

NFet2

../_images/electrical_193_0.svg

PFet2

../_images/electrical_194_0.svg

JFetN2

../_images/electrical_195_0.svg

JFetP2

../_images/electrical_196_0.svg

NMos2(diode=True)

../_images/electrical_197_0.svg

PMos2(diode=True)

../_images/electrical_198_0.svg

NMos2(circle=True)

../_images/electrical_199_0.svg

PMos2(circle=True)

../_images/electrical_200_0.svg

Vacuum Tubes

A generic configurable vacuum tube is provided in schemdraw.elements.tubes.VacuumTube. It may be created with any number of grids, an indirectly-heated or cold cathode, multiple anode options, and an optional heater filament. Some options are below.

with schemdraw.Drawing():
    elm.VacuumTube(cathode='cold', anodetype='narrow', grids=0, heater=False)
    elm.VacuumTube(cathode='none', heater=True).at((3, 0))
    elm.VacuumTube(anodetype='dot', grids=2).at((6, 0))
    elm.VacuumTube(grids=8).at((9, 0))
../_images/electrical_201_0.svg

For the basic tube, anchors are anode, cathode, cathode_R (the right-hand connection to the cathode), grid, grid_R, and heater anchors heat1 and heat2. When multiple grids are present, the grid anchors are grid_N and grid_NR where N is the grid number from the top down.

Common vacuum tubes are defined from the base VacuumTube element.

The triode, tetrode, and pentode include anchors named for function: control, screen, and suppressor. The pentode includes a strap parameter to connect the suppressor to the cathode.

with schemdraw.Drawing():
    elm.TubeDiode().label('TubeDiode')
    elm.Triode().at((3, 0)).label('Triode')
    elm.Tetrode().at((6, 0)).label('Tetrode')
    elm.Pentode().at((9, 0)).label('Pentode')
    elm.Pentode(strap=True).at((12.5, 0)).label('Pentode(strap=True)')
../_images/electrical_202_0.svg

The anchors are positioned internal to the tube envelope to allow connection from either side. Connecting lines extend into the envelope, and pin numbers appear just outside.

with schemdraw.Drawing():
    tube = (elm.Pentode()
               .label('1', 'cathode')
               .label('2', 'anode')
               .label('3', 'suppressor')
               .label('4', 'screen_R')
               .label('5', 'control')
        )
    elm.Line().down().at(tube.cathode).length(1)
    elm.Line().up().at(tube.anode).length(.5)
    elm.Line().left().at(tube.suppressor).length(1)
    elm.Line().right().at(tube.screen_R).length(1)
    elm.Line().left().at(tube.control).length(1)
../_images/electrical_203_0.svg

A dual vacuum tube may be drawn, with independent number of grids on each side. Anchors are designated A on the left element and B on the right element. schemdraw.elements.tubes.DualVacuumTube

with schemdraw.Drawing():
    t = (elm.DualVacuumTube(grids_left=1, grids_right=3, heater=False)
             .label('anodeA', 'anodeA', halign='right')
             .label('anodeB', 'anodeB')
             .label('cathodeA', 'cathodeA')
             .label('cathodeB_R', 'cathodeB_R', halign='left')
             .label('gridA', 'gridA', valign='center')
             .label('gridB_1R', 'gridB_1R', valign='center')
             .label('gridB_3R', 'gridB_3R', valign='center')
        )
../_images/electrical_204_0.svg

Sometimes, multiple tubes in one envelope are drawn in a split style. This may be enabled using split=’left’ or split=’right`.

with schemdraw.Drawing():
    tube1 = elm.Triode(split='left')
    elm.Line().down().at(tube1.cathode).length(1)
    tube2 = elm.Triode(split='right').at((2, 0))
    elm.Line().down().at(tube2.cathode_R).length(1)
../_images/electrical_205_0.svg

Nixie Tubes are multi-anode tubes drawn with schemdraw.elements.tubes.NixieTube. The cathode may be cold, T or none and anodetype may be narrow or dot or none.

with schemdraw.Drawing():
    t = elm.NixieTube(anodes=12)
    for i in range(12):
        t.label(chr(ord('a')+i), f'anode{i}', halign='center', ofst=(0, .1))

    elm.NixieTube(anodes=6, anodetype='dot', cathode='cold', grid=True).at((0, -3.5))
../_images/electrical_206_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_207_0.svg

Triax()

../_images/electrical_208_0.svg

Coax(length=5, radius=0.5)

../_images/electrical_209_0.svg

Triax(length=5, radiusinner=0.5)

../_images/electrical_210_0.svg
../_images/electrical_211_0.svg
../_images/electrical_212_0.svg

CoaxConnect

../_images/electrical_213_0.svg

Transformers

The schemdraw.elements.xform.Transformer element is used to create various transformers. The number of turns on each side is set with the t1 and t2 parameters. As integers, they define the total number of turns on that side. Multi-phase transformers may be created by setting t1 or t2 to a tuple of turns for each phase.

Transformer

../_images/electrical_214_0.svg

Transformer(loop=True)

../_images/electrical_215_0.svg

Transformer(core=False)

../_images/electrical_216_0.svg
with schemdraw.Drawing():
    elm.Transformer(t1=10, t2=(2, 2), loop=True)
../_images/electrical_217_0.svg