Modern Apps git
git clone https://git.maproj.org/Modern-Apps.git
translate ▾

Modern-Apps.git / FINDFAMILY_UWB_TRACKER_HARDWARE.md

FINDFAMILY_UWB_TRACKER_HARDWARE.md11.8 KiBRenderedCodeRaw
1# FindFamily Custom UWB Tracker — Hardware
2
3Companion to `FINDFAMILY_UWB_TRACKER_DESIGN.md`.
4
5> **The bench target is a Qorvo DWM3001CDK, not the custom board below.** The DWM3001C
6> module pairs a DW3110 with an **nRF52833**, whereas the BOM and pinmap in this document
7> specify a bare **nRF52840**. The two differ in ways that matter if you cross-read them:
8> the nRF52833 has 512 kB flash / 128 kB RAM against the nRF52840's 1 MB / 256 kB, and it
9> has **no USB peripheral**, so USB-DFU (§3 J1, §4) does not exist on the dev kit — it is
10> flashed over the on-board J-Link. Everything in §5 (the firmware contract) applies to
11> both; §1–§4 and §6–§10 describe the eventual custom board only. Firmware lives in
12> `firmware/findfamily-tracker/`.
13
14Physical design for the DIY
15tracker: **bare Qorvo DW3110 (UWB) + bare Nordic nRF52840 (MCU/BLE)**, small
16**LiPo + USB-C** charging, with a **piezo buzzer, pairing/mute button, and
17accelerometer**. Bare-chip path chosen deliberately — we own all RF and
18regulatory work (see §7, §8).
19
20The firmware contract (BLE UUIDs, beacon/provisioning/UWB byte formats, epoch-id
21derivation) mirrors the app exactly — see `findfamily/.../tracker/TrackerBle.kt`,
22`TrackerProtocol.kt`, `TrackerUwbKeys.kt`, and `TrackerUwbGatt.kt`.
23
24---
25
26## 1. Block diagram
27
28```
29 ┌───────────────────────────────┐
30 USB-C ─────────►│ CC 5.1k ×2 │ ESD │ charger IC │
31 (5V, D±) │ │ │ (BQ25100) │
32 │ └──────┬─────┴──────────┬────────┘
33 │ D± │ VBAT (3.0–4.2V)│ charge
34 ▼ ▼ ▼
35 ┌─────────┐ ┌───────────────┐ ┌────────┐
36 │nRF52840 │ │ buck-boost │ │ LiPo │
37 │ USB │ │ TPS63802 →3.3V │ │100-250 │
38 └─────────┘ └──────┬────────┘ │ mAh │
39 │ 3.3V rail └────────┘
40 ┌─────────────────┼───────────────────────┐
41 ▼ ▼ ▼
42 ┌───────────┐ ┌───────────────┐ ┌──────────────┐
43 │ nRF52840 │ │ DW3110 │ │ peripherals │
44 │ (BLE 2.4G)│◄──┤ SPI + IRQ/RST │ │ piezo+PAM8904│
45 │ 32MHz │ │ 38.4MHz XTAL │ │ LIS2DH12 │
46 │ 32.768kHz│ │ UWB antenna │ │ button │
47 │ BLE ant. │ │ bulk cap │ └──────────────┘
48 └───────────┘ └───────────────┘
49```
50
51Two independent RF front-ends: **2.4 GHz** (BLE, off nRF52840) and **6.5/8 GHz**
52(UWB, off DW3110). Keep them separated/orthogonal (see §7).
53
54---
55
56## 2. Power tree
57
58LiPo peaks at 4.2 V, above the nRF52840's 3.6 V absolute max, so **neither chip
59runs directly off the battery** — a single regulated 3.3 V rail feeds both.
60
61| Stage | Part | Key values / notes |
62|---|---|---|
63| USB-C sink | USB-C recept. | CC1/CC2 → 5.1 kΩ to GND (advertise sink); ESD array on D+/D-/VBUS |
64| Charger | TI **BQ25100** (or MCP73831) | I_charge ≈ 0.5C via ISET resistor; thermal-limited; STAT → GPIO |
65| Battery | LiPo pouch **100–250 mAh** | 3.0–4.2 V; size for form factor + UWB burst headroom |
66| Regulator | TI **TPS63802** buck-boost | 3.3 V out, ~11 µA Iq, holds 3.3 V from 4.2→2.7 V in; ≥1 A cap |
67| Bulk decap | 100–470 µF + 4.7 µF + 100 nF | at DW3110 supply — absorbs UWB TX spikes (~50–130 mA) |
68| VBAT sense | 2× 1 MΩ divider + 100 nF | → nRF52840 SAADC (AIN); feeds beacon battery byte |
69
70Why **buck-boost** not buck: a buck can't hold 3.3 V once the LiPo sags below
71~3.4 V; UWB must keep working as the battery drains.
72
73nRF52840 uses its **internal DC/DC** (external inductors per Nordic PS) off the
743.3 V rail for best efficiency. DW3110 uses its internal regulators (decoupling +
75DC/DC inductor per the DW3000 datasheet / Qorvo DWM3000 reference).
76
77---
78
79## 3. Bill of materials (core)
80
81| Ref | Part | Function |
82|---|---|---|
83| U1 | Nordic **nRF52840** (aQFN73) | MCU, BLE 2.4 GHz, USB, runs Qorvo FiRa stack + HKDF beacon |
84| U2 | Qorvo **DW3110** | UWB (FiRa, 802.15.4z, ch 5/9), SPI peripheral |
85| U3 | TI **TPS63802** | 3.3 V buck-boost |
86| U4 | TI **BQ25100** | Li-ion charger |
87| U5 | ST **LIS2DH12** | 3-axis accel, motion wake (~2 µA) |
88| U6 | **PAM8904** | piezo boost driver (loud "find" tone) |
89| Y1 | 32 MHz crystal | nRF52840 HF (RF) |
90| Y2 | 32.768 kHz crystal | nRF52840 LF (RTC / low-power) |
91| Y3 | **38.4 MHz** crystal | DW3110 reference (ToF accuracy — tight tolerance + trim) |
92| BZ1 | Piezo transducer | audible find + anti-stalk beep |
93| SW1 | Tactile switch | long = pair mode, short = mute |
94| ANT1 | 2.4 GHz antenna | PCB IFA or chip (Johanson 2450AT) |
95| ANT2 | UWB antenna | ch 9 / 8 GHz (Qorvo DWM3000 reference antenna) |
96| J1 | USB-C receptacle | charge + USB-DFU |
97| J2 | SWD header (SWDIO/SWDCLK) | programming/debug |
98| — | LiPo 100–250 mAh | battery |
99
100Matching networks, decoupling, DC/DC inductors, and ESD per each device's
101reference design.
102
103---
104
105## 4. nRF52840 ↔ DW3110 wiring (SPI + control)
106
107DW3110 is an SPI peripheral to the nRF52840 SPIM. Suggested pin map (adjust to
108routing):
109
110| Signal | nRF52840 | DW3110 | Notes |
111|---|---|---|---|
112| SPI SCK | P0.04 | SPICLK | up to ~36 MHz |
113| SPI MOSI | P0.05 | SPIMOSI | |
114| SPI MISO | P0.06 | SPIMISO | |
115| SPI CSn | P0.07 | SPICSn | active low |
116| IRQ | P0.08 | IRQ | ranging/event interrupt → GPIOTE |
117| RSTn | P0.11 | RSTn | open-drain reset (don't drive high) |
118| WAKEUP | P0.12 | WAKEUP | wake from deep-sleep before SPI |
119| EXTON (opt) | P0.13 | EXTON | power-sequencing/PA enable if used |
120
121Peripherals:
122
123| Signal | nRF52840 | Device | Notes |
124|---|---|---|---|
125| I²C SDA/SCL | P0.26 / P0.27 | LIS2DH12 | or SPI; keep off RF pins |
126| Accel INT1 | P0.14 | LIS2DH12 INT1 | motion wake (GPIOTE) |
127| Button | P0.15 | SW1 → GND | internal pull-up; RC debounce |
128| Piezo drive | P0.16 (PWM) | PAM8904 | EN + PWM for tone |
129| Charger STAT | P0.17 | BQ25100 STAT | optional charge LED/logic |
130| VBAT sense | P0.28 / AIN4 | divider | SAADC |
131| USB D+/D- | D+/D- (dedicated) | J1 | USB-DFU |
132| SWD | SWDIO/SWDCLK (dedicated) | J2 | flashing |
133| HF xtal | XC1/XC2 | Y1 32 MHz | |
134| LF xtal | P0.00/P0.01 (XL1/XL2) | Y2 32.768 kHz | |
135
136DW3110 38.4 MHz crystal (Y3) on its XTAL pins with trim caps; treat as a
137calibrated part (§8).
138
139---
140
141## 5. Firmware ↔ hardware contract (mirror of `TrackerBle`)
142
143The firmware must implement, over these radios:
144
145**BLE advertising (crowd-finding)** — service `6b1d2f00-4b3a-4c7e-9a10-1f2e3d4c5b6a`,
146service-data payload:
147```
148[16B epochId][1B battery%]
149```
150`epochId = HMAC-SHA256(secret, "fftrk1" || u64_be(epoch))[..16]`,
151`epoch = unix_seconds / 900` (15-min rotation). Matches `TrackerProtocol`.
152
153This must be sent as a **BLE 5 extended advertisement**: the AD structure is
154`1B length + 1B type + 16B UUID + 17B payload = 35 bytes`, past the 31-byte legacy
155limit, and the full UUID cannot be shortened because the phone looks the service data up
156by it. Pairing mode below stays legacy (21 bytes) so an unprovisioned tracker is
157discoverable with default scan settings. See `src/tracker_ble.c`.
158
159**BLE binding (GATT)** — service `…2f01…` (advertised only while unprovisioned;
160the characteristics stay registered for the device's life so the owner can write UWB
161params to a bound tracker), characteristics:
162- `…2f02…` (write): provisioning blob
163 ```
164 [8B trackerUserId BE][32B beaconSecret][8B unixSeconds BE]
165 ```
166 48 bytes; firmware also accepts the 40-byte form without the timestamp. The
167 timestamp is the tracker's only source of wall-clock time — there is no
168 battery-backed RTC, and without it `unix_seconds / 900` is unknowable, so the
169 tracker would beacon ids outside the owner's search window. Firmware keeps time as
170 `unix_at_provision + k_uptime_get()` and re-persists it once per epoch so a reset
171 costs one epoch of drift rather than the whole time base.
172
173 On success: persist, stop advertising the unprovisioned service, start the
174 rotating beacon.
175- `…2f03…` (write/notify): per-find FiRa params
176 ```
177 [2B phoneAddr][4B sessionId BE][1B channel][1B preamble]
178 ```
179 The STS key **and the tracker's own 2-byte UWB address** are derived on both ends
180 from `beaconSecret` via HKDF-SHA256 and are not sent OTA — the GATT link is unbonded,
181 so anything on it could come from a stranger nearby:
182 ```
183 stsKey = HKDF-SHA256(beaconSecret, info = "com.vayunmathur.findfamily/uwb-sts" || u32_be(sessionId))[..8]
184 uwbAddr = HKDF-SHA256(beaconSecret, info = "com.vayunmathur.findfamily/uwb-addr")[..2]
185 ```
186 (salt = 32 zero bytes; reserved `0x0000`/`0xFFFF` addresses have their low byte set to
187 `0x01`.) Mirrored by `TrackerUwbKeys.kt` and `src/tracker_sts.c`; fixed vectors live in
188 `TrackerUwbKeysTest.kt`.
189
190**UWB (precision find)** — DW3110 runs a FiRa **responder/controlee** session
191with those params; phone is controller/initiator. See `TrackerUwbGatt.kt`.
192
193Button: long-press → advertise unprovisioned service (pair mode); short-press →
194mute the piezo. Accelerometer INT → wake, refresh beacon, allow ranging.
195
196---
197
198## 6. Power budget (rough)
199
200| Mode | Current | Duty | Notes |
201|---|---|---|---|
202| System sleep (RTC + accel) | ~3–5 µA | most of the time | nRF52840 System OFF/ON + LIS2DH12 |
203| BLE beacon (1 adv) | ~5–10 mA for ~2 ms | e.g. every 1–2 s | dominates average when idle |
204| UWB ranging | ~50–130 mA | seconds, only during a find | rare; bulk cap smooths peaks |
205
206At a ~1 s beacon interval the average is tens of µA → a 150 mAh LiPo lasts
207weeks–months between charges; motion-gating the beacon (accel) extends it. UWB is
208negligible to the average because it's infrequent.
209
210---
211
212## 7. RF / PCB guidance (the hard part)
213
214- **4-layer stackup**: L1 signal+RF / L2 solid GND / L3 power / L4 signal.
215- 50 Ω controlled impedance for both RF nets; keep UWB traces very short.
216- **2.4 GHz (BLE)**: nRF52840 has an integrated balun → pi-match + antenna; copy
217 Nordic's reference matching + antenna keep-out exactly.
218- **UWB (ch 9 / 8 GHz)**: replicate the Qorvo **DWM3000** matching + antenna
219 (that module is a DW3110) — it's your reference layout.
220- Place ANT1 and ANT2 on a board edge, **orthogonal**, with ground keep-outs and
221 via-stitched grounds to minimize cross-coupling.
222- Crystals (32 MHz, 32.768 kHz, 38.4 MHz) close to their pins with guard rings;
223 keep the 38.4 MHz UWB reference away from switching noise.
224
225---
226
227## 8. Calibration & regulatory (cost of bare-chip)
228
229- **Per-unit UWB calibration**: antenna delay + crystal trim, per Qorvo's
230 procedure, for accurate ranging. (Modules ship calibrated; bare parts don't.)
231- **Regulatory**: FCC/CE intentional-radiator testing for **both** radios; UWB
232 has its own emission mask. Budget for a test lab.
233
234---
235
236## 9. Mechanical
237
238~30×30 mm 4-layer PCB; LiPo stacked underneath; USB-C on an edge; sound port over
239the piezo; button on top; keychain loop in a corner.
240
241---
242
243## 10. Open items
244
245- Exact DW3110 regulator config (LDO vs internal DC/DC + inductor) per datasheet.
246- Antenna vendor/part selection + matching component values (tune with a VNA).
247- Loudness target for the piezo (drives PAM8904 boost voltage / transducer choice).
248- Whether to add a MAX17048 fuel gauge for accurate battery % vs the SAADC divider.
249- Charge-current + safety (NTC thermistor on the LiPo → charger TS pin).