ShiboSoftwareDev/magsafe-spin-counter

A 48 mm round, battery-powered MagSafe spin counter PCB featuring an nRF52840 BLE module, TMAG5273 magnetic sensor, 32.768 kHz crystal, 3 V coin cell, pushbutton, pull-ups, decoupling capacitors, and SWD test points.

Version
1.0.2
License
unset
Stars
0

Files

README.md

# MagSafe Spin Counter

A 48 mm, battery-powered BLE board for a 3D-printed MagSafe fidget spinner. A TMAG5273A2 three-axis Hall sensor sits at a 15 mm radius and detects the rotor magnet. An Ebyte E73-2G4M08S1C (nRF52840) counts passes and can report the total over Bluetooth Low Energy.

This is a passive MagSafe attachment: the MagSafe magnet ring and any steel flux plate belong in the printed housing, not on the PCB. The electronics run from a bottom-mounted CR1220 cell.

## Board specification

- 48 mm circular, 2-layer FR-4 PCB
- 1.2 mm finished thickness
- 5.5 mm central shaft/bearing clearance hole
- 0.15 mm minimum signal trace width
- 0.30 mm finished via drill and 0.45 mm via pad on every routed via
- Black solder mask and white silkscreen in the board preset
- Double-sided assembly; the battery holder is on the bottom
- Radio antenna keepout at the lower board edge

## Electronics

- `U1`: E73-2G4M08S1C raw nRF52840 BLE module
- `U2`: TMAG5273A2QDBVR, ±266 mT three-axis Hall sensor
- `Y1`: 32.768 kHz low-frequency crystal
- `BT1`: CR1220 holder
- `SW1`: reset button
- Five 1.5 mm pogo pads for GND, target voltage, SWDIO, SWDCLK, and RESET

Firmware pin map:

| Function | nRF52840 module pin |
|---|---|
| Hall I²C SCL | P0.26 |
| Hall I²C SDA | P0.06 |
| Hall interrupt | P0.08 |
| Reset | P0.18 |
| LF crystal | P0.00 / P0.01 |
| Debug | SWDIO / SWDCLK |

The left-edge programming pads are labelled `G V D C R` for GND, target voltage, SWDIO, SWDCLK, and RESET. The target-voltage pad is directly connected to the coin cell rail. Do not drive it from a programmer while a cell is installed; either use the target self-powered or remove the cell.

## Mechanical integration

- Put the rotating magnet over the `TMAG5273 r=15mm` sensor mark. With one rotor magnet, one detected pass equals one revolution; divide by the number of equally spaced rotor magnets otherwise.
- Keep the MagSafe ring, steel plate, and enclosure metal out of the marked radio-antenna keepout sector.
- The phone's MagSafe field will create a static Hall offset. Calibrate the field baseline after attachment, then count changes caused by the rotor magnet.
- Confirm the real magnet stackup and air gap in a printed prototype before freezing the enclosure. The Hall sensor range is intentionally the high-range A2 variant.

## JLCPCB assembly parts

Inventory was verified through live JLCPCB search on 2026-09-30. Stock is dynamic, so re-check before ordering.

| Refdes | Qty | Value / MPN | LCSC |
|---|---:|---|---|
| BT1 | 1 | XDCR-1220-006 | C7498147 |
| C1 | 1 | 47 uF, 1206 | C68361 |
| C2 | 1 | 4.7 uF, 0603 | C8032 |
| C3, C6 | 2 | CL05B104KO5NNNC, 100 nF | C1525 |
| U1 | 1 | E73-2G4M08S1C | C356849 |
| Y1 | 1 | X1A0000610002, 32.768 kHz | C55208 |
| C4, C5 | 2 | 0402CG120J500NT, 12 pF | C1547 |
| U2 | 1 | TMAG5273A2QDBVR | C3715882 |
| R1, R2 | 2 | 0402WGF4701TCE, 4.7 kΩ | C25900 |
| R3 | 1 | 0402WGF1002TCE, 10 kΩ | C25744 |
| SW1 | 1 | TS-1185-W-4P-H1.8-160 | C51927445 |

The test points, shaft hole, copper pours, and antenna keepout are PCB features and do not require BOM entries.

## Validation

- TypeScript typecheck: pass
- `tsci check netlist`: 0 errors, 0 warnings
- `tsci check schematic-placement`: pass
- `tsci check placement`: 0 errors, 0 warnings
- Online tsci parts/footprint build: pass
- Full routed circuit diagnostics: 0
- `tsci check shorts`: no shorts detected
- Routed vias inspected in circuit JSON: 27 vias, all 0.30 mm hole / 0.45 mm pad

The PCB hardware is fabrication-ready; application firmware and the 3D-printed housing are separate deliverables.