🎉 25% off Pre-Sale! Bluetooth LE course with real hardware included - no SDK required
Bluetooth® Low Energy Protocol · · 6 min read

How Bluetooth Low Energy Works: Advertisements (Part 2)

Part 2 of BLE advertisements: broadcasting and connectable device behavior, discoverable modes, advertising parameters and intervals, with practical examples.

How Bluetooth Low Energy Works Advertisements (Part 2)

In this week's post, we'll continue our discussion on Bluetooth Advertisements (first part here) and cover them in a bit more detail.

Bluetooth Advertisements are crucial for any BLE device since they are utilized for all types of applications, whether that's a device that allows connections or one that simply advertises its presence and includes data for others to discover.

In order to utilize advertising packets efficiently, we need to understand the way they get used, the different capabilities they provide, the format of the packets, and how much data they can hold.

The most important goal of advertising packets is to convey information to other BLE devices via the advertising packet type and the advertising data types included in the packet.

The best way to better understand the concept is by going through a few examples of advertisement packets, so let's do that next.

Broadcasting Devices

If you're looking to design a device with the main role of advertising its presence and possibly broadcast some data for other BLE devices (observers, centrals) to discover, then you can implement the Broadcast role.

One example would be a beacon device.

Going back to the different advertising packet types, here are the ones we can use for implementing this role:

Let's revisit the packet format of advertising packets:

BLE Uncoded PHY Packet Format
Source: Bluetooth Core Specification document

PDU Payload format:

BLE PDU Payload Format
Source: Bluetooth Core Specification Document

Depending on the platform and Bluetooth stack used on your device, the APIs will differ, but in general, you'll need to define the following:

PDU Content

In the case of a Legacy Advertising Packet, the advertising data portion has a maximum size of 31 bytes (with at least 2 bytes used up by the Length and Type fields in the case of one advertising data type included, leaving a max of 29 bytes for the payload).

Also, keep in mind that the Manufacturer Specific Data field will include 2 bytes containing the Company Identifier Code, which is followed by the user data. Company Identifier Codes can be obtained from the Bluetooth SIG for free (as long as the company is a Bluetooth SIG member company). Learn more here: https://www.bluetooth.com/specifications/assigned-numbers/company-identifiers/

If you choose to implement a Scan Response, you could include a second advertising packet to send additional advertising data that does not fit into the main advertising packet.

This relies on the Observer/Central sending a Scan Request packet to the advertising device, to which the advertiser responds with a Scan Response packet. The format of the Scan Response packet is exactly the same as the Advertising packet.

Let's take a look at an example of a device that simply advertises its Complete Local Name.

The PDU Payload would look something like this:

Value Notes
0x0BLength of the data
0x09<<Complete local name>>
0x4e'N'
0x6f'o'
0x76'v'
0x65'e'
0x6c'l'
0x20' ' (space)
0x42'B'
0x69'i'
0x74't'
0x73's'

Advertising PDU Payload data

To learn more about the different advertising data types, refer to the Supplement to Bluetooth Core Specification document: https://www.bluetooth.com/specifications/bluetooth-core-specification/

Connectable Devices

If you're looking to design a device that primarily allows connections from another BLE device and operates mostly in connection mode, then here are a few things to keep in mind:

One important thing to keep in mind is that Extended Advertisements are not supported by all scanners. So, if you're looking to implement a connectable device that can be connected to from both legacy devices and ones that support scanning for extended advertisements, it's highly recommended to configure your device to advertise using Legacy and Extended advertisements.

LE Limited Discoverable Mode vs. General Discoverable Mode

As part of the Flags AD field included in the advertisement data, there are two flags we haven't discussed yet:

Limited Discoverable mode devices are discoverable for a limited period of time and this mode is typically triggered on a device by user interaction.

Note that Limited Discoverable Mode is only allowed to be set in advertisements sent by devices operating in the peripheral role. Scanning devices need to perform what's called a limited discovery procedure in order to discover devices in this mode.

Per the Bluetooth specification, there are two common reasons to use limited discoverable mode:

–  Limited discoverable mode can be used to allow remote devices using the general discovery procedure to prioritize or otherwise identify devices in limited discoverable mode when presenting discovered devices to the end user because, typically, the user is interacting with them.

–  Limited discoverable mode can also be used to allow remote devices using the limited discovery procedure to filter out devices using the general discoverable mode.

Core Bluetooth Specification document

On the other hand, devices operating in the General Discoverable mode are discoverable for an indefinite period of time by devices performing the general discovery procedure.

Similar to the limited discoverable mode, this mode is also only supported by devices operating in the peripheral role (devices that allow connections). Scanning devices need to perform what's called a general discovery procedure in order to discover devices in this mode.

Advertising Parameters

In addition to the advertising data, there are a few key parameters that define the behavior of an advertising device. For simplicity, we will focus on Legacy Advertisements which are the most popular.

These parameters are:

Each of these parameters has to be configured carefully in order to achieve the best user experience for your device.

For example, here are some notes/tips to keep in mind:

Summary

In this post, we covered advertisements in a bit more detail. We went over:

In the next post within the series, we'll take a deeper look into:

💡
Insider Tip: Want to dive deeper into Bluetooth LE advertising, scanning, and beyond? Check out the Bluetooth Developer Academy for comprehensive courses that take you from beginner to expert!

Read next