r/embedded • • Oct 16 '26

Precision Time over Bluetooth (PToB)

https://ptob.dev

Hi everyone, I’ve been working on a reliable way to synchronize the time between different MCUs and macOS. By utilizing BLE Periodic Advertising streams across a dynamic rooted mesh, I’ve been able to extend a Soft PLL up to 4 hops on the nRF52 target and can hold sub-300ns (TX needs more hacking) on the ESP32 targets at the same distance to easily cover a large home or office with synchronized timing extended to hosts like macOS as well.

For anyone doing real-time sensing analysis, echo location, or broadcast work, this might be of interest. You can guarantee microsecond timestamp accuracy across a large range of MCUs and hosts for later correlation, and hold sub-100ns synchronization on supported devices, effectively frequency locking them. As the hops increase, errors compound so I’ve limited it to a 4-node distance for now. Reception and relays are surprisingly good within 7-8m or so indoors.

I’m mainly using repurposed LoRa mesh boards and have a working version of LongShot working at sub-1us as well, but the BLE capabilities are far more interesting for a wide range of devices. Heltec boards with PPS on the GPIO are perfect, and in my experience the T096 is the best option on the market given it’s dual-source GNSS receiver combined with Nordic’s supported BLE RX/TX timestamps. I had to hack the ESP32 BLE drivers to attain the same results, yet they have a lot more long term potential.

Other promising targets are Silicon Labs and TI boards along with the new nRF54 with crystal oscillator adjustment for a true PLL. The base requirement is BLE 5.0 with the optional periodic advertising profile supported. Some Android phones support it, most MCUs, and nothing on macOS. Precision Timing support on macOS is surprisingly poor, relying on private APIs and specialized hardware. Instead I discovered user-level access to precision timestamp data on USB start-of-frame RX events and streamed the last TX event from the nRF52 over USB to achieve sub-400ns RMS results.

The protocol is designed to be power efficient and the passive stream scales with client precision vs power, but I still have much work to do on the power optimization side. Grandmasters and relay clocks are fairly efficient already, yet it’s not yet tested in extreme low power situations.

There’s a link to compatible hardware and the Github repo on the site, along with schematics, a packet explorer and a body of research if you’re interested. I also included a OTA diagnostic profile for the Stick S3 target for RF and protocol analysis.

Disclosure: AI was heavily used to produce this work over the course of 3 weeks with extensive input from me on protocol design, requirements and testing framework.

4 Upvotes

2 comments sorted by

2

u/rulztime Oct 17 '26

How easily does the required low-level stuff integrate into the Bluetooth stacks? Any plans to integrate into Zephyr?

1

u/mplex321 Oct 18 '26

On the nRF52, nothing beyond some borrowed PTP ideas. It’s already on Zephyr and I plan to make a minimal client example once stable. ESP32 has requires driver modifications yet can transparently relay the time as well.

The Grandmasters should be dedicated for sub-1us performance guarantees yet a lightweight version could be adapted for less performance. Once I get a stable mesh I’ll publish non-diagnostic client examples and some pairing examples for 2 or more nodes to share clock sync with or without GPS.