MustafaMulla29/wireless-mouse-pcb
This code defines a 3.3V low dropout voltage regulator chip (AP2112K-3.3TRG1) with five pins (VIN, GND, Enable, NC, VOUT) and its associated PCB footprint and 3D models for hardware implementation.
- Version
- 1.0.6
- License
- unset
- Stars
- 0
README.md
PCB
Schematic
# nRF52810 Bluetooth LE Wireless Mouse PCB
First-revision 2-layer wireless mouse PCB in tscircuit. The board is 70 mm × 44 mm and is organized into reusable schematic sheets and sections:
The schematic uses four default-size A4 sheets—power, wireless controller/RF/debug, optical sensor, and mouse inputs. No custom sheet dimensions are set.
- `WirelessControllerSection`
- `OpticalSensorSection`
- `MouseInputsSection`
- `UsbChargingSection`
- `BatteryPowerSection`
- `StatusAndDebugSection`
This repository contains the PCB design only. Bluetooth HID firmware is intentionally outside the tscircuit project.
The wireless controller is a bare `NRF52810-QFAA-R` SoC, not a radio module. Its support circuitry includes the Nordic internal-LDO decoupling network, a 32 MHz crystal, reset and SWD access, a discrete 2.4 GHz output/matching network, and a Johanson `2450AT18A100E` ceramic antenna. The remaining major parts are a PMW3360 optical sensor, EC10 wheel encoder, MCP73831 LiPo charger, USBLC6-2SC6 USB protection, AP2112K 3.3 V regulator, TLV70019DDCR 1.9 V sensor regulator, JST-PH connector for a protected LiPo pack, and charge/status indicators.
## Audit corrections — 4 September 2026
- Replaced the nominal 1.8 V sensor LDO with `TLV70019DDCR` (JLCPCB C2862411). Its 1.9 V nominal output and ±2% accuracy give margin above the sensor's 1.80 V minimum. Sensor VDD and the illumination branch use the `V1V9` net; VDDIO remains on `V3V3`.
- Moved the battery divider supply from `VBAT` to switched `VSYS`, avoiding a continuously powered ADC input when MCU power is off. The divider still measures half the battery voltage while the switch is on. Firmware must allow its 1 MΩ/1 MΩ/100 nF network to settle and select appropriate ADC acquisition timing.
- Replaced the side-push middle-click and DPI switches with top-push `EVQPLHA15` (JLCPCB C79172), using the untouched imported footprint. The imported footprint's duplicate contact pairs are pins 1–2 and 3–4; pins 5–6 are case ground. These are explicitly described with `internallyConnectedPins`. Wheel-carrier geometry must still accommodate the 1.5 mm-high actuator.
- Moved the RF shunt and matching parts closer to the MCU/antenna, widened RF connections to 0.2/0.3/0.5 mm, and enlarged the two-layer antenna keepout to 6.5 × 7.5 mm. The antenna T-network now follows Johanson's reference topology: `C_ANT_MATCH` is the 1 pF series input, `L_ANT_SHUNT` is the 2.7 nH branch to GND, and `L_ANT_MATCH_OUT` is the 3.9 nH series output toward the antenna. This corrects the previous mistaken series-inductor/shunt-capacitor arrangement using the same three parts and PCB pad locations. These are evaluation-board starting values, not measured values for this board; the trace widths are not a controlled-impedance sign-off.
Part references: [TI TLV700 datasheet](https://www.ti.com/lit/ds/symlink/tlv700.pdf), [Panasonic EVQPLHA15](https://industry.panasonic.com/ap/en/products/control/switch/light-touch/number/evqplha15), [Panasonic switch drawing supplied for C79172](https://datasheet.lcsc.com/datasheet/pdf/44b5dbe0240f4e9b8e618e1530aef0c5.pdf?productCode=C79172), and [Johanson antenna reference layout, page 3](https://www.johansontechnology.com/docs/3827/Antenna-2450AT18A0100001E-Rev4.0.pdf).
The debug indicator is one four-pin `WS2812B-V6` addressable RGB LED with an integrated IC (JLCPCB C52917433), imported with its exact EasyEDA footprint. It uses switched battery power (`VSYS`), one 330 Ω data resistor from `P0.25`, and one 100 nF bypass capacitor. DOUT is intentionally unconnected. No boost converter, level-shifting buffer, LED-enable GPIO, or separate LED-power sheet is used. `P0.26` is unused again. The separate charging LED is unchanged.
The V6 LED specifies a 3.3–5.3 V supply and a high-input threshold of 0.55 × VDD, allowing direct MCU data over the normal LiPo voltage range. Use low brightness for debugging and keep data low when idle. LED operation is not guaranteed below 3.3 V on `VSYS`; future firmware should turn the indicator off before that point (for example, at 3.4 V with suitable measurement margin). This deliberately simple circuit does not guarantee LED operation throughout deep battery discharge. No firmware is included here.
LED circuit reference: [Worldsemi WS2812B-V6 datasheet supplied for C52917433, pinout and electrical specifications on pages 2–3](https://datasheet.lcsc.com/datasheet/pdf/0689d8fd6dabfc7959e82552d4ffad8b.pdf?productCode=C52917433).
The project uses the `tscircuit` dependency only, without direct core/checks dependencies, package-manager overrides, or links to local libraries. No installed package source is edited and no checks are disabled.
## Mechanical and RF notes
- The antenna is at the rear-right board edge and has top/bottom copper, trace, component, and battery keepout space extending to the board edge.
- The RF component values are a reference-layout starting point. Tune and validate the antenna match on the assembled PCB in its final enclosure with the production stackup.
- The imported PMW3360 footprint keeps its original pad coordinates. The board adds PixArt's specified 8.60 mm × 17.26 mm through-board sensor/lens cutout for the LM19-LSI assembly.
- Three 2.4 mm non-plated mounting holes are provided for an M2-class chassis attachment.
- Preserve the PMW3360 reference stack: 7.40 mm from PCB top to tracking surface and 2.40 mm from lens flange to tracking surface.
- USB-C is charging-only; the nRF52810 sends mouse data over Bluetooth LE after BLE HID firmware is programmed through SWD.
- The design uses the nRF52810 calibrated LFRC instead of an external 32.768 kHz crystal. Firmware must configure/calibrate that clock source.
- Use a protected 1-cell LiPo pack with JST-PH polarity matching pin 1 = VBAT and pin 2 = GND.
- The MCP73831 charge current is approximately 250 mA. Turn the mouse off while charging because this straightforward revision does not include load-sharing/power-path management.
- Verify the enclosure, wheel axle, switch actuators, lens/baseplate, antenna clearance, and battery envelope before fabrication.
## Validation status
RF topology correction, checked on 4 September 2026:
- TypeScript and netlist checks pass (0 netlist errors/warnings). A focused check of the fresh compiled circuit confirms the 1 pF series input, 2.7 nH shunt to GND, and 3.9 nH series output to the antenna, with distinct RF nets and unchanged PCB pad locations. Component count remains 74.
- The controller/RF sheet has no schematic-placement findings; existing trace-simplification advisories remain on the power/sensor sheets. Inspected the fresh controller schematic and PCB placement preview.
- PCB placement reports only the unchanged sensor-over-cutout error, not an RF placement or courtyard error. This CLI installation still uses checks 0.0.178 and skips autorouting for that error. Its build returns exit code 0 despite reporting errors and generating 0 PCB traces, so this is **not** a verified routed build. No checks, footprints, dependencies, or router settings were overridden.
Simplified LED revision, checked on 4 September 2026:
- TypeScript check and netlist check pass; the netlist reports 0 errors and 0 warnings.
- Schematic placement has no LED symbol-padding or sheet-overflow issues; existing trace-simplification advisories remain in the power/sensor sections.
- PCB placement and the fresh build have **0 courtyard-overlap errors**, with one remaining sensor/cutout placement error.
- The installed `tscircuit` 0.0.2463 resolves to checks 0.0.178, which still rejects the sensor overlapping its own footprint cutout and skips routing. The separate boost-converter capacitor-length conflict no longer applies because that circuitry has been removed. No DRC or trace-length limits have been overridden.
- Routing-difficulty check completed; maximum predicted failure probability was 3.2% (preliminary, not a routing result).
- The current `dist/index/circuit.json` contains **0 PCB traces**. Current outputs are unrouted previews, not fabrication-ready exports. The earlier 155-trace result below is historical only.
Previous routed build, before the 5 V LED circuit, checked on 4 September 2026 (not validation of the new LED circuit):
- `npm run typecheck`: pass
- `tsci check netlist`: 0 errors, 0 warnings
- `tsci check placement`: 0 errors, 0 warnings
- `tsci check schematic-placement`: completed; retains WLED symbol-padding and trace-simplification advisories, not sheet overflow errors
- Schematic A4 overflow check: 0 warnings
- `tsci check routing-difficulty`: completed; highest predicted congestion failure is 4.3%
- `tsci build`: 155 routed traces, 0 jumpers, 0 autorouter failures
- Post-build PCB DRC: **0 errors**
- Re-ran placement and routing checks directly on the saved circuit JSON: 0 errors
- RF signal/matching routes: all top layer, 0 vias; individual segments 1.18–2.11 mm. Actual routed widths are 0.2 mm at the MCU match, 0.5 mm between matching networks, and 0.3 mm at the antenna match/feed.
- Inspected the PCB and all four schematic sheets. The build still reports non-blocking imported-symbol metadata and supplier-footprint comparison warnings; these were not disabled.
No manual PCB routes, forced vias, route hints, routing phases, or custom autorouter settings are used. Routing of the LED revision remains blocked as described above.
This is an unproven prototype design, not a manufacturing sign-off or a complete mechanical mouse. Complete fresh routing/DRC, reconcile the sensor's imported pin-row spacing against the mechanical drawing/actual part, and review fresh fabrication exports before ordering. A working unit also requires the LM19-LSI lens/baseplate, a matching protected LiPo pack, wheel and enclosure mechanics, assembled parts, SWD programming, BLE HID firmware, and prototype validation of RF range, antenna match, charging, battery life, and optical tracking.
## Commands
```sh
npm run typecheck
npx tsci check netlist
npx tsci check schematic-placement
npx tsci check placement
npx tsci check routing-difficulty
npx tsci build
npx tsci snapshot -u index.circuit.tsx
```
Nothing has been published, ordered, committed, or pushed.