Background
In school, I used Bluetooth technology to participate in competitions (and won awards); as Bluetooth is a common protocol in the Internet of Things, it is necessary to study it in depth. The subsequent articles will focus on BLE (v4.0).
Introduction
Bluetooth technology was originally created by the telecommunications giant Ericsson in 1994 as a replacement for RS232 data cables. Bluetooth can connect multiple devices and overcome the challenges of data synchronization. As Bluetooth headsets, Bluetooth mice, Bluetooth speakers, and other Bluetooth devices gradually fill our lives, Bluetooth is no longer just a replacement for data cables.
Today, Bluetooth is managed by the Bluetooth Special Interest Group (SIG). The Bluetooth SIG has over 25,000 member companies worldwide, spanning telecommunications, computing, networking, and consumer electronics.
In simple terms, Bluetooth is a short-range broadband wireless technology that serves as a global open standard for voice and data wireless transmission. It uses advanced technologies such as Frequency Hopping Spread Spectrum (FHSS), Time Division Multiple Access (TDMA), and Code Division Multiple Access (CDMA) to establish information transmission between various communication and information systems over a small range.
Bluetooth uses frequency hopping technology to divide the transmitted data into packets, which are transmitted over 79 designated Bluetooth channels. Each channel has a bandwidth of 1 MHz. Bluetooth 4.0 uses a 2 MHz spacing, accommodating 40 channels. The first channel starts at 2402 MHz, with one channel per MHz, up to 2480 MHz. With the Adaptive Frequency Hopping (AFH) feature, it typically hops 1600 times per second.
Initially, Gaussian Frequency Shift Keying (GFSK) modulation was the only available modulation scheme. However, Bluetooth 2.0+EDR made the use of π/4-DQPSK and 8DPSK modulation possible in compatible devices. Devices running GFSK can operate at a Basic Rate (BR) with an instantaneous rate of up to 1 Mbit/s. The term Enhanced Data Rate (EDR) is used to describe the π/4-DPSK and 8DPSK schemes, which can reach rates of 2 and 3 Mbit/s, respectively. In Bluetooth radio technology, the combination of these two modes (BR and EDR) is collectively referred to as “BR/EDR RF”.
Bluetooth is a packet-based protocol with a “master-slave architecture”. A master device can communicate with up to seven slave devices in the same domain. All devices share the master device’s clock. Packet switching is based on a basic clock defined by the master device, operating at intervals of 312.5µs. Two clock cycles form a 625µs slot, and two time slots form a 1250µs gap pair. In the case of single-slot packets, the master device sends information in even slots and receives information in odd slots. The slave devices do the opposite. Packet capacity can be up to 1, 3, or 5 time slots, but in any case, the master device starts transmission from even slots, and the slave device starts transmission from odd slots.
Main Technical Features of Bluetooth:
(1) Operating Frequency Band: 2.4GHz ISM band, no license required. Most countries use 79 frequency points, with carrier frequencies of (2402+k) MHz (k=0, 1, 2…78), with a carrier frequency interval of 1 MHz. Uses TDD duplex mode.
(2) Transmission Rate: 1Mb/s (for versions 2.0 and above)
(3) Modulation Method: GFSK modulation with BT=0.5, modulation index of 0.28-0.35.
(4) Frequency Hopping Technology: Hopping rate of 1600 hops/second, increased to 3200 hops/second during link establishment (including paging and inquiry). Bluetooth reduces co-channel interference and ensures transmission reliability through fast frequency hopping and short packet technology.
(5) Voice Modulation Method: Continuous Variable Slope Delta Modulation (CVSD), strong anti-fading capability, acceptable voice quality even at a bit error rate of 4%.
(6) Supports Circuit-Switched and Packet-Switched Services: Bluetooth supports synchronous connection-oriented (SCO links) and asynchronous connectionless (ACL links) services, the former mainly transmitting real-time information like voice, and the latter primarily focusing on data packets. Voice and data can be transmitted separately or simultaneously. Bluetooth supports one asynchronous data channel, three concurrent synchronous voice channels, or a channel that transmits asynchronous data and synchronous voice simultaneously. Each voice channel supports 64kbps synchronous voice; the asynchronous channel supports 723.2/57.6kbps asymmetric duplex communication or 433.9kbps symmetric full-duplex communication.
(7) Supports Point-to-Point and Point-to-Multipoint Communication: Bluetooth devices can form two types of networks: Piconet and Scatternet. A Piconet is established by the connection of two devices and can consist of up to eight devices. In a Piconet, there is only one master device, and all others are slave devices. Different master-slave pairs can use different connection methods, and the connection method can change at any time during a communication session. Several independent Piconets can be linked together in a specific way to form a Scatternet. All Bluetooth devices are peer-to-peer, so there is no concept of a base station in Bluetooth.
(8) Operating Range: Bluetooth devices are classified into three power levels: 100mW (20dBm), 2.5mW (4dBm), and 1mW (0dBm), with effective operating ranges of 100 meters, 10 meters, and 1 meter, respectively.
Bluetooth Version Information
Main Bluetooth versions: 1.1
, 1.2
, 2.0
, 2.1
, 3.0
, 4.0
, 5.0
.
Version 1.1
Transmission rates of approximately 748~810kb/s, as it was an early design, it was easily affected by interference from products operating at the same frequency.
Version 1.2
Also has a transmission rate of only 748~810kb/s, but adds improved software anti-interference frequency hopping capabilities.
Version 2.0+EDR
An improved version of 1.2, with a transmission rate of approximately 1.8M/s~2.1M/s, it began to support duplex mode—allowing for voice communication while also transmitting files/high-quality images. Version 2.0 also supports stereo operation.
The most widely used is the Bluetooth 2.0+EDR standard, which was launched in 2004, and products supporting Bluetooth 2.0+EDR standard appeared in large numbers by 2006. Although significant technical improvements were made in the Bluetooth 2.0+EDR standard, the complex configuration processes and high power consumption issues inherited from the 1.X standard still existed.
Version 2.1
Better power-saving effects: Bluetooth 2.1 introduced the Sniff Subrating function, which saves power by setting the interval for signal acknowledgment between two devices.
Version 3.0+HS
On April 21, 2009, the Bluetooth Special Interest Group (Bluetooth SIG) officially announced the new generation standard specification “Bluetooth Core Specification Version 3.0 High Speed”. The core of Bluetooth 3.0 is “Generic Alternate MAC/PHY” (AMP), a new alternate radio frequency technology that allows the Bluetooth protocol stack to dynamically select the correct radio frequency for any task. Initially, it was expected to use new specifications for technologies including 802.11 and UMB, but UMB’s application was removed from the new specification.
Version 4.0 (also known as Bluetooth Smart)
Improvements in Bluetooth 4.0 mainly focus on three aspects: battery life, energy efficiency, and device variety.
General improvements in version 4.0 include enhancements necessary for promoting Bluetooth low energy mode, as well as security management services (SM) for the Generic Attribute Profile (GATT) and AES encryption.
Bluetooth 4.0 includes two versions, further divided into three sub-specifications: classic Bluetooth (BT, which includes traditional Bluetooth technologies v1.x v2.0
, and high-speed Bluetooth v3.0
) and the new Bluetooth low energy technology (BLE, Bluetooth Low Energy Module).
-
Classic Bluetooth: Classic Bluetooth includes the old Bluetooth protocols.
-
High-speed Bluetooth: High-speed Bluetooth is based on Wi-Fi.
-
Bluetooth Low Energy Protocol: Bluetooth Low Energy, previously known as Wibree, is a subset of Bluetooth version 4.0, featuring a completely new protocol stack for quickly establishing simple connections.
Low energy Bluetooth is developed on the basis of traditional Bluetooth. The Bluetooth low energy technology uses variable connection time intervals, which can be set from a few milliseconds to several seconds depending on the specific application. Additionally, because the BLE technology uses a very fast connection method, it can remain in a “disconnected” state (saving energy), during which both ends of the link can only be aware of each other and can only open the link when necessary, and then close the link in the shortest time possible.
As a replacement for the Bluetooth standard protocols from versions 1.0 to 3.0, BLE mainly targets applications with extremely low power requirements, powered by button batteries. Chip designs can be of two types: dual-mode, single-mode, and enhanced early versions.
-
In single-mode, only low-power protocol stacks can be executed. STMicroelectronics, Semtech, CSR, Nordic Semiconductor, and Texas Instruments have released single-mode Bluetooth low energy solutions. The reduced cost of single-mode chips makes high integration and compatibility of devices possible. One of its features is a lightweight link layer that provides low-power idle mode operation, easy device discovery, and reliable point-to-multipoint data transmission, with very low-cost advanced energy-saving and secure encrypted connections.
-
In dual-mode, Bluetooth Smart functionality is integrated into existing classic Bluetooth controllers. As of March 2011, Qualcomm, CSR, Broadcom, and Texas Instruments have announced chips that comply with this standard. The applicable architecture shares all existing RF and functions of classic Bluetooth, with the price increase compared to classic Bluetooth being almost negligible.
With low cost, cross-vendor interoperability, 3 milliseconds low latency, ultra-long range over 100 meters, AES-128 encryption, and many other features, Bluetooth 4.0’s effective transmission distance has also improved. The effective transmission distance of Bluetooth 3.0 is 10 meters (about 32 feet), while Bluetooth 4.0’s effective transmission distance can reach up to 100 meters (about 328 feet).
Version 5.0
Bluetooth 5.0 targets low-power devices, offering a wider coverage range and a speed increase of four times compared to version 4.2. Bluetooth 5.0 will add indoor positioning assistance, achieving indoor positioning with an accuracy of less than 1 meter when combined with Wi-Fi.
The upper limit of transmission speed in low-power mode is 2Mbps, double that of the previous 4.2LE version. The effective operating distance can reach 300 meters, four times that of the previous 4.2LE version. Navigation features are added to achieve indoor positioning within 1 meter.
To meet the demands of mobile clients, it has lower power consumption and is compatible with older versions.
Bluetooth System Composition
1. Radio: The wireless RF unit responsible for sending and receiving data and voice, characterized by short distance and low power. Bluetooth antennas are generally small and lightweight, belonging to microstrip antennas.
2. Link Controller: The baseband or link control unit that converts RF signals to digital or voice signals, implementing baseband protocols and other low-level connection procedures.
3. Link Manager: The link management unit responsible for managing communication between Bluetooth devices, establishing, validating, and configuring links.
4. Bluetooth software protocol implementation: The Host part, where different hosts can port different protocol stacks. Generally, Bluetooth chips communicate with the main control chip via UART, USB, SDIO, I2S, PcCard, etc.
Bluetooth Protocol Specification
According to the logical functions of Bluetooth protocols, the protocol stack is divided into three parts: application protocols, intermediary protocols, and transport protocols.
The implementation code of a protocol is called a protocol stack.
Transport Protocol
Responsible for confirming the position of Bluetooth devices and establishing and managing physical links between Bluetooth devices;
-
Low-level transport protocols: Bluetooth RF (Radio) part, baseband link management controller (Baseband & Link Controller), and Link Manager Protocol (LMP). Responsible for the physical implementation of wireless language and data transmission as well as networking between Bluetooth devices.
-
High-level transport protocols: Logical Link Control and Adaptation Protocol (L2CAP), Host Control Interface (HCI). These protocols shield high-level applications from low-level transport operations such as frequency hopping sequence selection and provide effective data packet formats for higher-level programs.
Intermediary Protocol
Provides necessary support for high-level application protocols or programs, offering different standard interfaces for applications.
-
Serial port emulation protocol: RFCOMM, Service Discovery Protocol: SDP, Interoperability Protocol: IrDA, Network Access Protocols: PPP, IP, TCP, UDP, Telephony Control Protocol: TCS, AT command set.
Here is a description of the image.
Application Protocol
The application software above the Bluetooth protocol stack and the protocols involved, such as dial-up internet access, voice functionality applications.
The Bluetooth application framework is as follows:
-
General application class framework: query, establish connection services, etc.;
-
Bluetooth telephone application class framework: telephone control, voice;
-
Bluetooth networking application class framework: related to network applications;
-
Object interaction service class framework: IrDA, OBEX;
-
Bluetooth audio/video control class framework.
The complete Bluetooth protocol stack is shown in the following diagram; not every application must use all protocols, but can use one or more of them.
Bluetooth Master-Slave Modules
-
The master is the party that can search for others and actively establish connections.
-
The slave cannot actively establish connections and can only wait for others to connect to it.
-
The master-slave integrated module can switch between master and slave modes, acting as either.
Advantages and Disadvantages of Bluetooth Technology
Advantages:
-
Low power consumption, suitable for battery-powered devices.
-
Inexpensive, applicable to low-cost devices.
-
Simultaneously manages data and voice transmission.
-
Low latency.
Disadvantages:
-
Limited transmission distance.
-
Data transmission rate is 24 Mb/s.
-
Protocol incompatibility between different devices.
-
Requires local data recording to ensure continuous data availability.
-
Potential for attacks: (Denial of Service, eavesdropping, man-in-the-middle attacks, message modification, resource abuse).
Bluetooth Protocol Classification
HFP (Hands-free Profile)
HFP (Hands-free Profile) allows Bluetooth devices to control phones, such as answering, hanging up, rejecting calls, and voice dialing, depending on whether the Bluetooth headset and phone support these functions.
HSP
HSP describes how Bluetooth headsets communicate with computers or other Bluetooth devices (such as mobile phones). Once connected and configured, the headset can serve as an audio input and output interface for remote devices, which is the most common configuration for current popular Bluetooth headsets used with mobile phones. It relies on 64 kbps encoded audio/s CVSD or PCM and a subset of AT commands from GSM 07.07, including basic control for answering calls, hanging up, and adjusting volume. Typical usage scenarios involve connecting wireless headsets to mobile phones. Several device types may use HSP: headsets, mobile phones, PDAs, personal computers, laptops.
A2DP
A2DP stands for Advanced Audio Distribution Profile, which allows for high-definition audio transmission using the chip in the headset. Headsets with A2DP support are Bluetooth stereo headsets. Audio can reach 44.1 kHz, while general headsets can only reach 8 kHz. If a mobile phone supports Bluetooth, it can use A2DP headsets as long as the A2DP protocol is loaded. The technical parameters usually mentioned refer to Bluetooth V1.0, V1.1, V1.2, V2.0—these indicate the Bluetooth technical versions and the speeds at which data is transmitted via Bluetooth. Whether they support A2DP specifically depends on whether the Bluetooth product manufacturer uses this technology.
AVRCP
AVRCP (Audio/Video Remote Control Profile) is designed to provide a standard interface for controlling TV, Hi-Fi devices, etc. This profile allows a single remote control device (or other devices) to control all A/V devices that users can access. It can be used in conjunction with A2DP or VDP.
AVRCP defines how to control streaming media features, including:
Pause
Stop
Start playback
Volume control
Other types of remote control operations
AVRCP defines two roles:
Controller: The controller is typically a remote control device that translates detected user actions into A/V control signals and then transmits them to the remote Bluetooth device. For “portable” type media players, the control device can be headphones that allow skipping tracks.
Target Device: The target device is the device whose features can be changed. In AVRCP, the target device is the actual player. The capabilities of conventional infrared remote controls can be implemented in this protocol.
AVRCP protocol specifies the scope of the AV/C digital interface command set, simplifying implementation and ease of operation. This protocol uses the AV/C device mode and command format for control messages, which can be transmitted via the Audio/Video Control Transport Protocol (AVCTP).
OPP
The Bluetooth communication program section must use the Object Push Profile (OPP) for data transmission between devices. The OPP profile is further divided into OPPC (client) and OPPS (server) profiles; the distinction is that only the client side can initiate data transmission. However, in scenarios where devices communicate with mobile phones, both the mobile phone can initiate data transmission requests and the device side may also need to initiate transmission requests, so it is necessary to implement both OPPC and OPPS profiles in the device.
PBAP
Phonebook Access Profile (PBAP)