🛠 Démarrer le module radio et rejoindre un réseau LoRaWAN
Objectives
This tutorial replaces the classic "Wi-Fi scan": the board has no Wi-Fi module (no ESP32/NINA). The confirmed hardware equivalent is the Murata CMWX1ZZABZ LoRa radio module, a second CPU (STM32L0) that drives the SX1272 transceiver and communicates via AT commands over SPI. We start the module, read its identifier, and then join a LoRaWAN network using OTAA (The Things Network or a private server).
Hardware
- 1 Arduino MKR WAN 1300 + micro-UFL antenna (EU868 or US915 band depending on the version)
- The Things Network account (or ChirpStack)
- "MKRWAN" library (v1.1.2)
Complete Code
#include <MKRWAN.h>
LoRaModem modem; // module Murata câblé en SPI interne
String appEui = "0080000000000001";
String appKey = "00112233445566778899AABBCCDDEEFF";
void setup {
Serial.begin(115200);
while (!Serial) {}
if (!modem.begin(EU868)) { // bande de TA carte
Serial.println("Module KO - firmware probablement obsolete");
while (1) {}
}
Serial.print("fw="); Serial.println(modem.version);
Serial.print("DevEUI="); Serial.println(modem.deviceEUI);
if (!modem.joinOTAA(appEui, appKey)) {
Serial.println("Join echoue : cles, couverture, gateway ?");
while (1) {}
}
modem.minPollInterval(60); // le firmware impose >= 1 msg / 2 min
Serial.println("JOIN OK");
}
void loop { delay(1000); }
Expected Verification
The monitor displays the AT firmware version, the DevEUI (to be registered on TTN), and then "JOIN OK". The server shows the corresponding OTAA join.
Common Errors
- "Failed to start module": the module firmware is too old, see the firmware update tutorial.
- joinOTAA sometimes reports a false error (known bug, issue #139): check the server-side status before doubting the hardware.
- Wrong band (US915 configured on an EU868 board): no gateway is heard.
Other tutorials for this board
Code examples for this board
emission-p2p.inoArduinoreception-p2p.inoArduinoreglage-sp.inoArduinometeo-lora.inoArduinotrame-crc.inoArduinorelais-radio.inoArduino