Skip to content

Bluetooth protocol research

Introduction

As it was pretty difficult to find good documentation and intros to bluetooth (low energy) I’ve (Sijmen) compiled a list of useful webpages and Videos which should get one started with bluetooth concepts. As most concepts are very detailed and complex, I’ve tried to make a summary via paraprhasing and quotion of the underlieing and important topics.

Bluetooth (Classic) and BLE

The following comparison is sourced and partially paraphrased from: Geek for Geeks Bluetooth vs Bluetooth low energy. In this section we will cover the difference between normal bluetooth and BLE.

Bluetooth

Bluetooth is a short-range wireless LAN technology for connecting small devices and gadgets together and facilitating data transfer among themselves for personal use. Also known as Bluetooth classic, it operates in the 2.4 GHz ISM unlicensed bandwidth to communicate among paired devices. Bluetooth classic version comes in two distinct data rate types known as Basic Rate (BR) and Enhanced Data Rate (EDR). It is maintained by Bluetooth Special Interest Group (SIG) and is standardized by IEEE 802.15.

Ble

Bluetooth Low Energy (BLE) is similar to Bluetooth classic. It is a short-range wireless LAN communication technology standardized by IEEE 802.15. It also operates in 2.4 GHz ISM unlicensed bandwidth. The major distinguishing feature of BLE is its low power consumption while maintaining the same communication range as in Bluetooth classic. It typically finds its use in healthcare, fitness, security and home automation appliances that save power.

Bluetooth-vs-low-energy

Bluetooth can handle a lot of data in return it quickly consumes battery life and costs a lot more. Bluetooth Low Energy is used for applications that do not need to exchange large amounts of data and can run on battery power for years even at a cheaper cost. BLE achieves this power saving by putting the server in sleep mode until a transfer request is made by a slave device.

Conclusion

Ble has some interesting features which we find important such as:

  • Long battery life (so users don’t have to change batteries which often is hard)
  • Cheaper (Current offerings for people with bad sight are expensive)

We thus will continue with bluetooth low energy for further documentation instead of normal bluetooth.

Ble GAP

GAP is short for Generic Access Profile, and it controls connections and advertising in Bluetooth. GAP is what makes your device visible to the outside world, and determines how two devices can (or can’t) interact with each other.

Broadcasting

Ble GAP is mainly responsible for making the device known to bluetooth compatible devices. This is called advertising. If the device doesn’t do this (anymore; for example if you disconnected and it doesn’t advertise) the device isn’t visible anymore for user of that device.

Only for discovering

Once you establish a connection between your peripheral and a central device, the advertising process will generally stop and you will typically no longer be able to send advertising packets out anymore, and you will use GATT services and characteristics to communicate in both directions.

Ble GATT

GATT comes into play once a dedicated connection is established between two devices, meaning that you have already gone through the advertising process from GAP.

GATT Transactions

An important concept to understand with GATT is the server/client relationship.

The peripheral is known as the GATT Server, which holds the ATT lookup data and service and characteristic definitions, and the GATT Client (the phone/tablet), which sends requests to this server.

All transactions are started by the main device, the GATT Client, which receives response from the secondary device, the GATT Server.

When establishing a connection, the peripheral will suggest a ‘Connection Interval’ to the central device, and the central device will try to reconnect every connection interval to see if any new data is available, etc. It’s important to keep in mind that this connection interval is really just a suggestion, though! Your central device may not be able to honour the request because it’s busy talking to another peripheral or the required system resources just aren’t available.

Services and Characteristics

GATT transactions in BLE are based on high-level, nested objects called Profiles, Services and Characteristics, which can be seen in the illustration below: image of overview

Profiles

A Profile doesn’t actually exist on the BLE peripheral itself, it’s simply a pre-defined collection of Services that has been compiled by either the Bluetooth SIG or by the peripheral designers. The Heart Rate Profile, for example, combines the Heart Rate Service and the Device Information Service. The complete list of officially adopted GATT-based profiles can be seen on the bluetooth site[8].

Services

Services are used to break data up into logical entities, and contain specific chunks of data called characteristics. A service can have one or more characteristics, and each service distinguishes itself from other services by means of a unique numeric ID called a UUID, which can be either 16-bit (for officially adopted BLE Services) or 128-bit (for custom services).

A full list of officially adopted BLE services can be seen on the Services page of the Bluetooth Developer Portal. If you look at the Heart Rate Service, for example, we can see that this officially adopted service has a 16-bit UUID of 0x180D, and contains up to 3 characteristic, though only the first one is mandatory: Heart Rate Measurement, Body Sensor Location and Heart Rate Control Point.

Characteristics

The lowest level concept in GATT transactions is the Characteristic, which encapsulates a single data point (though it may contain an array of related data, such as X/Y/Z values from a 3-axis accelerometer, etc.).

Similarly to Services, each Characteristic distinguishes itself via a pre-defined 16-bit or 128-bit UUID, and you’re free to use the standard characteristics defined by the Bluetooth SIG (which ensures interoperability across and BLE-enabled HW/SW) or define your own custom characteristics which only your peripheral and SW understands.

For own usage UUID’s can be generated on this site: Uuidgenerator

Descriptors

Descriptors contain metadata which either augments the details relating to the Characteristic which the Descriptor belongs to or allows the configuration of a behaviour involving that Characteristic. For example, notification messages are switched on or off using a special descriptor called the Client Characteristic Configuration Descriptor .

One device limited

The most important thing to keep in mind with GATT and connections is that connections are exclusive. What is meant by that is that a BLE peripheral can only be connected to one central device (a mobile phone, etc.) at a time! As soon as a peripheral connects to a central device, it will stop advertising itself and other devices will no longer be able to see it or connect to it until the existing connection is broken.

Sources

  1. Videos and general information about bluetooth

  2. Guide which explains basic bluetooth concepts

  3. Bluetooth LE Primer (Quick introduction document of the whole stack)

  4. Usefull book about the ble standard (login on HVA O’Reilly to gain access or buy it)

  5. Video introduction to bluetooth low energy by Nordic semiconductor

  6. And another video about ble by Nordic semiconductor

  7. BLE vs classic bluetooth; a comparison

  8. Assigned numbers list, for bluetooth profiles

  9. Geek for Geeks Bluetooth vs Bluetooth low energy

  10. Introduction to bluetooth low energy


Last update: April 20, 2023