diff --git a/.gitattributes b/.gitattributes index afdcc85..3ed0664 100644 --- a/.gitattributes +++ b/.gitattributes @@ -38,3 +38,4 @@ *.ide-shm filter=lfs diff=lfs merge=lfs -text 2018-unity-sim/**/*.unity filter=lfs diff=lfs merge=lfs -text *.bytes filter=lfs diff=lfs merge=lfs -text +*.3mf filter=lfs diff=lfs merge=lfs -text diff --git a/2026-current/README.md b/2026-current/README.md index 7723071..4122359 100644 --- a/2026-current/README.md +++ b/2026-current/README.md @@ -4,7 +4,11 @@ A six-legged walking robot (Teensy 3.6) and its handheld remote (Teensy 4.0 + Nextion touchscreen), linked over nRF24L01. ![The hexapod, OpenSCAD model in its standing pose](hardware/openscad/renders/hexapod.png) -![The remote, OpenSCAD model](hardware/openscad/renders/remote.png) +![The remote (v2), OpenSCAD model: black ASA with a red honeycomb and white ON/OFF inlay](hardware/openscad/renders/remote_v2.png) + +The remote above is the new design (`hardware/openscad/remote_v2.scad`, not +printed yet). The original printed remote is on the +[archive page](hardware/openscad/ARCHIVE.md). ``` robot/ robot firmware: IK, gait, body pose, IMU stabilization, state machine @@ -12,7 +16,8 @@ remote/ remote firmware: 2 x 3-axis sticks, MPU6050 tilt, Nex shared/ HexapodProtocol: the CmdPacket wire format + radio settings used by both sim/ the unchanged robot firmware compiled into a DLL for the simulation Hexapod_Simulation_Unity/ Unity project that runs that DLL on the 3D model -hardware/openscad/ OpenSCAD model of the robot and remote, rebuilt from the Fusion designs +hardware/openscad/ OpenSCAD model of the robot (rebuilt from the Fusion designs) and the new remote +hardware/openscad/stl/ print-ready STL exports hardware/fusion360/ Fusion 360 designs: body, legs, servo, servo horn, remote case scripts/ PlatformIO helper (per-environment sketch folder) ``` @@ -41,6 +46,35 @@ From this `2026-current` folder in PowerShell (the dev PC is Windows): Then open `Hexapod_Simulation_Unity` and press Play. See [sim/README.md](sim/README.md). +## Printing the remote (v2) + +STLs in [hardware/openscad/stl/remote_v2/](hardware/openscad/stl/remote_v2/), +already in print orientation; everything prints in ASA without supports. +Regenerate them from `remote_v2.scad` with `-D 'PART="..."'`. + +| File | Part | Notes | +|------|------|-------| +| `remote_v2_top_multicolor.3mf` | top shell with both inlays | One object with three parts on filaments 1/2/3: case black, honeycomb red, ON/OFF white. The inlays are the first 3 layers (0.6 mm) of the face-down shell, so the colour swaps only happen there. Made by `hardware/openscad/export_3mf.py` from the three STLs below | +| `remote_v2_top.stl` + `_inlay.stl` + `_text.stl` | the same, as STLs | Load the three at once and keep them as one multi-part object | +| `remote_v2_bottom.stl` | bottom shell | flat underside on the bed | +| `remote_v2_kickstand.stl` | table stand | | +| `remote_v2_eyelet.stl` | neck-strap eyelet | on the top face (slots to balance it) or on the front edge | +| `remote_v2_bail.stl` | body brace | swings down and back to rest against your body | + +Hardware (besides the electronics of the old remote): + +- 14 x M3 heat-set inserts (4.0 mm hole, ~5.7 mm long): 4 shell screws, + 2 + 2 eyelet (top and front), 2 brace pivots, 4 main-board clamps +- M3 x 12 x 4 (shells), M3 x 8 button head x 2 (eyelet), M3 x 16 button + head + washer x 2 (brace), M3 x 8 button head + 7 mm washer x 4 (main + board clamps, no holes in the board), M3 x 40 + nut (kickstand pin) +- M2.5 x 14 x 8 (joysticks, into their own boxes), M2.5 self-tapping x 4 + (display), M3 self-tapping x 2 (UPS board), M2 self-tapping x 2 (switch) +- Set the Nextion's display direction to 180 in the Nextion Editor: the + display is mounted turned round so its connector clears the Teensy's USB plug. + +Design notes, checks and open points: [hardware/openscad/PLANNING.md](hardware/openscad/PLANNING.md). + ## Where to go next - **[robot/README.md](robot/README.md)**: placeholder geometry to measure, diff --git a/2026-current/hardware/openscad/ARCHIVE.md b/2026-current/hardware/openscad/ARCHIVE.md new file mode 100644 index 0000000..74a6052 --- /dev/null +++ b/2026-current/hardware/openscad/ARCHIVE.md @@ -0,0 +1,37 @@ +# Archive: earlier designs + +Designs that are no longer the current ones, kept for reference. The +current remote is `remote_v2.scad` (see [../../README.md](../../README.md)). + +## Original remote (`remote.scad`) + +![The original remote, OpenSCAD model](renders/remote.png) + +The remote used with the robot until 2026: a 208 x 175 x 45 mm box printed +from the Fusion 360 design `../fusion360/remote/remote v40.f3d`. +`remote.scad` rebuilds it from that file's solids (details, and the bugs +fixed in the rebuild, in [PLANNING.md](PLANNING.md), section "Remote"). + +What's inside (from the owner and the photos below): + +- Two joysticks, JH-D300X-R1 (3-axis twist grip), on the lid. The model + uses the similar JH-D400X-R4 drawing. +- Nextion NX4832T035 3.5" display under a window in the lid. +- A Teensy 4.0 socketed on a cut perfboard with the nRF24L01 (100 uF cap) + and an AMS1117 regulator. +- An MPU6050 (GY-521) on the big standoff in the middle. +- An 18650 UPS/boost board on two standoffs, with its charge and on LEDs + visible through two small slots in the floor. +- A USB-C breakout glued into the holder at the side port. +- A slide switch mounted on top of the lid, and a lanyard loop on the bump. + +Photos of the printed remote, opened: [original remote/](original%20remote/). + +| | | +|---|---| +| ![Lid from inside: Nextion and joysticks](original%20remote/20261114_175520.jpg) | ![Bottom shell: main board, battery, IMU, USB-C](original%20remote/20261114_175548.jpg) | +| ![Main board, top](original%20remote/20261114_175504.jpg) | ![Main board, wiring underneath](original%20remote/20261114_175509.jpg) | + +Why it was replaced: the new remote (`remote_v2.scad`) is smaller +(216 x 116 x 32 mm), prints in ASA without supports, hangs level from a neck +strap (a balance-point eyelet and a body brace), and stands on a table. diff --git a/2026-current/hardware/openscad/PLANNING.md b/2026-current/hardware/openscad/PLANNING.md index d3b11dd..4883f6e 100644 --- a/2026-current/hardware/openscad/PLANNING.md +++ b/2026-current/hardware/openscad/PLANNING.md @@ -118,7 +118,7 @@ mm (sat in the ledge, posts overlapping the bosses); the display bezel's mesh facets became a clean window; the stray Body12 (an ON-OFF bracket line never cut in) is left out. The display is a Nextion NX4832T035 (3.5" Basic); its board's M3 holes are the lid's 94.2 x 48.5 post grid. -Reference parts in `remote.scad`: the joysticks are JH-D400X-R4 (4-axis, +Reference parts in `remote.scad`: the joysticks are modelled as JH-D400X-R4 (owner's photos later showed JH-D300X-R1; 4-axis, X/Y ±25°, twist ±45°, button; owner), mounted with the dust cover on the lid's top face; their M2.5 square is 32.5 mm, so the lid's screw holes moved from the original's 33 mm square to 32.5. The battery is an 18650 UPS/boost @@ -135,8 +135,88 @@ hole-less 8 x 24 mm block as a guess. Open: what the 6 mm x 10 mm holes in the bottom bosses hold (magnets?), and whether the upper two bosses are meant to be asymmetric (x -80.387 / +82.73). +## Remote v2 (`remote_v2.scad`), draft 4 + +A new remote for the same electronics; `remote.scad` stays as the record of +the printed one. How it's used (owner): the sticks are big twist grips that +take a whole hand each, so nothing holds the case. It hangs from a neck strap +or lies on a table. Earlier drafts: gamepad grips (dropped: nobody holds +them), strap tabs at the rear corners (it tipped forward), a hexapod emblem +inlay (owner preferred a honeycomb). + +From the owner's photos and drawing: the sticks are JH-D300X-R1; the Teensy +sits socketed on a cut perfboard (~52 x 80, estimated) with the nRF24L01 +(100 uF cap), an AMS1117, the ribbon connectors and now also the GY-521; the +switch's plate sits on top of the case, body through the slot, and the old +8 x 16 slot with d2 holes 19 mm apart fits it exactly; the UPS board's +charge/on LEDs show through two slots in the floor. + +- Size 216 x 116 x 32 mm (old remote: 208 x 175 x 45). Sticks at u +-80, + display forward of them, strap eyelet behind the display, UPS board behind + that, switch at the rear centre. Main board under the display. +- JH-D300X-R1: dust cover d53.5 on the top face; the 40.4 mm control box + (25.5 tall) against the plate's underside, 4 x M2.5 x 14 through cover and + plate into the box (no nuts). Reaches 28.5 mm down. Pots (d16.5, 9.2 out) + towards the middle and towards the user. +- Display mounted turned 180 deg so its J1 connector is on the right, clear + of the Teensy's USB plug: set display direction 180 in the Nextion Editor. + Glass 1.5 mm under the top face, board on 4 posts (M2.5 self-tapping); + the LCD thickness (4.5) is a guess. +- Main board clamped at 4 points on its long sides, no holes in the board + (owner): posts beside the edges carry it, M3 x 8 button heads with d7 + washers in heat-set inserts clamp the edge. 2 mm above the kickstand + recess for the wires underneath; Teensy micro-USB to the left, nRF24 to + the right. The cable plug clears the display board by ~0.2 mm and the left + stick's pot narrowly: plug and board sizes are estimates. +- UPS board on 2 standoffs behind the eyelet, Type-C end to the right (room + for the cut cable's plug); LEDs through 2 x 6 mm floor slots. +- Strap eyelet (separate part, 2 x M3 into heat-set inserts): on the top face + behind the display (slots +-5 mm to balance it), or on the front face (the + edge away from you, 2 more inserts at Z -19). Folded forward, the bail + hits a front-mounted eyelet: then park the bail back or down. +- Brace bail: U pivoting on the side faces (v -25, Z -22), M3 x 16 into + heat-set inserts; 0 = folded forward, -150 = brace against chest or belly, + -180 = straight back. Swings down under the case. +- Kickstand: 30 x 35 mm flap in a recess in the underside, hinged at the front + on an M3 x 40 into a nut trap; lifts the front a little on a table. +- Shells split at Z -12, both print without supports (top face down, bottom + on its flat underside), 45 deg chamfers, 1.2 mm locating lip, 4 x M3 x 12 + from below into heat-set inserts. USB-C breakout glued into a pocket at + the front left, receptacle 0.6 mm inside the front face. +- Inlay (second colour, first 3 layers of the face-down top shell): ON/OFF + plus a honeycomb of whole cells (4.5 mm, 1.2 mm walls) right of a diagonal + through the middle, clear of display, sticks, eyelet and switch; lone + cells dropped. Colours (owner, ASA): black case, red honeycomb (PART + "inlay"), white ON/OFF (PART "text"); load "top", "inlay" and "text" as one + multi-part object. Each extra colour adds a swap on the first 3 layers only. +- Checked: no part collides with the shells or with each other, the shells + and the inlay don't overlap, kickstand clear at 0 and 70 deg, bail clear + from 0 to -180 deg (CGAL intersections). +- Open: perfboard size and holes, Teensy cable plug size, LCD thickness, UPS + hole spacing; hand room untested; set `IMU_AXIS_FROM_CHIP` / + `IMU_AXIS_SIGN` in `remote/Config.h` for the IMU on the main board. + ## Notes for future designs +- Robot power (still to choose): a battery or supply that gives a **stable + 6 V** with enough current for all 18 servos (12 x HS-485HB + 6 stronger + ones of the same size). Servos draw well over 1 A each when stalled or + starting, and many move at once while walking, so plan for a 6 V regulator + / UBEC of 15-20 A peak (e.g. a 2S LiPo through a high-current 6 V BEC), or + a pack that stays near 6 V under that load. Check the servos' datasheet + for the stall current. The battery must also fit the bay (see open + question 3) and leave room for the servo plugs. + +- Remote: connect the IMU to the normal pin headers instead of the Teensy + 4.0's underside pads; see `remote/README.md`, "Planned" (Wire on 18/19, + the two stick axes there move to A7/A8). + +- Remote: measure the 18650's voltage on the Teensy to show how much charge + is left (owner, later). Divider ~100k/100k from the cell's + (holder or the + UPS board's B+, not the 5 V output) to A6 (pin 20, free), 100 nF to GND; + full cell = ~2.1 V at the pin. Firmware: average, Li-ion curve to %, show + on the Nextion with a low-battery warning (optionally send it to the robot). + - Servo wires barely fit on the real robot: the six servo headers hang above the battery bay, and the front pair sits right over the bay's end stop (X 28.8..31.8, top at Z 13.5). Kept as-is for now; give the plugs and diff --git a/2026-current/hardware/openscad/export_3mf.py b/2026-current/hardware/openscad/export_3mf.py new file mode 100644 index 0000000..b707d5b --- /dev/null +++ b/2026-current/hardware/openscad/export_3mf.py @@ -0,0 +1,115 @@ +"""Combine STL parts into one multi-part 3MF for OrcaSlicer / PrusaSlicer. + + python export_3mf.py (from hardware/openscad, after the STL export) + +Writes stl/remote_v2/remote_v2_top_multicolor.3mf: the top shell with its +two inlays as ONE object with three parts, in the same frame, each part on +its own extruder/filament (1 = case, 2 = honeycomb, 3 = ON/OFF text). The +part list is in PARTS below. Uses the PrusaSlicer 3MF layout (one mesh, the +parts as triangle ranges in Metadata/Slic3r_PE_model.config), which +OrcaSlicer and PrusaSlicer both read. +""" +import os +import zipfile + +HERE = os.path.dirname(os.path.abspath(__file__)) +OUT_DIR = os.path.join(HERE, "stl", "remote_v2") + +# (file, part name, extruder) +PARTS = [ + ("remote_v2_top.stl", "top shell (black)", 1), + ("remote_v2_inlay.stl", "honeycomb inlay (red)", 2), + ("remote_v2_text.stl", "ON-OFF inlay (white)", 3), +] +OUT = "remote_v2_top_multicolor.3mf" + + +def read_stl(path): + """Triangles of an ASCII or binary STL as lists of 3 vertex tuples.""" + data = open(path, "rb").read() + tris = [] + if data[:5] == b"solid" and b"facet" in data[:400]: + verts = [] + for line in data.decode("ascii", "replace").splitlines(): + t = line.split() + if t and t[0] == "vertex": + verts.append(tuple(float(x) for x in t[1:4])) + if len(verts) == 3: + tris.append(verts) + verts = [] + else: + import struct + n = struct.unpack_from("', + '', + ' 1', + ' remote_v2 top shell with inlays', + ' ', + ' ', + ' ', + ' '] + model += [' ' % v for v in vertices] + model += [' ', ' '] + model += [' ' % tuple(t) for t in triangles] + model += [' ', ' ', ' ', ' ', + ' ', ' ', ' ', ''] + + config = ['', '', + ' ', + ' '] + for first, last, name, extruder in ranges: + config += [' ' % (first, last), + ' ' % name, + ' ', + ' ' % extruder, + ' '] + config += [' ', ''] + + content_types = ('\n' + '\n' + ' \n' + ' \n' + ' \n' + '\n') + rels = ('\n' + '\n' + ' \n' + '\n') + + path = os.path.join(OUT_DIR, OUT) + with zipfile.ZipFile(path, "w", zipfile.ZIP_DEFLATED) as z: + z.writestr("[Content_Types].xml", content_types) + z.writestr("_rels/.rels", rels) + z.writestr("3D/3dmodel.model", "\n".join(model) + "\n") + z.writestr("Metadata/Slic3r_PE_model.config", "\n".join(config) + "\n") + print("%s: %d vertices, %d triangles, parts %s" % (OUT, len(vertices), len(triangles), + ", ".join("%s %d-%d" % (r[2], r[0], r[1]) for r in ranges))) + + +if __name__ == "__main__": + main() diff --git a/2026-current/hardware/openscad/original remote/20261114_175504.jpg b/2026-current/hardware/openscad/original remote/20261114_175504.jpg new file mode 100644 index 0000000..c7f8500 --- /dev/null +++ b/2026-current/hardware/openscad/original remote/20261114_175504.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6ae5ea5bb99a9cd76bc22fc14b31aecdb94a67500e31eb4cffe551ebad97db3a +size 2460327 diff --git a/2026-current/hardware/openscad/original remote/20261114_175509.jpg b/2026-current/hardware/openscad/original remote/20261114_175509.jpg new file mode 100644 index 0000000..6d85e33 --- /dev/null +++ b/2026-current/hardware/openscad/original remote/20261114_175509.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f019b3f620e3c8cbb02f87d3372af5687f974cf69d149d95b0c993cf9fafa976 +size 3055285 diff --git a/2026-current/hardware/openscad/original remote/20261114_175520.jpg b/2026-current/hardware/openscad/original remote/20261114_175520.jpg new file mode 100644 index 0000000..5c905ac --- /dev/null +++ b/2026-current/hardware/openscad/original remote/20261114_175520.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f19462520f767e397094200c2ec82f1c410cdee537d51b2c7b6340d74f8ca54e +size 3122015 diff --git a/2026-current/hardware/openscad/original remote/20261114_175548.jpg b/2026-current/hardware/openscad/original remote/20261114_175548.jpg new file mode 100644 index 0000000..29a5fb5 --- /dev/null +++ b/2026-current/hardware/openscad/original remote/20261114_175548.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c79fe0ac29b07732c68218cf1201b8562aee4713b2bf956874fd468418ecdec6 +size 3204476 diff --git a/2026-current/hardware/openscad/remote.scad b/2026-current/hardware/openscad/remote.scad index 174a00d..5c7a7a2 100644 --- a/2026-current/hardware/openscad/remote.scad +++ b/2026-current/hardware/openscad/remote.scad @@ -150,8 +150,9 @@ module nextion_3_5() { color("#3050a0") translate([win[0] - 73.44/2, win[1] - 48.96/2, DISPLAY_POCKET_Z - 0.2]) cube([73.44, 48.96, 0.2]); } -// JH-D400X-R4 4-axis joystick (X/Y +-25 deg, twist +-45 deg, button), -// from its dimension drawing. Mounted with its dust cover on the lid's top +// Joystick, modelled from the JH-D400X-R4 drawing (4-axis, X/Y +-25 deg, +// twist +-45 deg, button). The remote's sticks turned out to be JH-D300X-R1 +// (label on the box, owner's photo): similar, dimensions not checked yet. Mounted with its dust cover on the lid's top // face; the body hangs through the d40 opening. Local frame: stick axis on // Z, Z = 0 on the dust cover's underside. Pots on +X and +Y. JOY_COVER_D = 53.5; diff --git a/2026-current/hardware/openscad/remote_v2.scad b/2026-current/hardware/openscad/remote_v2.scad new file mode 100644 index 0000000..e6722c7 --- /dev/null +++ b/2026-current/hardware/openscad/remote_v2.scad @@ -0,0 +1,581 @@ +// 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 +Z_BOT = -32; // flat underside (32 mm thick: the D300X sticks reach 28.5 down) +Z_SPLIT = -12; // 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 = -19; // 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.5, 54.94]; +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 = [84, 54]; // LCD module outline +NX_LCD_T = 4.5; // LCD thickness: approximate, measure before printing +NX_BEZEL = 1.5; // plate left above the glass +NX_POST_D = 5.5; // clears the LCD module by 0.2 mm +NX_SCREW_D = 2.2; // M2.5 self-tapping through the board + +/* [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, 19 x 30 holes. Size and corner holes are estimates from the +// owner's photos: measure before printing. Board frame: x across (0..52), y +// along (0..80), Teensy micro-USB at y 0, nRF24 overhanging at y 80. +PERF = [52, 80, 1.6]; +// 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], [52, 4], [52, 68]]; // board frame: on the edges x = 0 / 52, 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 = -19; +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, -22]; // 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); + } + translate(concat(NX_WIN - (NX_LCD + [1, 1]) / 2, -PLATE - 1)) cube(concat(NX_LCD + [1, 1], PLATE + 1 - NX_BEZEL)); + nx_holes() translate([0, 0, NX_BOARD_TOP - 1]) cylinder(d = NX_SCREW_D, h = 1 + 4.5); + // 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); + } + translate([0, 0, Z_SPLIT - 3]) lx(3) difference() { // ties the lip to the wall + offset(delta = -(T - JOIN)) outline_2d(); + offset(delta = -(T + FIT + LIP_W)) 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 + for (m = [-1, 1]) translate([m * SIDE_U, BAIL_PIVOT[0], BAIL_PIVOT[1]]) 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 + 0.3; +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_WIN - 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 - 6)) color("#eee") cube([6, 10, 6]); // 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([44, 8, PERF[2]]) cube([5, 21, 12]); + color("#333") translate([44, 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(); diff --git a/2026-current/hardware/openscad/renders/remote_v2.png b/2026-current/hardware/openscad/renders/remote_v2.png new file mode 100644 index 0000000..228bebe --- /dev/null +++ b/2026-current/hardware/openscad/renders/remote_v2.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0c337c3e6304e5924c50da987f5ad783a8daf7bef2d51267e92c99715eac1d0c +size 65642 diff --git a/2026-current/hardware/openscad/renders/remote_v2_brace.png b/2026-current/hardware/openscad/renders/remote_v2_brace.png new file mode 100644 index 0000000..c42ae11 --- /dev/null +++ b/2026-current/hardware/openscad/renders/remote_v2_brace.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1731824e5e80aad6e006d3bd124c04a52dfad1334b0e6a979c82bc0714602a09 +size 74740 diff --git a/2026-current/hardware/openscad/renders/remote_v2_inside.png b/2026-current/hardware/openscad/renders/remote_v2_inside.png new file mode 100644 index 0000000..ad8f7c0 --- /dev/null +++ b/2026-current/hardware/openscad/renders/remote_v2_inside.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2c254aa8737933839e4ad71aa8066bc09afe2fc4d1ca935298c7ca0be4be7600 +size 66344 diff --git a/2026-current/hardware/openscad/stl/remote_v2/remote_v2_bail.stl b/2026-current/hardware/openscad/stl/remote_v2/remote_v2_bail.stl new file mode 100644 index 0000000..fcb6ecd --- /dev/null +++ b/2026-current/hardware/openscad/stl/remote_v2/remote_v2_bail.stl @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ec29aff34fc8f776a209bf035ccb7c0110e3d33998c29f14e49e61c47cad110b +size 184902 diff --git a/2026-current/hardware/openscad/stl/remote_v2/remote_v2_bottom.stl b/2026-current/hardware/openscad/stl/remote_v2/remote_v2_bottom.stl new file mode 100644 index 0000000..d158d0a --- /dev/null +++ b/2026-current/hardware/openscad/stl/remote_v2/remote_v2_bottom.stl @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:03b4217577659447ca7c8debfad141d1c44265622f961e5cf02ec6a04847aa75 +size 1354705 diff --git a/2026-current/hardware/openscad/stl/remote_v2/remote_v2_eyelet.stl b/2026-current/hardware/openscad/stl/remote_v2/remote_v2_eyelet.stl new file mode 100644 index 0000000..6919b6f --- /dev/null +++ b/2026-current/hardware/openscad/stl/remote_v2/remote_v2_eyelet.stl @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2db37cf35a1cb6b412f80220c9cc8d33402e7005780a600f6151c3cf3cdbf45f +size 158658 diff --git a/2026-current/hardware/openscad/stl/remote_v2/remote_v2_inlay.stl b/2026-current/hardware/openscad/stl/remote_v2/remote_v2_inlay.stl new file mode 100644 index 0000000..3f3fe42 --- /dev/null +++ b/2026-current/hardware/openscad/stl/remote_v2/remote_v2_inlay.stl @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6dac571211fdc75ccfe266536e672ed4fe56ca0f94ba000d55357679ae6170dc +size 281231 diff --git a/2026-current/hardware/openscad/stl/remote_v2/remote_v2_kickstand.stl b/2026-current/hardware/openscad/stl/remote_v2/remote_v2_kickstand.stl new file mode 100644 index 0000000..724a47b --- /dev/null +++ b/2026-current/hardware/openscad/stl/remote_v2/remote_v2_kickstand.stl @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1d2286a86da4c8b812f6a1f36e9e580e50d872780ef3fac39c59b50a95bd8563 +size 61640 diff --git a/2026-current/hardware/openscad/stl/remote_v2/remote_v2_text.stl b/2026-current/hardware/openscad/stl/remote_v2/remote_v2_text.stl new file mode 100644 index 0000000..7fe698f --- /dev/null +++ b/2026-current/hardware/openscad/stl/remote_v2/remote_v2_text.stl @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ea3ee26812a8eb1392d7ba5f9f250c45cc8af10ba309a5f7dfe79d376b7c905d +size 214448 diff --git a/2026-current/hardware/openscad/stl/remote_v2/remote_v2_top.stl b/2026-current/hardware/openscad/stl/remote_v2/remote_v2_top.stl new file mode 100644 index 0000000..cd0a01b --- /dev/null +++ b/2026-current/hardware/openscad/stl/remote_v2/remote_v2_top.stl @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:345e684bfacc6ef5acfd9a56b4c0d640182e962c60bc2eec35f3da153bf55c95 +size 1470383 diff --git a/2026-current/hardware/openscad/stl/remote_v2/remote_v2_top_multicolor.3mf b/2026-current/hardware/openscad/stl/remote_v2/remote_v2_top_multicolor.3mf new file mode 100644 index 0000000..a2db16f --- /dev/null +++ b/2026-current/hardware/openscad/stl/remote_v2/remote_v2_top_multicolor.3mf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1f48afe1e86b871c1b54dd81c577aad4b93a161d1433aba5ea2ba53b307d1f67 +size 118336 diff --git a/2026-current/remote/README.md b/2026-current/remote/README.md index 6777174..1880d11 100644 --- a/2026-current/remote/README.md +++ b/2026-current/remote/README.md @@ -6,6 +6,24 @@ touchscreen, and sends a `CmdPacket` (defined in `../shared/HexapodProtocol/HexapodProtocol.h`) to the robot over nRF24L01 at 100 Hz. +## Planned + +- **Battery level** (not built yet): read the 18650's voltage through a + ~100k/100k divider from the cell's + (not the boost board's 5 V output) + into A6 (pin 20, free), with 100 nF to GND, and show the charge on the + Nextion with a low-battery warning. Details in + `../hardware/openscad/PLANNING.md` (notes for future designs). + +- **IMU on the normal pin headers** (suggestion, not done): with the GY-521 on + the main board, wire it to Wire (SDA 18 / SCL 19) instead of Wire2 (the + 24/25 pads under the Teensy 4.0). 18/19 are A4/A5, used by two stick axes + now, so move those two axes to A7 (pin 21) and A8 (pin 22): all on the + edge headers. A6 (pin 20) stays free for the battery divider, A9 (23) is + spare. Firmware: in `Config.h` `STICK_PINS = { A0, A1, A2, A3, A7, A8 }` + and `#define IMU_WIRE Wire`; `Sticks.cpp` reads through `STICK_PINS`, so + nothing else changes. Redo the stick axis check (`p` dump) and calibration + afterwards. (Wire1 is no way out: its 16/17 are stick pins A2/A3 too.) + ## Building From the `2026-current` folder: `pio run -e remote`, flash with diff --git a/README.md b/README.md index d08f5ae..8415923 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ named after the year it started, with its firmware, simulation, hardware, docume | [`2016-ssc32-processing-port/`](2016-ssc32-processing-port/) | ~2016–2018 | Arduino + SSC-32 | the Processing simulator's classes ported to Arduino, driving the SSC-32 again | | [`2018-unity-sim/`](2018-unity-sim/) | 2018–2023 | PC + SSC-32, later the Teensy | Unity computes the walking and drives the robot: first the SSC-32 over serial, from 2019 through the remote | | [`2019-teensy-nrf24/`](2019-teensy-nrf24/) | 2019–2022 | Teensy 3.6 on the robot (replaces the SSC-32), Teensy remote with Nextion screen, nRF24L01 | servo passthrough: Unity → remote over USB → radio → robot | -| [`2026-current/`](2026-current/) | 2026– | Teensy 3.6 robot, Teensy 4.1 remote, Fusion 360 designed parts | IK, gait, body pose and IMU stabilisation on the robot; the unchanged firmware also runs inside Unity | +| [`2026-current/`](2026-current/) | 2026– | Teensy 3.6 robot, Teensy 4.0 remote, Fusion 360 designed parts, OpenSCAD rebuild and new remote | IK, gait, body pose and IMU stabilisation on the robot; the unchanged firmware also runs inside Unity | ## Repository notes