Sign in with STEVE

steve/axial-resistor

Axial leaded metal film resistor, Vishay Beyschlag MBA/SMA 0204, MBB/SMA 0207 and MBE/SMA 0414, with colour rings, horizontal or vertical.

v1.0.0 Latest STEVE MIT 0
Isometric
part.py 157 lines · Python · STEVE runtime · checked
Download
1"""Axial leaded resistor, Vishay Beyschlag professional metal film MBA/SMA 0204, MBB/SMA 0207 and MBE/SMA 0414, mounted horizontal or
2vertical. Lead 1 is at the origin and lead 2 at +X by the pitch; the leads go down through the board. Horizontal: the body lies on the board
3along X, centred between the leads. Vertical: the body stands on the board over lead 1 and lead 2 comes back down beside it. The resistance
4and tolerance make the colour rings (IEC 60062). Dimensions from Vishay's data sheet, listed in the README."""
5import math
6
7from steve import Model
8
9series = "MBA" # MBA (DIN size 0204), MBB (0207) or MBE (0414)
10resistance = 10000.0 # Ω Resistance (in the range the sheet gives for the series and tolerance)
11tolerance = "F" # D 0.5 %, F 1 %, G 2 %, J 5 % (one the sheet offers for this resistance)
12mounting = "horizontal" # horizontal or vertical
13pitch = 7.62 # mm Lead pitch on the board
14tail = 3.0 # mm Leads below the board
15detail = "full" # full: body, colour rings and leads; simple: the body only
16
17# Vishay Beyschlag "MBA/SMA 0204, MBB/SMA 0207, MBE/SMA 0414 - Professional Metal Film Leaded Resistors", document number 28766, revision
18# 11-Jul-2018, page 13, table "DIMENSIONS - Leaded resistor types, mass and relevant physical dimensions": D max, L max, d nom and M min
19# (the smallest bent lead spacing), in mm.
20# Each entry: (body diameter max, body length max, lead diameter, smallest bent lead spacing).
21SIZES = {
22 "MBA": (1.6, 3.6, 0.5, 5.0),
23 "MBB": (2.5, 6.5, 0.6, 10.0),
24 "MBE": (4.2, 11.9, 0.8, 15.0),
25}
26# The same sheet, page 3, "TEMPERATURE COEFFICIENT AND RESISTANCE RANGE - Standard Products", ± 50 ppm/K rows: resistance ranges in Ω by
27# tolerance (the ± 25 ppm/K rows lie inside these). Values come from E24 (± 5 %, ± 2 %), E24/E96 (± 1 %) or E24/E192 (± 0.5 %).
28RANGES = {
29 "MBA": {"J": ((0.22, 0.91),), "F": ((1, 10e6),), "D": ((10, 475e3),)},
30 "MBB": {"J": ((0.22, 0.91), (11e6, 22e6)), "G": ((0.22, 0.91),), "F": ((1, 10e6),), "D": ((10, 1e6),)},
31 "MBE": {"J": ((0.22, 0.91),), "F": ((1, 22e6),), "D": ((10, 2.43e6),)},
32}
33# Colour code, IEC 60062 (the sheet, page 7: "Four or five color code rings designate the resistance value and tolerance in accordance with
34# IEC 60062"): ± 5 % and ± 2 % carry two digit rings, ± 1 % and ± 0.5 % three; then the multiplier ring and the tolerance ring.
35DIGIT_COLOURS = ("#1a1a1a", "#7a4a26", "#c8302c", "#e8792b", "#f2d22e", "#3f8f3f", "#2f5fb3", "#7d4fa8", "#8a8a8a", "#f4f4f4")
36MULTIPLIER_COLOURS = {-2: "#c0c0c4", -1: "#cfa646", 0: "#1a1a1a", 1: "#7a4a26", 2: "#c8302c", 3: "#e8792b", 4: "#f2d22e", 5: "#3f8f3f",
37 6: "#2f5fb3"}
38TOLERANCE_COLOURS = {"D": "#3f8f3f", "F": "#7a4a26", "G": "#c8302c", "J": "#cfa646"}
39
40if series not in SIZES:
41 raise ValueError(f"no series {series!r}: {', '.join(SIZES)}")
42if tolerance not in RANGES[series]:
43 raise ValueError(f"Vishay {series} comes in tolerance {', '.join(RANGES[series])}")
44if not any(low * (1 - 1e-9) <= resistance <= high * (1 + 1e-9) for low, high in RANGES[series][tolerance]):
45 spans = " or ".join(f"{low:g} to {high:g} Ω" for low, high in RANGES[series][tolerance])
46 raise ValueError(f"Vishay {series} at tolerance {tolerance}: {spans}")
47DIGITS = 2 if tolerance in "JG" else 3
48exponent = math.floor(math.log10(resistance) + 1e-9) - (DIGITS - 1)
49digits = round(resistance / 10 ** exponent)
50if digits >= 10 ** DIGITS:
51 digits, exponent = digits // 10, exponent + 1
52if not math.isclose(digits * 10.0 ** exponent, resistance, rel_tol=1e-6) or exponent not in MULTIPLIER_COLOURS:
53 raise ValueError(f"{resistance} Ω can't be written in {DIGITS} digit rings and a multiplier ring")
54diameter, length, lead, spacing = SIZES[series]
55if mounting not in ("horizontal", "vertical"):
56 raise ValueError("mounting is horizontal or vertical")
57R, r = diameter / 2, lead / 2
58BEND = lead # bend radius of the formed leads, one lead diameter: a proportion, for looks (the sheet gives none)
59LOOP = 2.0 # vertical: lead 2 clears the body's top end by this before it turns down, a proportion
60if mounting == "horizontal" and pitch < max(spacing, length + 2 * BEND):
61 raise ValueError(f"horizontal pitch: at least {max(spacing, length + 2 * BEND):.2f} mm for {series} (the sheet's M min is {spacing})")
62if mounting == "vertical" and pitch < max(R + r, 2 * BEND):
63 raise ValueError(f"vertical pitch must let lead 2 pass the body: at least {max(R + r, 2 * BEND):.2f} mm for a {diameter} mm body")
64
65
66def body_profile():
67 """The body outline as (u along the axis from the body's lead-1 end, radius), and the ring segments' indices in ring order. Proportions,
68 for looks (the sheet draws the body but dimensions only D and L): the end caps are 0.25 x the length at the full diameter, their outer
69 edges rounded by 0.25 x the radius; the coated middle is 0.9 x the diameter, reached over 0.05 x the length. Rings 0.08 x the length wide:
70 the first on the lead-1 cap, the tolerance ring on the other cap, the rest spread over the middle."""
71 e, cap, taper, mid, w = 0.25 * R, 0.25 * length, 0.05 * length, 0.9 * R, 0.08 * length
72 rings = DIGITS + 2
73 middle = (cap + taper, length - cap - taper)
74 inner = rings - 2
75 gap = (middle[1] - middle[0] - inner * w) / (inner + 1)
76 centres = [(e + cap) / 2] + [middle[0] + gap * (i + 1) + w * (i + 0.5) for i in range(inner)] + [length - (e + cap) / 2]
77 pts = [(0, 0), (0, R - e)]
78 pts += [(e * (1 - math.cos(math.pi / 2 * i / 4)), R - e + e * math.sin(math.pi / 2 * i / 4)) for i in range(1, 5)]
79 flats = [(e, cap, R), (middle[0], middle[1], mid), (length - cap, length - e, R)]
80 segments = []
81 for k, (a, b, rad) in enumerate(flats):
82 if k:
83 pts.append((a, rad))
84 for c in centres:
85 if a < c < b:
86 pts += [(c - w / 2, rad), (c + w / 2, rad)]
87 segments.append(len(pts) - 2)
88 pts.append((b, rad))
89 pts += [(length - u, v) for u, v in reversed(pts[1:5])]
90 pts += [(length, 0)]
91 return pts, segments
92
93
94def ring_colours():
95 text = str(digits).rjust(DIGITS, "0")
96 return [DIGIT_COLOURS[int(t)] for t in text] + [MULTIPLIER_COLOURS[exponent], TOLERANCE_COLOURS[tolerance]]
97
98
99model = Model()
100outline, rings = body_profile()
101horizontal = mounting == "horizontal"
102x0 = pitch / 2 - length / 2
103axis_z = R # horizontal: the body rests on the board
104if horizontal:
105 points = [(x0 + u, axis_z + v) for u, v in outline]
106 axis = ((0, 0, axis_z), (1, 0, 0))
107else:
108 points = [(v, u) for u, v in outline]
109 axis = "Z"
110with model.sketch("body_sketch", on="XZ", name="Body") as sk:
111 sk.polyline("body_outline", points, closed=True)
112model.revolve("body", "body_sketch", axis=axis, op="new", body="body_body", name="Body")
113bodies = ["body_body"]
114if detail == "full":
115 # Leads, swept along their bends. Horizontal: up from below the board at x = 0 and x = pitch to the body's axis, bent toward the body.
116 # Vertical: lead 1 straight down from the body's bottom end; lead 2 up from the top end, over and down at x = pitch.
117 if horizontal:
118 legs = [(0.0, 1, x0), (pitch, -1, x0 + length)]
119 for i, (x, side, x_end) in enumerate(legs, 1):
120 with model.sketch(f"lead_{i}_path", on="XZ", name=f"Lead {i} path") as sk:
121 sk.line(f"lead_{i}_up", (x, -tail), (x, axis_z - BEND), construction=True)
122 if side > 0:
123 sk.arc(f"lead_{i}_bend", (x + BEND, axis_z - BEND), BEND, 90, 180, construction=True)
124 else:
125 sk.arc(f"lead_{i}_bend", (x - BEND, axis_z - BEND), BEND, 0, 90, construction=True)
126 sk.line(f"lead_{i}_along", (x + side * BEND, axis_z), (x_end, axis_z), construction=True)
127 model.plane(f"lead_{i}_start", on="XY", offset=-tail, name=f"Lead {i} end")
128 with model.sketch(f"lead_{i}_section", on=f"lead_{i}_start", name=f"Lead {i}") as sk:
129 sk.circle(f"lead_{i}_round", (x, 0), r)
130 model.sweep(f"lead_{i}", f"lead_{i}_section", f"lead_{i}_path", op="new", body=f"lead_{i}_body", name=f"Lead {i}")
131 bodies.append(f"lead_{i}_body")
132 else:
133 model.plane("lead_1_start", on="XY", offset=-tail, name="Lead 1 end")
134 with model.sketch("lead_1_section", on="lead_1_start", name="Lead 1") as sk:
135 sk.circle("lead_1_round", (0, 0), r)
136 model.extrude("lead_1", "lead_1_section", distance=tail, op="new", body="lead_1_body", name="Lead 1")
137 top = length + LOOP
138 with model.sketch("lead_2_path", on="XZ", name="Lead 2 path") as sk:
139 sk.line("lead_2_up", (0, length), (0, top - BEND), construction=True)
140 sk.arc("lead_2_bend_1", (BEND, top - BEND), BEND, 90, 180, construction=True)
141 sk.line("lead_2_over", (BEND, top), (pitch - BEND, top), construction=True)
142 sk.arc("lead_2_bend_2", (pitch - BEND, top - BEND), BEND, 0, 90, construction=True)
143 sk.line("lead_2_down", (pitch, top - BEND), (pitch, -tail), construction=True)
144 model.plane("lead_2_start", on="XY", offset=length, name="Lead 2 start")
145 with model.sketch("lead_2_section", on="lead_2_start", name="Lead 2") as sk:
146 sk.circle("lead_2_round", (0, 0), r)
147 model.sweep("lead_2", "lead_2_section", "lead_2_path", op="new", body="lead_2_body", name="Lead 2")
148 bodies += ["lead_1_body", "lead_2_body"]
149# Materials, for looks and a rough mass: the body as its ceramic core (the sheet: "a high grade ceramic body") in the sheet's "light blue
150# protective coating"; the leads copper, tin plated ("electrolytic copper plated with 100 % pure tin").
151model.material("alumina", bodies=["body_body"], color="#9cc3e0")
152if detail == "full":
153 model.material("copper", bodies=[b for b in bodies if b.startswith("lead")], color="#c9ccd1")
154 for i, colour in zip(rings, ring_colours()):
155 model.appearance(color=colour, faces=[f"body.side(body_outline.side{i})"])
156result = model.result()
157

Axial leaded resistor with formed leads, lying on the board or standing up. Vishay Beyschlag's professional metal film resistors in DIN sizes 0204, 0207 and 0414, with the colour rings of the resistance and tolerance. The series gives the size, from Vishay's data sheet. Lead 1 at the origin, lead 2 along +X. See the README.

Axial resistor

An axial leaded metal film resistor with formed leads. Lead 1 is at the origin, lead 2 is at +X by the pitch, and the leads go down through the board.

  • Horizontal: the body lies on the board along X, centred between the leads. The leads come out of its ends at the body's axis and bend down.
  • Vertical: the body stands on the board over lead 1. Lead 2 leaves the top end, turns over and comes down at the pitch.

The series is Vishay Beyschlag's professional metal film resistor in one DIN size. The resistance and tolerance set the colour rings.

Series DIN size Body length max Body Ø max Lead Ø Smallest bent lead spacing
MBA/SMA 0204 0204 3.6 1.6 0.5 5.0
MBB/SMA 0207 0207 6.5 2.5 0.6 10.0
MBE/SMA 0414 0414 11.9 4.2 0.8 15.0

Resistance ranges (Ω), by tolerance:

Series ± 5 % (J) ± 2 % (G) ± 1 % (F) ± 0.5 % (D)
MBA 0.22 to 0.91 1 to 10 M 10 to 475 k
MBB 0.22 to 0.91, 11 M to 22 M 0.22 to 0.91 1 to 10 M 10 to 1 M
MBE 0.22 to 0.91 1 to 22 M 10 to 2.43 M

The sheet says values come from E24 for ± 5 % and ± 2 %, E24 or E96 for ± 1 %, and E24 or E192 for ± 0.5 %. This part checks the range, and that the value can be written in the rings: two digits for ± 5 % and ± 2 %, three for ± 1 % and ± 0.5 %.

Source

Vishay Beyschlag, "MBA/SMA 0204, MBB/SMA 0207, MBE/SMA 0414 - Professional Metal Film Leaded Resistors", document number 28766, revision 11-Jul-2018, from Vishay's own site: https://www.vishay.com/docs/28766/mbxsma.pdf.

  • Page 13, table "DIMENSIONS - Leaded resistor types, mass and relevant physical dimensions": D max, L max, d nom and M min (the first table above).
  • Page 3, "TEMPERATURE COEFFICIENT AND RESISTANCE RANGE - Standard Products": the ± 50 ppm/K ranges (the second table). The ± 25 ppm/K ranges lie inside them.
  • Page 7, "DESCRIPTION": a high grade ceramic body, plated steel caps, tin plated copper leads, "a light blue protective coating", and "four or five color code rings" to IEC 60062.

The rings follow IEC 60062: two or three digit rings, a multiplier ring (gold x0.1, silver x0.01) and a tolerance ring (green D, brown F, red G, gold J).

Proportions, for looks only:

  • The sheet draws the body but dimensions only its diameter and length. The end caps are each 0.25 x the length at the full diameter, with their outer edges rounded by 0.25 x the radius. The coated middle is 0.9 x the diameter, reached over 0.05 x the length.
  • Each ring is 0.08 x the length wide. The first ring is on the lead-1 cap, the tolerance ring on the other cap, and the rest are spread evenly over the middle.
  • The leads bend with a radius of one lead diameter. Vertical lead 2 rises 2.0 above the body before it turns. The body touches the board. The leads end 3.0 below the board by default (tail).
  • The body is drawn as its ceramic core in the sheet's light blue. Its colour is for looks.

Horizontal mounting needs the sheet's smallest bent lead spacing (M min), and room for the body plus two bend radii. Vertical mounting needs lead 2 to clear the body: half its diameter plus half the lead's.

Catalogue models

The catalogue's R_Axial_DIN0204_L3.6mm_D1.6mm_... models map to MBA/SMA 0204, at the model's own pitch and mounting. Each preset shows 10 kΩ ± 1 %. Measured on the reference models: the body is 3.6 long and Ø 1.6 at the caps, with a middle of Ø 1.44, and the leads are Ø 0.5. That's the sheet's maximum and its lead. The horizontal bodies touch the board. The vertical ones stand about 0.9 above it, where this part's touch it. The leads end 3.0 below the board.

MBB/SMA 0207 and MBE/SMA 0414 have no catalogue model of their size, so they're extra presets lying on the board at the 2.54 mm grid pitch nearest above the smallest bent lead spacing.

The catalogue's DIN 0207 and DIN 0414 models aren't here yet. No maker's table read so far matches their bodies:

  • DIN 0207: measured 6.3 long and Ø 2.5 at the caps, leads Ø 0.6. Vishay MBB/SMA 0207 is 6.5 x Ø 2.5 max. KOA Speer MF1/4 (sheet "MF, MFS, RK", dated 10/27/25) is 6.3 ± 0.5 x Ø 2.3 ± 0.3.
  • DIN 0414: measured 11.9 long and Ø 4.5 at the caps, leads Ø 0.8. Vishay MBE/SMA 0414 is 11.9 x Ø 4.2 max. KOA Speer's sheet has no 0414 size.

The other DIN sizes, power, shunt, box, radial and array resistors aren't here yet either; see COVERAGE.md.

  1. 1.0.0 Latest
More #resistor
STEVEMIT

steve/leaded-inductor

Axial leaded inductor, Fastron fixed choke coils (MICC, SMCC, MECC, HCCC, LACC, HBCC, VHBCC, XHBCC) and suppression coils (MISC, MESC, 77A), Vishay Dale molded IM-1 to IM-10, horizontal or vertical.

0 63 sizes 0 2 hours ago v1.1.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 38 minutes 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 17 minutes ago v1.0.0
STEVEMIT

steve/to-package

Through-hole TO packages standing on the board: TO-220AB, TO-220AC, TO-220F, TO-247AC, TO-126, TO-92 and the TO-18, TO-39 and TO-46 metal cans, from the makers' drawings.

0 12 sizes 0 7 minutes ago v1.1.0