alp@vilnius: ~ up since 2019 · Vilnius Download cv.pdf

← ALP-OS

alp ~ $ work beacon-flood

4,000 beacons vs. one phone link

In crowded BLE areas, trackers lost their phone link, and some got stuck in a reset loop. I measured everything in a flood of about 4,000 beacons before touching any code. Stuck cycles went from 17 of 62 to 0 of 350.

17/62  to 0/350BLE cycles where the phone link got stuck

Trackers had two problems in places crowded with BLE devices. After a phone session ended, the tracker stayed invisible to the phone. And in very dense areas, it reset every 33 seconds.

Neither shows up at a desk. So I brought the crowd to the bench.

Measuring before changing

I set up a flood of about 4,000 beacons. Before changing any code, I measured stuck cycles, resets and how many phone sessions passed.

Getting the phone link back

For the invisible tracker, I added three layers that kick in one after another. A probe checks that the phone link is really alive. With no phone connected, an advertising watchdog restarts advertising if it gets stuck. And if the Bluetooth stack doesn’t confirm that advertising started, the radio restarts.

Stopping the reset loop

For the reset loop, scanning now runs in slices, so the scanner can’t hog the system. The records that beacons generate are also paced.

Three checks bring the phone link back; sliced scanning and record pacing end the reset loop Two columns, one per failure. Left, after a phone session the tracker stayed invisible to the phone. Three layers act in turn. A link probe checks the phone link every 10 seconds and closes the link after 2 failed probes. With no phone connected, an advertising watchdog restarts advertising every 15 seconds. If the Bluetooth stack does not confirm the advertising start within 5 seconds, a radio watchdog restarts Bluetooth. Result: the tracker is visible to the phone again, and stuck cycles went from 17 of 62 to 0 of 350 over 10 hours. Right, in very dense BLE areas the tracker reset every 33 seconds. A timeline drawn to scale over 36 seconds shows the scan before the fix as one unbroken non-stop scan, and after the fix as 10 second scan slices with 2 second gaps, so the scanner cannot hold the radio without a break. Scanning also pauses after phone-link events. Record pacing spreads out the records that beacons generate. Result: the reset loop is gone, from one reset every 33 seconds to 0 resets in 80 minutes. Tested in a flood of about 4,000 beacons. For the vendor’s side of the problem, the vendor got an air log of 1,009 sniffed connection events. The flow on the left is schematic; the scan timeline is to scale. TWO FAILURES · each with its own fixes after a phone session tracker stayed invisible to the phone link probe · every 10 s 2 failed probes → close the link no phone now advertising watchdog · every 15 s no phone → restart advertising if the stack stalls radio watchdog · 5 s timeout start not confirmed → restart Bluetooth tracker visible to the phone again stuck cycles 17/62 → 0/350, 10 h in very dense BLE areas one reset every 33 s before · non-stop scan, no gaps one scan, never a break after · 10 s slices, 2 s gaps 10 s 10 s 10 s 2 s off 0 s 12 24 36 s Scan also pauses after phone-link events. record pacing under beacon floods reset loop gone 1 per 33 s → 0 in 80 min Tested in a flood of about 4,000 beacons. For the vendor’s side of the problem, the vendor got an air log of 1,009 sniffed connection events.
Three checks bring the phone link back; sliced scanning and record pacing end the reset loop

Conclusion

Stuck cycles went from 17 of 62 to 0 of 350, over 10 hours. The reset loop went from one reset every 33 s to none in 80 minutes. Phone sessions passing went from 51% to 80%.

Phone session pass rate

80% still means one session in five failed, and my data doesn’t say why. For the vendor’s part of the problem, I sent them an air log of 1,009 sniffed connection events.

The baseline is what let me say “better” with numbers.

Tags ble watchdog field-bug