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.
docs/original-brief.md
# Wireless Split Mechanical Keyboard — Custom tscircuit PCB Design Brief
## 1. Project objective
Design and implement a fully custom, wireless, ergonomic split mechanical keyboard using tscircuit (TypeScript/TSX) and ZMK firmware.
Use existing open-source keyboards as references for mechanical geometry, electrical architecture, ergonomics and functionality.
The final implementation must include complete schematics, routed PCBs, 3D models, manufacturing files and firmware.
## 2. Strict requirements
- Fully wireless communication between both keyboard halves.
- Bluetooth Low Energy connectivity to the host computer.
- One low-power display on each half.
- One rotary encoder with push-button functionality on each half.
- Independent rechargeable batteries.
- Integrated USB-C charging.
- Low-profile mechanical switches.
- Hot-swappable switches.
- Custom 3D-printable enclosure.
- All PCB design work must be implemented natively in tscircuit.
### No preassembled electronic modules
Do NOT use:
- nice!nano
- Pro Micro
- Seeed XIAO
- Bluetooth development boards
- Castellated Bluetooth modules
- nice!view breakout boards
- External battery charging modules
- Controller daughterboards
Instead, integrate the individual ICs, resistors, capacitors, crystals, inductors, antennas and supporting components directly onto the main PCBs.
Every individual component's position and rotation must be adjustable through TypeScript.
The objective is to have full control over PCB layout, component placement, thickness and mechanical integration.
## 3. Open-source reference projects
### Sofle Choc Wireless — Primary reference
Repository:
https://github.com/db-ok/SofleChocWireless
Firmware:
https://github.com/db-ok/zmk-config-soflechocwireless
Build guide:
https://github.com/db-ok/SofleChocWireless/blob/main/docs/build_guide_choc_wireless.md
Features:
- 58 mechanical switches and two rotary encoders.
- Ergonomic column-staggered layout.
- Wireless connectivity.
- Dual display support.
- Low-profile Choc switches.
- ZMK firmware.
- Public PCB design files.
Use this project as the primary reference for the keyboard's external appearance, dimensions, key placement, display positions and encoder positions.
### Temporal
Repository:
https://github.com/curbol/temporal
Features:
- 36–42 keys.
- Wireless connectivity.
- Rotary encoder support.
- nice!view display support.
- Parametric keyboard geometry.
- KiCad and manufacturing files.
- JLCPCB assembly references.
Study its mechanical design, component placement and manufacturing workflow.
### Rift
Repository:
https://github.com/cupcake08/Rift
Features:
- Compact 34-key layout.
- Wireless connectivity.
- Rotary encoder support.
- Display support.
- Optional trackpad.
- Compact enclosure design.
Study its compact electronics placement and mechanical integration.
### Corax
Repository:
https://github.com/dnlbauer/corax-keyboard
Firmware:
https://github.com/dnlbauer/corax-zmk-config
Features:
- 54–56 keys.
- Wireless connectivity.
- Dual displays.
- Horizontal rotary scrollwheels.
- Magnetic enclosure.
- Reversible PCB architecture.
Study its alternative encoder placement and enclosure design.
Verify each project's license at the selected commit before reusing any geometry, source files or firmware. Preserve required attribution and license notices.
## 4. Mechanical design requirements
The external shape should closely match Sofle Choc Wireless.
Preserve:
- Overall PCB outline.
- Ergonomic column stagger.
- Key spacing and key positions.
- Thumb cluster arrangement.
- Display positions.
- Rotary encoder positions.
- Mounting hole positions.
- Enclosure silhouette.
- Keycap clearances.
- Left and right keyboard proportions.
Do not estimate geometry from photographs.
Retrieve the original PCB design files and extract the exact board outline, switch coordinates, rotations and mounting locations.
Record the source repository commit used as the mechanical reference.
Separate the design into two independent coordinate systems:
1. Locked mechanical geometry.
2. Editable electronic component placement.
The internal electronic layout may change substantially, but the external keyboard appearance should remain as close to the reference as possible.
Expose component placement parameters such as:
- X coordinate.
- Y coordinate.
- Rotation.
- PCB side.
RF-critical components must retain their required relative placement.
Generate a visual overlay comparing the original reference PCB outline and switch locations against the new tscircuit implementation.
Report any differences rather than silently changing the shape.
## 5. Proposed hardware specifications
| Feature | Specification |
|---|---|
| Layout | Sofle Choc Wireless |
| Total switches | 58 |
| Switches per half | 29 |
| Rotary encoders | 2 |
| Displays | 2 |
| Microcontroller | Bare Nordic nRF52840 |
| Wireless | Bluetooth Low Energy |
| Firmware | ZMK |
| Switch type | Kailh Choc V1 |
| Hot-swap sockets | Choc-compatible |
| Battery | Independent protected 1S LiPo per half |
| Battery capacity | Approximately 150–500 mAh per half |
| Charging | Integrated USB-C |
| PCB layers | 4-layer FR-4 |
| PCB thickness | Initially 1.6 mm, subject to validation |
| Enclosure | Custom 3D-printable |
| RGB lighting | Omit in initial revision |
These are proposed engineering defaults, not finalized component selections.
## 6. System architecture
Computer / Phone
|
| Bluetooth HID
|
Left Keyboard — Central
|
| Bluetooth LE split communication
|
Right Keyboard — Peripheral
Each keyboard half contains:
- Bare nRF52840 SoC.
- Bluetooth antenna and RF matching network.
- Mechanical switch matrix.
- Rotary encoder.
- Memory LCD.
- Rechargeable LiPo battery.
- USB-C connector.
- Battery charging circuitry.
- Voltage regulation.
- Battery monitoring.
- Power switch.
- SWD programming interface.
Both halves must operate without any physical cable connecting them.
The central keyboard combines events from both halves and presents a single keyboard to the host.
USB connectivity may additionally support wired HID and firmware flashing.
## 7. Microcontroller and Bluetooth circuit
Use the bare Nordic nRF52840-QIAA SoC as the initial candidate.
Do not use a preassembled controller module.
Nordic reference documentation:
https://docs.nordicsemi.com/r/bundle/ps_nrf52840/
Implement:
- nRF52840 SoC.
- 32 MHz crystal.
- 32.768 kHz crystal.
- Crystal load capacitors.
- All required decoupling capacitors.
- Internal DC/DC support components.
- RF matching network.
- Bluetooth antenna.
- Required power connections.
- USB interface.
- Reset circuit.
- SWD programming pads.
Use the exact Nordic reference circuit for the selected package and power configuration.
Do not combine incompatible reference circuit configurations.
Never treat internal regulator decoupling pins as external supply rails.
### RF layout requirements
- Use a documented 2.4 GHz chip antenna or PCB antenna.
- Implement a correctly calculated 50-ohm RF transmission line.
- Calculate impedance using the actual PCB manufacturer stackup.
- Follow antenna-specific copper keepout requirements.
- Keep the matching network close to the RF output.
- Maintain appropriate ground stitching.
- Avoid routing unrelated signals through the antenna area.
- Maintain clearance from batteries, metal plates, switches and screws.
- Follow the Nordic reference PCB layout.
- Manually control RF routing and critical component placement.
Do not rely on unconstrained autorouting for RF circuitry.
A bare RF design is not pre-certified. Evaluate radio and EMC compliance before commercial distribution.
## 8. Key matrix
Use a proposed 5-row × 6-column matrix on each half.
Each half contains:
- 29 mechanical key switches.
- One rotary encoder push button.
- 30 isolation diodes.
Total keyboard:
- 58 mechanical switches.
- Two encoder push buttons.
- 60 matrix diodes.
Use one diode per populated matrix position.
Potential diode: 1N4148W, with the exact package verified.
Use Kailh Choc V1-compatible hot-swap sockets.
Requirements:
- Verify exact switch and socket footprints.
- Include mechanical alignment holes.
- Validate socket orientation.
- Prevent collisions between sockets and other components.
- Ensure matrix diode orientation matches ZMK configuration.
- Generate physical layout and matrix mapping from shared TypeScript data.
The matrix requires 11 GPIO pins per half.
## 9. Rotary encoder
Use one EC11-style quadrature rotary encoder per half.
Each encoder should provide:
- Clockwise rotation.
- Counterclockwise rotation.
- Momentary push-button functionality.
Connect encoder A and B signals to dedicated GPIO pins.
Connect the push button to an available position in the keyboard matrix.
Verify the encoder's datasheet, pinout, mounting dimensions, shaft height, shaft diameter and detent characteristics.
Suggested default functionality:
Left encoder:
- Volume adjustment.
- Push to mute.
Right encoder:
- Vertical scrolling.
- Push for configurable action.
All actions should be customizable through ZMK.
## 10. Integrated low-power display
Do not use a nice!view breakout board.
Instead, use the underlying raw LCD panel or a suitable equivalent.
Primary candidate:
Sharp LS011B7DH03
- Memory LCD technology.
- 160 × 68 resolution.
- Low-power operation.
- Suitable for battery-powered devices.
- Used in the nice!view display assembly.
References:
https://nicekeyboards.com/nice-view/
https://nicekeyboards.com/docs/nice-view/pinout-schematic/
Integrate the raw display using its appropriate FPC connector directly on the keyboard PCB.
Implement all required supporting circuitry on the main PCB.
Verify:
- Raw panel datasheet.
- Actual panel availability.
- FPC pinout.
- Connector pitch and orientation.
- Supply voltage.
- Logic levels.
- SPI communication requirements.
- Chip-select polarity.
- VCOM inversion requirements.
- Display enable functionality.
- Power consumption.
- Mechanical dimensions.
- FPC bend radius.
Do not confuse the nice!view breakout header pinout with the raw display panel's pinout.
The display should show:
- Local battery percentage.
- Bluetooth connection status.
- Active keyboard layer.
- Active Bluetooth profile.
- Other useful keyboard information.
Remote battery information and synchronized display state should be implemented where supported by the firmware.
Use a compatible ZMK/Zephyr display driver.
Zephyr reference:
https://docs.zephyrproject.org/latest/build/dts/api/bindings/display/sharp%2Cls0xx.html
Implement the required VCOM inversion behavior even during sleep, or shut down the panel according to its datasheet.
If the proposed display is unavailable, investigate equivalent raw memory LCD or low-power OLED panels.
Do not substitute a preassembled display breakout.
## 11. Battery and charging architecture
Each keyboard half must have an independent rechargeable single-cell LiPo battery.
Suggested initial capacity:
150–500 mAh per half, depending on enclosure space and battery-life requirements.
Implement the following directly on the main PCB:
- USB-C receptacle.
- USB-C CC pull-down resistors.
- USB ESD protection.
- LiPo charging IC.
- Power-path management.
- Low-power voltage regulator.
- Battery connector.
- Power switch.
- Battery voltage monitoring.
- Charging status circuitry where needed.
Candidate charging IC:
TI BQ25185
https://www.ti.com/product/BQ25185
Candidate buck-boost voltage regulator:
TI TPS63802
https://www.ti.com/product/TPS63802
These components are candidates and must be validated before final selection.
### Proposed power flow
USB-C 5V
|
Battery charger and power-path IC
|
+---- Protected LiPo battery
|
Low-quiescent-current 3.3V regulator
|
+---- nRF52840
|
+---- Display
|
+---- Supporting circuitry
Requirements:
- Allow charging while the keyboard is switched off.
- Set charging current according to the actual battery datasheet.
- Verify battery protection and connector polarity.
- Implement low-leakage battery voltage monitoring.
- Avoid back-powering the MCU through USB or debug interfaces.
- Verify operation during USB insertion and battery depletion.
- Minimize idle and sleep current.
- Avoid unnecessary always-on LEDs.
- Provide test pads for VBUS, VBAT, SYS, 3V3 and GND.
- Follow USB current advertisement and enumeration requirements.
- Never connect USB 5V or raw battery voltage directly to the 3.3V supply rail.
Calculate expected battery life separately for the central and peripheral halves.
Include display power, regulator losses, charger leakage and radio power consumption.
Measure actual consumption on physical prototypes.
## 12. USB and programming
Integrate USB-C directly into both keyboard PCBs.
Support:
- Battery charging.
- USB data where required.
- Firmware updates where supported.
- Wired HID on the central half, if desired.
Implement the appropriate USB D+ and D- connections for both connector orientations.
Follow Nordic's documented USB supply and decoupling requirements.
Provide accessible SWD programming pads:
- SWDIO.
- SWDCLK.
- GND.
- Target voltage reference.
- RESET.
The bare nRF52840 must be programmable using an external SWD programmer.
Install a compatible bootloader only after validating its flash partition layout and compatibility.
Do not assume that the nice!nano bootloader automatically works with the custom board.
## 13. PCB stackup and layout
Use a four-layer PCB as the initial baseline.
Suggested stackup:
- Layer 1: Components and signals.
- Layer 2: Ground reference plane.
- Layer 3: Power and additional signals.
- Layer 4: Components and signals.
Validate the final stackup against RF requirements and the fabrication service's capabilities.
Requirements:
- Continuous ground reference planes where appropriate.
- Proper power distribution.
- Adequate trace widths.
- Short decoupling connections.
- Correct RF impedance.
- Antenna keepout.
- Sufficient via stitching.
- Fabrication-compatible SoC fanout.
- No unnecessary PCB thickness.
- No component collisions.
- Accessible USB ports and switches.
- Adequate battery and display clearance.
Use separate left and right PCBs initially.
A reversible PCB may be considered later if component orientation, routing and mechanical constraints allow it.
## 14. tscircuit implementation
Use tscircuit as the source of truth.
Documentation:
https://docs.tscircuit.com/
CLI:
https://docs.tscircuit.com/intro/quickstart-cli
Fabrication documentation:
https://docs.tscircuit.com/guides/understanding-fabrication-files
Read the current tscircuit documentation and available AI skill instructions before starting.
Validate all JSX elements, properties and CLI commands against the installed version.
Do not invent unsupported APIs.
### Suggested project structure
index.tsx
src/
LeftKeyboard.tsx
RightKeyboard.tsx
KeyboardHalf.tsx
KeyCell.tsx
Nrf52840.tsx
RadioFrontend.tsx
Display.tsx
Encoder.tsx
UsbC.tsx
BatteryPower.tsx
mechanicalGeometry.ts
componentPlacement.ts
layout.ts
pinout.ts
footprints/
firmware/
config/
boards/
tests/
keyboard.test.ts
snapshots/
docs/
design.md
pinout.md
assembly.md
validation.md
references.md
outputs/
### Implementation requirements
- Create reusable TypeScript components.
- Create reusable switch and diode cells.
- Generate switch positions from shared coordinate data.
- Create separate left and right keyboard entry points.
- Define individual component placements in TypeScript.
- Use accurate, datasheet-backed footprints.
- Verify physical package pad numbers and electrical port mappings.
- Add custom footprints where necessary.
- Include accurate 3D models where available.
- Use explicit routing constraints for critical circuitry.
- Keep RF components grouped appropriately.
- Resolve all connectivity and design-rule errors.
- Generate schematic and PCB previews.
- Generate top, bottom and 3D visual snapshots.
- Generate Circuit JSON.
- Generate manufacturing exports.
- Publish source code and previews.
Use KiCad reference files only for measurement, research and independent verification.
Do not make KiCad the primary PCB design tool.
Do not simply import an existing keyboard PCB into tscircuit.
The complete design must be implemented natively using tscircuit components and TypeScript.
## 15. Component sourcing
Prefer readily available components that can be assembled by JLCPCB or a comparable PCB assembly service.
Check:
- LCSC.
- JLCPCB component library.
- DigiKey.
- Mouser.
- Manufacturer documentation.
For every component, record:
- Manufacturer.
- Manufacturer part number.
- Supplier part number.
- Package.
- Footprint.
- Electrical specifications.
- Availability.
- Approximate cost.
- Assembly requirements.
Do not invent supplier part numbers.
Do not select components solely because they have existing tscircuit footprints.
Verify the actual mechanical and electrical specifications.
## 16. Preliminary BOM
Quantities below are for the complete keyboard.
| Component | Quantity |
|---|---:|
| Bare Nordic nRF52840 SoC | 2 |
| 32 MHz crystal | 2 |
| 32.768 kHz crystal | 2 |
| Bluetooth antenna | 2 |
| RF matching component sets | 2 |
| MCU decoupling component sets | 2 |
| USB-C receptacle | 2 |
| USB ESD protection circuitry | 2 sets |
| LiPo charging IC | 2 |
| Low-power voltage regulator | 2 |
| Kailh Choc V1 switches | 58 |
| Choc hot-swap sockets | 58 |
| Matrix diodes | 60 |
| EC11-style rotary encoder | 2 |
| Encoder knob | 2 |
| Raw memory LCD panel | 2 |
| Display FPC connector | 2 |
| Protected LiPo battery | 2 |
| Battery connector | 2 |
| Power switch | 2 |
| Reset button | 2 |
| Battery voltage sensing circuitry | 2 sets |
| Programming test pads | 2 sets |
| Custom four-layer PCB | 2 |
| Keycaps | 58 |
| Custom enclosure | 2 |
Additional resistors, capacitors, inductors and mechanical parts must be determined from the final validated schematic.
This is a preliminary functional BOM, not a fabrication-ready purchasing list.
## 17. ZMK firmware
Use ZMK firmware with native custom board definitions.
References:
https://zmk.dev/docs/features/split-keyboards
https://zmk.dev/docs/hardware-integration
https://zmk.dev/docs/hardware-integration/new-board
https://zmk.dev/docs/hardware-integration/new-shield
https://zmk.dev/docs/hardware-integration/encoders
https://zmk.dev/docs/config/split
Do not configure the hardware as a nice!nano board.
Create custom Zephyr/ZMK board definitions for the actual integrated PCBs.
Implement:
- Left central role.
- Right peripheral role.
- Bluetooth split communication.
- Bluetooth HID.
- Keyboard matrix scanning.
- Diode direction.
- Physical layout.
- Keymap.
- Rotary encoder behavior.
- Display driver.
- Battery voltage monitoring.
- Sleep and wake behavior.
- Bluetooth profile management.
- USB HID where supported.
- Firmware flashing and recovery.
Generate firmware GPIO definitions from the actual PCB pin assignments.
Ensure that no GPIO is assigned to conflicting functions.
Build firmware for both keyboard halves.
Document initial SWD flashing, bootloader installation if applicable, Bluetooth pairing, bond reset and recovery.
## 18. Enclosure design
Create custom 3D-printable enclosures for both halves.
Preserve the Sofle Choc Wireless appearance.
Requirements:
- Thin, ergonomic design.
- Correct switch and keycap clearance.
- Display opening.
- Rotary encoder opening.
- USB-C access.
- Power switch access.
- Battery compartment.
- Safe battery mounting without compression.
- Accessible mounting screws.
- Adequate RF clearance.
- FPC cable protection.
- No collisions with PCB components.
Generate:
- Complete enclosure assembly.
- PCB mounted inside the enclosure.
- Exploded assembly view.
- Top and bottom views.
- STEP exports where supported.
- Printable STL files.
## 19. Manufacturing deliverables
Generate and validate:
- Complete tscircuit source code.
- Circuit JSON.
- Schematics.
- PCB layouts.
- Gerber files.
- Drill files.
- Bill of materials.
- Pick-and-place files.
- Assembly drawings.
- PCB dimensions.
- 3D previews.
- STEP files where supported.
- Firmware binaries.
- Assembly instructions.
- Component placement documentation.
- Mechanical reference overlays.
- License and attribution documentation.
Distinguish automatically assembled SMT components from manually installed parts.
Validate the actual fabrication and assembly rules before ordering.
## 20. Validation checklist
- [ ] Both keyboard PCBs compile successfully.
- [ ] No unsupported tscircuit syntax.
- [ ] No preassembled controller modules.
- [ ] No preassembled Bluetooth modules.
- [ ] No preassembled display breakout boards.
- [ ] No external charging boards.
- [ ] All electronics integrated directly into the PCBs.
- [ ] External shape matches the selected Sofle reference.
- [ ] Key positions and rotations verified.
- [ ] Mounting holes verified.
- [ ] Individual component positions adjustable.
- [ ] All schematic connections correct.
- [ ] All expected nets routed.
- [ ] No unexpected shorts or open circuits.
- [ ] No conflicting GPIO assignments.
- [ ] All switch footprints correct.
- [ ] All switch orientations correct.
- [ ] Encoder pinouts verified.
- [ ] Display pinout and voltages verified.
- [ ] RF circuitry matches the selected Nordic reference.
- [ ] Antenna keepout validated.
- [ ] RF impedance calculated.
- [ ] USB charging circuit reviewed.
- [ ] Battery charging current validated.
- [ ] SWD programming interface available.
- [ ] PCB fabrication design-rule checks passed.
- [ ] JLCPCB assembly feasibility checked.
- [ ] Left and right firmware builds successful.
- [ ] Manufacturing files inspected.
- [ ] Top and bottom renders generated.
- [ ] 3D component collisions checked.
- [ ] Enclosure fit checked.
- [ ] Design published with source code.
Physical prototype testing:
- [ ] Every key works.
- [ ] Both rotary encoders work.
- [ ] Both displays work.
- [ ] Wireless communication between halves works.
- [ ] Bluetooth host connectivity works.
- [ ] Reconnection works reliably.
- [ ] USB charging works correctly.
- [ ] Battery monitoring works.
- [ ] Sleep and wake behavior works.
- [ ] Battery life measured.
- [ ] RF performance measured.
## 21. Execution instructions for the AI agent
1. Study the four open-source reference projects.
2. Select a specific Sofle Choc Wireless revision.
3. Extract exact mechanical dimensions and key coordinates.
4. Create the locked mechanical geometry in TypeScript.
5. Select and verify individual electronic components.
6. Design the integrated nRF52840 circuit.
7. Design the RF circuit and antenna layout.
8. Design the integrated charging and power circuitry.
9. Design the raw memory LCD interface.
10. Implement the switch matrix and rotary encoders.
11. Create both complete PCBs using tscircuit.
12. Optimize component placement without changing the external geometry.
13. Route the PCBs.
14. Resolve all electrical and manufacturing errors.
15. Generate visual snapshots and 3D previews.
16. Create matching custom ZMK firmware.
17. Validate manufacturing exports.
18. Design the enclosure.
19. Publish the complete project.
20. Document remaining issues and risks.
Do not stop after creating a requirements document or schematic.
Continue through implementation, routing, verification and manufacturing exports.
Do not use preassembled boards as a workaround for difficult PCB design.
Preserve the external keyboard shape while allowing maximum flexibility in internal component placement.
Never claim a validation step passed unless it was actually performed.
## 22. Current assumptions and unresolved decisions
- Sofle Choc Wireless is assumed to be the desired external shape.
- The exact reference PCB revision and dimensions still need to be extracted.
- The raw Sharp display's availability must be confirmed.
- The suggested charging IC and regulator are preliminary candidates.
- Exact component part numbers and footprints require verification.
- The RF layout and electrical schematic require engineering review.
- Battery size must be selected based on actual enclosure space.
- No physical prototype has been tested.
This document is an implementation brief, not a finished or manufacturing-validated PCB design.