Sign in with STEVE

steve/dsub-connector

D-sub connectors, standard density, 9, 15, 25 and 37 positions, male or female, vertical (NorComp 171) or right-angle .318" (NorComp 182).

v1.0.0 Latest STEVE MIT 0
Isometric
part.py 201 lines · Python · STEVE runtime · checked
Download
1"""D-sub connector, standard density, 9, 15, 25 and 37 positions, male (pins) or female (sockets), vertical or right-angle through-hole: NorComp
2171 (vertical, dip solder) and 182 (right angle, .318" footprint). Pin 1 is at the origin; the first row (the longer one, on the D's wide side)
3runs along +X on a male part and along -X on a female part, so the two mate pin for pin; the second row is 2.84 along -Y.
4Vertical: the board is the XY plane, the D faces up (+Z), the tails go down through the board. Right-angle: the flange stands on the board
5with the D facing -Y, the D's wide side up; the first row of tails is the one farther from the flange. Dimensions in the README."""
6from steve import Model
7import math
8
9positions = 9 # Positions: 9, 15, 25 or 37
10gender = "male" # male (pins, plug) or female (sockets, receptacle)
11mounting = "vertical" # vertical (NorComp 171) or right-angle (NorComp 182, .318")
12detail = "full" # full: shell, insulator and contacts; simple: the metal shell only
13
14# NorComp, drawing 171-YYY-113RYY1 rev 18 (male, dip solder) and 171-YYY-213RYY1 rev 17 (female), sheet 1, table "DIMENSIONS (in/mm)", mm:
15# positions: (A flange width, B mounting hole spacing, C D-shell width male, C female, D rear shell width, E D-shell height male, E female,
16# F flange height). The 50-position size (three rows) isn't offered.
17VERTICAL = {
18 9: (30.80, 24.99, 16.92, 16.30, 19.20, 8.36, 7.90, 12.60),
19 15: (39.15, 33.32, 25.25, 24.65, 27.70, 8.36, 7.90, 12.60),
20 25: (53.00, 47.04, 38.96, 38.40, 41.10, 8.36, 7.90, 12.60),
21 37: (69.30, 63.50, 55.42, 54.80, 57.30, 8.36, 7.90, 12.60),
22}
23# 171, sheet 1 views (mm): flange 0.90 thick; the D 6.00 in front of the flange; the rear shell 4.10 behind the flange and 10.90 high; the
24# insulator 5.60 max behind the flange; the tails 4.80 beyond the insulator and 4.00 beyond its standoffs (the seating plane).
25V_FLANGE, V_FRONT, V_REAR_SHELL, V_REAR_INSULATOR, V_REAR_HIGH, V_TAIL_PAST_INSULATOR, V_TAIL = 0.90, 6.00, 4.10, 5.60, 10.90, 4.80, 4.00
26# 171 sheet 2, recommended PCB layout (inch): the 25-position first row spans 2 x 0.652 over 12 pitches (pitch 0.1087" = 2.76 mm), the rows are
27# 0.056 either side of the centre line (2.84 apart).
28V_PITCH, ROW = 0.652 / 6 * 25.4, 0.112 * 25.4
29# NorComp, drawing 182-YYY-113RYY1 rev 16 (male) and 182-YYY-213RYY1 rev 18 (female), R/A .318", sheet 1, table "DIMENSIONS", mm:
30# positions: (A flange width male, A female, B mounting hole spacing, C D-shell width male, C female).
31RIGHT_ANGLE = {
32 9: (30.80, 30.81, 24.99, 16.92, 16.30),
33 15: (39.14, 39.14, 33.32, 25.25, 24.65),
34 25: (53.04, 53.04, 47.04, 38.96, 38.40),
35 37: (69.32, 69.32, 63.50, 55.40, 54.80),
36}
37# 182 sheet 1 views (mm): flange 12.55 high, its lower edge on the board; the D 6.0 (male) or 5.9 (female) in front of the flange; overall depth
38# 18.51 (male) or 18.3 (female); the first row of tails 8.08 (.318") behind the flange's front face, the rows 2.84 apart, pitch 2.77; tails
39# 0.64 square, 3.18 below the board; Ø 3.05 holes through the flange (hardware option 43, ".120 dia. hole", sheet 2).
40RA_FLANGE_HIGH, RA_FRONT, RA_DEPTH, RA_ROW, RA_PITCH, RA_TAIL, RA_POST = 12.55, {"male": 6.0, "female": 5.9}, {"male": 18.51, "female": 18.3}, 8.08, 2.77, 3.18, 0.64
41HOLE = 3.05
42# NorComp panel cutout drawing (Panel_Cutout_D-Sub-Single): the D's sides lean 10 deg.
43SIDE_ANGLE = 10.0
44# Proportions, for looks (README): shell sheet 0.4 thick; the D's corners rounded 0.15 x its height; the flange's corners 0.6; the male pins
45# Ø 1.0 rising from an insulator 1.5 above the flange to 0.6 below the D's front edge; the female insulator flush with the D's front, its
46# sockets Ø 1.0 and 4 deep; the vertical part's tails Ø 0.8 (the sheet's PCB hole is Ø 1.09); its rear insulator 0.6 inside the rear shell,
47# with four Ø 1.5 standoffs; the right-angle part's insulator body the flange's full width and height. The 171 flange (0.90) is used for the 182.
48SHEET, PIN, SOCKET_DEPTH, V_TAIL_D, STANDOFF_D = 0.4, 1.0, 4.0, 0.8, 1.5
49
50if positions not in VERTICAL:
51 raise ValueError(f"positions: one of {', '.join(map(str, VERTICAL))}")
52if gender not in ("male", "female") or mounting not in ("vertical", "right-angle"):
53 raise ValueError("gender: male or female; mounting: vertical or right-angle")
54male = gender == "male"
55vertical = mounting == "vertical"
56first = (positions + 1) // 2
57side = 1 if male else -1
58if vertical:
59 A, B, C_m, C_f, D_rear, E_m, E_f, F = VERTICAL[positions]
60 C, E = (C_m, E_m) if male else (C_f, E_f)
61 pitch = V_PITCH
62 flange_front = V_TAIL_PAST_INSULATOR - V_TAIL + V_REAR_INSULATOR + V_FLANGE # seating plane to the flange's front face
63 cw = -ROW / 2 # cross-axis (Y) centre of the D
64else:
65 A_m, A_f, B, C_m, C_f = RIGHT_ANGLE[positions]
66 A, C = (A_m, C_m) if male else (A_f, C_f)
67 E = VERTICAL[positions][5 if male else 6] # the 182 uses the same shell; its D height is on the 171 drawing
68 F = RA_FLANGE_HIGH
69 pitch = RA_PITCH
70 flange_front = RA_ROW + ROW # first row (y = 0) to the flange's front face, along -Y
71 cw = F / 2 # cross-axis (Z) centre of the D
72cx = side * (first - 1) * pitch / 2
73front = flange_front + (V_FRONT if vertical else RA_FRONT[gender])
74flange_rear = flange_front - V_FLANGE
75
76
77def rounded(points, r, n=5):
78 """A convex polygon (counter-clockwise) with its corners rounded to radius r."""
79 out = []
80 k = len(points)
81 for i in range(k):
82 px, py = points[i - 1]
83 vx, vy = points[i]
84 nx, ny = points[(i + 1) % k]
85 a = (px - vx, py - vy)
86 b = (nx - vx, ny - vy)
87 la, lb = math.hypot(*a), math.hypot(*b)
88 a, b = (a[0] / la, a[1] / la), (b[0] / lb, b[1] / lb)
89 theta = math.acos(max(-1.0, min(1.0, a[0] * b[0] + a[1] * b[1])))
90 t = r / math.tan(theta / 2)
91 bis = (a[0] + b[0], a[1] + b[1])
92 lbis = math.hypot(*bis)
93 c = (vx + bis[0] / lbis * r / math.sin(theta / 2), vy + bis[1] / lbis * r / math.sin(theta / 2))
94 p0 = (vx + a[0] * t, vy + a[1] * t)
95 p1 = (vx + b[0] * t, vy + b[1] * t)
96 a0 = math.atan2(p0[1] - c[1], p0[0] - c[0])
97 a1 = math.atan2(p1[1] - c[1], p1[0] - c[0])
98 while a1 < a0:
99 a1 += 2 * math.pi
100 out += [(c[0] + r * math.cos(a0 + (a1 - a0) * j / n), c[1] + r * math.sin(a0 + (a1 - a0) * j / n)) for j in range(n + 1)]
101 return out
102
103
104def d_shape(width, high, r, inset=0.0):
105 """The D: `width` across its wide side (+cross axis), sides leaning SIDE_ANGLE, shrunk by `inset` all round."""
106 tan = math.tan(math.radians(SIDE_ANGLE))
107 w = width - 2 * inset / math.cos(math.radians(SIDE_ANGLE))
108 h = high - 2 * inset
109 top, bottom = w / 2, w / 2 - h * tan
110 pts = [(cx - bottom, cw - h / 2), (cx + bottom, cw - h / 2), (cx + top, cw + h / 2), (cx - top, cw + h / 2)]
111 return rounded(pts, max(r - inset, 0.1))
112
113
114def rect(w, h):
115 return [(cx - w / 2, cw - h / 2), (cx + w / 2, cw - h / 2), (cx + w / 2, cw + h / 2), (cx - w / 2, cw + h / 2)]
116
117
118model = Model()
119
120
121def prism(fid, pts, u0, u1, name, body, op="join"):
122 """A prism of the outline `pts` (x, cross) from u0 to u1 along the connector's axis (toward the mating face)."""
123 if vertical:
124 model.plane(f"{fid}_plane", on="XY", offset=u0, name=name)
125 else:
126 model.plane(f"{fid}_plane", on="XZ", offset=u0, name=name) # XZ at y = -u0; a positive extrude runs along -Y
127 with model.sketch(f"{fid}_sketch", on=f"{fid}_plane", name=name) as sk:
128 sk.polyline(f"{fid}_outline", pts, closed=True)
129 model.extrude(fid, f"{fid}_sketch", distance=u1 - u0, op=op, body=body, name=name)
130
131
132def rods(fid, centres, d, u0, u1, name, body, op="new"):
133 if vertical:
134 model.plane(f"{fid}_plane", on="XY", offset=u0, name=name)
135 else:
136 model.plane(f"{fid}_plane", on="XZ", offset=u0, name=name)
137 with model.sketch(f"{fid}_sketch", on=f"{fid}_plane", name=name) as sk:
138 for i, (x, w) in enumerate(centres):
139 sk.circle(f"{fid}_{i}", (x, w), d / 2)
140 model.extrude(fid, f"{fid}_sketch", distance=u1 - u0, op=op, body=body, name=name)
141
142
143corner = 0.15 * E
144row_w = (cw + ROW / 2, cw - ROW / 2) # first and second row on the D's face
145face = [(side * i * pitch, row_w[0]) for i in range(first)] + [(side * (i + 0.5) * pitch, row_w[1]) for i in range(positions - first)]
146holes = [(cx - B / 2, cw), (cx + B / 2, cw)]
147
148# The metal shell: flange, the D in front of it and (vertical) the rear shell behind it.
149prism("flange", rounded(rect(A, F), 0.6), flange_rear, flange_front, "Flange", "shell_body", op="new")
150prism("d_shell", d_shape(C, E, corner), flange_front, front, "D shell", "shell_body")
151if vertical:
152 prism("rear_shell", d_shape(D_rear, V_REAR_HIGH, corner), flange_rear - V_REAR_SHELL, flange_rear, "Rear shell", "shell_body")
153if detail == "full":
154 prism("d_cavity", d_shape(C, E, corner, SHEET), flange_front, front, "D cavity", "shell_body", op="cut")
155rods("mount_holes", holes, HOLE, flange_rear, flange_front, "Mounting holes", "shell_body", op="cut")
156bodies = {"shell_body": ("steel-dc01", "#c9cdd2")}
157
158if detail == "full":
159 # Insulator: inside the D, and behind the flange.
160 if male:
161 prism("insulator_face", d_shape(C, E, corner, SHEET), flange_front, flange_front + 1.5, "Insulator", "insulator_body", op="new")
162 else:
163 prism("insulator_face", d_shape(C, E, corner, SHEET), flange_front, front, "Insulator", "insulator_body", op="new")
164 if vertical:
165 floor = V_TAIL_PAST_INSULATOR - V_TAIL
166 prism("insulator_rear", d_shape(D_rear, V_REAR_HIGH, corner, 0.6), floor, flange_rear - V_REAR_SHELL, "Rear insulator", "insulator_body")
167 tan = math.tan(math.radians(SIDE_ANGLE))
168 hw, hh = (D_rear - 1.2) / 2 - (V_REAR_HIGH - 1.2) * tan - 1.6, (V_REAR_HIGH - 1.2) / 2 - 1.6
169 rods("standoffs", [(cx - hw, cw - hh), (cx + hw, cw - hh), (cx - hw - 2 * hh * tan, cw + hh), (cx + hw + 2 * hh * tan, cw + hh)],
170 STANDOFF_D, 0.0, floor, "Standoffs", "insulator_body", op="join")
171 else:
172 back = flange_front - RA_DEPTH[gender] + RA_FRONT[gender]
173 prism("insulator_rear", rounded(rect(A, F), 0.6), back, flange_rear, "Insulator body", "insulator_body")
174 rods("body_holes", holes, HOLE, back, flange_rear, "Mounting holes", "insulator_body", op="cut")
175 bodies["insulator_body"] = ("pa6", "#1d1d1f")
176 # Contacts: male pins on the D's face, female sockets cut into the insulator; the tails below the board.
177 if male:
178 rods("pins", face, PIN, flange_front + 1.5, front - 0.6, "Pins", "contacts_body")
179 else:
180 rods("sockets", face, PIN, front - SOCKET_DEPTH, front, "Sockets", "insulator_body", op="cut")
181 tails = [(side * i * pitch, 0.0) for i in range(first)] + [(side * (i + 0.5) * pitch, -ROW) for i in range(positions - first)]
182 if vertical:
183 model.plane("tails_plane", on="XY", offset=-V_TAIL, name="Tails")
184 with model.sketch("tails_sketch", on="tails_plane", name="Tails") as sk:
185 for i, (x, y) in enumerate(tails):
186 sk.circle(f"tail_{i}", (x, y), V_TAIL_D / 2)
187 model.extrude("tails", "tails_sketch", distance=V_TAIL + V_TAIL_PAST_INSULATOR - V_TAIL, op="join" if male else "new", body="contacts_body", name="Tails")
188 else:
189 model.plane("tails_plane", on="XY", offset=-RA_TAIL, name="Tails")
190 with model.sketch("tails_sketch", on="tails_plane", name="Tails") as sk:
191 for i, (x, y) in enumerate(tails):
192 sk.rect(f"tail_{i}", (x - RA_POST / 2, y - RA_POST / 2), (x + RA_POST / 2, y + RA_POST / 2))
193 model.extrude("tails", "tails_sketch", distance=RA_TAIL + 1.0, op="join" if male else "new", body="contacts_body", name="Tails")
194 bodies["contacts_body"] = ("brass", "#d4a94a")
195
196# Materials, for looks and a rough mass: the shell is nickel-plated SPCC (cold-rolled steel, DC01); the insulator PA6T / PA9T, so nylon (PA6);
197# the contacts gold-plated brass.
198for body, (material, colour) in bodies.items():
199 model.material(material, bodies=[body], color=colour)
200result = model.result()
201

D-sub (D-subminiature) board connector with the standard shell, from NorComp's drawings: the stamped steel shell with its flange and mounting holes, the D, the insulator and the contacts. Vertical dip-solder (NorComp 171) or right-angle with the .318" footprint (NorComp 182), male (pins) or female (sockets). Pin 1 at the origin. See the README.

D-sub connector

A D-sub (D-subminiature) board connector, standard density, with the standard shell: NorComp's 171 series (vertical, dip solder) and 182 series (right angle, .318" footprint). The stamped steel shell has its flange with two mounting holes, the D in front of the flange and, on the vertical part, the rear shell behind it. Inside are the insulator and the contacts: pins on a male part (plug), sockets on a female part (receptacle).

  • positions: 9, 15, 25 or 37, the shell sizes E, A, B and C (DE-9, DA-15, DB-25, DC-37).
  • gender: male or female.
  • mounting: vertical (NorComp 171, the D facing up) or right-angle (NorComp 182, the flange standing on the board, the D facing -Y).
  • detail: full, or simple for the metal shell only.

Pin 1 is at the origin. The first row, the longer one, is on the D's wide side. It runs along +X on a male part and along -X on a female part, so a plug and a receptacle mate pin for pin. The second row is 2.84 along -Y. On the right-angle part, the first row is the one farther from the flange.

Positions Flange A Hole spacing B D width C, male / female D height E, male / female Rear shell D (171)
9 30.80 24.99 16.92 / 16.30 8.36 / 7.90 19.20
15 39.15 33.32 25.25 / 24.65 8.36 / 7.90 27.70
25 53.00 47.04 38.96 / 38.40 8.36 / 7.90 41.10
37 69.30 63.50 55.42 / 54.80 8.36 / 7.90 57.30

These are the 171 values. The 182 drawings give A as 30.80 (30.81 female), 39.14, 53.04 and 69.32, and C for the 37-position male as 55.40. part.py uses each drawing's own values.

Vertical (171). The flange is 12.60 high and 0.90 thick. The D stands 6.00 in front of the flange. Behind the flange, the rear shell is 4.10 deep and 10.90 high, and the insulator ends 5.60 max behind the flange. The tails reach 4.80 beyond the insulator and 4.00 beyond its standoffs, which sit on the board. So the seating plane is 0.8 below the insulator, the flange is 6.4 to 7.3 above the board, and the D's front is 13.3 above it. The pitch is 2.76 (0.1087"), with the rows 2.84 apart.

Right angle (182, .318"). The flange is 12.55 high, with its lower edge on the board. The D stands 6.0 (male) or 5.9 (female) in front of the flange. The overall depth is 18.51 (male) or 18.3 (female). The first row of tails nearest the flange is 8.08 (.318") behind the flange's front face, and the rows are 2.84 apart at a pitch of 2.77. The tails are 0.64 square and 3.18 long below the board. The flange has Ø 3.05 holes, which is hardware option 43, ".120 dia. hole".

Source

NorComp drawings, from NorComp's own site (content.norcomp.net, rohspdfs/Connectors/...):

  • 171-YYY-113RYY1, rev 18 (male, dip solder, stamped) and 171-YYY-213RYY1, rev 17 (female). Sheet 1 has the table "DIMENSIONS (in/mm)" (A to F, by positions) and the side views: 0.90 flange, 6.00 D, 4.10 rear shell, 5.60 max insulator, 10.90 rear height, and 4.80 and 4.00 tails. Sheet 2 has the recommended PCB layout: the pin coordinates (25 positions: first row ±0.652 over 12 pitches; rows 0.056 either side of the centre line) and the Ø 0.043 tail holes. The materials are PA6T insulator, gold-plated brass contacts and a nickel-plated steel shell.
  • 182-YYY-113RYY1, rev 16 (R/A .318", male) and 182-YYY-213RYY1, rev 18 (female). Sheet 1 has the table "DIMENSIONS" (A to D) and these views: 12.55 flange, 6.0 / 5.9 D, 18.51 / 18.3 depth, 0.318 [8.08] row, 0.109 [2.77] pitch, 0.112 [2.84] rows, 0.64 square tails, 3.18 below the board, and Ø 3.05 holes. Sheet 2 has the hardware options (43: metal shell, .120" hole). The materials are a nickel-plated SPCC shell, PA9T insulator and gold-plated brass contacts. The 182 drawings don't give the D's height. The 182 is built on the same standard shell (its A, B and C are the 171's), so the 171's E is used.
  • Panel_Cutout_D-Sub-Single: the D's sides lean 10°.

Proportions, for looks only. The drawings show these but don't dimension them:

  • The shell sheet is 0.4 thick. The D's corners are rounded to 0.15 x its height, and the flange's corners to 0.6. The rear shell (171) is drawn as the same 10° D.
  • The male pins are Ø 1.0. They rise from an insulator face 1.5 in front of the flange to 0.6 below the D's front edge. The female insulator is flush with the D's front, with Ø 1.0 sockets 4 deep.
  • On the 171, the tails are Ø 0.8, under the sheet's Ø 1.09 PCB hole. The rear insulator is 0.6 inside the rear shell, with four Ø 1.5 standoffs, 0.8 high, under it.
  • On the 182, the insulator body is as wide and high as the flange, with the mounting holes through it. The flange is 0.90 thick, as on the 171.
  • Materials are for looks and a rough mass. The shell is SPCC (cold-rolled steel, DC01), the insulator is nylon (PA6, for PA6T / PA9T) and the contacts are brass.

The 50-position size, which has three rows, isn't offered.

Catalogue models

The catalogue's DSUB-<n>_<Pins|Male|Socket|Female>_<Vertical|Horizontal>_... models name no maker. Every maker builds the same standard shell, and NorComp's drawings follow it, but the reference models' shells are narrower. Measured on the reference models:

  • The D shell is 16.56 wide for the 9-pin plug, 15.92 for the 9-pin socket and 37.92 for the 25-pin socket. NorComp gives 16.92, 16.30 and 38.40, so the models are 0.3 to 0.5 mm narrower than the standard shell. The models are wrong, not another part.
  • The vertical 9-pin plug's flange is 12.5 high and 4.2 to 4.7 above the board, with the D's front at 10.5 and 8.3 high. On NorComp's part, the flange is 12.60 high and 6.4 to 7.3 above the board, with the D's front at 13.3 and 8.36 high.
  • The vertical models' pitch is 2.77. NorComp's layout gives 0.1087" (2.76).

So each model whose pin count, gender and mounting NorComp's drawings have maps to NorComp's part, 28 of the 104:

  • Vertical, P2.77x2.84mm, with or without _MountingHoles (9, 15, 25 and 37 positions, pins, male, socket and female), maps to the 171.
  • Horizontal, EdgePinOffset7.70mm_Housed_MountingHolesOffset9.12mm (9, 15, 25 and 37 positions, pins and socket), maps to the 182. Measured on the 25-socket model: the flange's front face is 7.98 in front of the nearer row of pins, where the 182 has .318" (8.08). The mounting holes are 1.42 behind that row, as on the 182. The flange is 53.10 x 12.5, against 53.04 x 12.55, and the D is 6.1 deep, against 5.9.

These stay "no table read yet" (COVERAGE.md) until a drawing for them is read:

  • the high-density models (15, 26, 44 and 62 positions);
  • the other right-angle footprints: edge offsets 4.94, 9.40, 9.90 and 14.56, including the unhoused 9.40 models, which measured 9.7 from the flange to the nearer row;
  • the P2.77x2.54mm models.
  1. 1.0.0 Latest
More #d-sub
STEVEMIT

steve/pin-socket

Pin socket (female header): 2.54 mm straight, 2.00 mm surface-mount, 1.27 mm surface-mount and right-angle, 1.00 mm straight and surface-mount, one or two rows.

1 440 sizes 0 4 hours ago v1.2.0
STEVEMIT

steve/fh12-fpc-connector

Hirose FH12 0.5 mm pitch FPC/FFC connectors, right angle, bottom contact, flip lock, 6 to 53 contacts, by the maker's drawing.

0 28 sizes 0 7 hours ago v1.0.0
STEVEMIT

steve/axial-diode

Axial leaded diodes in Vishay's DO-35, DO-41, DO-15, DO-201AD and P600 packages, with the cathode band, horizontal or vertical.

0 30 sizes 0 1 hour ago v1.0.0
STEVEMIT

steve/bridge-rectifier

Single-phase bridge rectifiers in Vishay's through-hole cases: GBL, GBU, KBL and KBU in-line, KBPC1 and KBPC6 square, from Vishay's data sheets.

0 7 sizes 0 1 hour ago v1.0.0