BLE Fundamentals
An excellent resource for understanding the fundamentals of BLE is here:
The Ultimate Bluetooth Low Energy (BLE) Tutorial Novel Bits
Here are notes from my viewing of this video:
BLE Overview
- Low power consumption
- RF ISM Band (2.4GHz)
- RF Spectrum split into 40 Channels:
3 x Primary Advertisement Channels
37 x Secondary Advertisement & Data Transfer - BLE is designed for data burst transmission (RF is turned on & off to conserve power)
- Range: Variable and application specific. From a few metres to over one kilometre.
Long range is achieved through forward error correction (FEC), rather than RF power. - Data Throughput: Radio = 2Mbps, Actual = 1.4Mbps
- Uses Adaptive Frequency Hopping to avoid collisions (within the band)
BLE Fundamental Concepts
- Peripherals & Centrals
- Advertising & Scanning
- Connections
- Characteristics & Services
1. Peripherals & Centrals
The Peripheral device sends out advertising data for other devices to discover it.
This to connect to it, or just to read its advertising data.
This to connect to it, or just to read its advertising data.
The Central is the device that discovers these advertising packets and, if the advertising packet allows for, connects to that Peripheral device. Example of a device that does not connect: Bluetooth Beacon.
The Central takes on the heavy lifting in terms of timing and parameters of the BLE connection. Due to this a Central consumes more power than a Peripheral.
Multi-connections are possible. Ie: Peripheral to Central, Peripheral to Peripheral, Central to Central and multiples.
2. Advertising & Scanning
Advertising mode is when a Peripheral sends out packets of data called: "Advertising Packets", for other devices to connect to.
Peripherals send out Advertising packets on the three primary advertising channels.
The Central will be continuously scanning for Advertising packets. Different Advertising packets are used. Some allow connections, while others do not (Beacons).
Advertising Packet Data generally contain at least:
- Device name
- TX power
- Service supported by the device
- Appearance ID which identifies the type of device.
The Advertising interval (which determines how quickly a connection can be made) varies between:
20ms - 10.24s.
20ms - 10.24s.
On the Central side there are two key parameters:
- Scan Window: how long to scan for advertising packets
- Scan Interval: how often to scan for advertising packets.
3. Connections
For a connection to occur a few things need to happen:
- A Peripheral needs to be sending out connectable Advertising Packets
- The Central needs to be scanning for Advertising Packets on the three primary advertising channels.
- Once the Central sees a Connectable Advertising Packet, it will send out a Connection Request Packet to the Peripheral.
- The Peripheral receives the Request and responds with a Packet. Once the Central receives this Packet, a Connection is considered to be established. The two devices are now Connected.
Connection key parameters:
- Connection Interval - How often the C & P exchange data.
- Peripheral Latency - Number of times a P can skip sending a packet before the C drops the Connection.
- Supervision Timeout - Decide how much time should pass, before a Connection should be lost.
4. Services & Characteristics ("Attributes")
This is how BLE devices organise and structure the data that is exposed to other devices to discover it.
Characteristic
A piece of info or data that a BLE device wants to expose to another device.
Eg: Our sensor reading.
Eg: Our sensor reading.
A Characteristic is used for allowing another device to control the behaviours of the BLE device that's exposing its data.
Service
A Service is a grouping of one or more Characteristics.
Usually, Characteristics are grouped in one Service.
Eg: Service = "Environmental"
Characteristic#1 = "Temp"
Characteristic#2 = "Humidity"
Characteristic#3 = "Air Qual"
To finish these video notes:
New BLE specifications are coming out regularly!