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-keyboardIn 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/KeyboardModels.tsx
import * as React from 'react'
import { assembly } from 'tscircuit'
import { jscadPlanner as cad } from 'jscad-planner'
import { coloredBox, mechanical, knobModel, mountingScrewModel, ntcWireCadModel } from './mechanicalModels'
import { chocSwitchCadModel } from '../imports/CPG135001D02'
import { geometryFor, type Half } from './mechanicalGeometry'
import models from './models/catalog.json'
import { offsetPlacement } from './componentPlacement'
/** Assembly models add no duplicate electrical pads, holes or silkscreen. */
export function KeyboardModels({ half }: { half: Half }) {
const geometry = geometryFor(half)
const screenX = half === 'left' ? 53.3 : -53.3
const ntc = offsetPlacement(half,'J_NTC','U_CHG',8,2)
return <>
{geometry.keys.map(key => {
const profile = key.row===4 ? 'thumb' : key.row===2 && key.column===3 ? 'homing' : 'normal'
const color = key.row===4 ? 'blue' : 'ivory'
const keycap = models[`keycap-${profile}-${color}`]
return <React.Fragment key={key.reference}>
<assembly.part name={`${key.reference}_KEY`} displayName={`${key.reference} Kailh Choc V1 switch`}
purchaseUrls={['https://jlcpcb.com/partdetail/C400230']}
cadModel={{...chocSwitchCadModel,modelOriginPosition:{x:0,y:0,z:-3},
positionOffset:{x:key.x,y:key.y,z:.8},pcbRotationOffset:key.rotation+180}}/>
<assembly.part name={`${key.reference}_CAP`} displayName={`${key.reference} KLP Lamé ${profile}, Choc stem / Choc size`}
purchaseUrls={['https://github.com/braindefender/KLP-Lame-Keycaps']}
cadModel={{glbUrl:keycap.glbUrl,modelUnitToMmScale:1,
positionOffset:{x:key.x,y:key.y,z:mechanical.keycap.modelOffsetZ},pcbRotationOffset:key.rotation}}/>
</React.Fragment>
})}
{geometry.mountingHoles.slice(2).map(hole=><assembly.part key={hole.reference}
name={`MOUNT_SCREW_${hole.reference}`} displayName="M2 x 12 button-head envelope, 3.5 mm OD / 1.3 mm head"
cadModel={{jscad:cad.transforms.translate([hole.x,hole.y,0],mountingScrewModel)}}/>)}
<assembly.part name="LCD_GLASS" displayName="Sharp LS011B7DH03 raw panel: glass, polarizer and active area"
purchaseUrls={['https://github.com/karnadii/sharp_memory_display_breakout']}
cadModel={{glbUrl:models['sharp-panel'].glbUrl,modelUnitToMmScale:1,positionOffset:{x:screenX,y:29,z:1.8}}}/>
<assembly.part name="LCD_ACTIVE" displayName="LCD active area (illustrative unpowered appearance)"
cadModel={{jscad:coloredBox([screenX,30.173,2.551],[10.744,25.28,.012],[.65,.70,.65])}}/>
<assembly.part name="LCD_FLEX" displayName="Shaped polyimide FPC: 9.47 mm root, 5.5 mm finished tail, ten gold contacts"
cadModel={{glbUrl:models['sharp-flex'].glbUrl,modelUnitToMmScale:1,positionOffset:{x:screenX,y:29,z:1.8}}}/>
<assembly.part name="BATTERY_CELL" displayName="Protected Li-ion cell envelope (29 x 36 x 4.75 mm)"
cadModel={{jscad:coloredBox([half==='left'?-8:8,5,-6.625],[29,36,4.75],[.62,.65,.68])}}/>
<assembly.part name="J_NTC_WIRES" displayName="Manual NTC wire pair, direct solder to the two PCB pads"
cadModel={{jscad:cad.transforms.translate([ntc.x,ntc.y,-.8],
cad.transforms.rotateZ(ntc.rotation*Math.PI/180,cad.transforms.rotateY(Math.PI,ntcWireCadModel)))}}/>
<assembly.part name="BATTERY_LABEL" displayName="Protected cell label (illustrative)"
cadModel={{jscad:coloredBox([half==='left'?-8:8,5,-4.225],[22,26,.05],[.94,.94,.90])}}/>
<assembly.part name="ENC1_KNOB" displayName="Printed 14 x 10 mm low-mounted knob, radial M3 grub screw"
cadModel={{jscad:cad.transforms.translate([geometry.encoder.x,geometry.encoder.y,mechanical.knob.centerZ],
cad.colors.colorize([.26,.45,.56],knobModel))}}/>
</>
}