rushabhcodes/wireless-split-keyboard

Wireless Split Keyboard — custom routed nRF52840 split PCBs with a printable enclosure

Version
0.4.5
License
unset
Stars
0

Use with the tscircuit CLI

tsci is the tscircuit CLI. Install it with npm install -g tscircuit.

tsci clone rushabhcodes/wireless-split-keyboard  # download the package files into ./wireless-split-keyboard
tsci add rushabhcodes/wireless-split-keyboard    # add it to your project as @tsci/rushabhcodes.wireless-split-keyboard

In a cloned or new (tsci init) project: tsci dev starts a local preview, tsci build outputs Circuit JSON, and tsci push publishes to tscircuit.com.

src/mechanicalModels.ts

/** Nominal reference geometry in mm. Supplier drawings and physical fit govern. */
import { jscadPlanner as cad, type Color, type Vector3D } from 'jscad-planner'

export const mechanical = {
  // KLP's underside seating land is Z=2.7; Choc plunger top is Z=8.8.
  // Include 0.02 mm visual contact allowance for the reduced mesh.
  keycap: { width:17.5, depth:16.5, modelOffsetZ:6.12, bodyBottomZ:7.42, nominalTravel:3, maximumTravel:3.5 },
  encoder: { bodyHeight:6.5, shaftLength:15, shaftDiameter:6, maximumPush:.8 },
  knob: { radius:7, height:10, centerZ:19, boreRadius:3.1, boreDepth:9 },
  battery: { width:29, depth:36, height:4.75, centerZ:-6.625 },
} as const
export function coloredBox(position: Vector3D, size: Vector3D, color: Color) {
  return cad.transforms.translate(position,cad.colors.colorize(color,cad.primitives.cuboid({size})))
}
const cylinder = (radius:number,height:number,z:number) => cad.transforms.translate([0,0,z],cad.primitives.cylinder({radius,height,resolution:48}))
export const encoderCadModel = cad.booleans.union(
  coloredBox([0,0,1.25],[12.5,13.4,2.5],[.18,.19,.20]),
  coloredBox([0,0,4.5],[12.5,13.4,4],[.68,.70,.72]),
  cad.colors.colorize([.55,.57,.59],cylinder(3.5,5,9)),
  cad.colors.colorize([.72,.74,.75],cylinder(3,15,14)),
  ...[-2.5,0,2.5].map(x=>coloredBox([x,-7.5,-1.25],[.8,.4,4.5],[.75,.76,.77])),
  ...[-2.5,2.5].map(x=>coloredBox([x,7,-1.25],[.8,.4,4.5],[.75,.76,.77])),
  ...[-5.7,5.7].map(x=>coloredBox([x,0,-1.25],[.8,2,4.5],[.75,.76,.77])),
)
/** Printed 14 x 10 mm low-mounted knob, 6.2 mm bore, radial M3 self-tap pilot. */
export const knobModel = cad.booleans.subtract(
  cylinder(mechanical.knob.radius,mechanical.knob.height,0),
  cylinder(mechanical.knob.boreRadius,mechanical.knob.boreDepth+.2,-.6),
  cad.transforms.translate([5,0,0],cad.transforms.rotateY(Math.PI/2,
    cad.primitives.cylinder({radius:1.25,height:6,resolution:32}))),
)
/** Direct-soldered NTC wire stubs; no tall pin header is fitted. */
export const ntcWireCadModel=cad.booleans.union(...[-1.27,1.27].map(x=>
  cad.transforms.translate([x,0,1.2],cad.colors.colorize([.15,.16,.17],
    cad.primitives.cylinder({radius:.4,height:2.4,resolution:16})))))
/** M2 x 12 small button-head envelope: 3.5 mm head OD, 1.3 mm high. */
export const mountingScrewModel=cad.colors.colorize([.42,.44,.46],cad.booleans.subtract(
  cad.booleans.union(cylinder(1,12,-3),cylinder(1.75,1.3,3.65)),
  cad.transforms.translate([0,0,4.15],cad.primitives.cylinder({radius:.75,height:.5,resolution:6})),
))