mirror of
https://github.com/jmead/Meshcore-Repeater-MQTT-Gateway.git
synced 2026-10-30 22:11:57 +01:00
8.7 KiB
8.7 KiB
Serial Commands Reference
Quick reference for all serial commands and configuration options.
Runtime Commands
These commands work anytime (press the key in serial monitor). By default, when you connect over serial you will see live radio/repeater/MQTT activity scrolling. Press c to pause live activity and enter the menu.
| Key | Command | Description |
|---|---|---|
c |
Configuration Menu | Enter interactive configuration mode (pauses live view) |
s |
Show Statistics | Display packet counts, uptime, memory |
r |
Restart | Reboot the device |
Configuration Menu
Press c to enter configuration menu (the menu does NOT open automatically), then use these options:
Main Menu Options
| # | Menu Item | Description |
|---|---|---|
| 1 | WiFi Settings | Configure WiFi connection |
| 2 | MQTT Settings | Configure MQTT broker and topics |
| 3 | LoRa Settings | Configure radio parameters |
| 4 | Repeater Settings | Configure mesh network behavior |
| 5 | Show Configuration | Display all current settings |
| 6 | Save Configuration | Write settings to flash memory |
| 7 | Reset to Defaults | Restore factory default settings |
| 8 | Restart Device | Reboot with new settings |
| 0 | Exit Configuration | Return to normal operation |
Configuration Options Detail
1. WiFi Settings
Enable WiFi (y/n): y
WiFi SSID: MyNetwork
WiFi Password: ********
Options:
Enable: Enable or disable WiFi connectivitySSID: Network name (max 64 characters)Password: Network password (max 64 characters)
Notes:
- ESP32 only supports 2.4GHz WiFi
- WPA2 Personal/Enterprise supported
- Hidden SSIDs supported
2. MQTT Settings (ISO-coded topics)
Enable MQTT (y/n): y
MQTT Server: mqtt.example.com
MQTT Port: 1883
MQTT Username: myuser
MQTT Password: ********
Client ID: (auto from Repeater Node Name)
Base Prefix (e.g. MESHCORE): MESHCORE
Country ISO2 (optional): AU
Region ISO (optional): NSW
Effective Topic Prefix: MESHCORE/AU/NSW
Publish raw packets (y/n): y
Publish decoded messages (y/n): y
Subscribe to commands (y/n): y
Options:
Enable: Enable or disable MQTT bridgingServer: Broker hostname or IP (max 128 chars)Port: Broker port (usually 1883 or 8883)Username: MQTT authentication username (optional)Password: MQTT authentication password (optional)Client ID: Auto-derived from Repeater Node NameBase Prefix: Root of topic hierarchy (defaultMESHCORE)Country ISO2: Optional ISO country code (e.g.,AU,US,NZ)Region ISO: Optional ISO-3166-2 subdivision code part (e.g.,NSW,CA,AUK)Effective Topic Prefix: Uppercase hierarchical prefix computed from abovePublish Raw: Send raw hex packet dataPublish Decoded: Send parsed message dataSubscribe Commands: Accept commands from MQTT
Port Numbers:
1883- Standard MQTT (unencrypted)8883- MQTT over TLS/SSL1884- MQTT WebSocket (if supported by broker)
Notes:
- Empty username = anonymous connection
- Client ID must be unique per broker
- Effective topic prefix examples (normalized, uppercase):
MESHCOREMESHCORE/AUMESHCORE/AU/NSWMESHCORE/NZ/AUK- When Region is empty, the gateway also subscribes to all sub-regions for raw/messages and commands.
3. LoRa Settings
Frequency (MHz): 915.0
Bandwidth (kHz): 125.0
Spreading Factor (7-12): 7
Coding Rate (5-8): 5
TX Power (2-20 dBm): 20
Sync Word (hex): 0x12
Enable CRC (y/n): y
Frequency by Region:
433.0- Asia, some EU regions868.0- Europe (863-870 MHz)915.0- North America (902-928 MHz)923.0- Asia-Pacific
Bandwidth Options:
7.8- Very narrow, longest range, slowest10.415.620.831.2541.762.5125.0- Standard, good balance250.0- Wide, faster but shorter range500.0- Very wide, fastest but shortest range
Spreading Factor:
7- Fastest, shortest range (~2km)8- Fast, short range (~4km)9- Moderate speed/range (~6km)10- Slower, longer range (~8km)11- Slow, long range (~11km)12- Slowest, maximum range (~15km)
Coding Rate:
5- 4/5 - Least overhead, fastest6- 4/6 - Low overhead7- 4/7 - Medium overhead8- 4/8 - Most overhead, best error correction
TX Power:
2- Minimum (for testing nearby)10- Low power17- Standard20- Maximum (regulatory limit in most regions)
Sync Word:
0x12- Default private network0x34- LoRaWAN public network0xXX- Custom (must match all nodes)- Input accepts hex in
0xNNorNNform (case-insensitive); non-hex chars ignored.
Notes:
- ⚠️ Restart required after changing LoRa settings
- All mesh nodes must use identical LoRa parameters
- Higher SF = longer range but slower speed
- Check local regulations for frequency and power limits
4. Repeater Settings
Node Name: MQTT-Gateway
Max Hops (1-7): 3
Auto ACK (y/n): y
Broadcast Enabled (y/n): y
Route Timeout (seconds): 300
Options:
Node Name: Friendly name (max 32 characters)Max Hops: Maximum packet forwarding hopsAuto ACK: Automatically acknowledge packetsBroadcast: Allow broadcasting to all nodesRoute Timeout: Seconds before route expires
Max Hops Recommendations:
1- No repeating (node only)2- Small networks (< 10 nodes)3- Medium networks (10-50 nodes) ← Recommended4- Large networks (50-100 nodes)5+- Very large networks (use with caution)
Route Timeout:
60- 1 minute (fast-moving nodes)300- 5 minutes (default)600- 10 minutes (stationary nodes)1800- 30 minutes (very stable network)
Notes:
- Node ID is auto-generated from chip MAC
- Lower max hops = less network congestion
- Higher route timeout = fewer route discoveries
Configuration Examples
Home Gateway (Stationary)
WiFi: Enabled
MQTT: Enabled
LoRa: 915MHz, SF7, 125kHz, 20dBm
Repeater: Max Hops 3, Auto ACK
Portable Gateway (Battery)
WiFi: Disabled (or mobile hotspot)
MQTT: Enabled (when WiFi available)
LoRa: 915MHz, SF9, 125kHz, 17dBm
Repeater: Max Hops 2, Auto ACK
High-Range Gateway
WiFi: Enabled
MQTT: Enabled
LoRa: 915MHz, SF12, 62.5kHz, 20dBm
Repeater: Max Hops 4, Auto ACK
Urban Dense Network
WiFi: Enabled
MQTT: Enabled
LoRa: 915MHz, SF7, 250kHz, 17dBm
Repeater: Max Hops 2, Auto ACK
Tips
Entering Configuration
- Open serial monitor at 115200 baud
- Watch live activity (default)
- Press
ckey to enter the menu (pauses live view) - Wait for menu to appear, then enter a number + Enter
Saving Settings
- ⚠️ Always select option
6to save before restarting! - Settings are stored in ESP32 NVS (non-volatile storage)
- Survives power cycles and reboots
- Can be erased with option
7(Reset to Defaults)
Troubleshooting Configuration
If settings won't save:
- Try
7to reset to defaults - Configure again
- Save with option
6 - Restart with option
8
Testing Changes
After configuring:
- Save configuration (
6) - Restart device (
8) - Check serial output for connection status
- Use
scommand to verify operation
Default Values
If you reset to defaults (option 7), these values are restored:
| Setting | Default Value |
|---|---|
| WiFi | |
| SSID | (empty) |
| Password | (empty) |
| Enabled | No |
| MQTT | |
| Server | mqtt.example.com |
| Port | 1883 |
| Username | (empty) |
| Password | (empty) |
| Client ID | (auto from Node Name) |
| Base Prefix | meshcore |
| Country | (empty) |
| Region | (empty) |
| Effective Topic Prefix | meshcore |
| Enabled | No |
| LoRa | |
| Frequency | 915.0 MHz |
| Bandwidth | 125.0 kHz |
| Spreading Factor | 7 |
| Coding Rate | 5 |
| TX Power | 20 dBm |
| Sync Word | 0x12 |
| CRC | Enabled |
| Repeater | |
| Node Name | MQTT-Gateway |
| Max Hops | 3 |
| Auto ACK | Yes |
| Broadcast | Yes |
| Route Timeout | 300 seconds |
Serial Monitor Setup
PlatformIO (VS Code)
- Click "PlatformIO" icon in sidebar
- Click "Serial Monitor" under your device
- Baud rate is set automatically to 115200
Arduino IDE
- Tools → Serial Monitor
- Set baud rate to 115200
- Set line ending to Newline or Both NL & CR
External Terminal (Windows)
# Using PuTTY
putty -serial COM3 -sercfg 115200,8,n,1,N
# Using PowerShell (Windows 10+)
$port = new-Object System.IO.Ports.SerialPort COM3,115200,None,8,one
$port.Open()
External Terminal (Linux/Mac)
# Using screen
screen /dev/ttyUSB0 115200
# Using minicom
minicom -D /dev/ttyUSB0 -b 115200
# Using picocom
picocom /dev/ttyUSB0 -b 115200
Need more help? Check README.md or QUICKSTART.md