This page provides an overview of Bluetooth Low Energy (BLE) communication, including how it works, key BLE concepts, and resources for further reading.
Concepts
The following concepts are necessary if you want to understand BLE on a deeper level or implement your custom applications outside of the Digi tools.
GATT (Generic Attribute Profile)
Generic Attribute Profile (GATT) is the protocol that defines how Bluetooth Low Energy (BLE) devices exchange data. It organizes services and characteristics in a hierarchical manner and outlines the communication rules and procedures between two devices, ensuring that one device can read, write, or subscribe to specific data from another device.
In a GATT-based interaction, devices take on one of two roles: GATT Server and GATT Client.
GATT Server
A GATT Server is responsible for storing and providing access to the data. It waits for requests from the client and responds by sending the requested data, accepting new data, or notifying the client about changes. The server holds the data in a structured format, organized into Services and Characteristics.
Devices like fitness trackers, heart rate monitors, or environmental sensors typically act as GATT Servers. XBee devices fall into this category.
GATT Client
A GATT Client is the device that initiates communication and interacts with the data stored in the GATT Server. It sends requests to discover available services, read and write data, or subscribe to updates from the server.
A smartphone, for instance, typically acts as the GATT Client when interacting with a BLE device like a fitness tracker.
Services
In BLE, services are a collection of data and operations that define a specific function the device can perform.
Each service contains one or more characteristics that provide the actual data or functions.
Services are identified by a Universally Unique Identifier (UUID).
A GATT server exposes its services while the GATT client accesses them.
Characteristics
Characteristics are the individual data points or functions within a service. Each characteristic has a value that can be read or written by a connected device, depending on the characteristic’s properties. Characteristics can also notify or indicate changes to their value, which is particularly useful for real-time data updates, like sensor readings.
Each characteristic consists of:
-
Value: The actual data being transferred.
-
Properties: Define how the characteristic can be interacted with. These properties are:
-
Read: The characteristic’s value can be accessed or retrieved by the connected device.
-
Write: The characteristic can accept data from the connected device.
-
Notify/Indicate: The characteristic can send updates to the connected device automatically without the device needing to poll for them.
-
Together, services and characteristics provide a structured way to communicate and manage data in BLE applications. For example, a heart rate monitor might have a service that includes characteristics for heart rate measurement and body sensor location.
BLE communication workflow
The typical BLE communication process involves these steps:
-
Advertisement: A BLE device (GATT server) broadcasts advertisement packets, announcing its availability and providing basic information, like its name and supported services.
-
Scanning: Nearby devices (GATT clients) scan for advertisement packets to discover devices they want to interact with.
-
Connection: Once a client identifies a device it wishes to connect with, it initiates the connection process. The GATT client then accesses the services provided by the GATT server.
-
Service Discovery: The client requests the list of services and characteristics from the server. This establishes the kind of data and interactions available on the server device.
-
Data Exchange: The client reads, writes, or subscribes to notifications or indications from the characteristics in the server’s services. This is where the actual application data, like sensor values, is exchanged.
-
Disconnection: After the data exchange is complete, the devices may disconnect to save power, especially in BLE environments where minimizing power consumption is critical.
Further reading
The specifications for Bluetooth are an open standard and can be found at the following links:
To deepen your understanding of BLE, here are other useful resources: