Libelium Waspmote LoRa Networking Manual

Waspmote-lora-868mhz_915mhz-sx1272

Advertisement

Quick Links

Waspmote-LoRa-868MHz_915MHz-SX1272
Networking Guide

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the Waspmote LoRa and is the answer not in the manual?

Questions and answers

Summary of Contents for Libelium Waspmote LoRa

  • Page 1 Waspmote-LoRa-868MHz_915MHz-SX1272 Networking Guide...
  • Page 2: Table Of Contents

    Index Document Version: v7.0 - 02/2017 © Libelium Comunicaciones Distribuidas S.L. INDEX 1. LoRa and LoRaWAN ..........................4 2. Hardware .............................. 5 3. Dual radio with Expansion Board ..................... 10 3.1. Expansion Radio Board ................................10 4. General considerations ........................12 4.1.
  • Page 3 Index 10. Long range tests ..........................25 10.1. Line of Sight test ..................................25 10.2. Non Line of Sight tests ................................26 10.2.1. Tests in Zaragoza ..............................26 10.2.2. Test in Paris .................................28 11. Connectivity ............................. 29 11.1. Topologies ....................................29 11.2.
  • Page 4: Lora And Lorawan

    These modules are based on the same modulation technology (the same PHY layer): LoRa™, developed by Semtech. The LoRa module implements a simple link protocol, created by Libelium. However, the LoRaWAN module runs the LoRaWAN protocol, a much richer and more advanced protocol, created by the LoRa Alliance.
  • Page 5: Hardware

    Hardware 2. Hardware The SX1272 chipset has been developed by the company Semtech. Based on this chipset, Libelium created the Waspmote- compliant LoRa module (or SX1272 module). Dual frequency Transmission Module Sensitivity Channels Distance band power 863-870 MHz (Europe) 22+ km...
  • Page 6 Hardware The user must keep in mind that there are two different antennas for LoRa modules regarding the frequency band: 868 or 900 MHz. Although the appearance of these antennas is the same, the user must choose which one needs to be purchased. Note: It is not recommended to work without an antenna screwed to the module.
  • Page 7 Hardware Channel Number Central frequency Channel Number Central frequency CH_10_868 CH_00_900 865.20 MHz 903.08 MHz CH_11_868 CH_01_900 865.50 MHz 905.24 MHz CH_12_868 CH_02_900 865.80 MHz 907.40 MHz CH_13_868 866.10 MHz CH_03_900 909.56 MHz CH_14_868 866.40 MHz CH_04_900 911.72 MHz CH_15_868 866.70 MHz CH_05_900 913.88 MHz...
  • Page 8 Hardware The LoRa module uses the SPI pins for communication. The SPI port allows more speed communication and frees up the Waspmote’s UART for other purposes. The Expansion Board allows to connect two communication modules at the same time in the Waspmote sensor platform. This means a lot of different combinations are possible using any of the radios available for Waspmote and the LoRa module.
  • Page 9 Hardware Figure: Star topology Note: OTA programming is not implemented for the LoRa module. Due to its low datarate, it would take much time to send one program. v7.0...
  • Page 10: Dual Radio With Expansion Board

    Dual radio with Expansion Board 3. Dual radio with Expansion Board 3.1. Expansion Radio Board The Expansion Board allows to connect two communication modules at the same time in the Waspmote sensor platform. This means a lot of different combinations are possible using any of the wireless radios available for Waspmote: 802.15.4, ZigBee, DigiMesh, 868 MHz, 900 MHz, LoRa, WiFi, GPRS, GPRS+GPS, 3G, 4G, Sigfox, LoRaWAN, Bluetooth Pro, Bluetooth Low Energy and RFID/NFC.
  • Page 11 Dual radio with Expansion Board The LoRa module can be used only in the socket 0. If the user wants to use a wireless radio, they must use the socket 1. WARNING: • Avoid to use DIGITAL7 pin when working with Expansion Board. This pin is used for setting the XBee into sleep. •...
  • Page 12: General Considerations

    General considerations 4. General considerations 4.1. Waspmote libraries 4.1.1. Waspmote SX1272 files WaspSX1272.h, WaspSX1272.cpp It is mandatory to include the SX1272 library when using this module. The following line must be introduced at the beginning of the code: #include <WaspSX1272.h> 4.1.2.
  • Page 13 General considerations The main functions are listed here: Basic functions WaspSX1272(); Class constructor. ON(); Opens the SPI and switches the SX1272 module on. OFF(); Closes the SPI and switches the SX1272 module off. readRegister(); Reads the indicated internal register. writeRegister(); Writes the indicated internal register.
  • Page 14: Additional Functions

    It reads the module temperature in Celsius. Negative temperatures can be expected. It stores the information in the global variable in Celsius. _temp Note: this feature has not a good accuracy because it requires internal calibration. Libelium recommends to use dedicated temperature sensor. Example of use: sx1272.getTemp();...
  • Page 15: Getting Maximum Allowed Current Supply

    Related variables: → stores the maximum current supply of the module sx1272._maxCurrent SX1272 getting current supply example: www.libelium.com/development/waspmote/examples/sx-14-currentsupply 4.4. Waspmote reboot When Waspmote is rebooted, the application code will start again, creating all the variables and objects from the beginning. -15-...
  • Page 16: Transmission Modes

    There are ten predefined modes in the API, including the largest distance mode, the fastest mode, and eight other intermediate modes that Libelium has found interesting. All of them can be modified or deleted, and also it is possible to attach new modes in the appropriate function.
  • Page 17: Bandwidth

    // Sets the LoRa mode in transmission mode 3 SX1272 configuration example: www.libelium.com/development/waspmote/examples/sx-01-configure-lora-parameters If the user is going to select a mode with this function, it is not necessary to set also the bandwidth, coding rate and spreading factor later.
  • Page 18: Initialization

    Initialization 6. Initialization Before starting to use a module, it needs to be initialized. During this process, Waspmote’s SPI bus has to be opened to communicate with the module, and the LoRa module’s switch has to be set on. Note: This module does not save the configuration. So, the network settings as the mode or the channel MUST be configured every time it is switched on.
  • Page 19: Node Parameters

    Node parameters 7. Node parameters When configuring a node, it is necessary to set some parameters which will be used lately in the network, and some parameters needed for using the API functions. 7.1. Node address Each module must have a unique address of 8 bits. It identifies uniquely a node inside a network.
  • Page 20: Channel

    Node parameters 7.3. Channel This parameter defines the frequency channel used by the module to transmit and receive. There are 8 channels defined to be used in the 868 MHz band and 13 channels to be used in the 900 MHz band. They can be observed in the following figures.
  • Page 21 Node parameters Example of use: sx1272.setChannel(CH_00_900); // Set channel sx1272.getChannel(); // Get Channel Related variables: → stores the operating channel sx1272._channel SX1272 configuration example: www.libelium.com/development/waspmote/examples/sx-01-configure-lora-parameters -21- v7.0...
  • Page 22: Packet Parameters

    Packet parameters 8. Packet parameters 8.1. Structure used in packets Packets are structured in WaspSX1272.h using a defined structure called . This structure has many fields to be filled by the pack user or the application: • Destination node address: this parameter is indicated as an input in the function used by the user. •...
  • Page 23: Power Gain And Sensitivity

    Power gain and sensitivity 9. Power gain and sensitivity When configuring a node and a network, one important parameter is related with power gain and sensitivity. 9.1. Power level Power level (dBm) at which the module transmits conducted power. The possible values are Low (‘L’), High (‘H’) and Max (‘M’): Parameter SX1272 power level 0 dBm...
  • Page 24: Rssi Of One Packet And Rssi Of The Channel

    SX1272 RSSI example: www.libelium.com/development/waspmote/examples/sx-12-rssilora The ideal working mode is at getting maximum coverage with the minimum power level. Thereby, a compromise between power level and coverage appears. Each application scenario will need some tests to find the best combination of both parameters.
  • Page 25: Long Range Tests

    Long range tests 10. Long range tests 10.1. Line of Sight test The Line of Sight (LOS) tests were taken between two different points next to the surrounding area of Zaragoza (Spain). The emitter was set in the point A : viewpoint of ‘La Plana de Cadrete’ . The receiver was set in the point B: viewpoint of the village of Alfocea.
  • Page 26: Non Line Of Sight Tests

    Zaragoza (Spain). The receiver was a Meshlium device, installed on the roof of the Libelium’s headquarters. The emitter was set in several points in order to know the performance of this module in NLOS conditions within a city area.
  • Page 27 Long range tests Results: Number of Buildings Mean SNR Mean RSSI Mean RSSI Point Range (m) Success (%) Margin (dB) (signal going through) (dB) (dBm) packet (dBm) Point 1 -7.89 -112.95 -124.89 9,11 Point 2 -14.26 -111.26 -131.26 2,74 Point 3 1070 -3.22 -114.14...
  • Page 28: Test In Paris

    Long range tests 10.2.2. Test in Paris This tests were developed in an office area in Paris city. The transmitter is outside the first floor of an office building, at a height of about 3 meters. The receiver is at street except in one of them that is situated bellow ground floor, in a garage. There is no line of sight between the points.
  • Page 29: Connectivity

    The central node gathers all data coming from the network nodes. It is not possible to set mesh networks with the LoRa module. Libelium offers the following options for the central node: Gateway LoRa : This special Gateway enables the user to receive data directly in a standard PC. It is interesting for the first •...
  • Page 30: Connections

    Figure: ACK confirmation diagram Unicast mode with ACK example: www.libelium.com/development/waspmote/examples/sx-03a-tx-lora-ack 2 - Retries: this option is only available with ACK confirmation. If the transmitting module does not receive the ACK, it will re- send the packet up to the configured number of times or until the ACK is received.
  • Page 31: Broadcast

    Connectivity Figure: ACK and retries diagram Unicast mode with ACK and retries example: www.libelium.com/development/waspmote/examples/sx-04a-tx-lora-ackwretries 11.2.2. Broadcast Broadcast is used to send a packet to all nodes in a network. Any module within range will accept a packet that contains the broadcast address (0).
  • Page 32: Connection Parameters

    Connectivity 11.3. Connection parameters There are some parameters related to connections and their configurations. 11.3.1. Setting retries It specifies the number of retries than can be sent for a given Unicast packet and stores it in the global variable _maxRetries Parameter range: from 0x00 to 0x05.
  • Page 33: Using Frame Class To Create Sx1272 Packets

    Frame is a class that allows the user to create data frames with a specified format. It is a very useful tool to set the payload of the packet to be sent. It is recommended to read the Waspmote Data Frame Guide in order to understand the LoRa module examples: www.libelium.com/development/waspmote/documentation/data-frame-guide/ SX1272 sending Frame examples: www.libelium.com/development/waspmote/examples/sx-05a-tx-lora-waspframe www.libelium.com/development/waspmote/examples/sx-06a-tx-lora-ack-waspframe...
  • Page 34: Receiving Data

    Connectivity Figure: ACK structure inside a packet structure Send packets in unicast mode and wait for a response: www.libelium.com/development/waspmote/examples/sx-03a-tx-lora-ack Send packets in unicast mode, wait for a response and retry to send the packet if there is no response: www.libelium.com/development/waspmote/examples/sx-04a-tx-lora-ackwretries 11.5.
  • Page 35: How To Receive Packets In Waspmote

    → stores the structure of the last packet received sx1272.packet_received → stores the structure of the ACK sx1272.ACK Receiving packets example: www.libelium.com/development/waspmote/examples/sx-02b-rx-lora Receiving packets and answering with ACK example: www.libelium.com/development/waspmote/examples/sx-03b-rx-lora-ack Receiving packets, sending a response and retrying to receive the packet example: www.libelium.com/development/waspmote/examples/sx-04b-rx-lora-ackwretries 11.5.2.
  • Page 36: Receiving All Packets

    Connectivity Receiving frames insides packets examples: www.libelium.com/development/waspmote/examples/sx-05b-rx-lora-waspframe www.libelium.com/development/waspmote/examples/sx-06b-rx-lora-ack-waspframe www.libelium.com/development/waspmote/examples/sx-07b-rx-lora-ackwretries-waspframe 11.5.3. Receiving all packets Due to the architecture of the LoRa module, all nodes in a channel with the same configuration mode listen any packet. Depending on the destination address, each node will hold packets addressed to it, and discard others.
  • Page 37: Starting A Network

    Example of use: sx1272.setChannel(CH_04_900); // Set channel SX1272 configuration example: www.libelium.com/development/waspmote/examples/sx-01-configure-lora-parameters 12.2. Choosing a mode This parameter is only intended for LoRa. Mode is different depending on the BW, CR and SF parameters chosen. There are 10 different modes in the Waspmote API, shown in the figure, but it is possible to add any other combination of BW, CR and SF values.
  • Page 38: Joining An Existing Network

    To set channel, use the API function responsible for that matter. Example of use: sx1272.setChannel(CH_04_900); // Set channel number 4 in 900 band SX1272 configuration example: www.libelium.com/development/waspmote/examples/sx-01-configure-lora-parameters 13.2. Mode To set mode, use the API function responsible for that matter. Example of use: sx1272.setMode(3);...
  • Page 39: Security And Data Encryption

    AES is classified as a block cipher algorithm. This means it has different modes of operation, like ECB or CBC mode. In this case it has been used ECB (electronic codebook) mode, which is the simplest of the encryption modes, with a ZEROS padding scheme. For further information, please check the Waspmote encryption Programming Guide: www.libelium.com/development/waspmote/documentation/encryption-programming-guide/ And also the encryption examples: www.libelium.com/development/waspmote/examples/ 14.1.
  • Page 40: Understanding Lora

    148 dB, what means more than 22 km (13.6 miles) in LOS links and up to 2 km (1.2 miles) in NLOS links in urban environment. Libelium’s LoRa module works in both 868 and 900 MHz ISM bands, which makes it suitable for virtually any country. Those frequency bands are lower than the popular 2.4 GHz band, so path loss attenuation is better in LoRa.
  • Page 41: Long Range Vs Transmission Time / Consumption

    Understanding LoRa As shown in the chapter “Long Range Tests”, Libelium performed long range tests, getting the awesome distance of 22 km (13.6 miles) in LOS configurations and 2 km (1.2 miles) in urban scenarios (going through buildings). The margin in those conditions would allow even more distance (x2, x3), the only problem was to keep the line-of-sight condition.
  • Page 42: Lora Vs Xbee 868/900 Mhz

    Libelium tests have checked that there is possible to set up a network with 8 different nodes sending frames every minute. This has been done using mode 1 which implies the worst time restrictions but best range. For the time synchronization, the RTC of Waspmote has been used to open temporal windows so as to perform the sending process.
  • Page 43: For What Applications Is Not Lora A Good Option

    Understanding LoRa 15.5. For what applications is NOT LoRa a good option? Definitely, LoRa is not suitable for projects which require high data-rate and/or very frequent transmissions (e.g., each 10 seconds). Also, LoRa is probably not suitable for highly populated networks. Anyway, it depends on the number of nodes, and on the number of packets per hour that each node sends.
  • Page 44: Code Examples And Extended Information

    Code examples and extended information 16. Code examples and extended information In the Waspmote Development section you can find complete examples: www.libelium.com/development/waspmote/examples Example: #include <WaspSX1272.h> #include <WaspFrame.h> // variable to show the flag from some functions int e; void setup() // Init USB port USB.ON();...
  • Page 45 Code examples and extended information frame.createFrame(ASCII,”WASP_PRO”); // Adding sensor battery frame.addSensor(SENSOR_BAT, (uint8_t) PWR.getBatteryLevel()); // Printing frame via USB frame.showFrame(); // Sending packet with timeout protection sx1272.sendPacketTimeout(5, frame.buffer, frame.length); delay(1000); -45- v7.0...
  • Page 46: Api Changelog

    API changelog 17. API changelog Keep track of the software changes on this link: www.libelium.com/development/waspmote/documentation/changelog/#LoRa -46- v7.0...
  • Page 47: Certifications

    Certifications 18. Certifications Libelium offers 2 types of IoT sensor platforms, Waspmote OEM and Plug & Sense!: Waspmote OEM is intended to be used for research purposes or as part of a major product so it needs final certification on •...

Table of Contents