UltraWideLock v0.4.0
UWB · NFC · Matter

UltraWideLock

Walk up. It Unlocks.

DS-TWR round live measurement drag the phone · or use the slider
A double-sided two-way ranging round A lock on the left and a phone on a distance scale, with the three ranging messages below: poll from the lock, response from the phone, and final from the lock. The measured distance, its tick count and the unlock decision are given as text beneath the diagram. 0 1 2 3 m unlock bound · 1.00 m lock phone 0.82 m poll response final
measured 0.82m ticks 154 time of flight 2.73ns unlock

One timestamp tick is 15.65 ps, which light crosses in 4.692 mm. The bound is ULTRAWIDELOCK_UNLOCK_RANGE_CM. A relay can add delay and nothing else, which is why arming one moves the measurement away from the door rather than toward it.

4.692 mmper ranging tick
9,608host checks, no hardware
0cloud dependencies
01

Install

A C compiler and python3 run the whole host suite.

shellno hardware
git clone https://github.com/ultrawidelock/ultrawidelock.git
cd ultrawidelock
make check                  # 18 suites, 9,608 checks

Five commands take a Qorvo DWM3001CDK from clone to a lock on the bench.

shellDWM3001CDK
make dfu-key                # once per clone   · image-signing key
make bootstrap              # once per machine · NCS v3.3.0
make build                  # -> build/cdk-matter
make flash                  # over the on-board J-Link
make monitor                # console, over RTT

The web flasher installs a prebuilt ESP32 image over WebSerial, with no toolchain.

02

How a door opens

Five steps, in the order they happen.

  1. 1BLE the phone finds the credential service 0xFFF2
  2. 2auth AUTH0, AUTH1, EXCHANGE, and both ends hold the URSK
  3. 3UWB key ladder to STS, then the DS-TWR round above
  4. 4gate a trusted range moves the bolt
  5. 5Matter lock state over Thread, into Apple Home
note

The credential is verified on the lock itself, so there is no remote verifier to compromise.

03

All of it on one nRF52833

512 KB of flash and 128 KB of RAM carry the reader, the DW3110 radio, an OpenThread MTD and a Matter node at the same time. A hand-written Matter node, rather than CHIP, is what makes it fit.

  • readerAUTH0 / AUTH1 / EXCHANGE, key ladder, STS, DS-TWR
  • matterhand-written node, Door Lock cluster, five fabrics
  • threadOpenThread MTD, joins a real network
  • classifierline-of-sight vs obstructed, 776 B of flash
Flash 96.31% 417,684 / 433,664 B
RAM 90.26% 118,312 / 131,072 B

Both bars are amber because both are tight; flash is the tighter. make cdk-size reports them.

ToolchainNCS v3.3.0, Zephyr 4.3.99
SigningECDSA-P256, verified by MCUboot
warn

Repository defaults are bench defaults. Keys and identities in the tree are for development. Do not secure valuables with it.

04

Obstruction detection

A phone in a hand and a phone through a wall both measure one metre. The shape of the arrival separates them: a direct path lands as one sharp edge, a path through a door arrives late, spread and weaker.

A decision tree reads the DW3000's own receive diagnostics in 776 bytes of flash, with no interpreter and no allocation.

Modeldepth-2 decision tree, generated by emlearn
Cost776 B flash, 0 B RAM, 28 B stack
Inputfive CIA registers plus the measured range
Gatethe host suite certifies the C matches the trained model
Two channel impulse responses compared A direct path arrives as a single narrow peak at the leading edge. An obstructed path arrives later, lower and spread across several samples, which is what the classifier reads. TIME → AMPLITUDE first path late, spread
What the CIA registers see. Mint is a hand holding a phone. Amber is the same one-metre reading through a door. The range agrees; the arrival does not.
05

Side of the door

A phone on the couch and a phone on the porch can be the same distance from the door. Only one of them should open it.

A second UWB anchor

The satellite joins the phone’s own ranging round as responder 1, so both distances come from one round rather than two guesses stitched together. It reports its distance sealed and bound to the block it was measured in, and the lock fuses the pair only when both halves carry the same block. It builds for the DWM3001CDK, the nRF5340 DK, and the ESP32 tier over an ESP-NOW carrier.

shelltwo boards
make anchorlink             # the lock half
make sat-build SAT_THREAD=1 # the satellite half
Two BLE witnesses

One nRF52840 dongle inside, one outside, a differential read consulted at the one moment it is reliable, and a door-transition latch that holds the answer between crossings. One image, role set at install.

shelltwo dongles
make witness-build
make witness-flash          # over USB DFU, no probe
note

The side gate fails closed for passive unlock: no agreeing second opinion, no walk-up open. A dead dongle, a dropped mesh, a reboot or corrupt storage each leave the lock refusing to open from inside. Outside, the recovery is a retry, an NFC tap, or the app.

06

Hardware targets

ApplicationHardwareConnectivity
dwm3001cdk-lockDWM3001CDK, nRF52833 + DW3110UWB, Matter over Thread
dwm3001cdk-lock-freertosthe same board, no ZephyrUWB, Matter over Thread
nrf5340dk-locknRF5340 DK, DWM3000EVB, NFC12A1UWB and NFC, Matter over Thread
esp32-matter-lockESP32-S3 / C5 / C6 with DWM3000EVBUWB, Matter over Wi-Fi
satelliteCDK, nRF5340 DK, or the ESP32 tierUWB responder, sealed link to the lock
07

Update over the air

Either chip, from a browser. The flash page finds the board, reads what it is running, and sends the one update that applies.

DWM3001CDKESP32-S3 / C5 / C6
Transportmcumgr, over BLE or USBnative GATT frames
Payloadsigned delta, about 11 KBsigned whole image, about 2 MB
Whyone MCUboot slot in 512 KBtwo full OTA slots
Timesecondsseveral minutes over BLE

Writing starts once the update window is open on the board: SW2 on the CDK, a double-click on the ESP32’s button. That press is the whole availability gate; authenticity is a P-256 signature, checked before the first byte is written and again by the bootloader. The CDK can also be reinstalled whole over the cable through MCUboot serial recovery, which runs from the bootloader alone.

note

Chrome or Edge on a computer, or Chrome on Android. Neither Web Bluetooth nor WebSerial exists in Safari, so not from an iPhone.

08

Try it without hardware

09

Specification

UWBDS-TWR under an STS session, channels 5 and 9
Resolutionone tick is about 15.65 ps, roughly 4.692 mm
BLEcredential service 0xFFF2, AUTH0 / AUTH1 / EXCHANGE
NFCECP, on the nRF5340 DK target
Side of doora second UWB anchor in the same round, or two BLE witnesses
Matterhand-written node over Thread, or over Wi-Fi on ESP32
Door LockLockOperation events, AutoRelockTime, DoorLockAlarm, Approach Direction
Matter clientCASE as initiator and the Binding cluster, to open a second lock. Off by default
Updatessigned delta over BLE or USB, applied from inside MCUboot; whole signed image on ESP32
PortsZephyr, ESP-IDF, and a Zephyr-free FreeRTOS port
Tests9,608 host checks across 18 suites, no hardware needed
LicenseISC. The vendored Qorvo UWB driver is LicenseRef-QORVO-2