Bluetooth low energy (BLE) is introduced as a light-weight subset of Bluetooth since Bluetooth 4.0. It originates from Nokia’s Wibree project and is quite different from Bluetooth by all means. There are many good BLE tutorials online and one of them is from Adafruit, https://learn.adafruit.com/introduction-to-bluetooth-low-energy/gap.
When BLE peripheral device is powered up, it periodically sends out (advertises) advertising data. BLE central device listens (scans) for advertisement and acquires surrounding BLE peripheral devices’ characteristics. This procedure is shown below. Central device can also send “scan response request” message so peripheral can respond with more information with “scan response data”. At protocol layer, this advertising process is governed by the so-called GAP (Generic Access Profile) profile.
In advertising process, peripheral device is not “connected” to central device yet and its advertisement can be pick up by multiple central devices. To setup a one-to-one connection, peripheral and central devices need to go through the following procedure.
Once connection is up, devices follow below procedure to exchange data. Central device which is the master sends out request and peripheral device responds with response data. This process repeats per connection interval. What is not shown in the drawing is within one connection interval, master/slave can also exchange data multiple times.
The communication in this connected state is governed by GATT (Generic Attribute Profile) profile which makes use of a generic data protocol called ATT (Attribute Protocol). GATT defiles profiles, services, and characteristics to represent, store, and transmit data. A profile can have multiple services and a service can have multiple characteristics. Profile and service can be predefined by Bluetooth SIG or be defined by users. It is characteristics really holds data of interest. Each characteristic distinguishes itself via a 16bit or 128bit UUID.
With above fundamental information about BLE, let’s take a look of a simple BLE application using Arduino and Bluefruit. Arduino is a popular open-source microcontroller development platform and Bluefruit is an BLE board using Nordic nRF8001 developed by adafruit.
The connection of these two are shown as below.
Below is Arduino code:
Use points to gain access. You can either purchase points or contribute content and use contribution points to gain access.