test-coverage.ino

Arduino MKR NB 1500 · File : test-coverage.ino · Language : Arduino · Use case : Cartographier la couverture LTE-M en se déplaçant

Before deploying NB-IoT stations, measure coverage: this sketch logs network status, RSSI and operator every five seconds as CSV. A USB stick or notebook on board is enough to build the drive-test heat map.

Hardware

An Arduino MKR NB 1500 (SAMD21 microcontroller, u-blox LTE-M/NB-IoT modem, external antenna, LiPo power on J6 or USB). MKR NB 1500 powered by a power bank, data SIM, antenna; optional serial GPS for geotagging.

Wiring

Nothing to wire for the base version; for GPS, cross TX/RX on Serial1 at 3.3 V.

How it works

signalQuality() returns the level reported by the SARA-R4; the semicolon separator imports straight into a spreadsheet or pandas. The 5 s cadence samples a car trip.

Running it

Install the Arduino SAMD Boards package and the MKRNB library, select the board, upload. Plan for an activated IoT SIM (LTE-M or NB1) and good reception: attaching to the network can take several minutes.

Variants

Add the retransmission counter or attach time as KPIs, or replace GPS with the driver phone timestamp.

test-coverage.ino

// Loggeur de couverture : RSSI horodate a chaque point GPS (ou a la main).
// Sortie serie en CSV, reprise par un notebook pour la carte.
#include <MKRNB.h>

const char PIN_SIM[] = "0000";

NB nb;

unsigned long dernier = 0;
const long PERIODE = 5000; // 1 point / 5 s en deplacement

void setup() {
  Serial.begin(9600);
  while (!Serial);
  if (nb.begin(PIN_SIM) != NB_READY) while (true);
  while (nb.getStatus() != NETWORK_JOINED) delay(2000);
  Serial.println(F("temps_s;statut;rssi;operateur"));
}

void loop() {
  if (millis() - dernier < PERIODE) return;
  dernier = millis();
  Serial.print(millis() / 1000);
  Serial.print(';');
  Serial.print(nb.getStatus());
  Serial.print(';');
  Serial.print(nb.signalQuality());
  Serial.print(';');
  Serial.println(nb.getOperator());
  // En deplacement : brancher un GPS serie et ajouter lat;lon ici.
}

← Back to the board