Menu

The Basics Of Bluetooth Low Energy Development

The Basics Of Bluetooth Low Energy Development

Bluetooth Low Energy development 101 for developers building the next connected gadget.

  1. Introduction
  2. The Master-Slave Relationship
  3. GATT And Bluetooth Profiles
  4. Profile Hierarchy
  5. GATT: Services And Characteristics
  6. Adopted And Custom Bluetooth Profiles
  7. Common Bluetooth Profiles
  8. Additional Bluetooth Resources

Introduction

If you building a connected gadget—what we tend to dub “things” these days—there is a good chance you will want at least three modes of wireless connectivity: Wi-Fi, cellular and Bluetooth.

Bluetooth is built and maintained by the Bluetooth Special Interest Group (SIG). The working group has 25,000 member corporations that contribute functionality and use cases to Bluetooth.

Devices connected to the Internet are projected to skyrocket in the next decade. Juniper Research predicts 38.5 billion connected devices by 2020. All of those devices will need to communicate with other devices and computers. Bluetooth will be one of the pivotal technologies creating the mesh network of the future.

The following cards break down the basics of Bluetooth Low Energy (LE) development, from the client-server relationship to GATT.

The Master-Slave Relationship

Like much of computing over time, Bluetooth works in a client-server relationship. This relationship is often referred to as the master/slave pairing to create what in Bluetooth parlance is called “piconets.” The pairing is also referred to as a central/peripheral arrangement.

The master/client/central device in this case is often a PC, smartphone or tablet. The master can connect to numerous slaves in the piconet and can push or request data to or from each device.

Slave/peripheral devices cannot talk to each other in the piconet and can only communicate with the master. To build a Bluetooth service, the Bluetooth functionality must be created and flashed on the peripheral device to its hardware specifications. The client (an app on a smartphone, for instance) then needs to be created to tell the slave what it is supposed to do.

“When you are talking about Bluetooth, you are talking about two things: the central and the peripheral,” said Steve Hegenderfer, Bluetooth SIG’s director of developer platforms. “In 99% of the cases, the central is the phone or the tablet. Some people call it the master, in master/slave relationship.”

GATT And Bluetooth Profiles

Bluetooth core specifications define how a Bluetooth gadget will function. Bluetooth profiles define how a gadget is used.

For two Bluetooth to communicate with each other, they must support the same Bluetooth profile. For instance, a wireless headset will need both the smartphone (master) and headset (slave) to use the Hands-Free Profile (HFP) to make a connection.

In Bluetooth 4.0 and above, the Bluetooth LE (also known as Bluetooth Smart) specification makes it easier to adopt Generic Attribute Profiles (GATT). The GATT profiles make Bluetooth development more seamless as developers can use profile  specifications that have already been built, standardized and supported by Bluetooth SIG.

The hierarchy of Bluetooth development starts with profiles. GATT gives those profiles form and function and define how they can be used. What makes profiles work are services and characteristics that encompass the nuts and bolts of GATT.

Profile Hierarchy

bluetooth_profile_service_characteristic

GATT: Services And Characteristics

Bluetooth profiles are built out of Attributes, defined as the GATT. Attributes are transported by the Attribute Protocol. Each Attribute is built with services and characteristics. Each Attribute can have multiple services and each service can have multiple characteristics.

“You have services and characteristics and those are kind of the building blocks of Bluetooth,” said Hegenderfer.

Services can have two forms: primary and secondary. The primary service describes the main functionality of the service while the secondary provides auxiliary functionality and is referenced from at least one primary service on a device.

Characteristics have their own mini-hierarchy. The building blocks of characteristics are the  properties, values and descriptors of the functionality.

A good example of how services are employed are Bluetooth beacons. The beacon has a profile made up of eight or services (depending on the beacon provider). The services include generic access, generic attributes, proximity, battery power etc. Each service has multiple characteristics with property values and descriptors that tell the service what to do.

Adopted And Custom Bluetooth Profiles

If you are building a Bluetooth device, the GATT is your best friend. Most of the functionality you can imagine is already built into profiles available through Bluetooth SIG’s various development tools.

If you are using the new Bluetooth Developer Studio, you can search its repository for “adopted profiles” built for nearly any kind of device imaginable. Beacons, health and fitness monitors, headsets, automotive … you name it and some type of profile has likely already been developed.

If a developer is building a gadget that does not already have a profile in Bluetooth’s repository, a custom profile can be designed by combining existing services and characteristics or developing new ones.

“So you’re building something like [a] Bluetooth diaper and you are looking at all these use cases out there for Bluetooth and say wow, I can’t find anything that does what I really want it to do,” said Hegenderfer. “With 4.0 you can build you own what we call custom profiles. These adopted profiles are the ones that our 25,000 members come up with. And they get ratified and eventually certified. The custom profiles is what you come up with for projects.”

Common Bluetooth Profiles

What are some common Bluetooth profiles? Let’s break down some of the most used.

Human Interface Device (HID): The go-to profile for accessory devices like keyboards, mice and video game controllers.

Device ID Profile (DIP): An essential profile that allows a device to be identified beyond the fairly generic Device Class. Helps identify the manufacturer of the device, product ID and version.

Serial Port Profile (SPP): Sends bursts of data between two devices and is one of the original and essential Bluetooth profiles.

Hands-Free Profile (HFP): Commonly used in cars to accept or reject calls along with phone accessory devices, like old Bluetooth ear buds.

Headset Profile (HSP): Takes a lot of the functionality of the HFP and adds functionality, such as audio integration, accepting/rejecting calls etc. from a smartphone.

Audio/Video Remote Control Profile (AVRCP): The profile that created the universal remote that can control all devices in an audio/visual set up such as TVs and speakers.

Health Device Profile (HDP): A broader profile category that contains other profiles for sending data between medical/fitness devices and a client. Includes the Health Thermometer Profile (HTP) and Heart Rate Profile (HRP) among others.

File Transfer Protocol (FTP): The ability to transfer files between two file systems.

Basic Imaging Profile (BIP): Helps transfer files (text, emails etc.) to printers from devices that do not necessarily have printer drives installed like smartphones or tablets.

Video Distribution Profile (VDP): Allows for video to be streamed from one device to another (though this is often better solved with other wireless technologies, like Wi-Fi Direct or Miracast etc.)

See the Bluetooth developer site for a more comprehensive list of common adopted profiles.