Section 7.3

Advertising and scanning

Definition

Advertising is the way a Bluetooth Low Energy (BLE) §7.1 device announces itself without a connection: it repeatedly transmits short packets, called advertisements, on three radio channels reserved for this purpose. Scanning is the matching activity: a device listens on those channels and receives advertisements. Together they let devices discover each other, start connections and broadcast small amounts of data to every listener. The advertiser chooses how often it transmits, and the scanner chooses how much of the time it listens.

The idea

A phone searches for a sensor that advertises every 100 ms. Each advertisement lasts less than half a millisecond. To save energy, the phone’s receiver listens only part of the time, and on one channel at a time. The phone discovers the sensor only when an advertisement is sent on the channel the phone is listening to, at a moment when the phone is listening. Neither device knows the other’s schedule, so they find each other when their schedules happen to overlap.

Picture a lighthouse that flashes briefly at regular intervals, and a watcher who keeps their eyes open for a fixed part of every minute: a flash is seen only if it comes while the eyes are open. More frequent flashes or longer open periods bring the first sighting sooner, and both cost energy, the advertiser’s for each transmission and the scanner’s for each millisecond of listening. The picture is incomplete in two ways. Both schedules are regular, so a watcher who misses once may keep missing for a long time; the advertiser adds a small random delay to every interval to break up such patterns. And packets can be lost to interference even when the timing is right.

How it works

Advertising.

  1. In every advertising event, the advertiser sends the same packet on each advertising channel it uses, normally all three: channels 37, 38 and 39, at 2402, 2426 and 2480 megahertz (MHz). The packets of one event follow each other within a few milliseconds.

  2. Events repeat at the advertising interval, which the Host, the upper part of the device’s Bluetooth software, sets in steps of 0.625 ms, with a minimum of 20 ms. The Link Layer §7.6, the part that controls the radio, adds a random delay of 0 to 10 ms to every interval, so the start of one event follows the start of the previous one by the advertising interval plus that delay.

  3. A legacy advertisement, the format used before version 5.0 and still common, carries the advertiser’s 6-byte device address and up to 31 bytes of advertising data: a sequence of fields, each made of a length byte, a type byte and content such as the device name, the services offered, or vendor data that starts with a company identifier §7.32. Extended advertising, added in version 5.0, points from the advertising channels to a longer packet on another channel and allows up to 1650 bytes of data.

  4. The packet type says which replies the advertiser accepts: ADV_IND accepts scan requests and connection requests, ADV_DIRECT_IND a connection request from one named device, ADV_SCAN_IND only scan requests, and ADV_NONCONN_IND nothing, which suits a beacon, a device that only broadcasts. After a packet that accepts replies, the advertiser listens on the same channel for a reply that starts 150 microseconds after its packet ends.

Scanning.

  1. The scanner’s Host sets two durations: the scan interval, and the scan window, the part of each scan interval during which the receiver listens. The ratio of window to interval is the scan duty cycle. A window equal to the interval means continuous listening.

  2. In each scan window the receiver listens on one advertising channel. The Link Layer specification says that the scanner should listen on a different advertising channel in each new window, and that it must use all three.

  3. In passive scanning the scanner only listens. In active scanning it answers an advertisement that accepts scan requests with a scan request (SCAN_REQ), and the advertiser replies with a scan response (SCAN_RSP) that carries up to 31 more bytes.

  4. A device that wants to connect scans in the same way. When it receives a connectable advertisement from the device it wants, it answers on the same channel with a connection request (CONNECT_IND) and becomes the central of the new connection.

When discovery happens. The scanner discovers the advertiser at the first advertisement that is sent on the channel the scanner is listening to, lies completely inside a scan window, and arrives undamaged. When the advertiser uses all three channels, the first condition holds in every event, because the advertiser visits whichever channel the scanner is on. Discovery therefore depends on timing: on where each event’s advertisement falls relative to the scanner’s windows.

Worked example

An advertiser uses an advertising interval of 100 ms. Its random delay lies between 0 and 10 ms; to keep the arithmetic simple, take every delay at its 5 ms average, so events start 105 ms apart. A legacy advertisement with 31 data bytes, sent at 1 million bits per second, has 47 bytes (31 of data, 6 of address and 10 of framing), which is 376 bits and lasts 376 microseconds, short enough to ignore here. Two scanners both have a scan duty cycle of 0.25.

Scanner A listens for 120 ms every 480 ms. The longest gap between events is 100+10=110100 + 10 = 110 ms, so every window holds at least one complete advertisement on the scanner’s channel. The first window that opens after the advertiser starts does so within 480 ms and catches the advertiser within its first 110+0.4=110.4110 + 0.4 = 110.4 ms, so discovery takes at most 480+110.4=590.4480 + 110.4 = 590.4 ms if no packet is lost.

Scanner B listens for 25 ms every 100 ms. Call the phase of an event the time within the scanner’s 100 ms cycle, counted from the opening of a window, at which the event’s advertisement arrives; the event is caught when its phase is below 25 ms. Each event comes 105 ms after the previous one, one cycle plus 5 ms, so the phase advances 5 ms per event.

A simpler model treats every event as an independent chance of 0.25, like a coin that lands heads one time in four. It predicts that the first 4 events all miss with probability 0.754=81/256≈0.320.75^4 = 81 / 256 \approx 0.32, that the first catch comes at event 1/0.25=41 / 0.25 = 4 on average, and that no number of events guarantees discovery: after 16 events a chance of 0.7516≈0.010.75^{16} \approx 0.01 remains. For scanner B this model predicts too few early misses, and it has no firm limit where scanner B has one. Both scanners listen a quarter of the time, yet scanner A finds the advertiser within 0.6 s, while scanner B can need 16 events, about 1.6 s.

Stated precisely

Let TaT_a be the advertising interval, so consecutive events start between TaT_a and Ta+10T_a + 10 ms apart; let II be the scan interval, WW the scan window, d=W/Id = W / I the scan duty cycle, and tt the duration of one advertisement. Assume (A1) that the advertiser uses all three advertising channels and sends on each at the same point of every event, and (A2) that no advertisement is lost to interference or collision.

Assumption A3 is the weak one. From one event to the next, the position within the scan interval moves by the event spacing minus a whole number of scan intervals, a step that varies only through the 0 to 10 ms random delay, so consecutive events are strongly correlated, as scanner B shows. The Core Specification states no discovery deadline; any bound comes from a model of both schedules.

Limits and common mistakes

Not seeing an advertisement does not prove that none was sent: with scanner B of the worked example, the first four events go unseen 60% of the time while the advertiser works normally.

A scan log is not a record of the packets on air. With duplicate filtering on, the Controller, the lower part of the Bluetooth system, suppresses repeated reports from the same advertiser, and reports that arrive faster than the Host reads them can be dropped.

All advertisers share three channels, so collisions grow with the number of devices: two advertisements that overlap on one channel can both be lost. The random delay stops two advertisers with equal intervals from colliding in every event. Wi-Fi traffic in the same band adds further losses.

Shorter intervals and longer windows cost energy: an advertiser at the 20 ms minimum transmits 5 times as often as one at 100 ms. Devices therefore often advertise quickly for a short time after a user action and slowly afterwards.

The Link Layer neither encrypts nor authenticates advertisements: anyone in range can read them or send fake ones, unless the application protects the data itself, for example with the Encrypted Advertising Data feature added in version 5.4, which needs a key shared in advance. A fixed advertised address lets observers track a device; a resolvable private address §7.31, which changes regularly and which only peers holding the right key can link to the device, limits this.

Questions answered

How do advertising interval and scan duty cycle affect discovery latency?

A shorter advertising interval and a higher scan duty cycle both shorten discovery latency, and both cost energy, but neither determines it alone. Discovery latency is the time until a scanner first receives an advertisement, the short packet that a Bluetooth Low Energy (BLE) device repeats in order to be found. The advertiser repeats it every advertising interval plus a random 0 to 10 ms; the scanner listens for a scan window in every scan interval, and the scan duty cycle is the window divided by the interval.

Compute discovery latency from both schedules together, never from one parameter alone.

Related entries: Throughput versus goodput (§7.39), Jamming versus protocol DoS (§7.40), Independent and identically distributed samples (§11.5), Central and peripheral roles (§7.2), Resolvable private address (RPA) (§7.31), Company identifier (§7.32). Further reading: [19, 93].