Files
hexapod-robot/2026-current/hardware/openscad/remote_v2.scad
T

588 lines
33 KiB
OpenSCAD
Raw Normal View History

// Remote v2: a flat console for the same electronics as the original remote
// (remote.scad, kept as the record of the printed one). Draft 3, not printed.
//
// Use (owner): both hands wrap the big twist-grip sticks, so nothing holds
// the case. It hangs from a neck strap on one eyelet on the top face, near
// the balance point and behind the display (slide it in its slots to balance),
// with a fold-out bail that braces against the body; or it lies on a table on
// its kickstand. The sticks sit far apart and nothing rises above the top face
// near them.
//
// Two shells split horizontally, printed in ASA: the top shell face down,
// the bottom shell on its flat underside, both without supports. The
// kickstand, strap eyelet and brace bail are separate parts. The shells are joined by M3 screws from below
// into heat-set inserts in the top shell.
//
// Frame: u to the right, v away from the user (the far edge is the front),
// Z up, Z = 0 on the top face.
//
// Electronics (all reused): 2 x JH-D300X-R1 joystick, Nextion NX4832T035
// (3.5"), 18650 UPS/boost board (89 x 22), Teensy 4.0, GY-521 (MPU6050),
// 12 x 15 mm 4-pin USB-C breakout (V, D-, D+, G), slide switch (the robot's).
// Wiring (owner): the breakout's V/G go to the UPS board's charge input and
// D-/D+ to the Teensy, through two halves of a cut USB cable whose plugs go
// into the UPS board and the Teensy; the UPS output feeds the Teensy.
/* [Shell] */
T = 2.4; // walls and floor (6 perimeters of 0.4)
PLATE = 3.0; // top plate
TOP_GROW = 10; // extra height of the top shell only (room behind the display); the bottom shell is unchanged
Z_BOT = -32 - TOP_GROW; // flat underside (32 mm thick before TOP_GROW: the D300X sticks reach 28.5 down)
Z_SPLIT = -12 - TOP_GROW; // top shell / bottom shell
CHAMFER = 4; // 45 deg bottom edge (printable without support)
TOP_CHAMFER = 1.5; // 45 deg top edge (the top shell prints face down)
LIP_H = 2.5; // locating lip on the bottom shell, into the top shell
LIP_W = 1.2;
FIT = 0.2; // clearance per side between printed parts
/* [Outline] */
STICKS = [[-80, 0], [80, 0]];
STICK_SQ = [28, 40]; // half size (u, v) of the rounded box around each stick
STICK_SQ_R = 10;
FRONT_BAND = [[-60, 0], [60, 52]]; // u, v box: display, USB-C, Teensy
FRONT_V = FRONT_BAND[1][1];
SIDE_U = STICKS[1][0] + STICK_SQ[0]; // the flat side faces
REAR_BAND = [[-80, -64], [80, 0]]; // UPS board behind the strap eyelet, switch behind that
CORNER_R = 10;
/* [Fasteners] */
// M3 x 12 from below; heat-set insert M3 (4.0 mm hole, 5.7 mm long) in the top shell
SCREWS = [[-58, 32], [58, 32], [-70, -52], [70, -52]];
BOSS_D = 9;
INSERT_D = 4.0;
INSERT_L = 6;
SCREW_D = 3.4;
HEAD_D = 6.5;
HEAD_Z = Z_SPLIT - 7; // counterbore floor: 7 mm of tower + 5 mm into the insert
/* [Joysticks] */
STICK_HOLE_D = 40;
STICK_SCREW = 16.25; // 4 x M2.5 x 14 on a 32.5 mm square, through cover and plate into the control box
STICK_SCREW_D = 2.8;
/* [Display: Nextion NX4832T035] */
NX_BOARD = [100.6, 55]; // measured by the owner
NX_HOLES = [94.2, 48.5]; // M3 grid, centred on the board
NX_CENTRE = [0, 20]; // board centre (forward of the sticks, so the strap misses it)
NX_FLIP = true; // display mounted turned 180 deg (its J1 connector on the right, clear of
// the Teensy's USB plug): set display direction 180 in the Nextion Editor
NX_WIN_OFF = [NX_FLIP ? 2.15 : -2.15, 0]; // window (visible area) centre from the board centre
NX_WINDOW = [75.9, 50.9]; // opening in the plate
NX_LCD = [85.7, 55]; // LCD module outline (owner: 7.45 mm of board beside it on both sides, centred on the board)
NX_LCD_CABLE = 1.3; // its flex cable sticks out this much on one short side (87 mm overall)
NX_LCD_T = 3.86; // LCD thickness (owner)
NX_BACK = 11.21 - NX_LCD_T - 1.6; // board underside to back of the J1 connector (owner: 11.21 from the glass)
NX_BEZEL = 1.0; // plate left above the glass (was 1.5: the display sat on the Teensy)
NX_POST_D = 5.5; // clears the LCD module (with its cable) by 0.2 mm
NX_SCREW_D = 2.5; // M3 tap drill: tap the posts for M3 x 5 machine screws through the board
NX_SKIN = 1.2; // plastic left between the tapped hole and the top face
/* [Switch: slide switch, mounted on top] */
SWITCH_POS = [0, -56];
SWITCH_SLOT = [16, 8]; // 8 x 16 slot and d2 holes 19 apart: fit the switch exactly (owner, old remote)
SWITCH_PITCH = 19;
SWITCH_HOLE_D = 2.0;
ENGRAVE_D = 0.6; // ON/OFF inlay: the first 3 layers (0.2) of the face-down top shell
/* [USB-C breakout] */
USBC_BOARD = [12, 15, 1.6];
USBC_RCPT = [8.94, 7.35, 3.26]; // receptacle, flush with the board's front edge
USBC_POS = [-45, 0]; // board centre u (v follows from the front wall)
USBC_Z = Z_BOT + 10; // board underside
/* [Other boards] */
UPS_CENTRE = [0, -41];
UPS_LEDS = [[-23.9, 0], [23.9, 0]]; // charge / on LEDs, seen through 2 x 6 mm floor slots (as on the old remote)
UPS_HOLES = 27.9; // +- u, not confirmed (same as the old remote)
UPS_Z = Z_BOT + T + 2; // board underside (2 mm standoffs); its top ends 2 mm under the plate
/* [Main board: perfboard with the Teensy 4.0 (socketed), nRF24L01, AMS1117] */
// Cut perfboard, 56 x 80 mm (owner). Component positions are estimates from the
// owner's photos. Board frame: x across (0..56), y
// along (0..80), Teensy micro-USB at y 0, nRF24 overhanging at y 80.
PERF = [56, 80, 1.6]; // measured by the owner: 56 x 80
// Held by 4 clamps on its long sides, no holes in the board (owner): a post
// beside the edge carries the board's edge on its inner half, and an M3 x 8
// button head with a washer (d7) in a heat-set insert in the post clamps it.
PERF_CLAMPS = [[0, 4], [0, 68], [PERF[0], 4], [PERF[0], 68]]; // board frame: on the long edges x = 0 / PERF[0], at these y
PERF_CLAMP_OUT = 1.5; // post centre outside the board edge (washer overlaps the board ~2 mm)
PERF_POS = [-36, 37]; // where the board's (0, 0) corner goes; x runs to -v, y to +u
PERF_Z = Z_BOT + 7.5; // board underside: 2 mm over the kickstand recess roof for wires (the Teensy USB plug then clears the display board)
PERF_IMU = [23, 38]; // GY-521 on the main board (owner), on 8.5 mm headers: its corner, board frame
/* [Kickstand] */
KS_W = 30; // flap width (u)
KS_V = [8, 43.75]; // free end, hinge axis (the trough clears the main board)
KS_T = 3;
KS_BARREL_D = 6.5;
KS_PIN_D = 3.3; // M3 x 40 screw, from inside on the left, into a nut trap on the right
KS_WALL = 3; // side walls (nut trap)
KS_WALL_V = 2; // front/back walls
/* [Strap eyelet] */
// A loop on the top face for the neck strap's snap hook, near the balance
// point (estimated centre of mass v -3, Z -18: with the eyelet at v -24 the
// remote hangs level when the strap leaves at ~34 deg from vertical).
// Two M3 x 8 button heads into heat-set inserts; the slots give
// +-HOOK_TRAVEL to balance it.
HOOK_POS = [0, -24];
HOOK_TRAVEL = 5;
HOOK_INSERTS = 7; // +- u
HOOK_BASE = [24, 18, 4]; // u, v, Z
// Alternative place: the front face (the edge away from you), 2 inserts in
// the front wall of the bottom shell; the loop then points forward.
HOOK_FRONT_Z = Z_SPLIT - 7;
HOOK_MOUNT = "top"; // [top, front] (assembly view only)
HOOK_HOLE_D = 8; // for the snap hook
HOOK_H = 16; // top of the loop above the top face
/* [Brace bail] */
// A U-shaped bail pivoting on the side faces, outside the case and below the
// hands. Folded forward it wraps the front edge; swung back and down its
// crossbar rests against your chest or belly. M3 x 16 button-head screws
// with a washer into heat-set inserts in the side walls; friction holds it.
BAIL_PIVOT = [-25, Z_BOT + 10]; // v, Z on the side faces (u +-SIDE_U)
BAIL_L = 82; // pivot to crossbar centre line
BAIL_BOW = 10; // crossbar bows outwards by this much in the middle
BAIL_T = 5; // arm thickness (u)
BAIL_H = 12; // arm and crossbar height
BAIL_GAP = 0.5; // arm to side face (a washer fills it)
BAIL_ANGLE = 0; // 0 = folded forward, swings down: -90 hanging, -180 straight back, ~-150 brace
/* [Rendering] */
PART = "assembly"; // [assembly, top, inlay, text, bottom, kickstand, eyelet, bail]
SHOW_TOP = true;
SHOW_BOTTOM = true;
SHOW_PARTS = true;
SHOW_STICKS = true;
KS_OPEN = 0; // kickstand angle, deg
EXPLODE = 0;
/* [Hidden] */
$fa = 4; $fs = 0.5;
BIG = 400;
JOIN = 1;
module lx(h) linear_extrude(h, convexity = 10) children();
module rbox(b, r) translate(b[0] + [r, r]) offset(r = r) square(b[1] - b[0] - [2 * r, 2 * r]);
module rsq(c, h, r) translate(c) offset(r = r) square(2 * (h - [r, r]), center = true);
// ---------- outline and solid ----------------------------------------------
module outline_2d() hull() {
rbox(FRONT_BAND, CORNER_R);
rbox(REAR_BAND, CORNER_R);
for (s = STICKS) rsq(s, STICK_SQ, STICK_SQ_R);
}
// The outline swept with a 45 deg chamfer at the bottom (and optionally at
// the top): a thin slab of the outline, inset by the chamfer, Minkowski'd
// with a turned profile. `inset` gives the inner surface of the walls.
module swept(inset, z0, z1, top_chamfer) {
c = CHAMFER;
h = z1 - z0;
tc = top_chamfer;
minkowski() {
translate([0, 0, z0]) linear_extrude(0.01) offset(delta = -(c + inset)) outline_2d();
rotate_extrude($fn = 32) polygon([[0, 0], [c, c], [c, h - tc], [c - tc, h], [0, h]]);
}
}
module outer_solid() swept(0, Z_BOT, 0, TOP_CHAMFER);
module inner_solid() swept(T, Z_BOT + T, BIG / 4, 0);
// ---------- top shell -------------------------------------------------------
module nx_holes() for (du = [-1, 1], dv = [-1, 1]) translate(NX_CENTRE + [du * NX_HOLES[0], dv * NX_HOLES[1]] / 2) children();
module stick_screws() for (s = STICKS, du = [-1, 1], dv = [-1, 1]) translate(s + [du, dv] * STICK_SCREW) children();
NX_WIN = NX_CENTRE + NX_WIN_OFF;
NX_BOARD_TOP = -NX_BEZEL - NX_LCD_T; // board's top face
module top_shell() render(convexity = 10) difference() {
union() {
intersection() {
outer_solid();
difference() {
translate([-BIG / 2, -BIG / 2, Z_SPLIT]) cube([BIG, BIG, -Z_SPLIT]);
difference() { inner_solid(); translate([-BIG / 2, -BIG / 2, -PLATE]) cube(BIG); }
}
}
// eyelet inserts
for (m = [-1, 1]) translate([HOOK_POS[0] + m * HOOK_INSERTS, HOOK_POS[1], -PLATE - 7 + JOIN]) cylinder(d = 8, h = 7);
// screw bosses
for (s = SCREWS) translate([s[0], s[1], Z_SPLIT]) cylinder(d = BOSS_D, h = -Z_SPLIT - PLATE + JOIN);
// display posts
nx_holes() translate([0, 0, NX_BOARD_TOP]) cylinder(d = NX_POST_D, h = -NX_BOARD_TOP - PLATE + JOIN);
// joystick nut bosses
}
// display: window (chamfered to the top) and LCD pocket
translate(concat(NX_WIN, -NX_BEZEL - 0.01)) hull() {
translate([0, 0, 0.005]) cube(concat(NX_WINDOW, 0.01), center = true);
translate([0, 0, NX_BEZEL + 0.01]) cube(concat(NX_WINDOW + [2, 2] * NX_BEZEL, 0.02), center = true);
}
// LCD pocket: cable allowance on both short sides, so it fits either way round
translate(concat(NX_CENTRE - (NX_LCD + [2 * NX_LCD_CABLE + 0.4, 1]) / 2, -PLATE - 1)) cube(concat(NX_LCD + [2 * NX_LCD_CABLE + 0.4, 1], PLATE + 1 - NX_BEZEL));
nx_holes() translate([0, 0, NX_BOARD_TOP - 1]) cylinder(d = NX_SCREW_D, h = 1 - NX_BOARD_TOP - NX_SKIN);
// joysticks
for (s = STICKS) translate([s[0], s[1], -BIG / 2]) cylinder(d = STICK_HOLE_D, h = BIG);
stick_screws() translate([0, 0, -BIG / 2]) cylinder(d = STICK_SCREW_D, h = BIG);
// switch
translate(SWITCH_POS) {
translate([-SWITCH_SLOT[0] / 2, -SWITCH_SLOT[1] / 2, -BIG / 2]) cube([SWITCH_SLOT[0], SWITCH_SLOT[1], BIG]);
for (m = [-1, 1]) translate([m * SWITCH_PITCH / 2, 0, -BIG / 2]) cylinder(d = SWITCH_HOLE_D, h = BIG);
}
// inserts
for (s = SCREWS) translate([s[0], s[1], Z_SPLIT - 1]) cylinder(d = INSERT_D, h = 1 + INSERT_L);
translate([0, 0, -ENGRAVE_D]) lx(1 + ENGRAVE_D) top_inlay_2d(); // ON/OFF and honeycomb inlays
for (m = [-1, 1]) translate([HOOK_POS[0] + m * HOOK_INSERTS, HOOK_POS[1], -PLATE - 7]) {
cylinder(d = INSERT_D, h = 7 + PLATE - 1);
cylinder(d = SCREW_D, h = BIG);
}
}
// ON/OFF text, cut into the top face and printed as a second-colour inlay
// (PART = "inlay", exported in the same frame as PART = "top").
module switch_text_2d() for (t = [["ON", -1], ["OFF", 1]]) translate([t[1] * 19, 0])
text(t[0], size = 5, halign = "center", valign = "center", font = "Liberation Sans:style=Bold");
// Honeycomb on the right of a diagonal through the middle of the top face.
// Only whole cells are drawn (every wall full width): a cell is kept when its
// outer edge lies right of the diagonal, inside the top face (EDGE_KEEP from
// the outline) and clear of the display window, the stick covers, the strap
// eyelet (with its travel) and the switch with its ON/OFF text.
HEX_R = 4.5; // cell circumradius (wall centre lines)
HEX_LINE = 1.2; // wall width (3 extrusion widths)
DIAG_POINT = [0, -14]; // the diagonal passes through here...
DIAG_ANGLE = 20; // ...leaning this far from the v axis (top end to the right)
EDGE_KEEP = 3; // from the outline (clear of the top chamfer)
HEX_GAP = 1.5; // around the keep-outs
HEX_OUT = (HEX_R + HEX_LINE / 2 / cos(30)); // outer circumradius of a cell
// The outline is the hull of rounded boxes with one corner radius, so it is
// this convex polygon grown by CORNER_R (corners listed counter-clockwise).
function _ol_pts() = let(r = CORNER_R, f = FRONT_BAND, b = REAR_BAND,
su = STICKS[1][0] + STICK_SQ[0] - r, sv = STICK_SQ[1] - r)
[[f[0][0] + r, f[1][1] - r], [-su, sv], [-su, -sv], [b[0][0] + r, b[0][1] + r],
[b[1][0] - r, b[0][1] + r], [su, -sv], [su, sv], [f[1][0] - r, f[1][1] - r]];
function _cross(a, b, q) = (b[0] - a[0]) * (q[1] - a[1]) - (b[1] - a[1]) * (q[0] - a[0]);
function _seg_dist(a, b, q) = let(d = b - a, t = max(0, min(1, ((q - a) * d) / (d * d)))) norm(q - (a + t * d));
function _poly_dist(P, q) = let(n = len(P),
inside = min([for (i = [0 : n - 1]) _cross(P[i], P[(i + 1) % n], q)]) >= 0)
inside ? 0 : min([for (i = [0 : n - 1]) _seg_dist(P[i], P[(i + 1) % n], q)]);
function _in_face(q) = _poly_dist(_ol_pts(), q) <= CORNER_R - EDGE_KEEP;
function _right(q) = ((q - DIAG_POINT) * [cos(DIAG_ANGLE), -sin(DIAG_ANGLE)]) >= 0;
function _rect_dist(c, size, q) = let(d = [max(abs(q[0] - c[0]) - size[0] / 2, 0), max(abs(q[1] - c[1]) - size[1] / 2, 0)]) norm(d);
function _clear(q) = let(rr = HEX_OUT + HEX_GAP)
_rect_dist(NX_WIN, NX_WINDOW + [2, 2] * NX_BEZEL, q) >= rr &&
min([for (st = STICKS) norm(q - st)]) >= 53.5 / 2 + rr &&
_rect_dist(HOOK_POS, [HOOK_BASE[0], HOOK_BASE[1] + 2 * HOOK_TRAVEL], q) >= rr &&
_rect_dist(SWITCH_POS, [2 * 19 + 16, 7], q) >= rr;
function _cell_ok(c) = _clear(c) && min([for (k = [0 : 5]) let(q = c + HEX_OUT * [cos(60 * k), sin(60 * k)])
(_right(q) && _in_face(q)) ? 1 : 0]) == 1;
HEX_CELLS = [for (i = [-30 : 30], j = [-20 : 20])
let(c = [i * 1.5 * HEX_R, (j + (i % 2 == 0 ? 0 : 0.5)) * sqrt(3) * HEX_R]) if (_cell_ok(c)) c];
// drop stray cells (fewer than 2 neighbours)
HEX_KEEP = [for (c = HEX_CELLS) if (len([for (o = HEX_CELLS) if (o != c && norm(o - c) < 2 * HEX_R) 1]) >= 2) c];
module hex_pattern_2d() for (c = HEX_KEEP) translate(c) difference() {
circle(r = HEX_OUT, $fn = 6);
circle(r = HEX_R - HEX_LINE / 2 / cos(30), $fn = 6);
}
module top_inlay_2d() { translate(SWITCH_POS) switch_text_2d(); hex_pattern_2d(); }
// Two inlays, so each can have its own colour (owner: black case, red
// honeycomb, white ON/OFF). Each extra colour adds a swap on the first 3 layers.
module hex_inlay() translate([0, 0, -ENGRAVE_D]) lx(ENGRAVE_D) hex_pattern_2d();
module text_inlay() translate([0, 0, -ENGRAVE_D]) lx(ENGRAVE_D) translate(SWITCH_POS) switch_text_2d();
// ---------- bottom shell ----------------------------------------------------
USBC_V = FRONT_V - 0.6; // receptacle front, 0.6 inside the front face
module bottom_shell() render(convexity = 10) difference() {
union() {
difference() {
intersection() {
outer_solid();
translate([-BIG / 2, -BIG / 2, Z_BOT - 1]) cube([BIG, BIG, Z_SPLIT - Z_BOT + 1]);
}
inner_solid();
}
// locating lip
translate([0, 0, Z_SPLIT - 3]) lx(3 + LIP_H) difference() {
offset(delta = -(T + FIT)) outline_2d();
offset(delta = -(T + FIT + LIP_W)) outline_2d();
for (s = SCREWS) translate(s) circle(d = BOSS_D + 2 * FIT);
}
// ties the lip to the wall; its underside steps out at 45 deg (no flat overhang)
for (i = [0 : 4]) translate([0, 0, Z_SPLIT - 3 - i * 0.35]) lx(3 + 0.01) difference() {
offset(delta = -(T - JOIN)) outline_2d();
offset(delta = -(T + FIT + LIP_W - i * 0.35)) outline_2d();
for (s = SCREWS) translate(s) circle(d = BOSS_D + 2 * FIT);
}
intersection() {
inner_solid();
union() {
// screw towers
for (s = SCREWS) translate([s[0], s[1], Z_BOT]) cylinder(d = BOSS_D, h = Z_SPLIT - Z_BOT);
// bail pivot bosses in the side walls, on pillars down to the floor (printable)
for (m = [-1, 1]) hull() for (z = [BAIL_PIVOT[1], Z_BOT + 5])
translate([m * SIDE_U, BAIL_PIVOT[0], z]) rotate([0, -m * 90, 0]) cylinder(d = 10, h = 14);
// UPS standoffs
for (m = [-1, 1]) translate([UPS_CENTRE[0] + m * UPS_HOLES, UPS_CENTRE[1], Z_BOT]) cylinder(d = 6, h = UPS_Z - Z_BOT);
// kickstand recess and hinge trough walls
kickstand_housing();
// USB-C cradle
usbc_cradle();
}
}
// main board standoffs
intersection() {
inner_solid();
perf_clamp_place() translate([0, 0, Z_BOT - PERF_Z]) cylinder(d = 8, h = PERF_Z - Z_BOT);
}
// front eyelet inserts: bosses behind the front wall
intersection() {
inner_solid();
for (m = [-1, 1]) translate([m * HOOK_INSERTS, FRONT_V - T - 6 + JOIN, HOOK_FRONT_Z]) rotate([-90, 0, 0]) cylinder(d = 8, h = 6 + JOIN);
}
}
// screw holes: counterbore from below, clearance up to the split
for (s = SCREWS) translate([s[0], s[1], 0]) {
translate([0, 0, Z_BOT - 1]) cylinder(d = HEAD_D, h = HEAD_Z - Z_BOT + 1);
cylinder(d = SCREW_D, h = BIG, center = true);
}
for (m = [-1, 1]) translate([UPS_CENTRE[0] + m * UPS_HOLES, UPS_CENTRE[1], Z_BOT + 1.2]) cylinder(d = 2.5, h = 20);
for (l = UPS_LEDS) translate(concat(UPS_CENTRE + l, Z_BOT - 1)) lx(T + 2) hull() for (d = [-2, 2]) translate([0, d]) circle(d = 2);
perf_clamp_place() translate([0, 0, -6]) cylinder(d = INSERT_D, h = 7);
for (m = [-1, 1]) translate([m * HOOK_INSERTS, FRONT_V - INSERT_L - 1, HOOK_FRONT_Z]) rotate([-90, 0, 0]) cylinder(d = INSERT_D, h = INSERT_L + 2);
kickstand_cut();
usbc_cut();
for (m = [-1, 1]) translate([m * SIDE_U, BAIL_PIVOT[0], BAIL_PIVOT[1]]) rotate([0, -m * 90, 0]) translate([0, 0, -1]) cylinder(d = INSERT_D, h = 1 + 8);
}
// Kickstand: a flap in a recess in the underside, hinged at the front on a
// pin through a barrel. Friction on the pin holds the angle.
KS_RECESS = KS_T + 0.5;
KS_ROOF = Z_BOT + KS_RECESS + 2; // top of the recess roof
KS_AXIS_Z = Z_BOT + KS_BARREL_D / 2; // barrel tangent to the underside (sits on the bed when printed)
module kickstand_housing() {
translate([-KS_W / 2 - FIT - KS_WALL, KS_V[0] - FIT - KS_WALL_V, Z_BOT])
cube([KS_W + 2 * (FIT + KS_WALL), KS_V[1] - KS_V[0] + KS_BARREL_D / 2 + 2 * FIT + 2 * KS_WALL_V, KS_RECESS + 2]);
translate([-KS_W / 2 - FIT - KS_WALL, KS_V[1] - KS_BARREL_D / 2 - FIT - KS_WALL_V, Z_BOT])
cube([KS_W + 2 * (FIT + KS_WALL), KS_BARREL_D + 2 * (FIT + KS_WALL_V), KS_BARREL_D + 0.6 + FIT + 2]);
}
module kickstand_cut() {
translate([-KS_W / 2 - FIT, KS_V[0] - FIT, Z_BOT - 1]) cube([KS_W + 2 * FIT, KS_V[1] - KS_V[0] + 2 * FIT, 1 + KS_RECESS]);
translate([-KS_W / 2 - FIT, KS_V[1] - KS_BARREL_D / 2 - FIT, Z_BOT - 1]) cube([KS_W + 2 * FIT, KS_BARREL_D + 2 * FIT, 1 + KS_BARREL_D + 0.6 + FIT]);
translate([0, KS_V[1], KS_AXIS_Z]) rotate([0, 90, 0]) cylinder(d = KS_PIN_D, h = KS_W + 2 * KS_WALL + 10, center = true);
translate([KS_W / 2 + FIT + KS_WALL - 2.5, KS_V[1], KS_AXIS_Z]) rotate([0, 90, 0]) rotate([0, 0, 30]) cylinder(d = 5.5 / cos(30) + 0.3, h = 5, $fn = 6);
}
module kickstand() render(convexity = 10) difference() {
union() {
hull() {
translate([-KS_W / 2, KS_V[0], Z_BOT]) cube([KS_W, 1, KS_T]);
translate([-KS_W / 2, KS_V[1] - 1, Z_BOT]) cube([KS_W, 1, KS_T]);
}
translate([0, KS_V[1], KS_AXIS_Z]) rotate([0, 90, 0]) cylinder(d = KS_BARREL_D, h = KS_W, center = true);
// finger notch lip at the free end is cut below
}
translate([0, KS_V[1], KS_AXIS_Z]) rotate([0, 90, 0]) cylinder(d = KS_PIN_D, h = KS_W + 2, center = true);
translate([0, KS_V[0] - 2, Z_BOT - 1]) scale([1, 0.6, 1]) cylinder(r = 9, h = KS_T + 2); // finger notch
}
module perf_place() translate(concat(PERF_POS, PERF_Z)) rotate([0, 0, -90]) children();
// at each clamp post's axis, Z = 0 on the board's underside
module perf_clamp_place() perf_place() for (c = PERF_CLAMPS)
translate([c[0] + (c[0] > PERF[0] / 2 ? 1 : -1) * PERF_CLAMP_OUT, c[1], 0]) children();
module perf_clamp_screws() perf_clamp_place() translate([0, 0, PERF[2]]) color("#b0b0b0") {
cylinder(d = 7, h = 0.5); // washer
translate([0, 0, 0.5]) cylinder(d = 5.7, h = 1.65); // M3 button head
}
// USB-C breakout on a block, the receptacle in a slot through the front wall.
module usbc_cradle() translate([USBC_POS[0] - USBC_BOARD[0] / 2 - 2, USBC_V - USBC_BOARD[1] - 2, Z_BOT])
cube([USBC_BOARD[0] + 4, USBC_BOARD[1] + 2 + 3, USBC_Z - Z_BOT]);
module usbc_cut() {
inner_v = FRONT_V - T;
// board pocket (glue it in), open towards the inside; through the wall only the board's own slot
translate([USBC_POS[0] - USBC_BOARD[0] / 2 - FIT, USBC_V - USBC_BOARD[1] - FIT, USBC_Z]) cube([USBC_BOARD[0] + 2 * FIT, inner_v - (USBC_V - USBC_BOARD[1] - FIT), 20]);
translate([USBC_POS[0] - USBC_BOARD[0] / 2 - FIT, USBC_V - 5, USBC_Z]) cube([USBC_BOARD[0] + 2 * FIT, 5 + FIT, USBC_BOARD[2] + 2 * FIT]);
// receptacle opening, chamfered on the outside for the plug
translate([USBC_POS[0], USBC_V - 3, USBC_Z + USBC_BOARD[2] + USBC_RCPT[2] / 2]) rotate([-90, 0, 0]) {
linear_extrude(10) offset(r = 1.4) square([USBC_RCPT[0] + 0.6 - 2.8, USBC_RCPT[2] + 0.6 - 2.8], center = true);
translate([0, 0, 3 + 0.6 - 0.01]) linear_extrude(1.01, scale = [1.3, 1.6]) offset(r = 1.4) square([USBC_RCPT[0] + 0.6 - 2.8, USBC_RCPT[2] + 0.6 - 2.8], center = true);
}
}
// Strap eyelet: printed base down (the d8 loop hole is a short bridge).
module eyelet() render(convexity = 10) difference() {
b = HOOK_BASE;
union() {
translate([-b[0] / 2, -b[1] / 2, 0]) cube(b);
hull() {
translate([-4, -b[1] / 2 + 2, 0]) cube([8, b[1] - 4, b[2]]);
translate([-4, 0, HOOK_H - b[1] / 2 + 2]) rotate([0, 90, 0]) cylinder(r = b[1] / 2 - 2, h = 8);
}
}
translate([-10, 0, HOOK_H - b[1] / 2 + 2]) rotate([0, 90, 0]) cylinder(d = HOOK_HOLE_D, h = 20);
for (m = [-1, 1]) translate([m * HOOK_INSERTS, 0, -1]) hull() for (d = [-1, 1]) translate([0, d * HOOK_TRAVEL, 0]) cylinder(d = SCREW_D, h = 10);
// screw heads (M3 button head, 5.7 mm) in slotted counterbores beside the loop
for (m = [-1, 1]) translate([m * HOOK_INSERTS, 0, 2]) hull() for (d = [-1, 1]) translate([0, d * HOOK_TRAVEL, 0]) cylinder(d = 6.2, h = 10);
}
module eyelet_placed(shift = 0) translate([HOOK_POS[0], HOOK_POS[1] + shift, 0]) eyelet();
module eyelet_front_placed() translate([HOOK_POS[0], FRONT_V, HOOK_FRONT_Z]) rotate([-90, 0, 0]) eyelet();
// Brace bail, in its pivot frame: arms along +y (folded forward), pivots on x.
BAIL_X = SIDE_U + BAIL_GAP;
module bail() render(convexity = 10) difference() {
union() {
for (m = [-1, 1]) hull() for (y = [0, BAIL_L]) translate([m > 0 ? BAIL_X : -BAIL_X - BAIL_T, y, 0]) rotate([0, 90, 0]) cylinder(d = BAIL_H, h = BAIL_T);
// crossbar, bowed outwards
n = 16;
w = BAIL_X + BAIL_T / 2;
translate([0, 0, -BAIL_H / 2]) lx(BAIL_H) for (i = [0 : n - 1]) hull() for (k = [i, i + 1]) {
x = -w + k * 2 * w / n;
translate([x, BAIL_L + BAIL_BOW * (1 - pow(x / w, 2))]) circle(d = 8);
}
}
rotate([0, 90, 0]) cylinder(d = SCREW_D, h = 2 * BIG, center = true);
}
module bail_placed() translate([0, BAIL_PIVOT[0], BAIL_PIVOT[1]]) rotate([BAIL_ANGLE, 0, 0]) bail();
// ---------- reference parts (local frames, then placed) ---------------------
module nextion() {
translate(concat(NX_CENTRE, NX_BOARD_TOP - 1.6)) color("#1e5a2a") difference() {
translate(concat(-NX_BOARD / 2, 0)) cube(concat(NX_BOARD, 1.6));
for (du = [-1, 1], dv = [-1, 1]) translate([du * NX_HOLES[0], dv * NX_HOLES[1], 0] / 2 + [0, 0, -1]) cylinder(d = 3.2, h = 4);
}
translate(concat(NX_CENTRE - NX_LCD / 2, NX_BOARD_TOP)) color("#202020") cube(concat(NX_LCD, NX_LCD_T));
translate(concat(NX_WIN - [73.44, 48.96] / 2, -NX_BEZEL - 0.2)) color("#3050a0") cube([73.44, 48.96, 0.2]);
translate(concat(NX_CENTRE + [(NX_FLIP ? 1 : -1) * (NX_BOARD[0] / 2 - 7), -5], NX_BOARD_TOP - 1.6 - NX_BACK)) color("#eee") cube([6, 10, NX_BACK]); // J1 4-pin connector (approx.)
}
module ups_18650() translate(concat(UPS_CENTRE, UPS_Z)) {
color("#202020") difference() {
translate([-89 / 2, -22 / 2, 0]) cube([89, 22, 1.6]);
for (m = [-1, 1]) translate([m * UPS_HOLES, 0, -1]) cylinder(d = 3, h = 4);
}
color("#151515") translate([-77 / 2, -21 / 2, 1.6]) difference() {
cube([77, 21, 22.4 - 1.6]);
translate([3, 1.5, 3]) cube([71, 18, 30]);
}
color("#4060c0") translate([-65 / 2, 0, 1.6 + 3 + 18.5 / 2]) rotate([0, 90, 0]) cylinder(d = 18.5, h = 65);
color("#b0b0b0") translate([89 / 2 - 7, -4.5, 1.6]) cube([7.5, 9, 3.2]); // Type-C (charge input)
color("#808080") translate([89 / 2 + 0.5, -6, 0]) cube([18, 12, 7]); // cut-cable plug (approx.)
}
// Main board as in the owner's photos (layout approximate).
module main_board() { perf_clamp_screws(); main_board_only(); }
module main_board_only() perf_place() {
color("#2a8a4a") difference() {
cube(PERF);
}
// Teensy 4.0 in female headers (8.5 mm), micro-USB at the board edge
translate([12.1, 1, PERF[2]]) {
color("#111") for (x = [0, 17.8 - 2.5]) translate([x, 0, 0]) cube([2.5, 35.6, 8.5]);
translate([0, 0, 8.5]) {
color("#1e5a2a") cube([17.8, 35.6, 1.6]);
color("#222") translate([4, 12, 1.6]) cube([10, 10, 1.2]);
color("#c0c0c0") translate([(17.8 - 7.5) / 2, -1, 1.6]) cube([7.5, 5.7, 2.9]);
color("#808080") translate([(17.8 - 10) / 2, -1 - 18, 1.6 - 2]) cube([10, 18, 7]); // cable plug (approx.)
}
}
// nRF24L01 lying over the far edge, on its 2 x 4 header
translate([15, 63, PERF[2]]) {
color("#111") translate([2, 0, 0]) cube([10, 5, 2.5]);
color("#151515") translate([0, 0, 2.5]) cube([15.3, 29, 1.2]);
}
color("#222") translate([2, 74, PERF[2]]) cube([11, 6.3, 6.3]); // 100 uF cap, lying
color("#222") translate([5, 58, PERF[2]]) cube([7, 6.5, 1.8]); // AMS1117
// ribbon and display/IMU connectors at the edge, plugs on top (approx.)
color("#333") translate([PERF[0] - 8, 8, PERF[2]]) cube([5, 21, 12]);
color("#333") translate([PERF[0] - 8, 44, PERF[2]]) cube([5, 11, 12]);
}
// GY-521 on the main board, on headers (board frame: 15.6 across, 21.2 along)
module imu_gy521() perf_place() translate(concat(PERF_IMU, PERF[2])) {
color("#111") translate([0, 1, 0]) cube([2.5, 19, 8.5]);
translate([0, 0, 8.5]) {
color("#1f4fa0") cube([15.6, 21.2, 1.6]);
color("#222") translate([6, 8.6, 1.6]) cube([4, 4, 1]);
}
}
module usbc_breakout() translate([USBC_POS[0], USBC_V, USBC_Z]) {
color("#1a7a3a") translate([-USBC_BOARD[0] / 2, -USBC_BOARD[1], 0]) cube(USBC_BOARD);
color("#c0c0c0") translate([-USBC_RCPT[0] / 2, -USBC_RCPT[1], USBC_BOARD[2]]) cube(USBC_RCPT);
}
// Slide switch as on the old remote: mounting plate on the top face, screwed
// down with 2 screws, body hanging through the slot. Sizes approximate.
module slide_switch() translate(SWITCH_POS) color("#303030") {
translate([-12.5, -3.5, 0]) cube([25, 7, 0.8]); // mounting plate
translate([-7.5, -3.5, -10]) cube([15, 7, 10]); // body, through the slot
translate([-1.5, -1.5, 0.8]) cube([3, 3, 4]); // knob
}
// JH-D300X-R1 3-axis joystick (owner's drawing): handle d35 with the twist
// pot inside, dust cover d53.5 on top of the plate, 40.4 mm control box
// (25.5 tall) under it, clamping the plate with 4 x M2.5 x 14. X/Y pots
// d16.5 sticking 9.2 out of the box on -x and -y. Local Z = 0 on the cover's
// underside (the top face); the box hangs from the plate's underside.
JOY_BOX = 40.4; JOY_BOX_H = 25.5; JOY_POT_D = 16.5; JOY_POT_L = 49.6 - 40.4;
JOY_COVER_T = 3.8; JOY_POT_Z = 15.3; // pot axis above the box bottom (from the drawing)
module jh_d300x() {
zb = -PLATE - JOY_BOX_H; // box bottom
color("#202020") {
difference() {
cylinder(d1 = 53.5, d2 = 50, h = JOY_COVER_T);
for (du = [-1, 1], dv = [-1, 1]) translate([du * STICK_SCREW, dv * STICK_SCREW, -1]) cylinder(d = 2.7, h = 6);
}
translate([0, 0, JOY_COVER_T]) cylinder(d = 39.5, h = 1); // dust ring
translate([-JOY_BOX / 2, -JOY_BOX / 2, zb]) cube([JOY_BOX, JOY_BOX, JOY_BOX_H]);
translate([0, 0, zb + JOY_POT_Z]) {
rotate([0, -90, 0]) translate([0, 0, JOY_BOX / 2]) cylinder(d = JOY_POT_D, h = JOY_POT_L); // Y pot, -x
rotate([90, 0, 0]) translate([0, 0, JOY_BOX / 2]) cylinder(d = JOY_POT_D, h = JOY_POT_L); // X pot, -y
}
t = JOY_COVER_T;
translate([0, 0, t]) cylinder(d = 6, h = 11.5); // shaft
translate([0, 0, t + 11]) cylinder(d1 = 12, d2 = 18, h = 8); // neck
translate([0, 0, t + 19]) cylinder(d = 32, h = 7);
translate([0, 0, t + 26]) cylinder(d = 35, h = 19); // knurled grip
translate([0, 0, t + 45]) cylinder(d1 = 35, d2 = 30, h = 8); // top: 53 above the cover
}
}
// pots towards the middle and towards the user
module sticks() for (s = STICKS) translate(concat(s, 0)) if (s[0] > 0) jh_d300x(); else mirror([1, 0, 0]) jh_d300x();
module electronics() {
nextion();
ups_18650();
main_board();
imu_gy521();
usbc_breakout();
slide_switch();
}
// ---------- assembly and print layout --------------------------------------
module kickstand_placed() translate([0, KS_V[1], KS_AXIS_Z]) rotate([KS_OPEN, 0, 0]) translate([0, -KS_V[1], -KS_AXIS_Z]) kickstand();
module remote_v2() {
if (SHOW_BOTTOM) { color("#1c1c1c") bottom_shell(); color("#1c1c1c") kickstand_placed(); color("#1c1c1c") bail_placed(); }
if (HOOK_MOUNT == "front") color("#1c1c1c") eyelet_front_placed();
else if (SHOW_TOP) translate([0, 0, EXPLODE]) color("#1c1c1c") eyelet_placed();
if (SHOW_TOP) translate([0, 0, EXPLODE]) { color("#262626") top_shell(); color("#c8102e") hex_inlay(); color("#f2f2f2") text_inlay(); }
if (SHOW_PARTS) { translate([0, 0, EXPLODE]) { nextion(); slide_switch(); }
ups_18650(); main_board(); imu_gy521(); usbc_breakout(); }
if (SHOW_STICKS) translate([0, 0, EXPLODE]) sticks();
}
if (PART == "assembly") remote_v2();
else if (PART == "top") rotate([180, 0, 0]) top_shell(); // face down on the bed
else if (PART == "inlay") rotate([180, 0, 0]) hex_inlay(); // load with "top" (and "text") as one multi-part object
else if (PART == "text") rotate([180, 0, 0]) text_inlay();
else if (PART == "bottom") translate([0, 0, -Z_BOT]) bottom_shell();
else if (PART == "kickstand") translate([0, 0, -Z_BOT]) kickstand();
else if (PART == "eyelet") eyelet(); // base on the bed, the loop hole bridges
else if (PART == "bail") translate([0, 0, BAIL_H / 2]) bail();