🛠 LoRa point à point sans réseau (dumb modem)

Arduino MKR WAN 1310 · intermediaire · Schéma : IMG-mkr-wan-1310-intermediaire-2-mkrwan1310-lora-point-a-point.svg — Deux MKR WAN 1310 échangeant des paquets LoRa en mode direct, ondes radio entre les antennes, aucun routeur ni passerelle au centre.

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

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

Other tutorials for this board

Code examples for this board

← Back to the board 🛠 All tutorials