LoRa Setup
LoRa Setup
Section titled “LoRa Setup”Configure MikroTik routers as LoRaWAN gateways to connect IoT devices to network servers. MikroTik LoRa support enables long-range, low-power communication for sensor networks, asset tracking, and remote monitoring applications.
Overview
Section titled “Overview”LoRa (Long Range) is a wireless modulation technique for long-range communications at low power. LoRaWAN (Long Range Wide Area Network) is the network protocol built on top of LoRa, defining the system architecture for IoT deployments.
Supported Hardware
Section titled “Supported Hardware”| Device | Description | LoRa Card |
|---|---|---|
| KNOT | IoT gateway with LoRa and Bluetooth | Built-in LoRa radio |
| LtAP | Portable LTE/LoRa access point | Built-in LoRa radio |
| mAP | LoRa-enabled access point | External LoRa card |
Key Capabilities
Section titled “Key Capabilities”- Act as a LoRaWAN gateway for thousands of end devices
- Support for multiple spreading factors (SF7-SF12)
- Connect to network servers via UDP, LNS, or CUPS protocols
- Integrate with The Things Network, The Things Stack, and AWS IoT Core
- Configure multiple frequency plans for different regions
Sub-menu
Section titled “Sub-menu”/iot lora
Prerequisites
Section titled “Prerequisites”Before setting up LoRa, ensure you have:
Hardware Requirements
Section titled “Hardware Requirements”- MikroTik device with LoRa capability (KNOT, LtAP, or LoRa card)
- LoRa antenna (typically 868MHz or 915MHz depending on region)
- Network connectivity (Ethernet, LTE, or Wi-Fi)
Software Requirements
Section titled “Software Requirements”- RouterOS 7.x with IoT package installed
- Account with a LoRa network server (TTN, TTS, or AWS)
- Understanding of your regional frequency plan
LoRa Card Installation
Section titled “LoRa Card Installation”Hardware Installation
Section titled “Hardware Installation”- Power off the router
- Insert the LoRa card into the appropriate slot
- Attach the LoRa antenna
- Power on the router
Verifying Installation
Section titled “Verifying Installation”Check that the LoRa card is detected:
/iot lora pic printExpected output:
# NAME MODEL VERSION 0 KNOT R11e-LoRa8 v1.0Enable the LoRa interface:
/iot lora set enabled=yesVerify interface status:
/iot lora info print enabled: yes name: lora1 chip: sx1301 model: R11e-LoRa8 firmware: 1.0 temperature: 38°CNetwork Server Connection
Section titled “Network Server Connection”LoRa gateways connect to network servers using one of three protocols:
| Protocol | Port | Use Case |
|---|---|---|
| UDP | 1700 | Basic, non-encrypted connections |
| LNS | 8883 | Secure TCP connections (The Things Stack) |
| CUPS | 443 | Configuration updates, certificate management |
The Things Network (UDP)
Section titled “The Things Network (UDP)”The simplest way to connect is via UDP to The Things Network:
/iot lora ns add name=ttn address=eu1.cloud.thethings.network port=1700Enable the gateway:
/iot lora ns set name=ttn enabled=yesVerify connection:
/iot lora ns print/iot lora stats printThe Things Stack (LNS)
Section titled “The Things Stack (LNS)”For The Things Stack, use LNS protocol with authentication:
/iot lora ns add name=tts address=eu1.cloud.thethings.network port=8883 protocol=lnsConfigure gateway ID and API key:
/iot lora ns set name=tts gateway-id=eui-XXXXXXXXXXXXXX api-key=XXXXXThe Things Stack (CUPS)
Section titled “The Things Stack (CUPS)”CUPS (Concentrator UDP Protocol) provides automatic configuration:
/iot lora cups add name=cups address=eu1.cloud.thethings.network port=443 protocol=cups/iot lora cups set name=cups gateway-id=eui-XXXXXXXXXXXXXX api-key=XXXXXAWS LoRaWAN Configuration
Section titled “AWS LoRaWAN Configuration”Connect to AWS IoT Core via LNS or CUPS:
/iot lora ns add name=aws address=xxxxx.lns.lorawan.eu-west-1.amazonaws.com port=8883 protocol=lnsCertificate Setup
Section titled “Certificate Setup”Import AWS certificates:
/certificate import file-name=aws-cert.pem/certificate import file-name=aws-private-key.pem passphrase=Configure TLS:
/iot lora ns set name=aws tls=yesGateway Configuration
Section titled “Gateway Configuration”Basic Settings
Section titled “Basic Settings”Configure essential gateway parameters:
/iot lora set \ enabled=yes \ name=lora1 \ frequency-mode=EU868 \ tx-power=14 \ antenna-gain=2.5| Parameter | Description | Default |
|---|---|---|
| frequency-mode | Regional band plan (EU868, US915, etc.) | Device default |
| tx-power | Transmit power in dBm | 14 |
| antenna-gain | Antenna gain in dBi | 2.5 |
Frequency Planning
Section titled “Frequency Planning”EU868 Plan
Section titled “EU868 Plan”/iot lora set frequency-mode=EU868Standard EU868 channels:
- 868.0 MHz (SF12)
- 868.1 MHz (SF12)
- 868.3 MHz (SF12)
- 868.5 MHz (SF7)
- 867.0 MHz (SF9)
- 867.5 MHz (SF9)
US915 Plan
Section titled “US915 Plan”/iot lora set frequency-mode=US915Channel Configuration
Section titled “Channel Configuration”View configured channels:
/iot lora channel printAdd custom channels:
/iot lora channel add frequency=867100000 bandwidth=125000 spread-factor=12Verification and Testing
Section titled “Verification and Testing”Gateway Status
Section titled “Gateway Status”Check gateway connection status:
/iot lora status print name: lora1 gateway-id: eui-xxxxxxxxxxxx network-server: ttns connected-up: yes frames-received: 1234 frames-sent: 567 rx-packets: 890 tx-packets: 234Viewing Traffic
Section titled “Viewing Traffic”Monitor incoming LoRa frames:
/iot lora frame receive printMonitor transmitted frames:
/iot lora frame transmit printGateway Metrics
Section titled “Gateway Metrics”View gateway statistics:
/iot lora stats printNetwork Server Verification
Section titled “Network Server Verification”In The Things Network console:
- Navigate to your gateway
- Check “Gateway Status” shows “Connected”
- Verify “Last seen” timestamp is recent
- Check “Uplink” and “Downlink” counters
Troubleshooting
Section titled “Troubleshooting”Gateway Not Connecting
Section titled “Gateway Not Connecting”- Verify network server address is correct
- Check firewall allows outbound port 1700 (UDP) or 8883/443 (TCP)
- Confirm gateway ID matches console registration
- Verify API key has correct permissions
/iot lora ns print/iot lora stats printNo Uplink Traffic
Section titled “No Uplink Traffic”- Ensure LoRa device is within range
- Verify device is configured with correct frequency plan
- Check device is joined to the network (OTAA or ABP)
- Review network server logs for error messages
/iot lora frame receive print/iot lora stats printDownlink Failures
Section titled “Downlink Failures”- Check TX power configuration
- Verify antenna is properly connected
- Confirm device supports downlink on configured frequencies
- Review network server queue status
Intermittent Connectivity
Section titled “Intermittent Connectivity”- Check cable connections and antenna
- Verify sufficient power supply
- Review environmental factors (interference, distance)
- Check for network latency issues
/ping eu1.cloud.thethings.network/iot lora info printRelated Commands
Section titled “Related Commands”/iot lora- Main LoRa configuration/iot lora ns- Network server settings/iot lora cups- CUPS configuration/iot lora channel- Channel management/iot lora stats- Gateway statistics/iot lora frame- Frame monitoring/iot lora pic- PIC management