wikiroute

networking recipes

User Tools

Site Tools


exploring_lora

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
Next revisionBoth sides next revision
exploring_lora [2018/09/23 14:17] – [2. Software Tools] samerexploring_lora [2018/09/29 14:03] – [4.1. Time on Air] samer
Line 2: Line 2:
 As defined by Semtech, [[http://www.semtech.com/wireless-rf/internet-of-things/what_is_lora.html|LoRa]] is //a wireless technology developed to create the low-power, wide-area networks (LPWANs) required for machine-to-machine (M2M) and Internet of Things (IoT) applications. The technology offers a very compelling mix of long range, low power consumption and secure data transmission and is gaining significant traction in IoT networks being deployed by wireless network operators// As defined by Semtech, [[http://www.semtech.com/wireless-rf/internet-of-things/what_is_lora.html|LoRa]] is //a wireless technology developed to create the low-power, wide-area networks (LPWANs) required for machine-to-machine (M2M) and Internet of Things (IoT) applications. The technology offers a very compelling mix of long range, low power consumption and secure data transmission and is gaining significant traction in IoT networks being deployed by wireless network operators//
  
-In this lab, you will implement a prototype of LoRa communication between two wireless modules. This enables you to get hands-on experience with LoRa, assess the radio performance, and prepare future advanced prototypes and experimentations.+In this lab, you will implement a prototype of LoRa communication between two wireless devices. This enables you to get hands-on experience with LoRa, assess the radio performance, and prepare future advanced prototypes and experimentations.
  
 <WRAP center round help 100%> <WRAP center round help 100%>
Line 8: Line 8:
   * How LoRa is compatible with LPWAN requirements and constraints?   * How LoRa is compatible with LPWAN requirements and constraints?
 </WRAP> </WRAP>
-===== -. Hardware Platform =====+ 
 +===== -. Setting the Lab ===== 
 + 
 +==== -. Hardware Platform ====
  
 In order to design and implement experiments with LoRa, you will use the following devices:   In order to design and implement experiments with LoRa, you will use the following devices:  
Line 21: Line 24:
   * Give an estimated cost of your platform.   * Give an estimated cost of your platform.
 </WRAP> </WRAP>
-===== -. Software Tools =====+ 
 +==== -. Software Tools ====
  
 Download the following software on your PC: Download the following software on your PC:
-  * RadioHead: The Packet Radio library for embedded microprocessors can be downloaded from [[http://www.airspayce.com/mikem/arduino/RadioHead/]] or from this [[http://www.airspayce.com/mikem/arduino/RadioHead/RadioHead-1.86.zip|direct link]].  +  * RadioHead: The Packet Radio library for embedded microprocessors can be downloaded from [[https://github.com/samerlahoud/RadioHead]].  
-  * Arduino IDE: Specific OS versions can be downloaded from [[https://www.arduino.cc/en/Main/Software]] or easier for the course Moodle+  * Arduino IDE: Specific OS versions can be downloaded from [[https://www.arduino.cc/en/Main/Software]].
  
 Unzip the RadioHead library and copy it to your sketchbook library folder as detailed in [[https://www.arduino.cc/en/Guide/Libraries]]. Unzip the RadioHead library and copy it to your sketchbook library folder as detailed in [[https://www.arduino.cc/en/Guide/Libraries]].
-===== -. Installation =====+ 
 +<WRAP center round tip 75%> 
 +Note well the location of the library folder on your computer. In the following, you will be required to modify source files located in this folder.  
 +</WRAP> 
 +==== -. Installation ====
  
 Start by plugging the Dragino shields on the Arduino devices and mounting the antennas as shown in Fig. 1. Start by plugging the Dragino shields on the Arduino devices and mounting the antennas as shown in Fig. 1.
Line 41: Line 49:
 For Arduino Mega 2560, additional drivers for Microsoft Windows can be installed from [[http://wch.cn/download/CH341SER_ZIP.html]]. For Arduino Mega 2560, additional drivers for Microsoft Windows can be installed from [[http://wch.cn/download/CH341SER_ZIP.html]].
 </WRAP> </WRAP>
-===== -. Running Basic Sketches ===== 
-Start by setting the central frequency of the LoRa modules. For this, open the ''RH_RF95.cpp'' file locate in the ''RadioHead'' folder and change the frequency to 868.10 (Group 1), 868.30 (Group 2), and 868.50 MHz (Group 3). 
  
-<file cpp RH_RF95.cpp> +===== -Theoretical Study =====
-setFrequency(868.X); +
-</file>+
  
-Download the {{ :example-lora-sketch.zip | basic sketches}} that implement a reliable LoRa communication between the two modules. Open the sketches with Arduino IDE, compile and upload on the two arduino modules, respectively. On the serial interfaces, you should obtain similar results as in Fig. 2 and Fig. 3. The client sends short message and waits for an acknowledgement message from the server. Both modules output the RSSI (received power in dBm) for each received message. +In this section, you will perform theoretical assessment of the performance of LoRa modulation. You will later compare this theoretical results to the experimental ones as in a typical scientific study 
- +
-[{{ :client-iotlab1.png?direct&600 ||Figure 2. Client serial monitor}}] +
-[{{ :server-iotlab1.png?direct&600 ||Figure 3. Server serial monitor}}] +
-===== -. Modifying the Radio Parameters ===== +
- +
-The typical configuration for LoRa modules consists of 125 kHz sub-channels, a coding rate of 4/5, and a spreading factor equal to 7. You can modify the radio parameters by selecting one of the three available configurations: +
- +
-  * Bw125Cr45Sf128 +
-  * Bw125Cr48Sf4096 +
-  * Bw31_25Cr48Sf512 +
- +
-Radio configuration is applied in ''RH_RF95.cpp'' as in the following example: +
-<file cpp RH_RF95.cpp> +
-setModemConfig(Bw125Cr45Sf128); +
-</file>+
  
 <WRAP left round help 100%> <WRAP left round help 100%>
   * What is the relation between processing gain and spreading factor in LoRa modulation? Explain.   * What is the relation between processing gain and spreading factor in LoRa modulation? Explain.
   * How does the spreading factor impact the coverage of a LoRa transmitter?    * How does the spreading factor impact the coverage of a LoRa transmitter? 
-  * For each of the three possible configurations of your LoRa module, what is the transmission bit rate? Explain your computation.+  * For each of the three possible configurations of your LoRa device, what is the transmission bit rate? Explain your computation.
   * Compute the receiver sensitivity, assuming the following parameters: channel bandwidth = 125 kHz, spreading factor = 7, coding rate = 4/5, bit error rate (BER) target = 10<sup>-4</sup>, and receiver noise figure = 6 dB. Refer to this {{ :1705.05899.pdf | article}} to determine the mapping between the BER and the SNR.   * Compute the receiver sensitivity, assuming the following parameters: channel bandwidth = 125 kHz, spreading factor = 7, coding rate = 4/5, bit error rate (BER) target = 10<sup>-4</sup>, and receiver noise figure = 6 dB. Refer to this {{ :1705.05899.pdf | article}} to determine the mapping between the BER and the SNR.
   * Compare the computed sensitivity to that provided by the {{ :an1200.22.pdf |Semtech Application Note AN1200.22}} for the same parameters.   * Compare the computed sensitivity to that provided by the {{ :an1200.22.pdf |Semtech Application Note AN1200.22}} for the same parameters.
Line 74: Line 63:
  
 In the remainder of this lab, you will conduct measurements to validate the obtained theoretical receiver sensitivity. In the remainder of this lab, you will conduct measurements to validate the obtained theoretical receiver sensitivity.
 +===== -. Configuring and Running the Lab =====
 +
 +==== -. Modifying the Radio Parameters ====
 +
 +Download the {{ :sketch-1819.zip | basic sketches}} that implement a simple LoRa communication between the two devices: a client and a server. Open the sketches with Arduino IDE. Make sure to choose the correct ''Board'' and ''Port'' in the ''Tools'' menu. 
 +
 +Take a look at the source code in ''rf95_client.ino'' and ''rf95_server.ino''. Particularly, the ''setup'' function configures the radio parameters of your LoRa devices:
 + 
 +  * Central frequency (freq)
 +  * Spreading Factor (SF)
 +  * Bandwidth (Bw)
 +  * Coding Rate (CR) 
 +  * Transmit power (Pow)
 +
 +<code c++>
 +rf95.setFrequency(frequency);
 +// Setup Power,dBm
 +rf95.setTxPower(13);
 +
 +// Setup Spreading Factor (6 ~ 12)
 +rf95.setSpreadingFactor(7);
 +  
 +// Setup BandWidth, option: 7800,10400,15600,20800,31250,41700,62500,125000,250000,500000
 +//Lower BandWidth for longer distance.
 +rf95.setSignalBandwidth(125000);
 +  
 +// Setup Coding Rate:5(4/5),6(4/6),7(4/7),8(4/8) 
 +rf95.setCodingRate4(5);
 +</code>
 +
 +In order to reduce collisions, configure the central frequency of your LoRa devices as indicated below:
 +
 +^  Group Number  ^   Frequency     ^
 +|              |      866.7      |
 +|              |      866.9      |
 +|              |      867.1      |
 +|              |      867.3      |
 +|              |      867.5      |
 +|              |      867.7      |
 +|              |      867.9      |
 +|              |      868.1      |
 +|              |      868.3      |
 +|       10            868.5      |
 +|       11            868.7      |
 +|       12            868.9      |
 +
 +==== -. Running Basic Sketches ====
 +
 +Now you can compile and upload the client and server sketches on the two arduino devices, respectively. On the serial interfaces, you should obtain similar results as in Fig. 2 and Fig. 3. The client sends periodically a short message towards the server. The server outputs the RSSI (received power in dBm) for each received message.
 +
 +[{{ :client-iotlab1.png?direct&600 ||Figure 2. Client serial monitor}}]
 +[{{ :server-iotlab1.png?direct&600 ||Figure 3. Server serial monitor}}]
 ===== -. Performance Evaluation ===== ===== -. Performance Evaluation =====
-In the following, you will design and implement a set of scenarios that enable to evaluate the performance of the LoRa modulation. As you will deal with scientific assessment, you are required to use scientific tools to show the results. You have the choice between [[http://www.gnuplot.info | gnuplot]], [[https://matplotlib.org/index.html#|matplotlib]] with Python, and MATLAB. Take some time to become familiar with one of these software as you will be required to use them in different occasions off your academic programme. +In the following, you will design and implement a set of scenarios that enable to evaluate the performance of the LoRa modulation. As you will deal with scientific assessment, you are required to use scientific tools to show the results. You have the choice between [[http://www.gnuplot.info | gnuplot]], [[https://matplotlib.org/index.html#|matplotlib]] with Python, and MATLAB. Take some time to become familiar with one of these software as you will be required to use them in different occasions of your academic programme.
-==== -. Round Trip Time ====+
  
-In this section, you will measure the Round Trip Time of LoRa communication under the three different radio configurations. For thisyou can start by implementing function on the client that measures the time between the message sending and the reception of the acknowledge from the server. For example, you can use the [[https://www.arduino.cc/en/Reference/Micros| micros()]] function available in the arduino libraries.+As we are in presence of variable radio conditionssome experiments should be repeated multiple times and results can be shown as probability distributions. Take look at this excellent repository of data visualisation tools [[https://www.data-to-viz.com]]. 
 +==== -. Time on Air ====
  
-<WRAP center round help 100%> +In this section, you will measure the Time on Air (ToA) as given by the time necessary to transmit a message on the radio interfaceYou will assess the impact of the spreading factor, bandwidth, coding rate, the message size on the ToA.
-  * Draw a box plot of the RTT under the three different radio configurations +
-  * Analyze the obtained results and compare with the theoretical computations. +
-</WRAP>+
  
 +For this, you can start by implementing a function on the client that measures the time necessary for sending a message. For example, you can use the [[https://www.arduino.cc/en/Reference/Micros| micros()]] function available in the arduino libraries. As we are in presence of variable experimental conditions, experiments should be repeated. 
  
-==== -. Packet Error Rate ====+<WRAP center round help 100%> 
 +  * Describe the scenarios you used for assessing the impact of radio parameters on the ToA. You can join commented extracts of your code. 
 +  * Visualise the experimental results by plotting the ToA as a function of each of the different radio parameters. 
 +  * Analyze the obtained results and compare with the theoretical computations. You can superpose the theoretical results and the experimental ones on the same graph. 
 +</WRAP> 
 +==== -. Packet Delivery Ratio ====
  
 In this section, you will measure the Packet Error Rate (PER) under the three different radio configurations and for different transmission periods. For this, you can start by implementing a function on the client that measures the ratio of successfully delivered packets.  In this section, you will measure the Packet Error Rate (PER) under the three different radio configurations and for different transmission periods. For this, you can start by implementing a function on the client that measures the ratio of successfully delivered packets. 
Line 96: Line 140:
   * What type of mathematical models enables to theoretically compute the PER?   * What type of mathematical models enables to theoretically compute the PER?
 </WRAP> </WRAP>
 +
 ==== -. Coverage ==== ==== -. Coverage ====
  
  
-In this section, you will measure the coverage of LoRa modules under the three different radio configurations. For this, you can start by identifying a set of Test Points (TP) on the campus. Then, you should implement a function that sends packets with different radio configurations. Note that the following functions in the Arduino sketch enable to modify //on the fly// the LoRa parameters:+In this section, you will measure the coverage of LoRa devices under the three different radio configurations. For this, you can start by identifying a set of Test Points (TP) on the campus. Then, you should implement a function that sends packets with different radio configurations. Note that the following functions in the Arduino sketch enable to modify //on the fly// the LoRa parameters:
  
 <code c++> <code c++>
Line 124: Line 169:
    
 In order to compute distances in your experiment, you can get the GPS coordinates as recorded by your smartphone using an application such as [[https://play.google.com/store/apps/details?id=com.flashlight.lite.gps.logger&hl=en|Ultra GPS Logger]]. You can export the time-location correspondence in a CSV format from this application. As for the time-RSSI correspondence, you can use a {{ :log-windows.py.zip |logger file}} on your laptop. Finally, the time matching enables you to obtain the RSSI for each GPS location, hence for different distances. In order to compute distances in your experiment, you can get the GPS coordinates as recorded by your smartphone using an application such as [[https://play.google.com/store/apps/details?id=com.flashlight.lite.gps.logger&hl=en|Ultra GPS Logger]]. You can export the time-location correspondence in a CSV format from this application. As for the time-RSSI correspondence, you can use a {{ :log-windows.py.zip |logger file}} on your laptop. Finally, the time matching enables you to obtain the RSSI for each GPS location, hence for different distances.
 +===== -. Coverage Challenge =====
 +
 +
 ===== -. Grading ===== ===== -. Grading =====
  
Line 130: Line 178:
 ^ Design experiments                            |                    |                    |                    | ^ Design experiments                            |                    |                    |                    |
 ^ Analyse results          |                      |                    |                    |                    | ^ Analyse results          |                      |                    |                    |                    |
- 
exploring_lora.txt · Last modified: 2021/10/20 12:52 by samer