Bluetooth is a very popular technology.It was released in late 90's by Bluetooth special interest group(SIG) as way of transferring data between the devices.without wire over a short distance.The enhancements happened with new releases of Bluetooth like 2.0,3.0.4.0.4.1 etc. The bluetooth operates in 2.4 Ghz which is a Licence-free band.The technology is available in every mobile in the world.
Running bluetooth on mobile takes lot of battery energy and to use the Bluetooth for IOT devices which run on low power batteries can not afford to use Bluetooth. So SIG came out with new release of Blutooth i.e. Bluetooth Low Energy(BLE) Protocol with version 4.1 in 2013 which consumes less power and can be used for battery operated devices.
Both BLuetooth and bluetooth low energy support point to point and start network topologies.fof the device which out of range supported by Bluetooth is not possible.For IOT based devices the multi-multi poitnt communication is necessary for sensor devices spread across large areas.Bluetooth SIG came out with another release called Bluetooth Mesh which was released in 2017.
Bluetooth mesh is based on bluetooth le protocol but uses mostly advertising part of it In few cases it uses Gatt to interact with Device outside the mesh network.The information from nodes to nodes flows in the advertisement form.It uses the technique called managed Flooding.Every device in the network receives the advertisement which forwarded by the nodes called Router.The parameter called TTL(Time to Live) is set to restrict the continuous flooding across the network other it may cause the network congestion.The Relay node re-transmits the message as per value set for TTL parameter.
Device Roles for BLE Mesh
The devices in the BLE mesh network can play different roles.
Relay Node: The Relay node relays the messages received by it across the network.It re-transmits the message as per the value set in TTL. The Relay nodes are always stay in active mode.
Friend Node: These are the node to which end node is connected. The friend node saves the data received for the end node with it in the cache memory and whenever the end node wakes and polls for the messages then transmits the message to it.The Friend node always stays active.
End Node or Low Power Node: The node which acts as a sensor(e.g temperature) or the actuator(eg. Switch) and it does not relay the messages is a End Node.This node is connected with network through Friend Node.The End Node sleeps most of the times saving battery power as it is generally,power constrained device.It wakes up for transmitting the data or for polling the Friend Node for data.
The Node which is not part of the network is called un-provisioned Node.When it is provisioned then it becomes node in the network.
Proxy Node: The proxy node is used to interact with the device (Mobile Phone)outside mesh network The outside device gets paired with the proxy node and communication with the network with limited scope. The Proxy node is also used ofr provisioning of new Device into the mesh network.
Architecture of Bluetooth Mesh
BleMEsh Architecure(Courtesy:Bluetooth Website)
If the image above,we can see BleMesh mainly depends on the Bluetooth Low Energy(bluetooth le) Stack over which the BleMesh stack works.
Bearer Layer: This layer is responsible for communication of Ble Mesh Messages transmission and receipt.If define how PDUs for mesh communication wiill be handled by the syste. There are tow types of Bearer Advertising and Gatt.
The advertising bearer uses advertising and scanning capabilities of the Ble to transmit and receive the message.
The Gatt Bearer communicates with the device which does not support Advertising bearer and allows the external device to communicate indirectly with nodes of the network using the protocol called proxy protocol. The proxy protocol is nothing but an encapsulated Gatt Protocol which specially designed The node which supports this type of communication is a proxy node. The proxy node supports both advertising Bearer and Gatt Bearer.
Network Layer:The network layer defines the message address types and network message format which used to transport message from transport layer to bearer layer.
Lower Transport Layer: The lower transport layer receives the pdu from upper transport layer and sends it to the lower transport layer of the peer device. If required,it performs the segmentation of the PDU and reassembly.
Upper Transport Layer: The function of this layer is to encrypt ,decrypt and authenticate the data passing to and form Access layer.It also generates the control message internally eg. friendship or heartbeat.
Access Layer:The Access Layer defines the format of the application data.It defines and control the encryption and decryption process for upper transport layer. It also verifies the application data received from the upper transport layer.
Foundation Model Layer:This layer is responsible for implementing models with configuration and management of the network.
Models Layer:This layer is responsible for implementation the models.It implements the states,behaviours,messages,state binding etc.It tunes the connection parameters after wake-up.
Provisioning
The provisioning is a process by which a device joins the mesh network and becomes the node.
This process involves several steps including exchange of security keys.This process is carried out through device called provisioner eg. Tablet or Mobile on which provisioning app is running.The Provisioning progresses through 5 steps as stated below.
1, Beconing. The unprovisioned device interested in joining the mesh network,transmits the advertisement with Mesh Beacon AD type or flag set.The process can be initiated by pressing the key or combination of keys on the device.
2. Invitation:In this step,the Provisioner sends the invitation request or Provisioning PDU to the device.The device responds by sending information about it with the capabilities supported in Provisioning Capabilities PDU.
3.Exchange of Public Keys:The Provisioner and the unprovisioned device exchange the public keys which may static or for short duration.These keys can be exchanged directly or through Out of band Method eg.NFC.
4. Authentication:In this step the new device outputs a random number as per its capabilities.It may indicate it using the flashing of the LED on the Device.The user enters the random number in the Provisioner. Then the cryptographic communication takes place between the device and Provisioner and the authentication process is completed.
5. Distribution of .of Provisioning data:After the completion of the authentication process,each device generates its session keys from the privates keys and the public keys are exchanged between the devices.This session key is used to exchange the communication data for provisioning Process.At the end of the Provisioning the new device has a Network Key(NetKey),a mesh security parameter called IV index and a unicast address.Now the new device becomes node and is a part of mesh network.
Security
The Bluetooth Mesh Network uses security and which is mandatory.The security is used at different levels like Application,Network and Device.
Network level Security:When new device joins the network it gets the Network Key or NetKey for the mesh network.This key is common for the particular network.A network encryption key and privacy keys are directly generated form Netkey.In possession of the NetKey allows the member node to decrypt and authenticate the communication packet upto network layer,This allows the Relay node to carry out the re-transmission of the PDU.But every member can not decrypt the data upto Application level.
Application Keys:Each network is sub-divided into groups as per the application it performs.For example the light and swicthes nodes can form a separate group.Each application group has its unique Application key(AppKey) and NetKey. The member node which is in possession of app key,can decrypt the application data and initiate the action.The AppKeys are used by the upper Transport Layer to decrypt and authenticate the application message to pass it to Access Layer.
Device keys:Every Device in the mesh Network has its own device key(DevKey) which is known to the Provisioner Application.The device Key is used during provision process by the device and the provisioner to secure the communication.
The Mesh network provides security againts Trash Can attack and Replay Attack.The Privacy key derived from the NetKey is used to obsfuscate the network PDU header and source address so that no one can intercept and track the device traffic.
How Bluetooth Mesh Works
The BluetoothMesh uses the managed flooding technique to send the message across the network.Every nodewhich is in the radio range receives the message.Every node can decrypt the message up to network layer.The Relay node forwards the message to next nodes.As the message travels through multi path so the network is reliable for message delivery.
The BluetoothMesh uses the Publish and Subscribe model for message delivery.The act of sending the message across the network is called publishing.When nodes in the network are configured to specific message or the addresses are called subscriber. The Publisher can address the message to the Group address or Virtual Address.
Publish-Subscribe Model(Credit Bluetooth)
In the image above,Switch 1 publishes message to the address kitchen to which Light 1,Light 2,Light 3 are subscribed.The Light 3 is a also subscribed to the Dinning room address to which Switch 2 publishes message.
The switch 4 publishes message to Bedroom to which Light 6 is subscribed.
The switch 5 and switch publish message to the address Garden to which Light 7,Light 8 and Light 9 are subscribed,
The above examples how flexible and scalable this model is.
Conclusion.
The BluetoothMesh is from Bluetooth SIG can play significant role in the IOT field.The main advantage of this Mesh technology is that it can be directly accessed through Mobile or Tablet PC without adding new Hardware.The Low power is also promising feature of this technologies.Big sensor network can seamlessly established with this technologies.It can compete with other mesh Supporting technologies Like Thread,Zigbee,Zwave Etc.