Low Energy Bluetooth (BLE) is a wireless communication technology that has the advantages of low power consumption, short distance（ Refer article ：WHAT DOES IT HAVE TO DO WITH ZIGBEE, BLUETOOTH, WI-FI? ）, and security. It has been widely used in communication between various smart devices. This article will introduce the basic process of low energy Bluetooth connection to help readers better understand and apply this technology.
The basic process of low energy Bluetooth connection includes
. We will introduce the specific contents of each step below.
: Before establishing a low energy Bluetooth connection, the devices need to be scanned. There are two scanning methods: active scanning and passive scanning. Active scanning refers to the central device (such as a phone) initiating a scan to search for peripheral devices (such as a Xiaomi smart bracelet) in the vicinity. Passive scanning is when the peripheral device is discovered by the central device while broadcasting its information. Scanning can obtain device unique identifiers (MAC addresses) and device names. The following image shows the broadcasting process:
: Connection refers to establishing a communication link between the central device and the peripheral device. Connection includes the following steps: first, the central device sends a connection request to the peripheral device. Then, the peripheral device replies with a connection response and begins to establish a communication link. Next, the central device and the peripheral device perform service discovery to determine the services and characteristic values that each other supports. Finally, the central device and the peripheral device perform characteristic value reading, writing, subscription, and other operations.
: After the connection is established, data transmission can be performed between the central device and the peripheral device. Low energy Bluetooth communication uses a "master-slave" architecture, which means that the central device controls the communication process, while the peripheral device passively accepts and responds. During communication, the central device sends commands to the peripheral device, including read, write, subscribe, and other operations. The peripheral device processes the commands and returns the results to the central device. The following image shows the connection process:
The Bluetooth advertising packet is 37 bytes (maximum length), with the device address occupying 6 bytes, and the remaining 31 bytes can be customized. The 31 available bytes are organized into n AD structures according to a certain format, as shown in the following image:
In summary, the low energy Bluetooth connection process includes scanning, connection, and communication. Through these steps, a stable and efficient communication link can be established between the central device and the peripheral device, enabling data transmission and control operations. In daily life, low energy Bluetooth has become an important means of interconnecting smart devices, bringing people more convenient and intelligent life experiences, such as lighting, temperature, security, etc. Users can use smartphones or voice assistants to control and manage these devices, thereby improving the comfort and safety of their homes.