This project contains source code for setting up a Bluetooth mesh network between Reel Board devices running Zephyr RTOS.
The project was initiated as a course project for the COMP 7570 Wireless Sensor Networks instructed by Dr. Rasit Eskicioglu at the University of Manitoba.
The Reel Boards connected via this project transmit sensor values such as:
- Temperature
- Humidity
Additionally, the distance between the nodes is estimated and reported in fractional metres.
The project was built and tested using Zephyr version 2.4. Here is the information of the Zephyr version file:
VERSION_MAJOR = 2
VERSION_MINOR = 4
PATCHLEVEL = 99
VERSION_TWEAK = 0
EXTRAVERSION =
More specifically, the Zephyr folder was checked out from this specific commit (3b89f4a).
The only required edition to this version of Zephyr's source code is copying the following file:
EDITED-Kconfig
from the repository to the following Zephyr directory:
zephyr/subsys/bluetooth/mesh/
this 'EDITED-Kconfig' should replace the Kconfig file already present in the directory.
Since the source project controls the nRF chip's Bluetooth mesh configuration, clearing this chip's ROM is required once to switch to the new mesh configuration. In order to do so, execute the following command:
pyocd erase -c chip -t nrf52
Also, during the first deployment, the boards need to be configured via Nordic nRF Connect app. For more information have a look at the Mesh Badge sample of Zephyr.
The boards require a calibration step before they can estimate their distance and generate the values.
The calibration step involves putting two boards facing each other in close vicinity (around 1 to 2 centimetres) and pressing the button on one of them. The board sends calibration data to the other device, triggering calibration data to be sent by the other one as well. During the calibration, 5 Bluetooth messages are transmitted from each of the boards, containing the proximity values. After the calibration, the boards are able to estimate their distance from each other with high accuracy (± 20 cm).
See the pictures below:
The distance is estimated by the RSSI values and can have a higher error by the fluctuations in the signal strength.
The mesh_app.c exposes the following method:
void get_mesh_summary(char* buffer);
This method provides a comprehensive summary of all the connected nodes' data and puts it in the provided buffer array. A sample output of two connected boards looks like the following:
3d78,25.6,22;1,6afc:0.1
6afc,25.9,23;1,3d78:0.1
Each line contains the following node information:
<Address>,<Temperature>,<Humidity>;<NeighborCount>{,<NeighborAddress>,<NeighborDistance>}*NeighborCount
So in the aforementioned example, the first board (first line) has an address of '3d78', the temperature of '25.6' centigrade, the humidity of '22' percent, '1' connected neighbor with address '6afc' in '0.1' metres of its vicinity. While the other node (second line) has the address of '6afc' reporting the node with the address of '3d78' as its neighbor.