Classic Bluetooth was designed to replace cables and covers many protocols, with speed increasing with each new version.
Power consumption was not the primary concern for this technology and was not suitable for wireless boards running on battery power that need to send only a few bytes of information.
What is BLE?
Bluetooth Low Energy (or BLE), on the other hand, takes the same brand but must be considered as a new technology as the approach is in the opposite direction. Everything is specified in order to use the minimum current for each action. A few examples:
- The discovering process is based on three frequencies as a compromise between robustness and low power
- Small packets in the link layer for a minimum memory requirement for the radio
- Asymmetric design allows the device with smaller energy source less to do
- Everything has state, reducing quantity of code and complexity of firmware
- Connections are transient and short
- Only one protocol : Attribute protocol
Bluetooth Low Energy Architecture
Understanding the attribute protocol, highlighted in red in Figure 1, is the basis of Bluetooth Low Energy.
Figure 1: Bluetooth Low Energy Architecture
This Bluetooth Low Energy protocol defines a set of rules for accessing data on a peer device. The data is stored in an attribute that is composed of three elements as shown in figure 2.
- A handle that is like the line number in a data base (see Figure 3)
- Type of data that is exposed: for instance, what kind of sensor. This value is a UUID (Universally Unique Identifier) that is a 128-bit value.
- The value of the data itself
Figure 2 : Attribute Values
Then, a series of handles creates a database.
Figure 3: Example of BLE database
BLE GATT
The generic Attribute Profile or GATT, defines the type of attributes and how they are used. It introduces the concepts of service, characteristic and descriptor. A service is the equivalent of an object that has an immutable interface. A 0x2800 UUID means a Primary service declaration. A characteristic wraps value and behavior of the data thanks to its descriptors. Let’s take figure 4 as example and let’s read the matrix. A service includes one or several characteristics. In the database, all the data between two 0x2800 UUID belong to this service.
Figure 4
- Handle 0x000C, with a UUID of 0x2800 means a primary service is declared with a value of 0xCAB5. The Bluetooth Special Interest Group defines many profiles and reserve UUID. For instance, a 0x180F would mean a battery level is exposed. Reserved UUIDs cannot be used by custom profiles. 0xCAB5 is a UUID from Cypress for touch sensor.
-Handle 0x000D and UUID of 0x2803 with value. 0x2803 means it is a characteristic. 12:0E:00:A2:CA means the value is at the handle 0x000E and UUID 0xCAA2. 0x12 means the characteristic can be read and notified.
- Handle 0x000E and UUID 0xCAA2. Based on characteristic declaration, we know the value of the characteristic is on the line and is equal to 32.
- Handle 0x000F and UUID 0x2902. 0x2902 means it’s a configuration programmed by the client. 1 means the notification is enabled.
Ähnliches Produkt:
The data is organized logically and rigorously, making it easy to find to optimize power consumption.
BLE GAP
The Generic Access Profile (GAP) defines how devices discover, connect and present useful information to the user. There are four GAP roles available: Broadcaster (just sends advertising data), Observer (scans for broadcasters), peripheral (advertises to be connected and becomes a slave once connected) and central (initiates connections to peripherals and becomes the master hence once connected). The GAP also defines some filter policies, timing, information in the advertisement packet and scan response.
BLE Application Design
The standard Bluetooth signature can be recognized by the concepts of host, controller, L2CAP and HCI that don’t need to be studied for a basic BLE application. Vendors of BLE solutions integrate all the layers on one die, with specific API to program easily attributes and GAP layer. As management of the Link Layer is included too, a few lines of code are sufficient to design a Bluetooth Low Energy application.