wikiroute

networking recipes

User Tools

Site Tools


lorawan_downlink

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
lorawan_downlink [2017/08/22 21:50] – [4.1. Autonomo with LoRaBee] samerlorawan_downlink [2017/12/13 17:30] – [5. Selecting the Receive Windows] samer
Line 6: Line 6:
 According to the [[https://www.lora-alliance.org/lorawan-for-developers | LoRaWAN specification ]], each uplink transmission by an end-device of class A is followed by two short downlink receive windows as in Figure 1. According to the [[https://www.lora-alliance.org/lorawan-for-developers | LoRaWAN specification ]], each uplink transmission by an end-device of class A is followed by two short downlink receive windows as in Figure 1.
  
-  * The first receive window is implemented on the same channel and data rate as the uplink+  * The first receive window is implemented on the same channel and data rate as the uplink.
   * The second receive window is implemented on a predefined channel and data rate. This window can also be modified by MAC commands.   * The second receive window is implemented on a predefined channel and data rate. This window can also be modified by MAC commands.
  
Line 33: Line 33:
 You can use mqtt-spy to debug the messages received from the LoRaWAN devices. Start by configuring a new connection to the MQTT broker by simply adding the IP address of the broker in the ''Server URI'' field. Now you can subscribe to any MQTT topic. If you want to receive all messages arriving at the backend, you can use the generic topic ''#''. You can also limit to the topic including the messages of any specific device: ''application/APPLICATION_ID/node/DEVICE_EUI/rx'' The ''APPLICATION_ID'' and ''DEVICE_EUI'' are those used in the configuration of your LoRaWAN application server as explained in [[esib_iot_challenge|ESIB IoT Challenge]]. You can use mqtt-spy to debug the messages received from the LoRaWAN devices. Start by configuring a new connection to the MQTT broker by simply adding the IP address of the broker in the ''Server URI'' field. Now you can subscribe to any MQTT topic. If you want to receive all messages arriving at the backend, you can use the generic topic ''#''. You can also limit to the topic including the messages of any specific device: ''application/APPLICATION_ID/node/DEVICE_EUI/rx'' The ''APPLICATION_ID'' and ''DEVICE_EUI'' are those used in the configuration of your LoRaWAN application server as explained in [[esib_iot_challenge|ESIB IoT Challenge]].
  
-In order to send downlink data to a specific device, you should publish the encoded message in the corresponding topic ''application/APPLICATION_ID/node/DEVICE_EUI/tx'' as follows:+In order to send downlink data to a specific device, you should publish the encoded message in the corresponding topic ''application/APPLICATION_ID/node/DEVICE_EUI/tx'' as explained in the loraserver [[https://docs.loraserver.io/lora-app-server/integrate/data/|documentation]]:
  
 <code> <code>
Line 47: Line 47:
 The payload sent by the MQTT client must be encoded in Base64.  The payload sent by the MQTT client must be encoded in Base64. 
 </WRAP> </WRAP>
- 
 ==== -. Using IoT MQTT Dashboard ==== ==== -. Using IoT MQTT Dashboard ====
 [[https://play.google.com/store/apps/details?id=com.thn.iotmqttdashboard&hl=en | IoT MQTT Dashboard]] is a smartphone application available on Android platforms that enables to manage IoT projects using MQTT protocol. The availability on handheld devices makes this application attractive for situations where mobility is required, for instance in showrooms or road testing. [[https://play.google.com/store/apps/details?id=com.thn.iotmqttdashboard&hl=en | IoT MQTT Dashboard]] is a smartphone application available on Android platforms that enables to manage IoT projects using MQTT protocol. The availability on handheld devices makes this application attractive for situations where mobility is required, for instance in showrooms or road testing.
Line 55: Line 54:
 {{:2017-08-22 21.45.28.png?direct&200 |}} {{:2017-08-22 21.45.28.png?direct&200 |}}
 {{:2017-08-22 21.45.13.png?direct&200 |}} {{:2017-08-22 21.45.13.png?direct&200 |}}
 +
  
    
Line 62: Line 62:
 In the LoRaWAN platform, we support devices based on an [[http://support.sodaq.com/sodaq-one/autonomо/|Autonomo]] board with a LoRaBee Microchip RN2483 module. According to [[http://shop.sodaq.com]], Autonomo is a matchbox-sized powerhouse which uses the new Atmel Cortex M0+ 32bit micro controller. One advantage of such device is that it can be powered by a smartphone-sized solar panel. In order to configure the Autonomo with LoRaBee device, you can refer to [[deploying_lorawan|Deploying an End-to-End LoRaWAN Platform]]. In the LoRaWAN platform, we support devices based on an [[http://support.sodaq.com/sodaq-one/autonomо/|Autonomo]] board with a LoRaBee Microchip RN2483 module. According to [[http://shop.sodaq.com]], Autonomo is a matchbox-sized powerhouse which uses the new Atmel Cortex M0+ 32bit micro controller. One advantage of such device is that it can be powered by a smartphone-sized solar panel. In order to configure the Autonomo with LoRaBee device, you can refer to [[deploying_lorawan|Deploying an End-to-End LoRaWAN Platform]].
  
-This sketch {{ ::example-code-autonomo.ino.zip |}} can be used as an example. The following extract denotes the part corresponding to receiving downlink messages. Based on the received value, any action can be added as for example to trigger an action on the Arduino module.+This sketch {{ ::example-code-autonomo.ino.zip |}} can be used as an example. The following extract denotes the part corresponding to receiving downlink messages. For example, the received value can be used to trigger some action on the Arduino module
 + 
 +<code c++> 
 +void receiveData() { 
 +  // After we have send some data, we can receive some data 
 +  // First we make a buffer 
 +  uint8_t payload[64]; 
 +  // Now we fill the buffer and 
 +  // len = the size of the data 
 +  uint16_t len = LoRaBee.receive(payload, 64); 
 +  String HEXPayload = ""; 
 + 
 +  // When there is no payload the lorabee will return 131 (0x83) 
 +  // I filter this out 
 +  if (payload[0] != 131) { 
 +    for (int i = 0; i < len; i++) { 
 +      HEXPayload += char(payload[i]); 
 +    } 
 + 
 +    if (HEXPayload == "on") { 
 +      digitalWrite(LED_BUILTIN, HIGH); 
 +    } 
 +    if (HEXPayload == "off") { 
 +      digitalWrite(LED_BUILTIN, LOW); 
 +    } 
 +    debugSerial.println(HEXPayload); 
 +    //switchLED(HEXPayload); 
 +  } else { 
 +    debugSerial.println("no payload"); 
 +  } 
 +
 +</code> 
 +==== -. Arduino with Dragino Shield ==== 
 +Devices in the LoRaWAN platform can also be implemented on Arduino boards with Dragino shields. The combined module as well as the basic configuration steps are presented in [[simple_lora_prototype|Simple Prototype of LoRa Communications]]. Similarly to the Autonomo device, you can download the following sketch {{ ::example-code-arduino.ino.zip |}} and modify it according to your preferences. Below you can find an extract of the receiving function for downlink messages.
  
 <code c++> <code c++>
Line 74: Line 107:
       }       }
 </code> </code>
-==== -. Arduino with Dragino Shield ==== +===== -. Selecting the Receive Windows =====
-Devices in the LoRaWAN platform can also be implemented on Arduino boards with Dragino shields. The combined module as well as the basic configuration steps are presented in [[simple_lora_prototype|Simple Prototype of LoRa Communications]]. Similarly to the Autonomo device, you can download the following sketch {{ :test-loraserver-comb-loraserver-dragino.zip |}} and modify it according to your preferences. Below you can find somme commented extracts of the sketch.+
  
-We tested two types of devices on the LoRaWAN platform. The first type is based on Arduino boards with Dragino shields. The combined module as well as the basic configuration steps are presented in [[simple_lora_prototype|Simple Prototype of LoRa Communications]]The second one is based on [[http://support.sodaq.com/sodaq-one/autonomо/|Autonomo]] board with a LoRaBee Microchip RN2483 module. According to [[http://shop.sodaq.com]], Autonomo is a matchbox-sized powerhouse which uses the new Atmel Cortex M0+ 32bit micro controller. One advantage of such device is that it can be powered by a smartphone-sized solar panel.+The selection of the receive window is one important parameter in receiving downlink messagesThus, you should note these two important limitations:
  
 +  - The LoraWAN-in-C library used on the Arduino based devices has only been tested for receiving downlink packets in the RX2 window. 
 +  - The Microchip LoRaBee is configured by default with RX2 corresponding to SF9 on the center frequency 869525000 Hz. However, the LoRaWAN specification recommends for RX2 the same sub-channel but with SF12.
  
-{{ ::example-code-arduino.ino.zip |}}+Therefore, the recommended configuration consists of selecting to receive on RX2 for Arduino based devices (this is mandatory) and RX1 for autonomo based devices (this is the easiest configuration). Figure 3 shows the configuration interface of loraserver that enables to select the receive windows for each configured device.  
 + 
 +[{{ undefined:loraserver-downlink-dr.png?durect&650 Figure 3. Receive window selection on loraserver backend}}
 + 
 +<WRAP center round tip 60%> 
 +Without configuring the receive window, with OTAA mode, autonomo is receiving on RX1. 
 +</WRAP>
lorawan_downlink.txt · Last modified: 2021/08/28 09:53 by samer