astra/iphone-encoder-counter
A CR2450-powered MSP430 FRAM counter combines an always-on dual-channel TMR rotation sensor, pushbutton input, and ST25DV NFC tag with an integrated tuned printed antenna and I²C/GPIO interface.
- Version
- 1.0.3
- License
- unset
- Stars
- 0
README.md
# iPhone encoder counter — Rev C
One rectangular 60 × 100 mm PCB with an integrated upper NFC antenna, CR2450 holder, magnetic rotation sensor and independent push-button counter. Designed in tscircuit. **Two copper layers; every fitted component is on the top side.** The case retains the PCB; the rotor, magnet and mounting magnets are separate mechanical parts.
## Release status
**FABRICATION RELEASE HOLD:** antenna tuning in the final phone/case is unmeasured; U2 has zero JLC stock and U3 has only 3 units in the direct-page stock check. This is a prototype candidate, not a fully stocked or RF-qualified design. See ANTENNA.md and STOCK.md.
Prototype fabrication package: routed source, native Gerbers, JLC assembly BOM/placement, geometry/export checks and portable counting code. Digital checks pass. Hardware, RF coupling to the attached iPhone, battery life and mechanical fit have not been bench validated. This is not a tested production release.
The PCB is continuously battery powered. The phone requests a snapshot through NFC; it does not power continuous counting. A twist is one complete revolution in either direction; partial reversals cancel. The button increments a separate persistent total. Live retrieval requires an iPhone Core NFC application implementing the request/snapshot protocol.
## Files
- `index.circuit.tsx`, `imports/`: editable design and footprints.
- `fabrication/iphone-encoder-counter-jlc.zip`: finished fabrication package to review in JLC's preview.
- `fabrication/bom.csv`, `pick_and_place.csv`: top-side assembly data, 23 fitted parts.
- `pcb-preview.png`, `assembly.svg`, `dist/index/schematic.svg`: design previews.
- `DESIGN.md`, `FABRICATION.md`, `SOURCING.md`, `FIRMWARE.md`: electrical, assembly and implementation notes.
- `validation/`: reproducible geometry, export and finishing reports.
- `firmware/`: host-tested counting/debounce/FRAM journal logic. MCU peripheral firmware and iPhone app remain to be implemented.
**All 23 fitted PCB components have JLCPCB numbers, including U2 ADT002-10E (C17208043).** U2 is included in BOM, placement and stencil. Its direct JLC listing currently reports zero stock and does not confirm standard assembly acceptance; resolve sourcing/assembly with JLC before ordering. The battery is separate. Four-year battery life is a design target under the budget in DESIGN.md, not a measured guarantee.
## Rebuild
Use tscircuit CLI 0.0.2646. From this directory:
```sh
npm run build
npm test
tsci export index.circuit.tsx -f gerbers -o "$PWD/fabrication/iphone-encoder-counter-gerbers.zip"
python3 scripts/finish_fab.py
python3 scripts/check_geometry.py
python3 scripts/check_exports.py
```
Python checks require Shapely 2.x. Export the TSX directly so the native exporter performs supplier orientation analysis. The finishing script adjusts the top legend and removes paste on bare contacts and printed coil terminals; copper, mask, drill, BOM and placement remain byte-identical to the native export. Re-run the checks after every layout change.