Dusun IoT’s Bluetooth Low Energy beacon devices are hardware transmitters that use BLE 4.2/5.0/5.2 protocols to broadcast their identifier to nearby BLE gateways and readers. These beacon devices enable various applications such as Bluetooth proximity marketing, indoor positioning, and BLE asset tracking, among others.
This article provides technical details about the working principle, data packets, BluFi services, and Bluetooth network configuration of BLE beacons, aiming to help people who are developing BLE beacon devices gain a comprehensive understanding of BLE beacons and their capabilities.
How Do BLE Beacons Work?
BLE (Bluetooth Low Energy) beacon devices work by continuously broadcasting specific Bluetooth packets that can be detected by nearby devices, such as smartphones or a Bluetooth gateway. Mobile apps or other software running on Bluetooth-enabled devices can scan for and detect these advertising packets.
Once the app detects advertising packets from BLE beacon devices, it can filter and analyze the content of the packets. Based on the filtered results, the app can create a whitelist that includes only the detected beacon devices that meet the specified criteria.
By using this approach, the BLE beacon device ensures that only the desired devices are added to its network or ecosystem.
Read More: What are BLE Beacons and How Beacon Technolgy Works?
Types of Data Packets Sent by BLE Beacons
Bluetooth protocol is a wireless communication standard that allows devices to connect and exchange data over short distances. It governs how BLE beacon devices communicate with other Bluetooth-enabled devices, such as smartphones and BLE beacon gateways.
In the context of beacon devices, two important components are Advertising packets (Advertising Data) and Response packets (Scan Response).
Advertising Packets (Advertising Data)
When a beacon device is in its advertising mode, it periodically broadcasts Advertising Data packets. These packets store customized data specific to the product, such as unique identifiers (UUIDs), major and minor values, signal strength, and other relevant data. Advertising packets are transmitted at regular intervals and are used to advertise the presence of the beacon to nearby devices.
Response Packets (Scan Response)
Scan Response packets, on the other hand, are optional packets that can be sent by the beacon device in response to a scan request from a scanning device (such as a Bluetooth gateway). Scan Response packets can provide additional information beyond what is included in the Advertising Data packets. This information can include device-specific data, manufacturer-specific data, or any other custom data that the beacon device wants to convey to the scanning device. It provides an opportunity for the beacon device to provide more detailed or context-specific information to the scanning device.
Structure and Content of BLE Beacons’ Advertising Data and Scan Response Packets
The structure and content of Advertising Data packets in Bluetooth Low Energy (BLE) beacon devices can vary, but there are common fields and information that can be found within these packets. Here’s an overview of the different fields and their meanings within the Bluetooth Advertising Data and Scan Response packets.
Advertising Data
The maximum advertising data length for BLE beacons is 31 bytes. The data format follows the Bluetooth broadcast packet standard and includes the following fields:
Name | Length (byte). | Data Type | Content Definition |
Physical Connectivity Capabilities | 2 | 0x01 | 06: normal discovery mode |
Vendor Custom Data | 19 | 0xff | Format: dusun logo + MAC + PID |
Peripheral Connection Interval Range | 5 | 0x12 | |
Full Name of the Device | Lengthening | 0x09 | Such as” “dsgw030” |
The vendor-defined data format is as follows:
Name | Length (byte). | definition |
SIG member ID | 2 | Default 0 |
Vendor identification | 5 (ascii) | dusun |
MAC | 6 | Bluetooth Mac, hexadecimal |
PID | 2 | IoT background generation, base 16 |
One-click Network Configuration Request Flag | 1 | The default is 0, set to 1 if the device wants to be configured by the router and other routers with one click |
Version Number | 1 | integer |
Bluetooth Type | 1 | 1. Ordinary Bluetooth2. Bluetooth Wi-Fi dual mode3. Bluetooth Wi-Fi dual-mode Mesh4. Android screen Bluetooth |
Scan Response
Name | Length | Data Type | Content Definition |
Device Name | Lengthened, no more than 31 | 0x09 | Device name, such as: dsgw |
BluFi Service and Characteristics: How BLE Beacon Transmit Data
Bluetooth data transmission of BLE beacons is mainly through BluFi Service, which defines two Characteristics: BluFi Write Characteristic and BluFi Notify Characteristic. The specific definitions are as follows:
GATT UUID related instructions:
- BluFi Service UUID: 0xAAAA (16-bit);
- BluFi Write Characteristic: 0xAA01 (used for writing data from the mobile app to Bluetooth beacons; writable)
- BluFi Notify Characteristic: 0xAA02 (used for Bluetooth beacon to report data to the mobile app; readable and notified)
By utilizing the BluFi Write Characteristic, the mobile app can write data to the Bluetooth beacon device, enabling control or configuration of the device. On the other hand, the BluFi Notify Characteristic allows the Bluetooth beacon device to report data to the mobile app, providing real-time updates or information.
Bluetooth Beacon Network Configuration Using Gateways
1. Enabling Bluetooth Broadcasting on the Beacon Device:
To enable Bluetooth broadcasting on the Beacon device, follow these steps:
- Press and hold the network key on the front of the gateway for 5 seconds.
- This action will activate the Bluetooth module broadcasting.
- Look for the gateway name “DusunGW30” to identify the device.
2. Connecting to the Gateway and Retrieving Gateway Information:
To connect to the gateway and retrieve gateway information, follow these steps:
- Enable Bluetooth on your mobile device.
- Connect to the DusunGW30 gateway device by selecting it from the available Bluetooth devices list.
- Once connected, send a request to the “BluFi Notify Characteristic” (0xAA02) to retrieve the current information of the gateway.
- The gateway will respond with the following information:
– Bluetooth version: “5.2”
– Product: “DSGW-030”
– MAC address: “30:ae:7b:e2:23:86”
– Gateway version: “1.0.0.1”
3. Sending Wi-Fi Distribution Network Information and MQTT Information:
To send Wi-Fi distribution network information, MQTT information, and enable encryption, follow these steps:
- Send the Wi-Fi distribution network information using the “BluFi Write Characteristic” (0xAA01). The data should include:
– SSID: “DUSUN_1E80”
– Password: “12345678”
- Send the MQTT information using the “BluFi Write Characteristic” (0xAA01). The data should include:
– Heartbeat: 60
– Client ID: “30:ae:7b:64:0b:7a”
– QoS: 0
– SSL Type: 0
– Password: “30:ae:7b:64:0b:7a-00000001”
– Username: “30:ae:7b:64:0b:7a-00000001”
– Address: “mqtt.remotecare4u.com”
– Port: 1883
– Retain: 0
4. Encryption and Packet Integrity Verification:
To encrypt data using AES and perform packet integrity verification, follow these steps:
- Use AES encryption with the key “www.hzdusun.com” and key length of 16.
- Use the AES-DUSUN-IOT-V1 initialization vector (IV) for encryption.
- Implement the CRC16 checksum algorithm for packet integrity verification. The provided implementation uses a buffer of uint8_t type and returns a uint16_t value representing the checksum.
Conclusion
This article serves as a valuable resource for individuals involved in the development of BLE beacon devices. By delving into the working principle, data packets, BluFi services, and Bluetooth network configuration, it aims to provide a comprehensive understanding of BLE beacons and their capabilities. Armed with this technical knowledge, IoT hardware developers can make informed decisions, optimize their implementations, and unlock the full potential of BLE beacon technology.
Dusun IoT is a leading company specializing in the design and manufacturing of cutting-edge BLE Beacon devices. We offer a wide range of high-quality BLE beacon devices delivering superior performance, reliability, and seamless connectivity in diverse IoT applications.
We understand that every project is unique, and offer exceptional ODM services to meet specific requirements. By choosing Dusun IoT, you benefit from our extensive experience, state-of-the-art manufacturing facilities, and a commitment to delivering excellence.
Explore our range of products, and feel free to consult our team for further information or inquire about our ODM services.