This is an example application based on Mbed-OS LoRaWAN protocol APIs. The Mbed-OS LoRaWAN stack implementation is compliant with LoRaWAN v1.0.2 specification.

Dependents:   Projet_de_bachelor_code Projet_de_bachelor_code

Basic OTAA example

This is a very basic example to use `Mbed-OS` LoRaWAN protocol APIs to connect to a LoRaWAN network using OTAA. The canonical source for this example lives at https://github.com/ARMmbed/mbed-os-example-lorawan

Selecting radio driver

Mbed-OS provides inherent support for a variety of modules. If your device is one of the those modules, you may skip this part. As you may notice that the correct radio type and pin set is already provided for the said modules in the `target-overrides` field (see mbed_app.json). For more information on supported modules, please refer to module support section.

If you are using an Mbed enabled radio shield like Mbed SX1276 shield LoRa https://os.mbed.com/components/SX1276MB1xAS/ or Mbed SX1272 LoRa shield https://os.mbed.com/components/SX1272MB2xAS/ with virtually any Mbed-enabled board, this part is relevant.

Please select your radio type by modifying `lora-radio` field and provide pin set if it is different from the default. For example:

"lora-radio": {
    "help": "Which radio to use (options: SX1272,SX1276)",
    "value": "SX1276"
},

Selecting a PHY

LoRaWAN protocol is subjected to various country specific regulations concerning radio emissions. That's why Mbed-OS LoRaWAN stack provides a `LoRaPHY` class which can be used to implement any region specific PHY layer. Currently, Mbed-OS LoRaWAN stack provides 10 different country-specific implementations of `LoRaPHY` class. Selection of a specific PHY layer happens at compile time. Bu default, the Mbed-OS LoRaWAN stack uses `EU 868 MHz` PHY. An example of selecting a PHY can be:

        "phy": {
            "help": "LoRa PHY region. 0 = EU868 (default), 1 = AS923, 2 = AU915, 3 = CN470, 4 = CN779, 5 = EU433, 6 = IN865, 7 = KR920, 8 = US915, 9 = US915_HYBRID",
            "value": "0"
        },

NOTE: Stack is certified and tested with EU region only.

Add network credentials

Open the file `mbed_app.json` in the root directory of your application. This file contains all the user specific configurations your application and the Mbed-OS LoRaWAN stack needs.

Please add `Device EUI`, `Application EUI` and `Application Key` needed for Over-the-air-activation(OTAA). For example:

"lora.device-eui": "{ YOUR_DEVICE_EUI }",
"lora.application-eui": "{ YOUR_APPLICATION_EUI }",
"lora.application-key": "{ YOUR_APPLICATION_KEY }"

Module support

Here is a non-exhaustive list of boards and modules which we have tested with Mbed-OS LoRaWAN stack.

  • MultiTech mDot
  • MultiTech xDot
  • LTEK_FF1705
  • Advantech Wise 1510
  • ST B-L072Z-LRWAN1 LoRa┬«Discovery kit (with muRata radio chip)

Compiling the application

Select your target and hit the compile button.

Running the application

Drag and drop the downloaded application binary into your Mbed enabled target hardware which appears as USB device on your host machine.

Attach a serial console emulator of your choice (for example, PuTTY, Minicom or screen) to your USB device. Set the baudrate to 115200 bit/s, and reset your board by pressing the reset button.

You should see an output similar to this:

Mbed LoRaWANStack initialized 
 
 Adaptive data  rate (ADR) - Enabled 
 
 Connection - In Progress ...
 
 Connection - Successful 
 
 Disconnected - Exiting Application 
 

Files at this revision

API Documentation at this revision

Comitter:
mbed_official
Date:
Tue Mar 13 09:45:19 2018 +0000
Parent:
4:df442e6af8cf
Child:
6:d6016e907c7a
Commit message:
Update mbed-os.lib
.
Commit copied from https://github.com/ARMmbed/mbed-os-example-lorawan

Changed in this revision

mbed-os.lib Show annotated file Show diff for this revision Revisions of this file
--- a/mbed-os.lib	Sun Mar 11 10:15:17 2018 +0000
+++ b/mbed-os.lib	Tue Mar 13 09:45:19 2018 +0000
@@ -1,1 +1,1 @@
-git@github.com:AnttiKauppila/mbed-os.git
+git@github.com:ARMmbed/mbed-os.git#24a3acd647de16ecb79b299c66f550881ee66b7f