Connectors

All connectors are defined with a default pin spacing of 0.6, matching the default pin spacing of the schemdraw.elements.intcircuits.Ic class, for easy connection of multiple signals.

Headers

A schemdraw.elements.connectors.Header is a generic Header block with any number of rows and columns. It can have round, square, or screw-head connection points.

class schemdraw.elements.connectors.Header(**kwargs)

Generic Header connector element

Parameters:
  • rows (int) – Number of rows [4]
  • cols (int) – Number of columns. Pin numbering requires 1 or 2 columns. [1]
  • style (string) – Connector style, ‘round’, ‘square’, or ‘screw’
  • numbering (string) – Pin numbering order. ‘lr’ for left-to-right numbering, ‘ud’ for up-down numbering, or ‘ccw’ for counter-clockwise integrated-circuit style numbering. Pin 1 is always at the top-left corner, unless flip parameter is also set.
  • shownumber (bool) – Draw pin numbers outside the header [False]
  • pinsleft (list) – List of pin labels for left side
  • pinsright (list) – List of pin labels for right side
  • pinalignleft (string) – Vertical alignment for pins on left side (‘center’, ‘top’, ‘bottom’)
  • pinalignright – Vertical alignment for pins on right side (‘center’, ‘top’, ‘bottom’)
  • pinfontsizeleft (float) – Font size for pin labels on left
  • pinfontsizeright (float) – Font size for pin labels on right
  • pinspacing (float) – Distance between pins [0.6]
  • edge (float) – Distance between header edge and first pin row/column [0.3]
  • pinfill (string) – Color to fill pin circles
../_images/connectors_1_0.svg

Header pins are given anchor names p1, p2, etc. Pin number labels and anchor names can be ordered left-to-right (lr), up-to-down (ud), or counterclockwise (ccw) like a traditional IC, depending on the numbering argument. The flip argument can be set True to put pin 1 at the bottom.

../_images/connectors_2_0.svg

A Jumper element is also defined, as a simple rectangle, for easy placing onto a header.

J = d.add(elm.Header(cols=2, style='square'))
d.add(elm.Jumper(at=J.p3, fill='lightgray'))
../_images/connectors_5_0.svg

D-Sub Connectors

Both DB9 and DB25 subminiature connectors are defined, with anchors p1 through p9 or p25.

../_images/connectors_6_0.svg

Multiple Lines

The schemdraw.elements.connectors.RightLines and schemdraw.elements.connectors.OrthoLines elements are useful for connecting multiple pins of an integrated circuit or header all at once. Both need an at and to location specified, along with the n parameter for setting the number of lines to draw.

Use RightLines when the Headers are perpindicular to each other.

D1 = d.add(elm.Ic(pins=[elm.IcPin(name='A', side='t', slot='1/4'),
                        elm.IcPin(name='B', side='t', slot='2/4'),
                        elm.IcPin(name='C', side='t', slot='3/4'),
                        elm.IcPin(name='D', side='t', slot='4/4')]))
D2 = d.add(elm.Header(rows=4, at=[5,4]))
d.add(elm.RightLines(at=D2.p1, to=D1.D, n=4, label='RightLines'))
../_images/connectors_9_0.svg

OrthoLines draw a z-shaped orthogonal connection. Use OrthoLines when the Headers are parallel but vertically offset. Use the xstart parameter, between 0 and 1, to specify the position where the first OrthoLine turns vertical.

D1 = d.add(elm.Ic(pins=[elm.IcPin(name='A', side='r', slot='1/4'),
                        elm.IcPin(name='B', side='r', slot='2/4'),
                        elm.IcPin(name='C', side='r', slot='3/4'),
                        elm.IcPin(name='D', side='r', slot='4/4')]))
D2 = d.add(elm.Header(rows=4, at=[7, -3]))
d.add(elm.OrthoLines(at=D1.D, to=D2.p1, n=4, label='OrthoLines'))
../_images/connectors_12_0.svg

Data Busses

Sometimes, multiple I/O pins to an integrated circuit are lumped together into a data bus. The connections to a bus can be drawn using the schemdraw.elements.connectors.BusConnect element, which takes n the number of data lines and an argument. schemdraw.elements.connectors.BusLine is simply a wider line used to extend the full bus to its destination.

BusConnect elements define anchors start, end on the endpoints of the wide bus line, and p1, p2, etc. for the individual signals.

J = d.add(elm.Header(rows=6))
B = d.add(elm.BusConnect(n=6, at=J.p1))
d.add(elm.BusLine('down', at=B.end, l=3))
B2 = d.add(elm.BusConnect(n=6, anchor='start', reverse=True))
d.add(elm.Header(rows=6, at=B2.p1, anchor='p1'))
../_images/connectors_15_0.svg