CAD / Robotics

OpenSCAD Parametric Component Library

Joel Johnston 2026-04-06 Pre-stroke design

OpenSCAD Parametric Component Library

Author: Joel Johnston Date: 2026-04-06 Domain: CAD / Robotics Stroke Timeline: Pre-stroke


Abstract

Fully parametric OpenSCAD modules shared across 5 hardware projects. Designed for reuse — the same servo mount works in the turret camera, laser bug zapper, seeker tracker, and drone gimbal. The library embodies the primitive composition pattern from the cognitive architecture: small reusable modules composed into different systems. All modules are support-free printable, parametric by design, and export clean STL.


Design Principles

Support-Free Printing

All overhangs are less than 45 degrees. No bridging exceeds 20mm. Every module prints without support material in any standard orientation. This constraint is enforced at design time — any revision that introduces a support-requiring feature is redesigned before being added to the library.

Supporting rationale: support material adds print time, wastes filament, and requires manual post-processing. In a library shared across 5 projects with dozens of print iterations, these costs compound. Support-free design is a force multiplier.

Parametric Dimensions

One variable change adjusts the entire assembly. A servo mount for SG90 becomes a servo mount for MG996R by changing the servo_type parameter. The screw holes, pocket depth, mounting tabs, and clearance tolerances all adjust automatically.

Snap-Fit Joints

Where possible, snap-fit connections replace screws and heat inserts. Reduces hardware BOM (bill of materials), eliminates the need for inserts, and speeds assembly. Used for non-structural connections — covers, cable routing clips, mounting tabs. Structural joints (anything load-bearing) use captured nuts and machine screws.

Integrated Cable Routing

Cable channels are designed into the structure, not added as afterthoughts. Every module that moves has a defined cable path from the actuator to the exit point, with enough slack radius to avoid strain at max range of motion.


Module Library

Servo Mounts

Parametric mounts for three servo classes:

Parameter SG90 MG996R NEMA-17
Type Micro servo, 9g Standard servo, 55g Stepper motor
Mount style Bracket Bracket Face mount
Screw pattern M2 M3 M3 (standard NEMA)
Clearance 1.2mm 1.5mm 0.5mm

servo_type parameter drives all dimensions. Adding a new servo type requires only a new entry in the servo dimension lookup table.

Camera Adapters

  • Pi Camera Module 3 (12MP, autofocus) — compact mount with cable strain relief
  • Pi HQ Camera (12.3MP, interchangeable lenses) — standard C/CS mount thread, configurable for 6mm wide-angle and 16mm telephoto lenses
  • Lens mounts — parametric adapter plates for any C-mount lens, calculated from manufacturer dimensional data

2-Axis Gimbal Assemblies

Pan/tilt gimbal with configurable range of motion. Parameters:

  • pan_range — degrees, default ±90
  • tilt_range — degrees, default +45/-90 (horizontal to full down)
  • servo_class — SG90 or MG996R (drives all servo mount dimensions)
  • camera_mount — Pi Module 3 or Pi HQ (drives all camera adapter dimensions)
  • cable_exit — bottom, side, rear (routes the cable path)

The gimbal is the most-reused module in the library. Used in: turret camera, laser bug zapper, seeker tracker, and drone payload mount.

Enclosures

Parametric box generator:

  • Outer dimensions (X, Y, Z)
  • Wall thickness
  • Ventilation pattern (none, slots, hex grid) with coverage percentage
  • Cable entry points (count, diameter, side)
  • Mounting tabs (count, pattern, M2/M3/M4)
  • Lid attachment (snap-fit, screw, friction)

Any electronics project gets a custom-fit enclosure in minutes. The generator produces a box body and matching lid as separate files.

Motor Brackets

  • DC gear motor brackets (JGB37 series — configurable for shaft height and gearbox OD)
  • Brushless motor mounts (2204/2212 class — configurable for stator diameter and prop shaft height)
  • Configurable hole pattern for frame attachment

All modules are validated with:

  • Material: PLA or PETG (PETG preferred for outdoor/UV exposure)
  • Layer height: 0.2mm
  • Infill: 20% (gyroid pattern for isotropy)
  • Perimeters: 3 (increases surface strength without infill cost)
  • Print speed: 60mm/s perimeters, 80mm/s infill

Project Usage

Project Modules Used
Turret Camera Gimbal (SG90), Pi Module 3 adapter
Laser Bug Zapper Gimbal (MG996R), enclosure (electronics), motor bracket
Seeker Tracker Gimbal (MG996R), Pi HQ adapter, lens mounts (6mm + 16mm)
Quadcopter Drone Motor brackets (brushless), enclosure (FC stack)
Tank-Track Platform Motor brackets (DC gear), enclosure (compute stack)

The turret camera was the origin project — the gimbal module was designed for it and then generalized when the bug zapper required the same assembly at different scale.


The Primitive Composition Connection

The library architecture directly reflects the primitive learning theory: each module is a primitive. Each project is a composition of primitives. The servo mount does not know it is in a bug zapper. The gimbal does not know it is in a seeker tracker. The primitives are domain-agnostic; the compositions are domain-specific.

This is the same pattern as robonet-core (primitives) + robonet-mesh (compositions). The cognitive architecture that produced robonet also produced the OpenSCAD library. The pattern is consistent because it emerges from the same underlying cognitive process.