# LapCounter prototype design and build specification

## 01 / What we are building
The customer hypothesis is a runner who loses track during a repetitive track workout, and a coach who wants that runner to finish the intended number of laps without repeated mental counting. The reference image also names military, emergency-service academies, schools and gyms. Those are potential customers, not validated buyers.

The first job is to set a target, start at a known beacon, complete circuits on a designated lane, receive one vibration for each accepted return, and see a clear completion state. All essential actions happen on the wearable. No account, phone, subscription, mobile network or backend is required.

### Baseline assumptions
- One wearable and one portable beacon, used by one runner on an outdoor 400m loop in one designated lane. A second lane is an experiment, not promised coverage.
- U.S. prototype procurement, prices in USD, estimated 9% sales tax. This is a planning estimate, not a purchase order or fixed contractor bid.
- The user has supplied an illustration, not existing engineering files. Workspace and active-task inspection found no relevant LapCounter implementation or attached worktree to reuse. Work stays in its own new project directory.
- The pending use-case question has no answer at authoring time. This scope is a stated default, not a confirmed customer requirement. Group operation and all-lane coverage are addressed as separate designs and costs.

### Observable done criteria for the physical proof of concept
A new user can configure an eight-lap run in under two minutes, start without counting the initial presence as lap one, run eight circuits, feel eight distinct alerts, and finish at 8/8. A separate observer records every crossing and compares the device log. Duplicate counts, misses and manual corrections are reported individually. A passing simulation alone does not satisfy this physical outcome.

## 02 / Design decisions and delivery boundaries
The design retains the image's separate beacon, green light bar, square wearable, replaceable strap, large lap count and vibration feedback. The first real wearable will be larger than the illustration because it uses purchasable development boards. Shrinking it is a separate iteration.

| Decision | Selected baseline |
| --- | --- |
| Radio | Bluetooth LE advertisements; RSSI is a proximity signal, never a precise distance or line detector |
| Wearable | XIAO nRF52840 Sense, memory LCD, haptic driver, battery gauge and protected LiPo |
| Beacon | XIAO nRF52840, LED bar, USB power bank and portable tripod |
| Display | 1.3-inch reflective monochrome LCD, black on gray, chosen for outdoor readability |
| Controls | Two physical buttons; no touch screen |
| Session | Target laps, count, elapsed time, event log and manual review |
| Data | Local session log; USB CSV export in commissioned firmware |
| Enclosure | Printed shell with removable back; splash resistance is a test goal, no IP claim |

### What is delivered in this package
Detailed requirements, a prototype wiring schedule, radio format, detection logic, screen and interaction design, mechanical envelopes, enclosure concept source, sourced parts budget, engineering estimate, assembly sequence, acceptance plan, interactive review demo and executable lap-state reference with checks.

### What needs physical engineering work
This package is not a fabrication release. It does not include a routed PCB, Gerbers, production STEP assembly, flashed embedded firmware, confirmed enclosure fit, field measurements or certification. These are explicitly priced future deliverables. The supplied CAD is an envelope concept; it must be adapted to measured hardware before printing a functional case. Nothing has been purchased or manufactured.

## 03 / What a beacon can and cannot prove
Bluetooth RSSI varies with body position, wrist swing, antenna orientation, the ground and nearby objects. A single signal-strength threshold can trigger while a runner is still approaching, miss a covered wrist, or fire repeatedly while someone waits near the beacon. Nordic describes this class of signal measurement as proximity sensing and distinguishes it from more precise ranging [S08].

The selected proof of concept therefore counts a qualified return to a calibrated beacon zone. It requires an initial departure, a minimum lap interval, repeated near packets and a new departure before another count. These rules reduce duplicates. They do not establish that the runner traveled the full loop. Someone can walk away, wait and return. A single beacon also cannot resolve crossing direction.

### How we present this honestly
The physical prototype screen and quick-start instructions say "Training prototype. Use the marked lane." The log calls an accepted event `auto_lap` and retains the qualifying samples. Approximate split times are for workout feedback. The product must not advertise finish-line accuracy, anti-cheating, official PT-test results, all-lane coverage or guaranteed missed-lap recovery on this baseline.

### Alternatives with material tradeoffs
- UWB measures time of flight and is a stronger ranging candidate. One anchor still defines a radius, not a finish-line plane or full circuit. The outdoor use classification must be checked for the actual product; 47 CFR 15.519 includes restrictions on fixed infrastructure [S09]. A portable tripod is not automatically an exemption.
- A two-anchor UWB gate can infer a directed crossing of a defined line segment using calibrated geometry and tracking. Body obstruction, height, geometry, scheduling and permitted outdoor use remain design work.
- For certified timing or large groups, evaluate an existing RFID/transponder timing system and a separate wrist feedback link. That is a different system architecture, not a minor firmware switch.

## 04 / System architecture and interfaces
The beacon repeatedly broadcasts its identity, power state, boot marker and sequence number. Each wearable scans independently and makes its own counting decision. The beacon does not maintain a roster. This avoids adding connection capacity limits to the one-runner prototype, but does not establish a tested group capacity.

### Wearable blocks
Protected 1S battery -> service switch -> XIAO battery input and onboard regulation -> 3.3V logic. The fuel gauge measures the unswitched protected battery voltage, with its I2C connections managed to avoid back-powering. The display uses a dedicated three-wire serial interface. The haptic driver uses I2C and drives the motor across its two output terminals. Buttons connect GPIO to ground. USB-C provides programming and charging while the unit is off the wrist.

### Beacon blocks
USB power bank -> USB-C on XIAO -> regulated 3.3V. A GPIO switches a transistor that sinks the two LED currents. A separate button enters a brief enrollment window. The enclosure is elevated on a stable weighted tripod outside the running lane.

### Firmware modules
`radio_rx` validates and timestamps advertisements; `lap_engine` accepts or rejects events; `ui` draws the current state; `buttons` debounces actions; `haptics` queues nonblocking patterns; `power` reads the gauge; `journal` commits records; `usb_export` exports a stable CSV snapshot. The beacon has `advertiser`, `pair_window`, `status_led` and `watchdog` modules.

All event timestamps use a monotonic clock. No wall-clock synchronization is required to count laps. A boot ID plus local sequence numbers separates events across resets. Flash operations and vibration effects must never block radio processing.

## 05 / Wearable electrical build schedule
Use Seeed XIAO nRF52840 Sense SKU 102010469, not a similarly named Plus or nRF54 board without rechecking its pin map. Use physical `D` labels in the harness and the named GPIO definitions in firmware; Arduino integer aliases differ between board packages. The assignments below follow Seeed's pin map [S02].

| Net | XIAO label | Destination | Electrical rule |
| --- | --- | --- | --- |
| LCD clock | D8 / P1.13 | LCD CLK | 3.3V serial, start at 1MHz |
| LCD data | D10 / P1.15 | LCD DI | Output only |
| LCD select | D3 / P0.29 | LCD CS | Use driver-defined active polarity |
| I2C data | D4 / P0.04 | DRV2605L SDA; MAX17048 SDA | 100kHz initial bus rate |
| I2C clock | D5 / P0.05 | DRV2605L SCL; MAX17048 SCL | Verify effective parallel pull-ups |
| Start/pause | D0 / P0.02 | Button A to GND | Input pull-up; active low |
| Select/back | D1 / P0.03 | Button B to GND | Input pull-up; active low |
| Peripheral power | 3V3 | LCD VIN; haptic VIN | Never apply LiPo directly to GPIO |
| Return | GND | All logic grounds; battery negative | Common return; short motor loop |
| Battery input | BAT+ / BAT- pads | Protected cell via service switch | Verify polarity before soldering |

Haptic breakout address is 0x5A; MAX17048 uses 0x36. Confirm those addresses on the assembled bus. The fuel-gauge JST power path senses the battery and is not a charger or a protection circuit. Connect its BAT/GND to the protected cell and route its output to the XIAO battery pads through the service switch. Prevent I2C back-powering in the service-off condition by unplugging the battery during servicing or disconnecting the gauge bus with the service harness.

Motor red/blue leads terminate at DRV2605L OUT+/OUT-. Do not connect a motor terminal to MCU GPIO. Add 100uF low-ESR bulk capacitance near the haptic supply, plus 100nF at the carrier supply entry. Check droop during a motor start. Target less than 100mV transient at MCU 3.3V and no reset; add a separate regulated motor rail if that fails.

## 06 / Beacon electrical build schedule
Use the standard XIAO nRF52840 SKU 102010448. Sense is an acceptable spare substitution if firmware and current are rechecked. USB power is the default. A 5000mAh-class power bank is an allowance, not a selected tested model; its low-current auto-shutoff behavior must be checked before ordering the remaining mechanical parts.

| Net | Connection |
| --- | --- |
| Input power | Power-bank 5V USB output to XIAO USB-C; never to 3V3 |
| LED control | D2 to 100-ohm series gate resistor to AO3400A gate |
| Default off | 100k-ohm gate-to-ground resistor |
| LED sink | AO3400A source to ground; drain to two parallel LED branches |
| LED branches | Each branch has its own green LED and 150-ohm resistor from 3V3 |
| Pair/setup | D0 to normally open button to ground; pull-up enabled |
| Debug | USB serial console; bootloader via onboard reset |

For a nominal 2.1V green LED at 3.3V, a 150-ohm resistor gives roughly 8mA per branch. Actual LED forward voltage and visibility must be measured. Use a frosted 45 x 5mm light pipe to join the two points visually. No exposed high-brightness LED should face the runner directly at close range.

### Beacon behavior
Holding setup for three seconds opens a 60-second enrollment window. Solid green means powered and advertising; a brief off pulse once per second during enrollment distinguishes pairing without needing a second color. The light indicates transmitter status, not proof a wearable counted a lap. Fast flashing indicates a firmware fault. A service switch powers down the entire USB path.

Firmware must detect a watchdog reset, generate a new boot nonce and advertise it. A wearable already in a session then enters review instead of silently treating the restart as uninterrupted operation. A power-bank fuel indicator provides the prototype beacon's battery status; exact percentage is not transmitted until a battery telemetry circuit is added.

## 07 / Power, charging and battery requirements
The wearable uses a protected 500mAh 1S LiPo. The selected Adafruit listing gives a 29 x 36 x 4.75mm cell envelope and 10.5g mass [S06]. Protection in the cell pack is a procurement requirement. Verify the supplied pack documentation, connector polarity and charge limits on receipt; never rely solely on connector shape.

The XIAO onboard charger is used for the bench prototype, initially at its approximately 50mA setting. Confirm the actual board revision and register behavior before enabling charging. Seeed's documentation describes both 50mA and 100mA settings [S02]. The first estimate is 12-14 hours to charge 500mAh at 50mA including taper. This is a calculation, not measured charge time. Disable session start when USB is connected. Charge off the wrist and stop the run before connecting a cable.

### Runtime estimate
Budget average wearable current at 12mA for active BLE scanning, MCU work, sensor access and support circuits. Allow another 0.5mA for display/board overhead and 0.2mA averaged haptics. These are engineering assumptions that must be replaced by current measurements. Using 70% usable capacity gives 350 / 12.7 = 27.6 hours on paper. The initial acceptance target is a measured eight-hour run with at least 20% indicated charge remaining, leaving room for implementation losses and gauge error.

Scanning duty is a reliability choice. Start with continuous scanning during an active run and reduce duty only after measured crossing performance remains acceptable. Idle and off-state current must be measured separately. The gauge percentage is advisory; low voltage overrides percentage.

Warn at 20% and once at 10%. At 5% or repeated loaded voltage below 3.45V, save and show "Battery low. Review run." Tune thresholds against the chosen cell. The firmware must keep a reserve for journal writes and avoid an endless reboot loop. P1 needs a charger with temperature monitoring and proper power-path handling, not a blind copy of the bench arrangement.

## 08 / Radio protocol and enrollment
Use Bluetooth LE legacy nonconnectable advertisements with a custom 128-bit service UUID `2b095d8e-2d70-4a6a-9497-63cdb3fd2001`. Put the payload in Service Data AD type 0x21. Do not use an unassigned Bluetooth company identifier. Flags consume 3 bytes; service-data overhead plus UUID consume 18 bytes, leaving 10 bytes for the application. Total 31 bytes.

| Payload byte | Meaning |
| --- | --- |
| 0 | Protocol version, 0x01 |
| 1-2 | Beacon ID, uint16 little endian |
| 3-4 | Random boot nonce, uint16 little endian |
| 5-6 | Advertisement sequence, uint16 little endian |
| 7 | Battery 0-100; 255 means external/unknown |
| 8 | Flags: bit0 enrollment; bit1 fault; remaining reserved zero |
| 9 | Signed int8 transmit setting in dBm, for diagnostic use |

Initial interval is 50ms plus the BLE stack's advertising random delay. Start transmit power at -12dBm and tune for the actual setup. Do not convert RSSI into a claimed meter value. Scan on all three primary advertising channels; retain raw RSSI and local packet times. Deduplicate repeated observations of the same sequence across channels. On wrap, use modular sequence comparisons and a short observation cache.

Enrollment requires both the beacon's enrollment flag and a deliberate wearable confirmation while the devices are adjacent. The wearable stores its selected beacon ID and a user-facing short label. Refuse ambiguous enrollment when more than one eligible beacon is strong. No connection is needed while running. Ignore other beacon IDs. The prototype does not authenticate radio packets, so it is not tamper resistant. A production version needs authenticated provisioning and replay protection; a beacon ID and boot nonce alone do not provide security.

## 09 / Detection algorithm
The supplied executable model implements the counting rules below using simulated packets. Firmware must pass the same traces and add the real radio driver, sequence-wrap handling, storage and watchdog behavior. The browser demo uses accelerated synthetic time and cannot establish radio reliability.

### Initial parameters
Near threshold -60dBm, far threshold -76dBm, minimum lap 45 seconds, three distinct near packets within 400ms, and at least two seconds of fresh weak packets to establish departure. Adjacent weak packets must be no more than 250ms apart. These are initial tuning values, not measured thresholds. Configure minimum lap from 10 to 600 seconds. For unusually fast 400m running, lower the default deliberately. Do not apply a 400m profile to a shorter loop.

### State transitions
READY -> WAIT_EXIT on deliberate start. Count remains zero even if the runner starts beside the beacon. WAIT_EXIT -> RUNNING after a qualified weak-packet departure. RUNNING -> WAIT_EXIT after a qualified near return, provided the minimum interval since start or last accepted event has elapsed. Increment once and vibrate. The target event changes the state to COMPLETE and stops further automatic counting.

The near packet counter resets on a non-near packet. Far qualification resets on a gap or non-far packet. Silence, by itself, never establishes departure: a dead beacon is not evidence the runner left. The near condition may first occur before the painted line. This is a fundamental limit of the chosen geometry, not a UI defect.

### Pause and restart
Pause freezes automatic events and clears candidates. Resume excludes paused time from lap-interval calculations and requires a fresh departure. A changed beacon boot nonce enters REVIEW. A wearable reboot loads its last valid journal record into REVIEW, never straight into an active run. The user must confirm the count, move through the start zone and resume deliberately.

## 10 / Setup and first-use flow
1. Charge the wearable off the wrist, unplug it, fit the strap and power on. The first screen identifies the unit as a training prototype.
2. Place the beacon outside the lane at wrist height, about 0.8-1.0m, using a stable tripod. Start with 1m lateral clearance from the designated path and enough setback that a falling stand cannot enter the lane. Follow venue rules and adjust for the stand's actual dimensions.
3. Hold the beacon setup button for three seconds. On the wearable choose "Find beacon," stand next to it and confirm its displayed ID. A single short vibration confirms enrollment.
4. Select track profile, target 1-99 laps and minimum lap interval. Default eight laps, 400m training, 45 seconds. Changing profile invalidates the previous calibration.
5. Perform a calibration walk through the start zone, then outward along the intended lane and back. Record near and far packet distributions and the exact beacon location. Test the wrist on both sides of the body. The physical firmware setup must refuse "Ready" if no stable separation can be found.
6. Perform three observed test passes at the intended running pace. If any is missed or doubled, adjust placement or thresholds and repeat those passes. This quick setup check does not replace the formal acceptance test.
7. Return to the start zone. Press A to start a three-second countdown. At zero, elapsed time starts, count shows 0/8 and text says "Leave start zone." The first presence is not a lap.

The screen must explain failed setup concretely: "No beacon," "Two beacons found," "Move closer," or "Calibration unclear. Reposition beacon." A generic green check is insufficient evidence of calibrated lap detection. No payment or account step appears in setup.

## 11 / Wearable screen and interaction design
The physical display is 168 x 144 monochrome pixels. Layout coordinates below are proposals for the selected display orientation. Use black foreground, light background and a plain sans-serif bitmap font. Keep at least six pixels of clear margin. Do not depend on color or animated radio waves to convey state.

| Screen | Content and placement |
| --- | --- |
| Ready | Top 18px status; target at y=38; "8 laps" at 28px; "A Start / B Setup" at y=117 |
| Countdown | Large 3, 2, 1 centered; target in footer; A cancels |
| Active | Count `3 / 8` in 36px at y=45; `LAPS DONE` at y=24; elapsed 16px at y=94; state at y=122 |
| Accepted lap | Same count, 300ms inverted frame; haptic and last split; no full-screen animation |
| Paused | `PAUSED` at y=24; count at y=52; `A Resume`; B opens review |
| Complete | `8 / 8`, check mark and `COMPLETE`; elapsed; `A Results / B Done` |
| Review | Existing count, reason, explicit +/- correction workflow, confirm before resume |
| Results | Laps, elapsed, automatic/manual event counts; USB export instructions |

The top strip includes a battery icon plus readable percentage when known. Radio status means "seen at setup" or "nearby packet received," never continuous coverage around the whole track. Out of radio range during the middle of a lap is normal. The footer uses "Away from beacon" rather than a persistent alarming disconnect symbol.

Button A is the forward/start/pause action. Button B is select/back. Both use 30ms debounce and one action per release. A two-second hold requests end-run confirmation; B cancels and A confirms. No short press resets a run. During active running, manual adjustment requires pause and entry into review.

## 12 / Haptics, accessibility and recovery
Use the DRV2605L with the selected ERM motor, configured to that actuator rather than an LRA preset [S04, S05]. Calibrate the drive and cap rated output at the motor's supported voltage. Use nonblocking effects or real-time mode so the radio task continues receiving packets.

| Event | Proposed pattern |
| --- | --- |
| Start | Two 100ms pulses, 120ms gap |
| Accepted lap | One 180ms pulse |
| Final lap | Three 250ms pulses, 150ms gaps; replaces the ordinary lap pulse |
| Pause | Two 70ms pulses, 100ms gap |
| Review required | 400ms pulse then 100ms pulse, separated by 150ms |
| Low battery | Two 250ms pulses, once per threshold crossing |

Patterns are initial human-factors settings. Verify that runners notice them while moving and can distinguish normal and final laps. The screen must always present the same event in text. No beeper is required. Offer normal and strong vibration profiles only after measuring current and comfort. An optional reduced-vibration setting still retains final and review signals.

### Failure handling
- Beacon not found before start: block start and show placement/enrollment steps.
- Missing packets mid-lap: show neutral away state. No estimate of missed laps.
- Suspected missed lap: runner pauses, chooses "Review count," selects +1/-1, confirms, and resumes after leaving the zone. Journal the correction separately.
- Beacon restart or wearable restart: freeze automatic counting in review. Preserve the last confirmed count.
- Display or I2C fault at boot: block a new run and show an error over USB if available. During a run, preserve the log and signal review if haptics still work.
- Battery critically low: commit state, stop new detections and show review. Never silently mark the run complete.

## 13 / Data, storage and USB output
Use a bounded event journal on the XIAO's available nonvolatile storage after confirming the board package's flash layout. Reserve 64KiB for a double-buffered journal in the firmware design. A 64-byte record budget supports roughly 1,000 records before metadata and spare capacity. Limit the first implementation to 200 events per session, including corrections and faults, and retain the last five sessions only if the actual compiled flash layout permits it. Warn before erasing old sessions.

### Record fields
Schema version, device ID, session ID, monotonically increasing event ID, event type, local uptime_ms, active_elapsed_ms, count_after_event, target_laps, beacon_id, beacon_boot_nonce, recent RSSI summary, battery_mv, flags and CRC32. Config records also store minimum lap, near/far thresholds, firmware build ID, profile and calibration ID. Log raw calibration packets separately with bounded capacity.

Write the new record, verify CRC and commit its valid marker before changing the visible count and issuing the alert. On power loss, recover the most recent complete record. A record that was committed but whose vibration was interrupted remains counted; review explains this ambiguity. A watchdog reset never invents an event. Test the commit sequence by interrupting power around each write stage.

### CSV export contract
Header: `session_id,event_id,event_type,active_elapsed_ms,count,target,beacon_id,rssi_dbm,battery_mv,manual_delta,firmware,calibration_id`. Add a separate metadata row or file for schema and profile. Use UTF-8, comma separators and CRLF or LF consistently. No names, medical data or location history are needed.

The commissioned P0 firmware exports via a USB serial command `EXPORT <session_id>`, with `BEGIN`, header, rows, then `END <record_count> <crc32>`. A small desktop script saves the CSV and verifies the footer. This feature is specified and priced; it is not implemented in the supplied browser demo. The demo exports its own simulated JSON review trace and clearly labels it simulated.

## 14 / Wearable mechanical design
The first enclosure is a provisional 58 x 58 x 26mm body, excluding strap lugs and button protrusions. Use a 24mm hook-and-loop strap for this heavy development prototype. Target mass is under 90g assembled, subject to actual weighing. The concept image's smaller, smoother watch is the P1 design target, not a P0 size claim.

### Stack and placement
Front to back: 1mm clear polycarbonate lens; adhesive light/splash seal; 40 x 39 x 4.6mm display breakout envelope; insulated carrier and flexible wires; XIAO plus haptic and gauge breakouts distributed around the carrier; 500mAh cell in its own padded rear pocket; 2mm back shell. Keep at least 1mm free space around the battery plus routing slack, and prevent screws, inserts or board edges from touching the cell. Do not clamp the cell between boards.

Place the XIAO antenna at the upper case edge, with no metal lens coating, screw, motor, battery or ground plane immediately in its radiating region. Follow the board manufacturer's antenna keepout during detailed layout. The concept drawing intentionally does not claim completed RF clearance analysis. The motor mounts against a stiff back-shell patch so vibration reaches the wrist without pressure on the battery.

### Shell and hardware
PA12 nylon is preferred for outsourced prints; PETG is acceptable for fit checks. Nominal walls 2mm, corner radius 7mm, four M2 fasteners into appropriate inserts, soft rear pad and captive strain relief for leads. Use a 27 x 24mm clear display opening and a 33 x 30mm lens allowance, then match the actual LCD active area before cutting. Two side buttons need distinct positions and positive travel through separate pushers. A covered USB-C opening is a prototype convenience, not a waterproof connector.

The supplied OpenSCAD file is an editable envelope with a lens opening, back, holes and strap slots. Board mounts, gasket grooves, exact USB position and button actuators await actual part measurement. Do not send it directly for production manufacturing.

## 15 / Beacon mechanical and placement design
The beacon housing target is 85mm wide x 105mm high x 40mm deep, excluding its stand. Mount its radio board above the power bank rather than behind it. The chosen power bank must fit the measured internal envelope; if it does not, enlarge the housing before ordering the print. Prototype CAD shows the electronics envelope, not a verified power-bank model.

Use a matte charcoal shell, a green horizontal diffused light bar near the top, a simple radio emblem, a recessed setup button on the rear and an accessible USB power-bank charge connection. Separate the light pipe from the antenna. Use a replaceable printed or rubber foot and a 1/4-20 insert for a mini tripod. The baseline has no high-power external antenna or additional RF amplifier.

### Placement procedure
Keep the stand entirely outside the running lane and the runner's arm swing. Elevate the beacon to wrist height for the first tests. Mark its exact position, antenna orientation, height and runner path. A ground-level placement matching the illustration is a separate validation configuration because track reflections and body shadowing may change reception.

The stand needs a broad base, secured ballast and rounded surfaces. Perform a tip test with the chosen stand at the intended height and surface. Move it farther from the lane if a tip can enter the path, then recalibrate. Do not stretch a charging lead across a track. A portable power bank avoids this cable problem during use.

### Environmental intent
The printed housing aims to resist incidental sweat and a brief light splash. It has no certified ingress rating. Conduct wet testing with an isolated low-energy dummy or protected electronics setup before exposing the assembled battery device. The first field trial is dry weather. Operating target is 0-40C for the full assembly, constrained by the selected battery and enclosure. Storage and charging limits follow component documentation. Outdoor sunlight heat is a measured test condition, not inferred from the MCU temperature rating.

## 16 / Compact P1 product direction
P1 converts the validated behavior into a smaller wrist device. Its industrial-design target is 46 x 50 x 17mm excluding lugs, a 22mm replaceable silicone strap and less than 55g total mass. These are packaging targets. They may change after PCB routing, display sourcing, antenna clearance and battery fit.

Use a custom carrier with a certified BLE module or the XIAO module if its form and radio integration remain suitable. Reuse the validated radio protocol and counting engine. Integrate the DRV2605L, MAX17048 and passives directly. Select a bare reflective LCD with a frozen supplier drawing and connector before final enclosure CAD. The prototype breakout's 40 x 39mm board should not be assumed to fit an attractive 46mm case with all other parts.

### Electrical and mechanical requirements for P1
Power architecture: protected 1S cell, USB-C sink CC resistors and input protection, a temperature-monitored power-path charger such as TI BQ24074, and a regulator selected for measured peak load. BQ24074 and TPS63031 are candidate parts, not a released circuit [S12, S13]. Final charge current, NTC network, thermal layout, inductor, capacitors and USB ESD circuit need calculations and schematic review. Do not use bare LiPo voltage as a 3.3V rail.

The final CAD needs gasket compression analysis, switch sealing, USB cover design, battery restraint, strap retention, serviceability and production tolerances. Assign every fastener, adhesive, seal and cable an actual drawing or part number. A four-layer PCB with antenna keepout is the default estimate; verify whether a simpler board meets RF and routing needs.

P1 output should include native schematics/layout, checked fabrication files, editable mechanical CAD, assembly drawings, firmware source and binaries, calibration instructions, test records and revision history. This package specifies those outputs and budgets their creation. It does not claim that they have been completed.

## 17 / Assembly, bring-up and first field build
1. Receive and inspect exact board revisions, battery documentation and connector polarity. Record serial numbers and photograph labels. Keep the cell disconnected while soldering.
2. Program each bare XIAO over USB and verify a unique device/beacon ID. Freeze toolchain and library versions in the build log. Firmware has not been compiled or flashed in this design exercise.
3. Build the wearable harness on an insulated carrier. Verify no battery-to-ground short, 3.3V rail polarity and common grounds. Power first from a current-limited bench supply or verified USB setup with the cell removed.
4. Bring up the LCD with its manufacturer driver, correct orientation and periodic VCOM inversion. A reflective memory LCD requires this maintenance even when the visible frame does not change. Confirm I2C addresses 0x5A and 0x36 and both buttons independently.
5. Connect the motor through the driver. Set its rated voltage and run short patterns. Measure supply transients, current and case vibration. Do not tune by simply applying the full battery voltage.
6. Add the battery through the proper connector and service switch. Test charge current and loaded low-battery behavior off the wrist. Resolve any thermal or power-loss defect before enclosure assembly.
7. Build the beacon LED circuit. Confirm advertising with a second receiver and verify power-bank operation at the real current draw for at least two hours. A shutdown-prone bank is a failed part choice.
8. Adapt enclosure CAD to measured boards, ports, leads and fasteners. Print a fit shell, dry assemble, inspect battery clearance and strap retention, then perform a bench session through completion.
9. Calibrate on the actual track. Perform observed short passes, then full laps and the formal matrix. Save firmware/configuration hashes, raw traces, observer ground truth and photos.

A successful bench assembly does not validate lane coverage, outdoor display readability or all-day comfort. Each has a separate field check in the next section.

## 18 / Verification matrix and release evidence
These are required acceptance tests for the commissioned physical P0. No physical result is asserted in this package. The evidence record supplied with this handoff separates model checks, browser review and unperformed hardware tests.

| Test | Sample and passing rule |
| --- | --- |
| First-use setup | 3 new users; each starts an eight-lap session in under 2 minutes after charge, with written setup instructions |
| Full circuits | 3 runners x 20 laps in the designated lane, varied pace/wrist; zero misses and zero duplicates in this 60-lap demonstration |
| Faster passes | 40 supervised line passes at 2-8m/s, both wrists; tune parameters, log every miss and duplicate separately |
| Nearby waiting | 10 minutes stationary plus 50 movements inside the near zone; zero automatic events without qualified departure |
| Premature return | 20 exits and returns below minimum lap interval; zero events |
| Wrong beacon | 20 passes with unrelated ID nearby; no wrong-ID event |
| Restart and low power | 10 wearable interruptions; 10 beacon restarts; no invented event and review shown |
| Daylight / haptics | 3 users read count at arm's length outdoors and identify final-lap vibration while jogging |
| Runtime | One eight-hour active run at recorded temperature and settings; >=20% indicated battery remains; compare gauge to charge measurement |
| Assembly | No battery pinch or short; 24mm strap survives a documented 50N pull for 10 seconds on a fixture, not a wrist |

Zero failures in 60 laps is a prototype observation, not proof of a 99.9% reliable product. With zero failures in roughly 3,000 independent representative crossings, the simple rule-of-three upper failure bound is about 0.1% at 95% confidence. Real crossings are correlated; weather, bodies, lanes and configurations must be sampled separately.

Record time offset from the observer's painted-line crossing as an error distribution. No time-accuracy claim is set for RSSI counting. If an official crossing timestamp or fraud prevention is a requirement, stop this architecture's promotion and validate a directional gate or existing timing platform.

## 19 / Parts and consumables budget
Published prices were checked on 17 October 2026. The core electronics have exact products and source URLs in `bill-of-materials.csv`. Mechanical parts, tools and passive bundles are explicit allowances pending actual procurement. No bulk discount, promotional coupon or free labor is assumed. A bill of materials is not a guarantee of stock or checkout price.

| Assembly | Part | Qty | Unit | Extended | Price basis |
| --- | --- | --- | --- | --- | --- |
| Wearable | Seeed XIAO nRF52840 Sense, SKU 102010469 | 1 | $15.90 | $15.90 | Published price |
| Wearable | Adafruit SHARP memory LCD breakout 3502 | 1 | $24.95 | $24.95 | Published price |
| Wearable | Adafruit DRV2605L haptic breakout 2305 | 1 | $7.95 | $7.95 | Published price |
| Wearable | Adafruit ERM disc motor 1201 | 1 | $1.95 | $1.95 | Published price |
| Wearable | Adafruit protected 500mAh LiPo 1578 | 1 | $7.95 | $7.95 | Published price |
| Wearable | Adafruit MAX17048 battery gauge breakout 5580 | 1 | $5.95 | $5.95 | Published price |
| Wearable | Momentary buttons | 2 | $0.75 | $1.50 | Allowance |
| Wearable | Battery service switch | 1 | $1.00 | $1.00 | Allowance |
| Wearable | Perfboard and insulated carrier | 1 | $5.00 | $5.00 | Allowance |
| Wearable | JST leads and wiring | 1 | $5.00 | $5.00 | Allowance |
| Wearable | Capacitors and resistors | 1 | $3.00 | $3.00 | Allowance |
| Wearable | Clear polycarbonate lens | 1 | $4.00 | $4.00 | Allowance |
| Wearable | Printed case and back | 1 | $18.00 | $18.00 | Allowance |
| Wearable | 24mm hook-and-loop strap | 1 | $8.00 | $8.00 | Allowance |
| Wearable | Gasket material | 1 | $3.00 | $3.00 | Allowance |
| Wearable | Screws and inserts | 1 | $3.00 | $3.00 | Allowance |
| Wearable | Foam and insulating tape | 1 | $2.00 | $2.00 | Allowance |
| Beacon | Seeed XIAO nRF52840, SKU 102010448 | 1 | $9.90 | $9.90 | Published price |
| Beacon | USB power bank, 5000mAh class | 1 | $20.00 | $20.00 | Allowance |
| Beacon | Green LED pair and diffuser | 1 | $5.00 | $5.00 | Allowance |
| Beacon | LED driver transistor and passives | 1 | $1.00 | $1.00 | Allowance |
| Beacon | Pair/setup button | 1 | $0.75 | $0.75 | Allowance |
| Beacon | Printed beacon shell | 1 | $22.00 | $22.00 | Allowance |
| Beacon | Mini tripod with 1/4-20 mount | 1 | $18.00 | $18.00 | Allowance |
| Beacon | USB-C cable | 1 | $4.00 | $4.00 | Allowance |
| Beacon | Fasteners | 1 | $3.00 | $3.00 | Allowance |
| Beacon | Base ballast | 1 | $8.00 | $8.00 | Allowance |
| Beacon | Perfboard and wiring | 1 | $5.00 | $5.00 | Allowance |
| Beacon | Power switch | 1 | $1.00 | $1.00 | Allowance |
| Shared | One spare XIAO Sense and spare small parts | 1 | $35.00 | $35.00 | Allowance |
| Tools | Temperature-controlled soldering iron | 1 | $60.00 | $60.00 | Allowance |
| Tools | Multimeter | 1 | $25.00 | $25.00 | Allowance |
| Tools | Solder, flux and heat shrink | 1 | $15.00 | $15.00 | Allowance |

The watch uses one battery; the beacon uses one USB power bank. A spare board is included once as a shared reserve part. Tool purchases are included even if the builder already owns them. If a bench supply, oscilloscope or current profiler must be purchased, add their actual cost; the commissioned labor estimate assumes the contractor already has normal lab equipment.

## 20 / The total cost
### Cash to build the first physical kit yourself
| Cost item | Amount |
| --- | --- |
| Parts, enclosure allowances, spares and basic tools | $350.80 |
| Shipping allowance | $35.00 |
| Tax allowance, 9% on hardware plus shipping | $34.72 |
| Procurement subtotal | $420.52 |
| DIY cash contingency, 25% | $105.13 |
| Total DIY cash budget | $525.65 |

This assumes you implement, solder, assemble, debug and test the firmware yourself. It does not mean the whole project can be outsourced for the parts price. The simulator and this design handoff do not constitute flashed hardware firmware.

### Hiring an engineer for the working P0
Planning rate is $100/hour. This is an explicit estimating assumption, not a surveyed market rate or a contractor quote. Firmware is the largest task because reliability, persistence, setup and recovery require more than a count-up demonstration.

| Work package | Hours | Labor |
| --- | --- | --- |
| Electrical integration and assembly plan | 16 | $1,600.00 |
| Beacon and wearable embedded firmware | 52 | $5,200.00 |
| Enclosure adaptation and assembly | 16 | $1,600.00 |
| Field tests and tuning | 24 | $2,400.00 |
| Build documentation and handoff | 8 | $800.00 |

| Total | Amount |
| --- | --- |
| Labor plus procurement subtotal | $11,600.00 + $420.52 |
| Project contingency, 20% | $2,404.10 |
| Commissioned P0 planning budget | $14,424.62 |

The commissioned contingency replaces the DIY contingency; they are not added twice. Labor tax, travel, venue rental, certification and schedule overruns beyond the reserve are excluded. At $75-$150/hour, the same 116 hours plus procurement and 20% reserve cost roughly $11,000-$21,500. Obtain a scoped quote against the acceptance matrix.

## 21 / Cost to resemble the image and scale
### Compact wearable iteration after P0
The P1 estimate is incremental to the working P0. It funds a compact BLE wearable and an adapted beacon with two mechanical/electrical iterations. It assumes the initial radio architecture passes field testing; changing technology is additional scope.

| Work package | Hours | Labor |
| --- | --- | --- |
| Custom PCB electrical design/layout and bring-up | 64 | $6,400.00 |
| Firmware integration on compact hardware | 32 | $3,200.00 |
| Mechanical detail, seal and strap iterations | 40 | $4,000.00 |
| Outdoor usability and RF validation | 32 | $3,200.00 |
| DFM, assembly files and handoff | 16 | $1,600.00 |

| Budget | Amount |
| --- | --- |
| PCB fabrication, assembly, parts and print iterations allowance | $1,800.00 |
| P1 increment including 20% contingency | $24,240.00 |
| P0 plus compact P1 total planning budget | $38,664.62 |

### Optional UWB feasibility experiment
Two Qorvo DWM3001CDK boards are listed at $29.50 each [S10]. Allow $69 for cables/fixtures/shipping, 32 hours for ranging and detection integration, and six hours for review of the intended RF use. At $100/hour plus 20% reserve, the incremental budget is $4,713.60. This evaluates one anchor and one tag. It does not buy a compact UWB watch, a directional two-anchor gate, legal certification or approval. A third $29.50 board alone does not complete that redesign.

### Small runs and retail
Ten more P0 wearable assemblies can be budgeted at the recurring wearable BOM plus assembly labor, printing, shipping and tax, but this does not validate ten simultaneous runners. Group firmware, interference and user support need their own test scope. Production cost cannot be defensibly quoted from one-off breakout prices. P1 needs distributor quotes, manufacturing yield, test time, packaging, warranty, duties and compliance costs before a retail price or gross margin can be estimated.

Cloud hosting and subscription cost for the specified offline baseline is $0/month. Charging electricity and occasional consumables are not priced as a subscription. Certification, tooling and a commercial launch remain separate quote-dependent projects.

## 22 / Delivery schedule and ownership
The estimate covers 116 engineering hours for P0. At 25 productive project hours per week, allow roughly five working weeks after parts arrive. This is an effort-based schedule assumption. Shipping delays, failed radio geometry and contractor availability can extend it. P1 adds 184 engineering hours plus PCB/print lead times, approximately eight to twelve further calendar weeks at the same allocation.

| Milestone | Reviewable output |
| --- | --- |
| Week 1 | Actual parts inspected; breadboard radio/display/haptics; current measurements |
| Week 2 | Embedded state machine, setup flow, journal and initial enclosure fit |
| Week 3 | Pausing/recovery, USB export, assembled wearable and beacon |
| Weeks 4-5 | Track calibration, ground-truth runs, fixes and documented acceptance results |
| P1 start | Only after radio and lap-flow evidence supports the intended customer use |

One embedded engineer owns the P0 wiring, firmware and test records. A mechanical designer can own the enclosure revision after actual component envelopes are frozen. A named runner/coach validates usability and ground-truth crossing records. No external person has been contacted, assigned or hired by this package.

### Contractor handoff checklist
Provide this report, the original reference image, BOM, wiring schedule, UI demo, behavioral model and test traces. Request a milestone quote that explicitly names the 60-lap acceptance run, raw data handoff, source-code ownership, native design files and failure/rework policy. Clarify whether pricing includes purchased parts, lab equipment use, taxes, venue access and test participants.

The first material decision is whether controlled-lane training is the desired first customer use. If the real customer is a police academy running 30 people across eight lanes, revise the architecture and budget before authorizing custom hardware. The simplest single-beacon prototype remains useful evidence, but does not fulfill that group requirement.

## 23 / Design files, evidence and known gaps
| File | Purpose |
| --- | --- |
| `index.html` | Offline interactive watch review demo, design views and budget; synthetic data only |
| `LapCounter-specification.md` | Editable full specification generated from the source |
| `output/pdf/LapCounter-prototype-design.pdf` | Shareable report |
| `bill-of-materials.csv` and `costs.json` | Itemized budget and machine-readable arithmetic |
| `design/industrial-design.svg` | Annotated wearable and beacon views with proposed dimensions |
| `design/electrical.svg` | Functional electrical block and harness diagram |
| `design/enclosure-concept.scad` | Editable enclosure envelopes; not production CAD |
| `model/lap-engine.js` | Executable behavioral reference, no device drivers |
| `model/check-engine.cjs` | Checks for initial presence, duplicate suppression, pause, restart and other model rules |
| `evidence/verification.json` | What was actually checked and what remains unmeasured |

### Established by this design exercise
The intended interaction can be reviewed in a browser. The budget can be recalculated from explicit quantities and rates. The reference model can be checked with deterministic sample traces. Supplier documentation supports the selected component interfaces and listed core prices.

### Not established
No real radio packets have been collected. Detection quality, thresholds, battery endurance, wearer comfort, lens readability, skin compatibility, strap strength and ingress resistance are unknown. Embedded firmware and USB export remain to be implemented. The enclosure geometry is not a fit-verified assembly. No PCB, firmware build or radio certification has been released. No physical prototype has been assembled.

These are remaining implementation tasks rather than observed defects. The known architectural limitations are more specific: single-beacon RSSI detects proximity, cannot verify circuit completion, and cannot provide exact painted-line or direction detection. Calibration may fail. That failure is a valid result and should trigger a radio architecture change before paying for miniaturization.

## 24 / Sources and price provenance
Sources were accessed on 17 October 2026. Supplier pages and documentation support product facts and listed prices. All lap parameters, labor hours, mechanical envelopes, schedules and acceptance thresholds are project proposals. They are not supplier guarantees.

- [S01 Seeed published XIAO prices and SKU list](https://www.seeedstudio.com/tag/Seeed-XIAO-Series.html). Sense $15.90 and standard $9.90 at quantity one.
- [S02 Seeed XIAO nRF52840 setup and pin documentation](https://wiki.seeedstudio.com/XIAO_BLE/). GPIO mapping, battery pads and charger settings. Reconfirm actual board revision.
- [S03 Adafruit 3502 reflective display](https://www.adafruit.com/product/3502). $24.95; 168 x 144 pixels; breakout envelope 40 x 39 x 4.6mm. It is unlit in darkness.
- [S04 Adafruit 2305 haptic driver](https://www.adafruit.com/product/2305). $7.95. I2C breakout supports the actuator driver.
- [S05 Adafruit 1201 vibration motor](https://www.adafruit.com/product/1201). $1.95; 10mm disc; use a supported drive voltage.
- [S06 Adafruit 1578 battery](https://www.adafruit.com/product/1578). $7.95; 500mAh cell, dimensions and shipping documents. Confirm exact variant.
- [S07 Adafruit 5580 fuel gauge](https://www.adafruit.com/product/5580). $5.95; MAX17048 breakout with battery connectors.
- [S08 Nordic on RSSI proximity limitations](https://www.nordicsemi.com/Nordic-news/2021/01/Precision-Positioning). Signal strength is affected by multipath and obstacles.
- [S09 eCFR 47 CFR 15.519](https://www.ecfr.gov/current/title-47/chapter-I/subchapter-A/part-15/subpart-F/section-15.519). Relevant UWB handheld-system conditions. The intended product category is not resolved by this report.
- [S10 Qorvo DWM3001CDK store listing](https://store.qorvo.com/products/detail/dwm3001cdk-qorvo/692466/). $29.50 at quantity one when checked.
- [S11 Qorvo development kit documentation](https://www.qorvo.com/products/ek/DWM3001CDK). Evaluation kit supports experiments as tag or anchor; it is not a ready-made LapCounter watch.
- [S12 TI BQ24074](https://www.ti.com/product/BQ24074). Candidate power-path charger for custom hardware.
- [S13 TI TPS63031](https://www.ti.com/product/TPS63031). Candidate regulated supply; final sizing needs measured peak loads.
- [S14 Analog Devices MAX17048](https://www.analog.com/en/products/max17048.html). Gauge reference for detailed electrical design.

Price listings can change and do not include checkout freight, import charges or local tax unless explicitly stated. The estimate carries allowances and contingency for those unknowns. All prices in the final summary use the same budget arithmetic as the CSV and JSON files.
