Bluetooth Low Energy, from the radio up · Puzzle 2 · 3 of 5

A timetable for two

In puzzle 1, the phone found the strap by listening to its advertisements. Now two devices that both sleep need to talk again and again, without missing each other.

The problem

In puzzle 1, the phone found the strap by listening until an advertisement landed. That's fine for finding it once. But a heart rate changes every second, and both radios want to sleep. If they only meet by luck, data arrives late or not at all. How do two sleepers meet on time, every time?

See it

The phone answers an advertisement with a connect request; they agree a connection interval; both wake at each connection event and sleep in between; each event uses a different channel phone: central strap: peripheral connect? ← connection interval → meet, then sleep channel Achannel Bchannel Cchannel D
  1. Right after an advertisement, the phone answers: "connect?". Now they're in a connection. The phone, which asked, is the central and sets the timing; the strap is the peripheral.

    Step 1 of 4
  2. The central sets a timetable: meet every connection interval, from 7.5 ms up to 4 s. In between, both radios sleep.

    Step 2 of 4
  3. Each meeting is a connection event: both wake at the agreed moment, exchange packets, and sleep. Predict: is every meeting on the same channel?

    Step 3 of 4
  4. No: each event uses a different channel, picked by a rule both sides know. Noise on one channel only spoils the events that land on it.

    Step 4 of 4

The building block

The phone answers an advertisement with a request to connect, in the moment the strap listens after advertising (puzzle 1). From then on, the two are in a connection, and each has a role. The side that sent the request becomes the central, which sets the timing: usually the phone, because the phone is the one that goes looking. The side that advertised becomes the peripheral, which follows it: usually the small device.

In its request, the central sets a timetable: meet every connection interval. The same request also carries the rule for picking each meeting's channel, so both sides know it from the start. The connection interval is a multiple of 1.25 ms, from 7.5 ms up to 4 s. Short means data moves sooner but more radio time; long means slow replies and a longer battery life. The central can change it later.

Each meeting is a connection event. Both radios wake at the agreed moment, exchange packets, and sleep again until the next one. If neither has anything to say, they swap tiny empty packets, just enough to stay in step. Because both know the timetable, neither has to listen in between.

Each connection event happens on a different channel, picked from the 37 non-advertising channels by a rule both sides know. If one channel is noisy, only the events that land on it suffer.

The analogy

Two lighthouse keepers who need to talk every night agree on a time: "every hour, on the hour". At each hour both light up, signal, and go dark again. And each hour they use a different color, picked by a list both have, so fog on one color doesn't silence them.

Check yourself

A heart strap's connection interval is 1 s. Your app shows the heart rate. What does the user notice?

Not quite. Packets only travel at connection events; between them both radios sleep.

Right. Data can only move when the two sides meet.

Not quite. Anything up to 4 s is allowed. It's slow, not broken.

Why does the phone, not the strap, set the timetable?

Not quite. Battery size isn't what decides it: the roles do. The central sets the timing.

Right. Roles: the central sets the timing, the peripheral follows.

Not quite. Both radios keep time; the rule is that the central decides.

What's the difference between a connection interval and an advertising interval?

Not quite. One is for being found by anyone, the other is a timetable for two devices that already found each other.

Right. One finds; the other keeps meeting.

Sources

  • Bluetooth Core Specification 5.4, Vol 6, Part B: Link Layer ("The connInterval shall be a multiple of 1.25 ms in the range 7.5 ms to 4.0 s. The connInterval is set by the Initiator's Link Layer… and can be changed using the Connection Update procedure"; "A Link Layer in the Central Role is called a Central… The Central controls the timing of a connection event"; channel selection: "the unmapped channel index for the current connection event")

What you now know

In a connection, the central (the phone) sets a timetable: meet every connection interval, 7.5 ms to 4 s. At each connection event both wake, exchange packets on a channel picked by a shared rule, and go back to sleep.