🛠 LoRa point à point sans réseau (dumb modem)
Objectives
Use the Murata module in "dumb modem" mode: output the AT LoRaWAN firmware and directly control the SX1276 over SPI1, without a gateway or server. Two cards exchange messages in pure LoRa. Requires the arduino-LoRa library ≥ 0.5.0, which knows the MKR WAN 1300/1310 pinout (CS = LORA_IRQ_DUMB on SPI1).
Hardware
- 2 MKR WAN 1310 cards with antennas (433/868/915 MHz)
- Libraries: arduino-LoRa ≥ 0.5.0 (and MKRWAN for dumb mode)
- Micro-USB cables for both cards
Complete code
// ===== EMETTEUR =====
#include <SPI.h>
#include <LoRa.h>
int compteur = 0;
void setup {
Serial.begin(9600);
while (!Serial);
// arduino-LoRa >= 0.5.0 redémarre le module Murata en mode bête lui-même
if (!LoRa.begin(868E6)) { // 868E6 (UE), 915E6 (US), 433E6
Serial.println("Demarrage LoRa impossible");
while (1);
}
Serial.println("LoRa emetteur pret");
}
void loop {
LoRa.beginPacket;
LoRa.print("bonjour ");
LoRa.print(compteur++);
LoRa.endPacket; // pas d'ACK en mode brut
delay(5000);
}
// ===== RECEPTEUR (autre carte) =====
// meme setup ; dans loop :
// int taille = LoRa.parsePacket;
// if (taille) { while (LoRa.available)
// Serial.write(LoRa.read); Serial.println; }
Expected verification
The transmitter increments a counter every 5 s; the receiver displays "hello N" with a delay of at most one packet. The range far exceeds Wi-Fi: a few km in the city, 16+ km in line of sight according to LoRa documentation.
Common errors
- Different frequencies between the two cards: no packet received, even if both display "ready".
- The module does not have a wired IRQ pin: the receiver must poll
LoRa.parsePacketin a loop, not wait for an interrupt. - Staying in AT mode: if an MKRWAN sketch ran before, re-upload the LoRa sketch which restarts the module in dumb mode.
- Different LoRa settings (spreading factor, bandwidth) between transmitter and receiver: arduino-LoRa uses identical default values, do not modify them on only one side.
- In raw mode, there is no retransmission or ACK: plan for an application-level acknowledgment if reliability matters.
Other tutorials for this board
Code examples for this board
join-otaa.inoArduinouplink-confirme.inoArduinodownlink.inoArduinoactivation-abp.inoArduinosuivi-adr.inoArduinoclasse-c.inoArduino