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.
scripts/export-inventory.py
"""Draft BOM and placements from the actual compiled Circuit JSON, not a parts wish list."""
from pathlib import Path
import csv,json,collections,hashlib
root=Path(__file__).resolve().parents[1]
summary={}
for half in ['left','right']:
j=json.loads((root/f'outputs/{half}/keyboard.circuit.json').read_text())
components={e['source_component_id']:e for e in j if e['type']=='source_component'}
pcb={e['source_component_id']:e for e in j if e['type']=='pcb_component'}
features={'J_NTC','J_SWD','TP_VBUS','TP_VBAT','TP_SYS','TP_VCC','TP_GND'}
groups=collections.defaultdict(list)
for e in components.values():
value=next((e[k] for k in ['display_capacitance','display_resistance','display_inductance','display_frequency'] if k in e),'')
cid=','.join(e.get('supplier_part_numbers',{}).get('jlcpcb',[]))
groups[(e.get('manufacturer_part_number',''),cid,value,e['ftype'],'mechanical' if e['ftype']=='subassembly' else 'printed' if e['ftype']=='printedpart' else 'feature' if e['name'] in features else 'dnp' if pcb.get(e['source_component_id'],{}).get('do_not_place') else 'part')].append(e['name'])
with (root/f'outputs/{half}/BOM-DRAFT.csv').open('w') as f:
w=csv.writer(f,lineterminator="\n");w.writerow(['Designators','Quantity','MPN','JLCPCB','Value','Type','Status'])
for (mpn,cid,value,ftype,kind),refs in sorted(groups.items()):
w.writerow([','.join(refs),len(refs),mpn,cid,value,ftype,'MECHANICAL MODEL; see display name and assembly documentation' if kind=='mechanical' else 'PRINTED PLA; outputs/enclosure' if kind=='printed' else 'DNP; tuning position' if kind=='dnp' else 'PCB FEATURE; no purchased part' if kind=='feature' else 'DRAFT; availability/ratings/footprint audit pending' if cid else 'UNSOURCED; not ready for ordering'])
with (root/f'outputs/{half}/placements-DRAFT.csv').open('w') as f:
w=csv.writer(f,lineterminator="\n");w.writerow(['Designator','Origin X mm','Origin Y mm','Rotation deg','Layer','Status'])
for sid,e in components.items():
p=pcb.get(sid)
if p:
c=p.get('footprint_origin',p['center']);w.writerow([e['name'],c['x'],c['y'],p['rotation'],p['layer'],'DRAFT; assembly datum/rotation convention unverified'])
summary[half]={'circuitJsonSha256':hashlib.sha256((root/f'outputs/{half}/keyboard.circuit.json').read_bytes()).hexdigest(),'components':len(components),'pcbComponents':len(pcb),'printedParts':sum(e['ftype']=='printedpart' for e in components.values()),'jlcpcbComponents':sum(bool(e.get('supplier_part_numbers',{}).get('jlcpcb')) for e in components.values()),'distinctJlcpcbIds':sorted({x for e in components.values() for x in e.get('supplier_part_numbers',{}).get('jlcpcb',[])}),'unsourcedRefs':[e['name'] for e in components.values() if e['ftype'] not in ['printedpart','subassembly'] and e['name'] not in features and not e.get('supplier_part_numbers',{}).get('jlcpcb')]}
(root/'outputs/component-inventory.json').write_text(json.dumps(summary,indent=2)+'\n')
print({h:{k:v for k,v in s.items() if k in ['components','jlcpcbComponents']} for h,s in summary.items()})
assembly=[
['Custom PCB/PCBA',2,'One left and one right; see both PCB BOM-DRAFT.csv','1+2+1 HDI; fabrication and sourcing review pending'],
['Choc hot-swap sockets',58,'CPG135001S30 / C5333465','Already in PCB BOM; buy separately only if assembler omits'],
['Hand-fitted key switches',58,'Kailh Choc V1; CPG135001D02 reference','Plug into sockets; no Choc V2/MX'],
['Keycaps',58,'KLP Lame; Choc stem / Choc size; 46 normal + 2 homing + 10 thumb','Actual stem/profile trial-fit required'],
['Rotary encoders',2,'Bourns PEC11R-4215K-S0012 / C18164806','Already in PCB BOM; buy separately only if assembler omits'],
['Knob prints',2,'encoder-knob-14x10.stl; 6.2 mm bore','M3 pilot; print roof-side down'],
['Knob grub screws',2,'M3 x 4 mm','Tap pilot; matching hex key required'],
['Raw LCD panels',2,'Sharp LS011B7DH03 with integral FPC','No display boards; verify stock/contact side/pin 1/mating'],
['Protected LiPo cells',2,'1S 3.7 V 500 mAh; Adafruit 1578 reference','29 x 36 x 4.75 mm; verify JST-PH polarity'],
['Cell thermistors',2,'10k ohm B25/85=3435K NTC','Exact MPN open; attach insulated sensor to each cell'],
['NTC wire pairs',2,'Thin insulated leads to TS/GND pads','Direct solder; no tall header'],
['Battery leads',2,'JST PHR-2 + SPH contacts or precrimped','Conditional: reference cells include harness'],
['Enclosure base prints',2,'*-case_base.stl','PLA prototype; trial fit'],
['Key plate prints',2,'*-case_plate.stl','Includes supported raw-panel carrier'],
['Upper spacer prints',10,'*-spacer_th*.stl','Five per half; 1.0 mm tall'],
['Case screws',10,'M2 x 12 mm small button head, <=3.5 mm OD / <=1.3 mm high','Trial-tap printed 1.6 mm pilots'],
['Cell retention',2,'Thin nonconductive strap sets','Use floor slots; protect cell from leads'],
['Insulating tape',1,'Kapton/electrical tape','Cell/NTC/solder lead insulation'],
['Display adhesive',1,'0.2 mm nonconductive double-sided tape','Only on support ledge outside active area/tail'],
['Flat-case rubber feet',8,'Thin adhesive feet','Four per half'],
['Optional tenting prints',2,'One left/right matching 5 / 10 / 15 degree pair','Default reference 10 degrees; no hinges/fasteners'],
['Optional tenting rubber strip',1,'Approx 1 m; 1 mm thick x 4-6 mm wide','Under contour frames'],
['USB data/charging cables',1,'USB-C; 11 x 7 mm max checked overmould','Two cables for simultaneous charging'],
['USB power source',1,'Compliant 5 V USB supply/PC','Both halves charge separately'],
['Programming tools',1,'3 V-compatible SWD probe + pogo leads','SWDIO/SWCLK/RESET/VCC-sense/GND'],
['Assembly/test tools',1,'Soldering tools, flux, meter, current-limited supply, screwdriver, M2/M3 taps, 1.3 mm hex key and knob key','Shared set; PC with Bluetooth'],
]
with (root/'outputs/assembly-parts-DRAFT.csv').open('w') as f:
w=csv.writer(f,lineterminator='\n');w.writerow(['Item','Quantity per complete keyboard','Selection','Status']);w.writerows(assembly)