Bluetooth Low Energy, also called BLE, was introduced in 2010 and ushred in a new age of connectivity, especially between smart devices and smartphones. BLE is a new wireless protocol that shares some features with Bluetooth Classic. It takes some of the same concepts pionered by Bluetooth like simple connections and fast data transfers, but is simplified for low power, reliable and quick data transfer between devices.
This guide is intended to cover many of the basics of BLE that you need to know when developing or designing a product. In addition to this guide, there are several other ones discussing advertising and other design aspects.
Before we talk about BLE, it's important to note the naming: Bluetooth Smart was the original marketing name for Bluetooth Low Energy. The Bluetooth Smart name and mark didn't catch on - most people including us refer to it as Bluetooth Low Energy or BLE. From a marketing perspective this was also confusing - is there any Bluetooth that's not smart?. To add to the confusion, there also existed "Smart Ready" devices thatare commonly referred to as "Dual Mode", meaning they support both Bluetooth Low Energy and Bluetooth Classic (used for making calls with your phone, for example). We won't be referring to Bluetooth as smart, but you should understand why the old Logos refer too.
While commonly referred to as BLE, the Bluetooth SIG discourages this name because BLE isn't a trademark they own. So officially, Bluetooth LE is the proper way to refer to it.
Bluetooth is one of the most popular wireless protocols, and it has been available in smartphones, computers, and other devices for over a decade. Most of us are familiar with Bluetooth and how Bluetooth can allow us to connect a headset and make calls using our cellphones. The explosive growth in Bluetooth devices and new use cases led the Bluetooth SIG and other companies to the realization that Bluetooth consumed too much power and took too long to connect in some applications. For example, a key chain finder using Bluetooth would not run very long and that it could take significant time for it to connect, frustrating users.
Apple’s support for BLE in their devices, starting with iPhone 4s, opened the way to a massive number of small, battery operated devices.
Before BLE, using Classic Bluetooth could be a pain for users and developers. Bluetooth Classic is complex, has significant battery drain and on iPhones required an authentication chip which was costly and made these products too expensive. For trnasferring data, BLE is supported without this requirement in Apple devices, so it is lower cost.
One of the most powerful aspects of BLE is how extensible it is and how it allows any developer with an idea and a need to exchange information to do so, as opposed to the rigid structure of Classic Bluetooth.
Bluetooth and BLE are great protocols that can simplify connectivity with products. But, it’s important to understand where they stand alongside other wireless technologies. WiFi, Zigbee, and other protocols are better at certain applications, and BLE can’t always be used. Below, we look at some of the characteristics that differentiate BLE from them:
|Frequency Band||2.4GHz||2.4GHz / 5GHz||2.4GHz|
|Modulation||GFSK 1Mbps, 2Mbps, Coded||OFDM, DSSS||DSSS|
|Range||< 100m to 1km+||< 300m||< 100m Point to Point, More with Meshing|
|Network Topology||Point to Point, Start, Mesh (Bluetooth Mesh)||Star||Star, Mesh|
|Data Rate||1Mbps, 2Mbps (Bluetooth 5.0)||11Mbps, 54Mbps, 150Mbps+||250kbps|
|Peak Current Consumption||< 15mA, ~5.5mA in latest devices||60mA RX, 200mA TX||19mA RX, 35mA TX|
|Standby Current||< 2uA||< 100uA||5uA|
Zigbee, WiFi and Bluetooth LE all use the 2.4GHz ISM band, but are all very different in their capabilities. While the BLE radio was a shorter range device that consumes less power than Zigbee and especially WiFi, it evolved in the Bluetooth 5.0 specification to allow for up to 20dBm of output power as well as LE Long Range. This mean that it's range is significant. In fact, we've been able to achieve practical distances of over 1km. The lower peak current consumption of BLE is critical when choosing a battery. WiFi, with up to 200mA or more of peak TX current could never operate out of a coin cell battery. BLE radios, however, are specifically designed for coin cell operation.
As opposed to Zigbee, BLE is generally a point to point technology. However, Bluetooth Mesh is available from some vendors which provides mesh capability for devices if integrated to the software. This mesh capability originated at CSR (now part of Qualcomm, which created CSR Mesh that was later adopted as part of the Bluetooth specification. Typically, Point to Point connectivity means that the devices has to be in range for the smartphone to control it. There are also solutions using a BLE gateway that connects BLE devices to a router, but these add costs that may not be acceptable in many applications.
Bluetooth LE introduced a completely new radio which a similar but different modulation to Bluetooth Classic's 1Mbps. Let's dive deeper into the BLE Physical layer. The Physical layer refers to the radio itself:
BLE uses the same 2.4GHz ISM band used by Bluetooth Classic and Wi-Fi since it is “unlicensed” and available without an FCC license, and is also available worldwide. This band starts at 2400MHz and continues until 2483.5MHz. The Bluetooth LE specification divides the band into 40 channels of 1MHz spaced 2MHz apart. This is half the channels of Bluetooth Classic, but it helps simplify some of the radio design. 3 Of these channels are called “advertising” and are used by devices exclusively to send beaconing packets called advertising packets. These packets contain information that allow other devices to connect, but can also provide information about a device.
The advertising channels have been placed specifically in the lower, upper, and middle of the band to avoid interference from Wi-Fi and other sources. For example, Wi-Fi can take 20MHz to 40MHz of bandwidth. By spreading the advertising channels it makes a Wi-Fi station much less likely to interfere with all the channels. For example, if Channel 38 and its surrounding channels are getting interference, then there are still 2 other advertising channels, 37 and 39, that will not be affected.
BLE Radios transmit using a modulation scheme that is either 1Mbps or 2Mbps for Bluetooth 5.0 capable radios. MOst if not all radios made available are 5.0 compatible, but some older devices are not. 2Mbps PHY (as physical layer is referred to) allow for faster data transfer, but usually at the cost of range. Bluetooth 5.0 also introduced the CODED phys. Transmissions using coded PHY use the 1Mbps modulation, but they use bits for redundancy (called Coding in wireless terms). This allows for error correction which effectively improves the noise signal.
One thing that is not typically explained are some of the tradeoffs. 1Mbps is the standard modulation used for most advertising. Using 2Mbps requires the radios to negotiation. for it to work, both sides of the connection need to support Bluetooth 5.0. The 2Mbps PHY is mandatory for Bluetooth 5.0 to support, but Bluetooth Long Range support is optional. Smartphones support the 2Mbps PHY but we have yet to see one support LE Long Range. Part of the reason is that Long Range is typically an industrial requirements.
Bluetooth 5.0 also enabled output powers up to +20dBm, the maximum limit you can achieve. Previously, +10dBm was the limit, but most BLE radios supported up to 4dBm or so, with a few exceptions. Such high output power enables BLE to cover very long ranges.
The flexibility of BLE in terms of speed and output power allows optimizing the design for the application and gives BLE a lot of power to fit into many use cases.
To build a BLE product it's not necessary to understand more about the physical layer, but a few words about the RF are in order. Like all wireless transmitters, BLE devices transmit and receive Radio Frequency signals which require an Antenna and careful design RF design. Antenna design is a complicated topic, but practically any 2.4GHz antenna can be used. PCB and Chip Antennas are among the most common ones, but there are many options. We’ll discuss some of this later.
Now that we understand the BLE PHY, it's important to cover the BLE Link Layer, which is the protocol in charge of exchanging packets and uses the BLE PHY to do so. This is where the majority of the BLE operations happen and what designers deal with most commonly.
Bluetooth LE specification defines two roles: Peripheral and Central. The real difference between the two is who initiates a connection. Central devices are the ones that initiate, while peripherals accept. In this sense Central acts as a master, with many peripheral slaves attached.
The design of the BLE protocol intentionally shifts the power requirements to the Central device. Perihperals are expected to act to conserve energy, while the Central is more burdened. We'll cover some of the specifics of this later.
Each device in the BLE can be in any of the following state
For the Peripheral device, the Advertising state is also the initial state before the Connection state. The connection state is the final state in which the Slave (Peripheral) and Master (Central) can exchange data.
Since the BLE Link layer exchanges packets, it's important to understand the two main mechanisms for exchanging data in BLE:
So advertising packets serve dual roles - they enable Central devices to find devices and connect, and also able to convey any information the designer want. For example, sensor data.
We won't go into the details of how a connection is established because they're standarized. In essence, the Central sends a connection request, coordinating the timing of the Connection interval. The perihperal then waits for data from the central device at the right moment, and they begin exchanging data. If data doesn't arrive, the connection is ultimately disconnected on both sides.
Most of what you think about exchanging data in BLE is done using connections. For example, when you buy a new iPhone accessory with Bluetooth support, you open the App which uses iOS or Android to scan for the advertising packets. It then finds the device and connects to it.
Data is transmitted on 37 data channels which are not used for advertising. When devices are in a connection, the periodically exchange packets periodically during Connection Events. The rate of these events is defined by parameters such as Connection Interval, which as you will learn are critical because they determine how quickly data is exchanged, but they also control the amount of power the BLE radio will end up using. Faster connection events mean quicker data transfer, but will consume much more power.
We touhed on the connection interval and said that at every such interval, the devices exchange either empty packets (if they don't have any data to send) or send whatever data they have available. So if the connection interval is every 30ms, the devices will exchange packets every 30ms. As you can imagine, there are many times where the either Central or peripheral won't have any actual data to send. The BLE specification allows the peripheral device to skip connection events. This is called "Slave Latency". By skipping connection events and not listening to the Central's packet, the Slave (peripheral) can save on power.
the slave latency parameter, like the Connection Interval Min and Max parameters, are configurable and need to be agreed upon by both sides of the connection. The Central is forced to send data on each interval . Remember when we mentioned that the Central ends up consuming more power? This is why.
A typical BLE application involves a BLE chip connected to various sensors. A user walks into the BLE range. For the User’s smartphone to connect and read the sensor data, the BLE device needs to be advertising. Once the Smartphone receives the advertisement packet, it will begin the process to connect and obtain the sensor data. If the advertising interval is set too high, the devices will take time connecting and the user will experience this delay. If the advertising delay is too short, the frequent TX and RX will drain the battery more quickly.
The L2CAP layer is often misunderstood by developers. Bluetooth LE (and Bluetooth, which uses L2CAP albeit differently) is used for a couple of reasons. The first thing to realize is that BLE can receive different types of data. For example, there is user data sent over the GATT protocol (to be described later), but there is also data that needs to be exchanged between the Security Manager of the Central and Peripheral devices. The Security manager is a part of the BLE stack that helps establish the security used by the BLE connection.
The L2CAP layer fragments and re-assembles packets from other layers, but it also acts as a sort of router - it takes packets received by the BLE link layer and forwards them to the right destination. In BLE, those destinations are commonly the GATT and the Security Manager
Recent additions to the BLE specification also allow for L2CAP Oriented Channels. As you'll soon see, the GATT protocol for sending data adds quite a bit of overhead. For many applications, it's overkill. L2CAP Oriented Channels allows establishing direct data channels between two devices that send data directly to their respective L2CAP layers without GATT. The overhead is reduced and the data rate effectively increased. It also can allow reducing the memory/flash footprint.
If you've spent any time looking at BLE, no doubt you have heard about GATT. Operations such as Read, Write, Notify are GATT operations that are at the heart of BLE, because BLE devices use GATT
The GATT layer is a separate layer composed of a Client or Server on the devices that exchange well defined and formatted data. GATT sends and receives data using L2CAP, which goes to the Link Layer and is sent over the Bluetooth Connection.
At the heart of GATT are attributes, which are just properties. These attributes are grouped into characteristics, services and profiles.
A few examples of operations you can perform with GATT: