Exploring the Basics of Bluetooth Low Energy: A Beginners Guide To BLE
Learn about the Bluetooth low energy (BLE) wireless communication protocol, namely its features, protocol stack, and how it communicates with devices.
Bluetooth LE is a Bluetooth protocol designed for ultra-low power applications. In this article, we will look at how BLE works to be an energy-efficient, short-range wireless connectivity technology. Before getting into the specifics of BLE, let's first go over communication protocols.
What is a Communication Protocol?
Over time, computing has progressed from standalone systems to computers connecting to form networks (Figure 1).
Figure 1. A simplified diagram of connected computers in a local area network (LAN).
A communication network enables shared computing, where many users or terminals can access the same computer system. In specific scenarios, shared computing can enable one central system to handle the brunt of the work and distribute its results among multiple users who lack that capability.
Communication networks are also used in decentralized computing, where many computers can work together as peers. These networks help make it possible to transfer data from one point to another. For instance, whatever device you use to read this webpage is wirelessly connected to the All About Circuits server in some other part of the world. From there, information is moved from the server to your device, allowing you to read this article.
An important point to note is that, for the different devices in the network to communicate or share data effectively, they must speak a common language. This is where communication protocols come into play.
Figure 2. A conceptual view of a protocol, which is a common language that allows different devices to communicate.
A communication protocol is a rulebook that strictly defines how the hardware and software of devices exchanging information should perform each communication function.
Inside a communication protocol, a.k.a. rulebook, you'll find rules for things like:
- How the devices should identify themselves
- How they should establish a connection, maintain it, and end it
- What kind of data can they can send, and how do they should format it
- How do they ensure that data is properly received and understood by both ends
- What modulation and channel should the devices use
- What error coding technique should the devices use
- How the information exchanged should be secured
A communication protocol is based on several things, including the characteristics of the information to be exchanged, the medium of communication, and the capabilities of the devices that will use it.
From a Protocol to a Standard
A communication protocol can go through a standardization process to become a standard. Standards are agreed-upon or widely adopted protocols that must be followed irrespective of the manufacturer. They allow different companies producing related products to adhere to the same protocol, so their devices can communicate.
This is why you can connect a Bluetooth headset from one company to your phone from another company. The manufacturers of these products, though different, followed a standardized communication protocol, in this case, Bluetooth.
Aside from Bluetooth, here are some other popular communication standards:
- Transmission Control Protocol/Internet Protocol (TCP/IP)
- Bluetooth Low Energy
So far, you've been given just a hint about BLE. As you can see, Bluetooth low energy is listed under standardized communication protocols. So, let's talk about that.
What is Bluetooth Low Energy?
Bluetooth, at its core, is a short-range connectivity technology that uses radio waves as a communication medium. The first standard or specification for this technology is called Bluetooth Classic. It was primarily designed to replace wires and provide wireless connectivity between mobile phones and other portable devices.
Introduced in 2010 as a part of the Bluetooth 4.0 specification, BLE is optimized for ultra-low power applications. Thanks to its use in ultra-low power applications, Bluetooth LE serves a market of battery-powered devices that need wireless networking capabilities. Before Bluetooth LE existed, these types of devices found it hard to support interconnectivity because they used up too much battery power.
Below, we'll go over some of the optimization features for Bluetooth LE to achieve the ultra-low power consumption goal.
Bluetooth LE Power Saving Features
1. LE Radio Isn’t Chatty
The radio of Bluetooth LE-enabled devices only awakes when necessary to conserve power. When a device wants to send or listen for data, the LE radio is turned on to quickly perform the necessary tasks and then disconnects. This operation of an LE radio differs from a Bluetooth Classic radio, where the radio is on most of the time, and the connections are maintained for many hours or days.
Since the LE radio is not chatty, it is suitable for applications where a device sends a small packet of data every now and then, ranging from once per second to once every few days. For example, a heart rate monitor in a fitness tracker can collect all the heart rate data and send it to your smartphone once every hour. Or a temperature sensor that’s triggered only to send the temperature reading if the temperature is very high or low.
2. The LE Radio Has Shorter Connection Times
Bluetooth LE consumes less energy due to the reduced number of RF channels available for the connection, which results in faster connections and less time spent scanning. Bluetooth Classic has 32 RF channels that can be used to establish a connection between devices, whereas Bluetooth LE only has three.
Additionally, a BLE device that wants to be discovered sends signals on the RF37, RF38, and RF39 channels, known as the primary advertising channels.
When a device wants to find other devices, it listens for advertisement packets on the primary advertising channels. Since there are only three primary advertisement channels, the LE radio doesn't have to scan as many channels and can spend less time awake, thus using less energy.
3. The LE Radio Uses Smaller Packets
Bluetooth LE data packets are much smaller than Bluetooth Classic data packets. Smaller packet sizes require less computation overhead when encoding and decoding. This reduces power consumption.
4. The Battery Discharge is Pulsed
One of the properties of a battery is how it is discharged affects its capacity. Battery capacity is the amount of energy that can be extracted from a battery under certain conditions. A constant current discharge of a battery reduces its life. On the other hand, a pulsed discharge, in which there is idle time between discharging, helps get a battery as close to its nominal capacity as possible. This is referred to as the battery recovery effect.
Bluetooth LE takes advantage of this recovery effect. Data transmissions with BLE are done in periodic short bursts that are followed by idle periods. During these idle periods, the battery can recover, which helps the battery last longer.
5. The Bluetooth LE Protocol is an Asymmetric Design
The LE protocol uses an asymmetric design to issue tasks to devices that want to connect. The device that is the most resource-constrained does the least work. For devices to be connected, one has to take the role of a central and the other of a peripheral. The central device usually has more processing capability and battery power, like a smartphone. On the other hand, the peripheral is usually a device with less processing power and limited energy resources like fitness trackers, heart-rate monitors, etc.
Bluetooth LE Protocol Stack
A protocol stack (or protocol suite or protocol architecture) is a collection or group of subprotocols that work together to achieve complete communication between two or more computers connected in a network. Each subprotocol in the protocol stack is referred to as a layer or level. The Bluetooth LE protocol stack uses the divide-and-conquer approach. This means that the overall communication task is divided among the layers, and each protocol layer is responsible for a specific communication function.
Figure 3 shows an example LE protocol stack and its layers.
Figure 3. Bluetooth LE stack. Image used courtesy of Bluetooth SIG
The main functions of each layer of the LE protocol stack are summarized in Table 1.
Table 1. Main functions of each LE protocol stack layer.
|Protocol Layer||Main Function|
Physical Layer (PHY)
Defines the specifications for the hardware (LE radio) used for sending and receiving data over the air.
The specifications include frequency bands, modulation characteristics, output power, and radio range.
Responsible for configuring the LE radio to form communication links per the type of communication.
Other functions include defining states of the LE radio, packet format, channel map, and device address, as well as encryption and control procedures.
Host Controller Interface (HCI) Layer
It is an interface between low-level protocols in the controller and upper-level protocols in the host.
The HCI can be implemented using UART, USB, or ignored if all the protocol layers are on a single chip.
|Logical Link Control & Adaptation Protocol Layer (L2CAP)||
It serves as a liaison between the upper and lower layers of the Bluetooth LE stack.
Tasks include: segmenting data from upper layers into smaller sizes suitable for lower layers and packet reassembly from lower layers to upper layers.
Security Manager (SM)
It defines the pairing, authentication, and encryption procedures between LE devices. It protects against passive eavesdropping, Man-in-the-Middle, and tracking.
Tasks include key generation, key distribution(pairing), and random address generation and resolution.
|Attribute Protocol (ATT)||
LE devices store data using a data type called an attribute. The ATT defines the structure of an attribute and its access permissions (read, write, read-only, etc.)
Generic Attribute Profile (GATT)
It provides a hierarchical data structure to arrange data in a file-folder way. Hierarchically organizing data makes it easy for LE devices to access and store data when interacting.
The hierarchical structure consists of profiles, services, and characteristics.Related characteristics are organized into a service. Services that are related are grouped into a profile.
Generic Access Profile (GAP)
It defines procedures for how a BLE device can communicate with others through broadcasting or connecting.
Tasks include: defining BLE device roles, as well as how each role controls the link layer.
Two Main Ways BLE-enabled Devices Communicate
A BLE-enabled device can communicate in one of two ways:
- Connectionless communication: it broadcasts its data to any listening device
- Connection-oriented communication: it forms a dedicated connection with another device and communicates with it using the client-server mechanism
Figure 4 shows an overview of these two ways of communication.
Figure 4. Different ways BLE devices communicate. Image used courtesy of Renesas
LE devices that want to participate in connectionless communication are given two roles defined by the GAP layer. One device has to be the broadcaster, and the other device(s) has to be the observer(s).
The GAP role of a device controls the link layer of the device, which in turn will control the LE radio of the device.
- Step 1: The broadcaster device instructs its link layer to be an advertiser. A link layer that is an advertiser controls the LE radio to move from the stand-by or idle state to the advertising state and vice versa.
- Step 2: When the LE radio is in an advertising state, the advertiser (link layer) can send out advertising packets on the three dedicated advertising channels, RF37, RF38, and RF39. The advertising packets can contain data such as the name and the address of the broadcasting device.
- Step 3: On the other hand, the observer(s) instructs its link layer to be a scanner. A link layer that is a scanner controls the LE radio to move from a stand-by state (idle) to the scanning state and vice versa.
- Step 4: When the LE radio is in the scanning state, the scanner tunes in and listens for data on the primary advertising channels (RF37, RF38, and RF39).
For instance, below in Figure 5 is an image that shows my phone as an observer that has picked up the advertisement packets of the two broadcasting beacons:
Figure 5. Devices are picked up by a scanner. [click image to enlarge]
Common applications of connectionless communication in Bluetooth LE include beacons and Internet-of-Things (IoT) sensors broadcasting their readings.
In connection-oriented communication, you must be clear about two main concepts: device discovery and the client-server relationship between connected devices.
Device Discovery & Connection Setup
One thing to note is that anything called a profile in Bluetooth LE can control and coordinate other layers of the stack for a specific use case. In this regard, the GAP governs how the link layer and PHY layer (LE Radio) should function for BLE devices to discover and establish connections.
LE devices that want to participate in connection-oriented communication are given two roles defined by the GAP layer. One device has to be central, and the other has to be peripheral.
- Step 1: The advertiser of a peripheral directs the LE radio to broadcast advertising packets on the advertising channels and to also listen for a connection request packet coming from a central device.
- Step 2: When a central device wants to connect to a peripheral device, it first uses its link layer as a scanner. The scanner will use the LE radio to listen for the advertising packets.
- Step 3: When a central device recognizes a device to which it wishes to connect, the link layer switches the LE radio from the advertising to the initiating state.
- Step 4: In the initiating state, the LE radio sends a connection request packet to the peripheral device. The connection is established if the peripheral device accepts the connection request.
After the connection setup is complete, the Generic Attribute Profile performs three main functions: It uses the ATT protocol to structure the data that will be exchanged. It defines a hierarchical structure comprising services and characteristics to arrange the data in a file-folder way. This way of arranging data makes it easily stored and accessed.
It also defines a client-server relationship for how the connected devices should interact. The GATT defines two roles for connected devices: One device will be a client, and the other will be a server.
- Server: acts as a database that houses the data variables. The server stores the data using the ATT protocol's attribute data type.The data on the server is organized hierarchically, as defined by the GATT. The server's data can be accessed based on access permission. Some data will be readable as well as writable. Some may only be readable.
- Client: After connecting to the server, the client typically requests to access the data (attributes) stored on the server. The client can read and/or write the server's attributes depending on the access permissions.
An example of a connection-oriented application of Bluetooth LE Devices:
A sleep tracker with sensors detects the physiological changes that occur while we sleep. The tracker is connected to your smartphone to share the readings. The tracker functions as a server. And the smartphone serves as a client, reading the data stored in the tracker.
The Bluetooth SIG (Special Interest Group)
What is the Bluetooth SIG? The Bluetooth SIG is an independent, not-for-profit organization that defines Bluetooth standards. The Bluetooth SIG is not a company or cooperation. It doesn't manufacture or sell Bluetooth products.
Instead, it has four primary responsibilities. These are:
- Publish the Bluetooth specification
- Protect the Bluetooth trademarks
- Provide qualification programs to qualify a product before it goes into the market
- Promote Bluetooth technology
The Bluetooth SIG started in 1998 with just five founding member countries. Those were Erricson, Intel, IBM, Nokia, and Toshiba. Over the years, the Bluetooth SIG organization has grown to over 16,000 member companies.
The Bluetooth SIG provides two membership levels for companies that wish to join, which are the adopter membership level and the associate membership level (Table 2).
Table 2. Bluetooth SIG membership details.
BLE SIG Membership
|Cost||Free||Annual membership fee|
Lastly, the Bluetooth SIG has seven member companies with promoter-level membership. These include all the founding companies, plus Apple and Microsoft.
Efficient Protocols and Corporate Collaboration
Bluetooth LE has become an important communication ultra-low power application in our increasingly connected world. As we have seen, it requires an efficient protocol design and collaboration between companies to make it possible for Bluetooth LE, or any communication standard really, to have a significant market impact.