11. LoRa MESH¶
Hero Shot of the Week¶
Summary¶
So this if from week 18. But I feel like I should put it here.
Work Process¶
Here I am working with:
- XIAO ESP32-S3 (Sense as it is the kit version)
- SEEED Wio-XS1262
Introduction¶
Meshtastic with Seeed Xiao ESP32S3 and Wio SX1262
Decoding LoRa Technology: Understanding the Differences Between LoRaWAN®, LoRa P2P, and LoRa Mesh
Know your frequencies
Not mush ont the FabAcademy repo:
Meshtastic + XIAO ESP32-S3 + Wio-SX1262¶
Intro¶
Home page of Meshtastic
So I am gonna start with reading this: Bootcamp 2025 xIAO-Lora
So I started to read the Getting Started documentation.
Seeed Tutorial & Documentation
This is the final understanding:
Driver¶
I have no clue if I need to download any of the drivers mentioned.
Lets continue and see if I have an error later on.
So I had that error after the flash of the ESP. Checking the Installation doc
I might need to install them after all.
Flash ESP32 Devices¶
Lets flash the firmware.
Use chromium based browser, eg: Chrome
So...
Is this a success or a fail ?
Well
The LED on the Wio-SX1262 is blinking so I will assume that it worked.
Settings¶
Serial Connection
Use chromium based browser, eg: Chrome
Wow.
The settings interface is so nice and user friendly.
So I managed to connect them together after selecting the right region.
Now I need to understand how to transfer my sensor data to another node.
USE THE RIGHT FREQUENCY FOR YOUR COUNTRY AND FOR YOUR ANTENNA
Code¶
So there is a PIO library for this.
Example Code from Meshtastic
The issue is that this code is for Adafruit Feather M0 WiFi.
Example Code | |
---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
|
Well...
This shit is not just plug and play...
Now I can't upload any arduino code...
So I figured out something. It is not the upload the issue but the fact that my button was on D6 which is now converted to serial comm as it is the TX pin.
I am starting to feel like I need to modify the firmware and I cannot just use it like a library.
Well...
The library
previously mentioned is only for interfacing with the nodes.
Not to connect to the MESH itself...
Day 2
I can connect via MESH 2 ESPs and chat.
Now I need to figure out how to send data FROM the secondary controller.
Serial Config¶
Following this Tutorial
- Go to the web portal
- Config
- Module Config
- Serial
- Enable
- Set RX and TX pins (GPIO Numbers)
- Select Baud Band Width
- Mode: Textmsg (For other modes check the Serial Conf link bellow)
Well...
Whenever I upload to the ESP connected to node 00, node 02 receives weird messages. But not the message that I am trying to send XD
Chat GPT
This is the code that is uploaded to my ESP that is connected to node 0
Node 2 does not recieves any of the serial.prints but node 2 shows messages (not related to the code) when I upload a new code to the esp it is the following text:
ESP-ROM:esp32s3-20210327 Build:Mar 27 2021 rst:0x15 (USB_UART_CHIP_RESET),boot:0x2 (DOWNLOAD(USB/UART0)) Saved PC:0x4201f4fe waiting for download
78be1 SPIWP:0xee mode:DIO, clock div:1 load:0x3fce3808,len:0x4bc load:0x403c9700,len:0xbd8 load:0x403cc700,len:0x2a0c entry 0x403c98d0
any idea what is happening ?
Chat GPT - Answer
Yes — this is a common and subtle issue when trying to use Serial communication between your ESP32-S3 (running Arduino code) and a Meshtastic node on the same or a separate device.
Let’s break it down:
🔍 What You’re Observing
- Your code prints serial data using
Serial.println()
- Node 2 is not receiving those prints
- But when you upload code, Node 2 sees bootloader/debug output like:
🎯 Root Cause
You're using:
Which is USB Serial on the ESP32-S3.
But Meshtastic expects serial data on UART, typically Serial1
, not the USB Serial interface.
In other words:¶
Serial
(USB) goes to your computerSerial1
(UART) goes to the LoRa Meshtastic node (via physical TX/RX pins)
Unless your ESP32-S3 is connected via UART (hardware TX/RX) to another Meshtastic node’s UART RX/TX, it won’t work.
✅ How to Fix It
🔧 Option 1: Use Serial1
for Meshtastic Connection
Update your code:
void setup() {
Serial.begin(115200); // USB for debug
Serial1.begin(921600); // UART for Meshtastic node
pinMode(LED_BUILTIN, OUTPUT);
i = 0;
}
void loop() {
i++;
Serial.println(String(i)); // USB debug
Serial.println("Hello World");
Serial1.print("Hello World from Node 0"); // UART to Node 2 (Meshtastic)
if ((i % 2) == 0){
digitalWrite(LED_BUILTIN, HIGH);
} else {
digitalWrite(LED_BUILTIN, LOW);
}
delay(2000);
}
📌 Important:
You must connect the hardware pins:
ESP TX (e.g. D6)
→Meshtastic RX
ESP RX (e.g. D7)
←Meshtastic TX
- Ensure common GND
And you must tell Serial1.begin()
which pins to use:
Replace RX_PIN
and TX_PIN
with the actual pins on your ESP32-S3 board you're using.
🧪 How to Verify
- Upload the modified code.
- Connect Node 0 (your ESP) to Node 2 via UART.
- Monitor Node 2's messages — it should now receive the
Serial1.print()
messages.
Bonus Tip
If you only have one ESP32-S3 and you're trying to act as both sensor and Meshtastic node, you’ll need to either:
- Modify Meshtastic firmware (advanced)
- Or use another ESP32 as the Meshtastic node, and let your ESP32-S3 just send sensor data via UART
Would you like help choosing the correct pins for Serial1
on your ESP32-S3 board or wiring it to your Wio-SX1262 module?
And now my code works...
Success !
An issue is that after some time the web interface freezes. I do not know if it is the whole MESH or just the web interface.
Now to figure out how to go from received data to a website.
More info on UART
So I managed to serial print data sent over the LoRa. In reality it is only half managed...
Now its good.
The codes can be found here:
Serial print to p5.js
Distance Measurement¶
So I continued with my testing. It seems that I can only achieve 20m of distance. I followed theses tutorials
- Range Test Module Configuration
- Automated Range Test with Meshtastic - Video
- Antenna Testing
- Meshtastic Coverage Mapping
I also installed the
Meshtastic python CLI.
I had the issue that it said that meshtastic
is not recognized so in the end my friend Alessandro helped out.
He gave me the following code to use instead
python -m meshtastic --port COM22 --info
Its funny how a whole day of work was resumed in just +-10 lines 🥲
So I thought. What if I have an inadequate antenna ?
Here is the answer
So it should work up to 2km in open space. And I am far of being of open space and without any interference...
But to go from 1km to 20m ...
Lets try it in a straight line. In the corridor.
Distance at which I loose signal
and the data analysis gives +-10m.
Meshtastic + XIAO nRF52840¶
Well...
It is for the kit version Mine is not the kit version.
Arduino LoRa¶
This library is for SX1276/77/78/79
But this tutorial says that it works with SX1262...
MeshCore¶
Home page of MeshCore
ripple¶
Home page of ripple