This demo demonstrates the fast provisioning of ESP BLE Mesh network and how to use the EspBleMesh app to control an individual provisioned node or all the provisioned nodes.
A video of this demo can be seen here
- EspBleMesh App for Android
- ESP BLE Mesh SDK v0.6(Beta Version)
- ESP32 Development Boards
Note:
- Please flash the
ble_mesh_fast_prov_server
to your boards first;- To have a better understanding of the performance of the BLE Mesh network, we recommend that at least 3 devices should be added in your network.
- We recommend that you solder LED indicators if your development board does not come with lights.
- Please check the type of board and LED pin definition enabled in
Example BLE Mesh Config
by runningmake menuconfig
- Enter the directory: examples/bluetooth/ble_mesh/ble_mesh_fast_provision/ble_mesh_fast_prov_server
- Make sure that the
IDF_PATH
environment variable was set in accordance with your current IDF path - Check the version of your toolchain. Version 4.1 or newer should be used.
- Run
make -j4 flash
to compile codes and flash the codes to the device.
Note:
Please click on the Exit button if you see the following windows.
- Please establish a connection between your device and PC, using the correct serial number, if you want to monitor the operation of this device on PC.
Please launch the EspBleMesh
app, and follow the steps described below to establish a BLE Mesh network and control any individual node or all the nodes.
- Click on the upper left corner to see more options;
- Click on Provisioning to scan nearby unprovisioned devices;
- Choose any unprovisioned devices in the scanned list;
- Enter the number of devices you want to add in your mesh network;
- Wait until all the devices are provisioned;
- Click on the upper left corner to see more options;
- Click on Fast Provisioned to see all the provisioned devices;
- Control your devices.
Note:
Please disable your Bluetooth function on your phone, enable it and try again, if you have encountered any connection issues.
- Phone - Top Provisioner
- The device that has been provisioned by Phone - Primary Provisioner
- Devices that have been provisioned and changed to the role of a provisioner - Temporary Provisioner
- Devices that have been provisioned but not changed to the role of a provisioner - Node
- The Top Provisioner configures the first device to access the network with the GATT bearer.
- The Top Provisioner sends the
send_config_appkey_add
message to allocate the Appkey to this device. - The Top Provisioner sends the
send_fast_prov_info_set
message to provide the necessary information so the device can be changed to a Primary Provisioner. - The device calls the
esp_ble_mesh_set_fast_prov_action
API to change itself into the role of a Primary Provisioner and disconnects with the Top Provisioner. - The Primary Provisioner sends the
send_config_appkey_add
message to allocate the Appkey to an other device. - The Primary Provisioner sends the
send_fast_prov_info_set
message to provide the necessary information so the device can be changed to a Temporary Provisioner. - The device calls the
esp_ble_mesh_set_fast_prov_action
API to change itself into the role of a Temporary Provisioner and starts its address timer. - The Temporary Provisioner collects the addresses of nodes that it has provisioned and sends these addresses to the Primary Provisioner, when its address timer times out, which indicates the Temporary Provisioner hasn't provisioned any devices for 10s.
- The Primary Provisioner reconnects to the Top Provisioner when its address timer times out, which indicates the Primary Provisioner hasn't received any messages from the Temporary Provisioners for 10s.
- The Top Provisioner sends the
node_adress_Get
message automatically after reconnecting with the Primary Provisioner. - At this point, the Top Provisioner is able to control any nodes in the BLE Mesh Network.
Note:
The nodes in the BLE Mesh Network only disable its provisioner functionality after it has been controlled by the Top Provisioner for at least one time.