This tutorial will just create a simple Mesh network that sends randomly messages to other nodes within the Mesh network. There is no data structure or gateway functions to other networks like GSM or WiFi. The goal here is to have a working core Mesh network that can be used to build up a second layer of communication which can be anything you want to do, e.g. a network of sensors that send out their sensor data.
The code is written to work on either an ESP32 or a nRF52 microcontroller and is not compatible with other microcontrollers. The LoRa transceivers used are Semtech SX1262 transceivers. They are either connected to the microcontroller as a Adafruit Feather compatible breakout (Circuitrocks Alora RFM1262) or integrated into a SOC together with a Nordic nRF52 (Insight ISP4520).
This code is NOT written to work with the ArduinoIDE. It is structured to be compiled under PlatformIO using one of the IDE’s supported by PlatformIO. My favorite is Visual Studio Code.
A fairly deep explanation how this software works can be found in the Alora RFM162 – LoRa Mesh Network article
Have a look into the platformio.ini file. You can see examples for 5 different target boards, 2 nRF52 based boards and 3 ESP32 boards from different sources.
The code depends heavily on compiler defines to adapt different LoRa transceiver boards, used GPIO's, used libraries and available peripherals (display). These defines are set in the platformio.ini file. Here is a list of the important defines:
Other defines used in the code, but setup by the PlatformIO packages
In the application the BLE UART is activated and the boards starts advertising. On a nRF52 based board there is a DFU service, the OTA update service of Nordic to update the firmware on the chip. On all boards there is a simple BLE-UART service to send debug messages over BLE to a BLE-UART app like the Serial Bluetooth Terminal for Android