gokul/usb3-sd-hub

Engineering draft: four-layer, computer-powered USB 3 hub with one USB-C host socket, two USB-C and two USB-A accessory sockets, and a full-size SD slot. Board and three schematic previews are available. Routing and production checks are incomplete; not fabrication ready.

Version
0.1.5
License
MIT
Stars
0

design/connector-models.ts

// Independently authored nominal solids from the manufacturers' 2D drawings.
// Coordinates are footprint-local mm, z=0 at the PCB top surface.
// These show socket mouths, shells and solder tails; internal springs are omitted.
type Vector3 = [number, number, number];
type Solid =
	| { type: "cuboid"; size: Vector3; center: Vector3 }
	| {
			type: "roundedCuboid";
			size: Vector3;
			center: Vector3;
			roundRadius: number;
			segments: number;
	  }
	| { type: "union" | "subtract"; shapes: Solid[] }
	| { type: "colorize"; color: Vector3; shape: Solid };
const metal: Vector3 = [0.68, 0.7, 0.73];
const polymer: Vector3 = [0.08, 0.09, 0.1];
const gold: Vector3 = [0.86, 0.65, 0.2];
function block({ size, center }: { size: Vector3; center: Vector3 }): Solid {
	return { type: "cuboid", size, center };
}
function colored(shape: Solid, color: Vector3): Solid {
	return { type: "colorize", color, shape };
}

// Amphenol GSB311131HR, customer drawing GSB3111XXXHR rev B2.
export const usbAPins = [
	{ pin: 1, x: -3.5, y: 0 },
	{ pin: 2, x: -1, y: 0 },
	{ pin: 3, x: 1, y: 0 },
	{ pin: 4, x: 3.5, y: 0 },
	{ pin: 5, x: 4, y: 1.5 },
	{ pin: 6, x: 2, y: 1.5 },
	{ pin: 7, x: 0, y: 1.5 },
	{ pin: 8, x: -2, y: 1.5 },
	{ pin: 9, x: -4, y: 1.5 },
];
export const usbAModel: Solid = {
	type: "union",
	shapes: [
		colored(
			{
				type: "subtract",
				shapes: [
					block({ size: [14.4, 16.5, 7], center: [0, -5.53, 3.5] }),
					block({ size: [13.8, 16.3, 6.4], center: [0, -5.83, 3.5] }),
				],
			},
			metal,
		),
		colored(
			block({ size: [12.5, 12, 1.2], center: [0, -4.2, 2.25] }),
			[0.04, 0.2, 0.66],
		),
		...usbAPins.map((pin) =>
			colored(
				block({ size: [0.4, 0.25, 3.2], center: [pin.x, pin.y, -1.6] }),
				metal,
			),
		),
		...[-6.57, 6.57].map((x) =>
			colored(block({ size: [0.3, 1.5, 2.4], center: [x, -2, -1.2] }), metal),
		),
	],
};

// Amphenol 12401610E4#2A, drawing C12401610 rev C.
export const usbCModel: Solid = {
	type: "union",
	shapes: [
		colored(
			{
				type: "subtract",
				shapes: [
					{
						type: "roundedCuboid",
						size: [9.2, 10.45, 3.28],
						center: [0, -0.005, 1.64],
						roundRadius: 0.18,
						segments: 16,
					},
					{
						type: "roundedCuboid",
						size: [8.6, 9.6, 2.68],
						center: [0, -0.53, 1.64],
						roundRadius: 0.15,
						segments: 16,
					},
				],
			},
			metal,
		),
		colored(block({ size: [6.69, 6.8, 0.7], center: [0, 0, 1.64] }), polymer),
		...Array.from({ length: 12 }, (_, index) =>
			colored(
				block({
					size: [0.2, 2.4, 0.05],
					center: [-2.75 + index * 0.5, -1.8, 2.015],
				}),
				gold,
			),
		),
		...[
			[-4.13, 3.11],
			[4.13, 3.11],
			[-4.49, -2.84],
			[4.49, -2.84],
		].map(([x, y]) =>
			colored(block({ size: [0.3, 0.7, 1], center: [x, y, -0.5] }), metal),
		),
	],
};

// Hirose DM1AA-SF-PEJ(82), EDC3-153736-02 rev 3.
// This is not derived from Hirose's restricted downloadable STEP model.
export const sdSocketModel: Solid = {
	type: "union",
	shapes: [
		colored(
			{
				type: "subtract",
				shapes: [
					block({ size: [28, 30.5, 2.9], center: [0, 0, 1.45] }),
					block({ size: [27.6, 30.5, 2.5], center: [0, -0.2, 1.25] }),
				],
			},
			metal,
		),
		...[-13, 13].map((x) =>
			colored(
				block({ size: [1.5, 29.8, 1.8], center: [x, 0.15, 0.9] }),
				polymer,
			),
		),
		colored(block({ size: [25, 2, 2.5], center: [0, 14.1, 1.25] }), polymer),
		...[
			[-14.5, 8.15],
			[14.5, 8.15],
			[-14.1, -10.5],
			[14.5, -10.5],
		].map(([x, y]) =>
			colored(block({ size: [1.6, 2.2, 0.2], center: [x, y, 0.1] }), metal),
		),
		...[1.35, 3.05, 5.475, 7.975, 10.475, 12.975, 15.475, 17.975, 20.475].map(
			(x) =>
				colored(
					block({ size: [0.7, 1.7, 0.15], center: [x - 11.9, 14.9, 0.075] }),
					gold,
				),
		),
	],
};