Comprehensive BLE training

BLE Advertising: Packet Types, Beacons and Payloads

How does a BLE device look like? Learn types of Advertising, Scan Response, Beacon and create Flags, Local Name, UUID and Manufacturer Data.

Contents
Real photo of ESP32 board with ESP-WROOM-32 module; Example of BLE compatible hardware.
Real photo of ESP32 board with ESP-WROOM-32 module; Example of BLE compatible hardware. Photo: Ubahnverleih; Wikimedia Commons resource; CC0. The content of the photo has not changed; A Wikimedia preview image is used. This is not a documentary photo of the LCENJ experiment.
Step 4 of 20 ways to master BLE

Before connecting, the device must announce its presence and capabilities. Advertising can only play a text message, allow scanning, or open a connection. The right design of this data has a direct effect on discoverability, battery consumption and mobile experience.

What does advertising do?

Advertiser sends messages on advertising channels at specific intervals. Scanner listens to these messages and makes a decision based on address, name, service UUID or manufacturer data. Shortening the Interval makes discovery faster but increases consumption and congestion.

The main types

Connectable Undirected is for most products that need to be found and connected by any Central. Directed is used to quickly connect to a specified device. Scannable allows receiving Scan Response and Non-Connectable only broadcasts data. Extended Advertising gives more space and a wider variety of PHYs, subject to support from both sides.

Scan Response and Beacon

If the data does not fit in the original packet, Scanner can send Scan Request and the device will respond with Scan Response with additional information such as full name. A beacon typically broadcasts ID or telemetry without a data connection. The iBeacon, Eddystone, and AltBeacon formats are different conventions for organizing this data.

Building AD Structure

Each Advertising section is made with one byte Length, then Type and Data. Flags tells the general status; Local Name is for human representation; The UUID of the service allows the application to filter; Service Data and Manufacturer Data carry proprietary data. Before sending, check the total length and ordinality of the numbers.

Thermometer data sample

For the thermometer, put Flags in the main package, add the UUID of the environment service, and put the short name in the remaining space. If it is necessary to see the model and firmware version, pass it to the Scan Response. Never send sensitive data to Advertising without a security design in place.

Budget of 31 bytes and the condition of receiving Scan Response

In the usual legacy advertising, Advertising Data has a maximum of 31 bytes and Scan Response has a maximum of 31 bytes of independent space. The two are not a contiguous 62-byte payload: the Scanner must be actively scanning and the Advertiser must be scannable to receive a complementary response.

For example, Flags take three bytes, a sixteen-bit UUID four bytes, and a four-character name six bytes; A total of 13 bytes. The device address and radio header are outside of this AD data budget. For Extended Advertising, read restrictions and phone compatibility separately.

UUID and device name are for discovery, not proof of identity. Do not assume the Public Beacon ID is a password or unlock authorization; For Manufacturer Specific Data, the Company Identifier must be selected according to the official SIG assignment and authorized use.

Question and answer article

Ask your technical question

Questions and answers are published after moderation. Authors can see their own pending drafts.

No confirmed questions have been registered for this article yet.