Search code examples
arduinogpssodaq-mbililoralorawan

Could I send JSON data with LoRa and how?


I've a SODAQ Mbili board with a LoRa bee. I've also a GPS sensor. Below you could find how I add the bee and the sensor.

On that board I make a JSON string with the GPS coordinates and I'll send that data over the LoRa network. But How could I do that.

In the source code I've download they use next code:

LoRaModemMicrochip modem(&MODEM_SERIAL, &debugSerial);
Device libTest(&modem, &debugSerial);

void readGPSData() {
    GPSSensor gpsSens(4.3, 51.222, 15.5, 0);
    dumpSendResult(gpsSens);
}

void dumpSendResult(Sensor& sns) {
    bool sendResult = libTest.send(sns, true);
}

I'll change this code like code below so I could send my JSON data

LoRaModemMicrochip modem(&MODEM_SERIAL, &debugSerial);
Device libTest(&modem, &debugSerial);

void readGPSData() {
    String json = "My JSON code";
    dumpJsonResult(json);
}

void dumpJsonResult(String& text) {
    bool sendResult = libTest.send(text, true);
}

But it gives me this error:

In function void dumpJsonResult(String&):

Error: no matching function for call to Device::send(String&, bool)

bool sendResult = libTest.send(text, true);
                                         ^

Did you know how I could send JSON data to the LoRaWAN?


Solution

  • If you have correct NWSessionKey and APPSessionKey and so on, you could try to onboard your device over Actility's free partner zone. https://partners.thingpark.com/

    Once you do that, you would need to:

    • Learn how to perform a downlink
    • Create your own payload mechanism, such as coding your GPS over signed ints for Lat, long and Alt.
    • Then decode it within your device

    Your device could also send ack to an Applicative Server you would plug to Actility's solution (REST-POST/JSON)

    Let us know how it goes Best regards,