Multi-frequency MeshCore with ESP-NOW
Background
What is MeshCore?
MeshCore is an off-grid text communications system which uses LoRa, enabling long-range communication between users without reliance on centralised infrastructure or the internet.
What is ESP-NOW?
ESP-NOW allows ESP32 devices to communicate with each other via a connectionless wireless protocol. By using ESP-NOW, the mesh avoids relying on the internet or having functional WiFi connections (this is the main reason MQTT is not supported by the MeshCore developers). ESP-NOW allows 250 byte messages to be efficiently transmitted between repeaters at a short distance, and includes support for basic encryption and callback functionality (necessary for path finding in MeshCore).
Running MeshCore over ESP-NOW
Requirements
- 2 ESP32-based nodes (must be able to use both as repeaters) with associated power and antennae
- Computer for flashing MeshCore ESP-NOW firmware (tested on Linux and MacOS, although I'd be very surprised if Windows doesn't work)
- (Recommended) MeshCore companion node to confirm the setup
Getting the firmware for your nodes
There are 3 options to get MeshCore Repeater ESP-NOW firmware:
From me (pre-built firmware)
- Go to my suspicious file server
- Under
meshcore/<VERSION>/repeater-bridge-espnow, identify your device model and download the respective .bin file. - Optionally cross-check the SHA256 sum and the PGP signature for the SHA256SUMS file. My PGP key can be confirmed via WKD or via the OpenPGP website.
Note that there will be 2 files that meet the criteria: one called DEVICE_repeater_bridge_espnow_VERSION_HASH.bin, and one called DEVICE_repeater_bridge_espnow_VERSION_HASH-merged.bin. The merged version should only be used on devices where you don't care if all the data (including existing keys, contacts, and settings) is wiped when you perform the install.
Kasvoton builds (pre-built firmware)
- Go to Kasvoton's file server
- Find the folder for the current firmware version (1.12.0 at time of writing), and go into the "bridge" folder within there
- Search for your device model. Ensure that you download the espnow version, rather than the RS232 version.
Note that there will be 2 files that meet the criteria: one called DEVICE_repeater_bridge_espnow_VERSION_HASH.bin, and one called DEVICE_repeater_bridge_espnow_VERSION_HASH-merged.bin. The merged version should only be used on devices where you don't care if all the data (including existing keys, contacts, and settings) is wiped when you perform the install.
Build it yourself
This will only be a summary, as these instructions are likely to change with some frequency.
- Clone the MeshCore GitHub repository
- Install PlatformIO
- Check out the current version of MeshCore (e.g.
repeater-v1.12.0) - If using VS Code: select your device using the PlatformIO environment selector in the bottom bar. Ensure that you select the ESP-NOW firmware version (for example,
Heltec_v3_repeater_bridge_espnow). Then, run the build. - If not using VS Code: identify your device in the "src/variants" folder, then identify the name of the build environment by reading the
platformio.inifile within that folder. Runplatformio run --environment <ENVIRONMENT>(for example,platformio run --environment Heltec_v3_repeater_bridge_espnow). - Either way, you will find your .bin file in
.pio/build/<ENVIRONMENT>/firmware.bin. Copy this file somewhere convenient.
Flash the firmware
Using a WebSerial-enabled browser (Chrome is usually fine), go to https://flasher.meshcore.co.uk, scroll all the way down to "custom firmware", and select the .bin file that you downloaded in the previous step.
Flash both of your repeater nodes, and set them up as if they were normal repeaters, ensuring that one is on each of the frequencies that you're trying to bridge. Reboot the repeaters, and place them in their final locations.
Profit
ESP-NOW will automatically negotiate a connection between the two devices, so there's nothing left to do for you. If you have a companion node on one of the 2 frequencies, add the other repeater as a contact, and attempt to log into it or get telemetry. You should see 1 hop when connecting to that repeater, and Direct when connecting to the one on the same frequency.
Other general notes
ESP-NOW is not a secure link. By default, it effectively uses unencrypted, unauthenticated WiFi, meaning an attacker could sniff traffic fairly easily. However, they would still need to break MeshCore encryption to actually get message content out.
In theory, you should be able to bridge up to 10 frequencies using ESP-NOW through the same method, although I'm not sure why you'd want to.