🛠 Se connecter au réseau cellulaire et publier un événement

Particle Boron · intermediaire · Schéma : IMG-particle-boron-intermediaire-1-boron-reseau-cellulaire-publish.svg — Boron avec antenne U.FL, ondes radio vers une antenne relais LTE-M, puis vers le cloud Particle et un tableau de bord.

Objectives

The Boron is the cellular board in the Particle range: the BRN404X model features a u-blox SARA-R510S modem (LTE Cat M1, bands 2/4/5/12/13, North America only) and a pre-provisioned EtherSIM. This tutorial takes you from "firmware running" to "connected object": enable the radio, wait for network registration and cloud connection, read signal strength (Cellular.RSSI), and publish events with Particle.publish. You will also verify that the external antenna is properly connected — without it, there is no cellular connectivity.

Hardware

Complete Code

// Boron — connexion cellulaire + publication cloud (Device OS 4.x LTS)
SYSTEM_THREAD(ENABLED);   // le stack cloud tourne en parallèle de loop

int rssi = 0;

void setup {
    Serial.begin(9600);
    Particle.variable("rssi", rssi);
    Cellular.on;
    Cellular.connect;
    // Attendre jusqu'à 120 s : enregistrement réseau + connexion cloud
    if (waitFor( => Cellular.ready, 120000)) {
        Serial.println("Cellulaire + cloud prets");
    } else {
        Serial.println("Echec de connexion : verifier antenne et couverture");
    }
}

void loop {
    if (Cellular.ready) {              // reseau ET cloud connectes
        rssi = Cellular.RSSI;
        char buf[64];
        snprintf(buf, sizeof(buf), "%d", rssi);
        Particle.publish("boron-rssi", buf, PRIVATE);
        Serial.printf("RSSI=%d publie\n", rssi);
    }
    delay(300000);                       // 5 minutes
}

Expected Verification

After flashing, the RGB LED goes through network search phases and then stays in a cyan "breathing" state when everything is connected. particle list shows your device as "online". On the cloud side, the private event boron-rssi arrives every 5 minutes: verify it with particle subscribe PRIVATE <your_account> or in the event stream of the Particle console. The RSSI value varies with the antenna position.

Common Errors

Other tutorials for this board

Code examples for this board

← Back to the board 🛠 All tutorials