The Bluetooth Mesh is a profile specification developed and published by the Bluetooth SIG. This document explains the basic concepts of the Bluetooth Mesh and gives an overview of the operation and capabilities of the profile, as well as explaining the life cycle of a mesh device. For more specific information about Nordic Semiconductor's implementation of the Bluetooth Mesh, see the mesh architecture documentation.
藍牙MESH的基本概念
藍牙MESH是一個由藍牙團體開發和發布的概要文件規范,該文檔解釋了藍牙MESH的基本概念,並概述了概要" profile"的操作和功能,並解釋了一個mesh設備的生命周期。要了解更多關於北歐半導體實現藍牙網格的信息,請參閱MESH架構文檔。
Relation to Bluetooth low energy
The Bluetooth Mesh is based on the Bluetooth low energy part of the Bluetooth 4.0 Specification and shares the lowest layers with this protocol. On-air, the Bluetooth Mesh physical representation is compatible with existing Bluetooth low energy devices, as mesh messages are contained inside the payload of Bluetooth low energy advertisement packets. However, Bluetooth Mesh specifies a completely new host layer, and although some concepts are shared, Bluetooth Mesh is incompatible with the Bluetooth low energy host layer.
與低功耗藍牙的關系
藍牙MESH是基於藍牙4.0規范的藍牙低能量部分,並與該協議共享最低層。在空中,藍牙MESH物理層表示與現有的低功耗藍牙設備兼容,因為MESH信息包含在藍牙低能量廣播包的有效負載中。然而,藍牙MESH指定了一個全新的主機層,盡管一些概念是共享的,但藍牙MESH與低功耗主機層是不兼容的。
藍牙MESH和低功耗藍牙技術之間的關系
Application areas
Bluetooth Mesh primarily targets simple control and monitoring applications, like light control or sensor data gathering. The packet format is optimized for small control packets, issuing single commands or reports, and is not intended for data streaming or other high-bandwidth applications.
Using Bluetooth Mesh causes higher power consumption than traditional Bluetooth low energy applications. This is mainly due to the need for keeping the radio running constantly. Therefore, unlike Bluetooth low energy advertisers, active mesh devices cannot be run off coin-cell batteries for extended periods of time.
Bluetooth Mesh supports up to 32767 devices in a network, with a maximum network diameter of 126 hops.
應用領域
藍牙MESH主要針對簡單的控制和監視應用,比如光控或傳感器數據采集。包格式針對小的控制包進行了優化,發出單一的命令或報告,並且不適合用於數據流或其他高帶寬的應用程序。使用藍牙MESH比傳統的低功耗藍牙技術更能消耗電能。這主要是由於需要保持無線電的持續運行。因此,不像BLE的廣播客戶,活躍的網狀設備不能在長時間內關閉電池。在一個MESH中,藍牙MESH最多支持32767個設備,最大的MESH直徑為126跳。
Network topology and relaying
Bluetooth Mesh is a broadcast-based network protocol, where every device in the network sends and receives all messages to and from all devices within radio range. There is no concept of connections in a mesh network. Any device in the network may relay messages from any other device, which makes it possible for a mesh device to send a message to a device outside of radio range by having one or more other devices relay the message towards the destination. This property also allows devices to move around and drop in and out of the network at any time.
網絡拓撲和中繼
藍牙MESH是一個基於廣播的網絡協議,在這個網絡協議中,網絡中的每一個設備都發送和接收來自無線電范圍內所有設備的所有消息。在網狀網絡中沒有連接的概念。網絡中的任何設備都可以從其他設備中傳輸消息,這使得一個網絡設備可以通過讓一個或多個其他設備將消息傳遞到目的地,從而將消息發送到無線電范圍之外的設備上。這一特性還允許設備在任何時候移動和退出網絡。
Mesh transport
Bluetooth Mesh utilizes the Bluetooth low energy advertiser and scanner roles, communicating through Bluetooth low energy advertisement packets. The advertisement packets are picked up by nearby mesh devices and handled like other Bluetooth low energy advertisement packets. The mesh packets are represented with a unique AD type and added to the advertisement packet payload.
Bluetooth low energy devices send advertisement packets at regular advertisement intervals, and mesh packets are no exception. However, unlike traditional advertisers, mesh devices will change their advertisement payload on every transmission, broadcasting new mesh packets as they are queued up in the stack. Every Bluetooth Mesh advertisement is transmitted only once for every device, and if there is no traffic in the mesh, the devices stay silent.
MESH傳輸
藍牙MESH利用BLE的廣播和掃描儀角色,通過BLE的廣播包進行通信。廣播包被附近的MESH設備接收,並像其他BLE的低能量廣播包一樣處理。MESH數據包以唯一的廣播類型表示,並添加到廣播層的有效負載中。
BLE在定期的廣播間隔發送廣播包,而MESH數據包也不例外。然而,與傳統的廣播者不同的是,MESH設備將會在每次傳輸中改變廣播層的有效負載,在堆棧中按照隊列的方式排列新的MESH包。每個藍牙MESH廣播包只在每台設備上傳輸一次,如果在MESH中沒有流量,設備就會保持沉默。
Relays
Bluetooth Mesh expands the range of the network by relaying messages. Any mesh device may be configured to act as a relay, and no dedicated relay devices are needed to build a network. Every device acting as a relay will decrement the Time To Live (TTL) value in received messages and forward them if the TTL is two or higher. This undirected relaying is referred to as messageflooding and ensures a high probability of message delivery, without requiring any information on the network topology. The Mesh Profile Specification does not provide any routing mechanisms, and all messages are forwarded by all relays until the TTL value reaches zero. To avoid messages being forwarded by the same relays over and over, all mesh devices maintain a message cache. This cache is used for filtering out packets that the device has already handled.
The flooding based approach to message relaying can cause a lot of redundant traffic on air, which may impact the throughput and reliability of the network. Therefore, it is highly recommended to limit the number of relays in a network to restrict this effect. The rate of relay-enabled devices in the network is a trade-off between message route-redundancy and reliability. It should be tuned according to network density, traffic volumes, network layout, and requirements for reliability and responsiveness.
中繼器
藍牙mesh通過轉播消息來擴展網絡的范圍。任何網絡設備都可以配置為一個中繼器,並且不需要專門的中繼設備來建立一個網絡。作為中繼的每一個設備都將減少接收消息的時間(TTL)值,如果TTL是2或更高,則轉發它們。這種無定向的中繼被稱為消息泛濫,並確保消息傳遞的高概率,而不需要任何關於網絡拓撲的信息。網格配置文件規范不提供任何路由機制,所有的消息都由所有的中繼轉發,直到TTL值達到0。為了避免被相同的中繼轉發的消息,所有的網格設備都維護一個消息緩存。這個緩存用於過濾設備已經處理過的數據包。基於洪水的消息傳遞方法可能會導致大量的空中冗余流量,這可能會影響網絡的吞吐量和可靠性。因此,強烈建議限制網絡中繼電器的數量來限制這種效果。在網絡中,啟用了中繼的設備的速率是消息的冗余和可靠性之間的一種權衡。它應該根據網絡密度、流量、網絡布局和可靠性和響應性需求進行調整。
GATT proxy
To enable support for legacy Bluetooth low energy devices that do not support receiving mesh packets, Bluetooth Mesh defines a separate protocol for tunneling mesh messages over the Bluetooth low energy GATT protocol. For this purpose, the Mesh Profile Specification defines a GATT bearer and the corresponding GATT Proxy Protocol. This protocol allows legacy Bluetooth low energy devices to participate in the mesh network by establishing a GATT connection to a mesh device that has the proxy feature enabled.
The legacy device gets assigned an address and the necessary keys to become a full-fledged member of the network. The device receives the security credentials through the regular provisioning procedure or through some out-of-band mechanism.
GATT 代理
為了支持不支持接收網格數據包的傳統藍牙低功耗設備,藍牙MESH定義了一個單獨的協議,用於通過藍牙低功耗的GATT協議來實現隧道網消息。為此,MESH配置文件規范定義了一個GATT的持有者和相應的GATT代理協議。該協議允許傳統的藍牙低功耗設備通過建立一個GATT連接到一個具有代理特性的網格設備來參與MESH。
遺留設備被分配一個地址和必要的密鑰,成為網絡的正式成員。該設備通過常規的配置過程或通過一些帶外的機制接收安全憑據。
Power consumption
To enable broadcast-based communication, the devices must continuously keep their radio in listening mode, causing significantly higher power consumption than in a typical Bluetooth low energy device. To enable low power devices to take part in the mesh network, Bluetooth Mesh contains a low power friendship feature. This protocol lets low power devices establish a relationship with a regular mesh device, which will then cache and forward messages to the low power device at regular intervals. This saves the low power device from having to stay on to listen for incoming messages.
電力消耗
為了支持基於廣播的通信,設備必須連續不斷地將無線電保持在收聽模式中,這比典型的低功耗藍牙低功耗設備的功耗要高得多。為了使低功耗設備能夠參與到MESH網絡中,藍牙MESH包含了一個低功耗的友好功能。該協議允許低功耗設備與常規的mesh設備建立一種關系,然后定期將消息緩存和轉發給低功耗設備。
這樣就可以節省低功率設備,讓它不必再繼續聽傳入的消息了。
Addressing
The Bluetooth Mesh addressing scheme is different from the Bluetooth low energy addressing scheme. It features three types of addresses:
- Unicast addresses: unique for every device
- Group addresses: allow forming a group of devices and addressing them all at once
- Virtual addresses: untracked UUID-based addresses with a large address space
When a device is added to a network, it is assigned a range of unicast addresses that represents it. A device's unicast addresses cannot be changed and are always sequential. The unicast address space supports having 32767 unicast addresses in a single mesh network. Unicast addresses can be used by any application to directly send a message to a device.
Group addresses are allocated and assigned as part of the network configuration procedure. A group address may represent any number of devices, and a device may be part of any number of groups. There can at most be 16127 general purpose group addresses in a mesh network.
The virtual addresses can be considered a special form of group addresses, and can be used to represent any number of devices. Each virtual address is a 128-bit UUID generated from a text label. The virtual addresses do not have to be tracked by a network configuration device, and in this way, users can generate virtual addresses prior to deployment or addresses can be generated ad-hoc between devices in the network.
尋址
藍牙MESH尋址方案與低功耗藍牙尋址方案不同。它有三種類型的地址:
- 單一地址:每個設備的唯一
- 組地址:允許形成一組設備,並一次性處理它們
- 虛擬地址:未跟蹤的基於uuid的地址,地址空間很大
當一個設備被添加到一個網絡時,它被分配一個代表它的單一地址的地址。設備的單位地址不能更改,而且總是順序的。單一的地址空間支持在單一的網格網絡中擁有32767個單位地址。任何應用程序都可以使用單播地址直接向設備發送消息。組地址分配和分配作為網絡配置過程的一部分。組地址可以表示任意數量的設備,並且設備可能是任意數量的組的一部分。在一個網狀網絡中最多可以有16127個通用目標組地址。虛擬地址可以看作是組地址的一種特殊形式,可以用來表示任意數量的設備。每個虛擬地址都是由一個文本標簽生成的128位UUID。虛擬地址不需要通過網絡配置設備來跟蹤,這樣,用戶可以在部署之前生成虛擬地址,也可以在網絡中的設備之間生成特定的地址。
Provisioning
Before a device can participate in normal mesh operation, it must be provisioned. During provisioning, a device gets added to the network and is assigned unicast addresses, a network key, and a device key. The provisioning is done by a Provisioner, which is a trusted device with access to the full list of devices in the network and their addresses. After the new device has been provisioned, the provisioner is expected to use the new device's device key to establish a secure channel to configure it.
供應
在一個設備能夠參與正常的網格操作之前,必須先提供它。在供應過程中,一個設備被添加到網絡中,並被分配到一個單一的地址、一個網絡密鑰和一個設備密鑰。供應是由一個供應者完成的,這是一個受信任的設備,可以訪問網絡中的所有設備和它們的地址。在配置了新設備之后,預計將使用新設備的設備密鑰來建立一個安全通道來配置它。
Models and Elements
To standardize communication between devices from different vendors, the Mesh Profile Specification defines an access layer, which routes mesh messages between the various models in a device. A model represents a specific behavior or service and defines a set of states and messages that act on these states. The Mesh Profile Specification and the Mesh Model Specification each define a set of models to cover typical usage scenarios like device configuration, sensor readings, and light control. In addition to these, vendors are free to define their own models with accompanying messages and states.
The models in a device belong in elements. Every device has one or more elements, each acting as a virtual entity in the mesh with its own unique unicast address. Each incoming message is handled by a model instance in an element. To make it possible to uniquely resolve how messages are handled, only one model instance per element can implement a handler for a specific message opcode. If a device has multiple instances of the same model, each instance must be assigned to a separate element. Similarly, if two models implement handlers for the same message, these models must be in separate elements.
To represent complex behavior with minimal message and state duplication, models can be made up of other models, potentially spanning multiple elements. These models are referred to as extended models. Models that are purely self-contained are referred to as root models.
Models talk to each other through a publish and subscribe system. Every model may subscribe to a set of group and virtual addresses, and the model will only handle messages that are published to one of its subscription addresses or the containing element's unicast address. Any model may maintain a publish address that it publishes messages to. This publish address can be of any type.
模型和元素
模型和元素為了規范來自不同供應商的設備之間的通信,網格配置文件規范定義了一個訪問層,它在設備的不同模型之間路由網格消息。模型表示特定的行為或服務,並定義一組狀態和消息,這些狀態和消息在這些狀態下執行。網格配置文件規范和網格模型規范分別定義了一組模型來覆蓋典型的使用場景,比如設備配置、傳感器讀數和光控制。除了這些,供應商還可以自由地定義自己的模型,並提供相應的消息和狀態。
設備中的模型屬於元素。每個設備都有一個或多個元素,每個元素都在網格中作為一個虛擬實體,並具有自己唯一的單一地址。每個傳入消息都由一個元素中的模型實例處理。為了能夠唯一地解決如何處理消息的方式,每個元素只有一個模型實例可以為特定的消息操作碼實現一個處理程序。如果一個設備具有相同模型的多個實例,那么每個實例必須被分配給一個單獨的元素。類似地,如果兩個模型為相同的消息實現處理程序,那么這些模型必須在單獨的元素中。
為了用最少的消息和狀態重復來表示復雜的行為,模型可以由其他模型組成,可能跨越多個元素。這些模型被稱為擴展模型。純自包含的模型稱為根模型。
模型通過發布和訂閱系統相互通信。每個模型都可以訂閱一組組和虛擬地址,並且模型只處理發布到其訂閱地址或包含元素的單播地址的消息。任何模型都可以維護發布消息的發布地址。這個發布地址可以是任何類型的。