“New generation of Libelium product lines”. The Libelium LoRaWAN module has been integrated into the main sensor lines Waspmote OEM and Plug & Sense!, so now you can create your own Low Power Wide Area Network (LPWAN). LoRaWAN is a new, private and spread-spectrum modulation technique which allows sending data at extremely low data-rates to extremely long ranges.
Page 6
Actility, Orbiwise and Loriot, you can find more information about the configuration in this tutorial. Figure: LoRaWAN network Libelium currently offers two options of this type of radio technology: LoRa (“raw”) and LoRaWAN: LoRa contains only the link layer protocol and is perfect to be used in P2P communications between nodes.
Page 7
Introduction In the P2P Mode nodes may connect directly among them and send messages directly at no cost (as they • are not using the LoRaWAN Network but just direct radio communication). This is useful as we can create secondary networks at any time as we don’t need to change the firmware but just use specific AT Commands in the current library.
Page 8
All documents and any examples they contain are provided as-is and are subject to change without notice. • Except to the extent prohibited by law, Libelium makes no express or implied representation or warranty of any kind with regard to the documents, and specifically disclaims the implied warranties and conditions of merchantability and fitness for a particular purpose.
Introduction 1.1. Technology overview LoRaWAN is a Low Power Wide Area Network (LPWAN) specification intended for wireless battery operated devices in regional, national or global network. LoRaWAN target key requirements of Internet of things such as secure bi-directional communication, mobility and localization services. This standard will provide seamless interoperability among smart Things without the need of complex local installations and gives back the freedom to the user, developer, businesses enabling the role out of Internet of Things.
Hardware 2. Hardware 2.1. Specifications The LoRaWAN module is managed via UART and it can be connected to SOCKET0 or SOCKET1. 2.1.1. LoRaWAN EU The main features of the module are listed below: Manufacturer: Microchip • Model: RN2483 • Protocol: LoRaWAN 1.0, Class A •...
Hardware 2.1.2. LoRaWAN US The main features of the module are listed below: Manufacturer: Microchip • Model: RN2903 • Protocol: LoRaWAN 1.0, Class A • LoRaWAN-ready • Frequency: US 902-928 MHz ISM band • TX power: up to +18.5 dBm •...
Hardware 2.1.3. LoRaWAN AU The main features of the module are listed below: Manufacturer: Microchip • Model: RN2903 • Protocol: LoRaWAN 1.0.1, Class A • LoRaWAN-ready • Frequency: AU 915-928 MHz ISM band • TX power: up to +18.5 dBm •...
Hardware 2.1.4. LoRaWAN IN The main features of the module are listed below: Manufacturer: Microchip • Model: RN2903 • Protocol: LoRaWAN 1.0.1, Class A • LoRaWAN-ready • Frequency: IN 865-867 MHz ISM band • TX power: up to +18.5 dBm •...
Libelium commercializes different items depending on the band the user wants to use. In the case of 868 and 433, the module is the same, but the antenna is different for each band. The module for EU (868) and 433 MHz includes 2 RP-SMA connectors for the antenna.
Libelium commercializes different items depending on the band the user wants to use. In the case of 868 and 433, the module is the same, but the antenna is different for each band. The module for EU (868) and 433 MHz includes 2 RP-SMA connectors for the antenna.
Hardware Note: Due to the propagation characteristics of the sub-GHz bands, the near field effect could make that 2 modules cannot communicate if they are placed very close (< 1 m). We suggest to keep a minimum distance of 3 or 4 meters between modules.
Hardware 2.3. Power consumption 2.3.1. LoRaWAN EU The LoRaWAN EU module is powered at 3.3 V. The next table shows the module’s average current consumption in different states of the module. State Power Consumption 2.8 mA Transmitting data 38.9 mA Receiving data 14.2 mA Figure: Power consumption table...
Hardware 2.3.5. LoRaWAN ASIA-PAC / LATAM The LoRaWAN ASIA-PAC / LATAM module is powered at 3.3 V. The next table shows the module’s average current consumption in different states of the module. State Power Consumption 2.7 mA Transmitting data 124.4 mA Receiving data 13.5 mA Figure: Power consumption table...
Hardware 2.4. Time consumption The elapsed periods defined in this chapter take into account the following steps depending on the case: Join to a network and send unconfirmed data • Join to a network and send confirmed data • These periods of time depend on the data rate set which is defined by the spreading factor and signal bandwidth configured.
Hardware 2.6. 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 21
Hardware The rest of functions are used the same way as they are used with older API versions. In order to understand them, we recommend to read this guide. Warnings: Avoid to use DIGITAL7 pin when working with the Expansion Board. This pin is used for setting the XBee into •...
This object, WaspLoRaWAN called , is already created by default inside Waspmote LoRaWAN library. It will be used through this guide LoRaWAN to show how Waspmote works. When using the class constructor, all variables are initialized to a default value.
Software 3.1.4. API variables The variables used inside functions and Waspmote codes are: Constant Description The buffer of memory used for storing the responses from the _buffer module The useful length of the buffer _length The time to wait after sending every command until listen for a _def_delay response The baudrate to be used when the module is switched on...
Software The value of the downlink frame counter _downCounter The output power level used by the transceiver _radioPower The spreading factor to be used by the transceiver _radioSF The receiving bandwidth used by the transceiver _radioRxBW The coding rate used by the transceiver _radioCR The time to be used by the transceiver watchdog timer _radioWDT...
Software 3.2. Module system management features 3.2.1. Switch on function allows to switch on the LoRaWAN module, it opens the MCU UART for communicating with the ON() module and it automatically enters into command mode. In addition, when the module has been powered and communication is opened, this function checks whether a module is plugged to the socket and which type of module has been plugged.
LoRaWAN.factoryReset(); Related variable: → Stores the module’s version LoRaWAN._version Examples of LoRaWAN configuration: www.libelium.com/development/waspmote/examples/lorawan-01a-configure-module-eu www.libelium.com/development/waspmote/examples/lorawan-01b-configure-module-us 3.2.5. Preprogrammed unique identifier (EUI) function allows the user to query the preprogrammed EUI node address from the module. The getEUI() preprogrammed EUI node address is a read-only value and cannot be changed or erased. It is a global unique 64-bit identifier.
LoRaWAN.getDeviceEUI(); Related variable: → Stores the previously set device EUI LoRaWAN._devEUI Examples of LoRaWAN configuration: www.libelium.com/development/waspmote/examples/lorawan-01a-configure-module-eu www.libelium.com/development/waspmote/examples/lorawan-01b-configure-module-us 3.3.2. Device address function allows the user to set the 32-bit hexadecimal number representing the device setDeviceAddr() address. This address must be unique to the current network. There are two function prototypes which are explained below: No input device address is specified, then the last 4 bytes of the preprogrammed EUI are set as device address.
LoRaWAN.setDeviceAddr(“01020304”); LoRaWAN.getDeviceAddr(); Related variable: → Stores the previously set device address LoRaWAN._devAddr Examples of LoRaWAN configuration: www.libelium.com/development/waspmote/examples/lorawan-01a-configure-module-eu www.libelium.com/development/waspmote/examples/lorawan-01b-configure-module-us 3.3.3. Application Session Key function allows the user to set the 128-bit hexadecimal number representing the setAppSessionKey() application session key. All payloads are encrypted using an AES algorithm with a 128-bit secret key, the Application Session Key. Each end-device has its own unique Application Session Key only known by the end-device and the application server.
Example of use: LoRaWAN.setAppSessionKey(“00102030405060708090A0B0C0D0E0F”); Related variable: → Stores the previously set application session key LoRaWAN._appSKey Examples of LoRaWAN configuration: www.libelium.com/development/waspmote/examples/lorawan-01a-configure-module-eu www.libelium.com/development/waspmote/examples/lorawan-01b-configure-module-us 3.3.4. Network session key function allows the user to set the 128-bit hexadecimal number representing the setNwkSessionKey() network session key.
LoRaWAN.setNwkSessionKey(“00102030405060708090A0B0C0D0E0F”); Related variable: → Stores the previously set network session key LoRaWAN._nwkSKey Examples of LoRaWAN configuration: www.libelium.com/development/waspmote/examples/lorawan-01a-configure-module-eu www.libelium.com/development/waspmote/examples/lorawan-01b-configure-module-us 3.3.5. Application EUI function allows the user to set the 64-bit hexadecimal number representing the application setAppEUI() identifier. This parameters is a global application identifier that uniquely identifies the application provider (i.e., owner) of the module.
Software 3.4. LoRaWAN module activation To participate in a LoRaWAN network, each module has to be personalized and activated. Activation of a module can be achieved in two ways, either via Over-The-Air Activation (OTAA) when an end-device is deployed or reset, or via Activation By Personalization (ABP) in which the two steps of end-device personalization and activation are done as one step.
Page 32
Software Join OTAA • Before joining the network, the specific parameters for activation should be configured: device EUI, application EUI and application key. Example of use: LoRaWAN.joinOTAA(); After joining via OTAA successfully, the module will be able to join the network in ABP mode in future joining procedures.
Software 3.5. LoRaWAN mode features 3.5.1. Operational ISM bands function allows the user to reset the software LoRaWAN stack and initialize it with the resetMacConfig() parameters for the selected band: 433 MHz, 868 MHz or 900 MHz. function allows the user to query the current frequency band of operation. This function is not getBand() available for the LoRaWAN US and AU modules since they can only work in the 902-928 MHz ISM band for the US version and 915-928 MHz ISM band for the AU version.
Page 34
Example of use: uint8_t port = 1; char data[] = “010203040506070809”; LoRaWAN.sendUnconfirmed( port, data); Example of sending a packet without ACK: www.libelium.com/development/waspmote/examples/lorawan-06-join-abp-send-unconfirmed www.libelium.com/development/waspmote/examples/lorawan-09-join-otaa-send-unconfirmed There is a second function prototype which permits to send a packet defined as an array of sendUnconfirmed() bytes.
Example of use: uint8_t port = 1; char data[] = “010203040506070809”; LoRaWAN.sendConfirmed( port, data); Example of sending a packet with ACK: www.libelium.com/development/waspmote/examples/lorawan-07-join-abp-send-confirmed www.libelium.com/development/waspmote/examples/lorawan-10-join-otaa-send-confirmed There is a second function prototype which permits to send a packet defined as an array of bytes. sendConfirmed() So the function expects three inputs: port, pointer to the data and length of the data.
• Example of use: LoRaWAN.saveConfig(); Examples of LoRaWAN configuration: www.libelium.com/development/waspmote/examples/lorawan-01a-configure-module-eu www.libelium.com/development/waspmote/examples/lorawan-01b-configure-module-us function allows the user to enable LoRaWAN mode. After switching on the module it is not macResume() mandatory to call this function because the default mode upon reboot is LoRaWAN mode. However, if P2P mode was previously set and the user needs to switch back to LoRaWAN mode, then this function must be called.
Software 3.5.5. Power level function allows the user to set the output power to be used on the next transmissions. setPower() function allows the user to query the device power index which was previously set by the user. getPower() The attribute permits to access to the settings of the module.
Page 38
MaxEIRP – 14 dB Figure: Power levels table (LoRaWAN JP / KR (band KR920-923MHz) module MaxEIRP is 14 dBm) Example of use: LoRaWAN.setPower(1); LoRaWAN.getPower(); Related variable: → Stores the previously set power LoRaWAN._powerIndex Example of setting power level: www.libelium.com/development/waspmote/examples/lorawan-03-power-level -38- v7.6...
This attribute is set to ‘true’ if ADR is enabled or ‘false’ if ADR is disabled. Example of use: LoRaWAN.setADR(“on”); LoRaWAN.setADR(“off”); LoRaWAN.getADR(); Related variable: → Stores the previously set ADR status LoRaWAN._adr Example of setting adaptive data rate: www.libelium.com/development/waspmote/examples/lorawan-05-adaptive-data-rate -39- v7.6...
The attribute permits to getDataRate() _dataRate access to the settings of the module. Example of use: LoRaWAN.setDatarate(0); LoRaWAN.getDataRate(); Related variable: → Stores the previously set data rate LoRaWAN._dataRate Example of setting data rate: www.libelium.com/development/waspmote/examples/lorawan-04-data-rate -40- v7.6...
Related variable: → Stores the previously set number of retransmissions LoRaWAN._retries Examples of LoRaWAN configuration: www.libelium.com/development/waspmote/examples/lorawan-01a-configure-module-eu www.libelium.com/development/waspmote/examples/lorawan-01b-configure-module-us 3.5.9. Receiving windows As it has been described in the section “Receiving data from a LoRaWAN gateway”, there is no specific function to receive data.
To get to know the saveConfig() previous state of this parameter user can use the attribute _ar. Example of use: LoRaWAN.setAR(“on”); LoRaWAN.setAR(“off”); LoRaWAN.getAR(); Related variable: → Stores the previously set ADR status LoRaWAN._ar Examples of LoRaWAN configuration: www.libelium.com/development/waspmote/examples/lorawan-01a-configure-lorawan-868 www.libelium.com/development/waspmote/examples/lorawan-01b-configure-lorawan-900 -42- v7.6...
Software 3.5.11. Uplink counter function allows the user to set the uplink frame counter that will be used for the next uplink setUpCounter() transmission. function allows the user to query the uplink frame counter that will be used for the next getUpCounter() uplink transmission.
Software 3.5.13. Channel parameters The LoRaWAN EU module has 16 channels available to be configured. The channel parameters are: Frequency • Duty cycle • Data rate range • Status • Frequency band (Default values) Channel Number Parameters Frequency (Hz) 868100000 433175000 Duty cycle Channel 0...
Page 45
Software The LoRaWAN AU module has 72 channels with a preset fixed frequency for every channel (like the US model). Data rate range and channel status are the only settable parameters. Channel Number Parameters Default Values Frequency (Hz) 915200000 + 200000 * channel Index Channel 0 - 63 Data rate range (min - max) 0 - 4...
Page 46
Software The LoRaWAN ASIA-PAC / LATAM module has 16 channels available to be configured. The channel parameters are: Frequency Duty cycle Data rate range Status Channel Number Parameters Default Values Frequency (Hz) 923200000 Duty cycle Channel 0 Data rate range Status Frequency (Hz) 923400000...
Page 47
Software The LoRaWAN JP / KR module configured in the AS923 MHz Japan band has 16 channels available to be configured. The channel parameters are: Frequency Frequency Data rate range Status Channel Number Parameters Default Values Frequency (Hz) 922100000 Channel 0 Data rate range Status Frequency (Hz)
Page 48
Software Example of channel settings configuration: www.libelium.com/development/waspmote/examples/lorawan-02a-channels-configuration-eu www.libelium.com/development/waspmote/examples/lorawan-02b-channels-configuration-us Channel duty cycle • function allows the user to set the operational duty cycle on the given channel setChannelDutyCycle() number (from 0 to 15). The duty cycle value that needs to be used as input argument can be obtained from the wanted duty cycle X (in percentage) using the following formula: duty cycle = (100/X) –...
Page 49
Software Example of channel settings configuration: www.libelium.com/development/waspmote/examples/lorawan-02a-channels-configuration-eu www.libelium.com/development/waspmote/examples/lorawan-02b-channels-configuration-us Channel status • function allows the user to set the operation of the given channel, either setChannelStatus() ”on” ”off” This function is not available for the LoRaWAN JP / KR. LoRaWAN EU, LoRaWAN IN and LoRaWAN ASIA-PAC / LATAM allows to configure the channel status on channels from 0 to 15.
Software 3.5.14. Duty cycle prescaler function allows the user to query the duty cycle prescaler. The value of the getDutyCyclePrescaler() prescaler can be configured only by the server through use of the Duty Cycle Request frame. Upon reception of this command from the server, the duty cycle prescaler is changed for all enabled channels. The attribute permits to access to the settings of the module.
Software 3.6.2. Send data function allows the user to transmit data using the radio transceiver. This function will not expect sendRadio() any acknowledgement back from the receiver. The maximum length of the frame is 255 bytes (510 ASCII digits). Example of use: char data[] = “010203040506070809”;...
Software Related variable: → Stores the previously set output power level LoRaWAN._radioPower 3.6.5. Spreading Factor function allows the user to set the operating spreading factor (SF) in P2P mode. setRadioSF() function allows the user to query the operating Spreading Factor (SF) in P2P mode which was getRadioSF() previously set by the user.
Software 3.6.8. CRC header function allows the user to set the Cyclic Redundancy Check (CRC) header status for transmit/ setRadioCRC() receive in P2P mode. function allows the user to query the CRC status which was previously set by the user. The getRadioCRC() attribute permits to access to the settings of the module.
Software 3.6.11. Frequency function allows the user to set the communication frequency of the radio transceiver. setRadioFrequency() function allows the user to query radio frequency which was previously set by the user. getRadioFrequency() The attribute permits to access to the settings of the module. _radioFreq When using the LoRaWAN EU or the LoRaWAN IN module, the operation frequency can take values from 433250000 to 434550000 or from 863250000 to 869750000, for the 433 and 868 MHz bands.
LoRaWAN networks (242 bytes). Therefore, the central node will be able to resend all received frames from the other P2P nodes. The following example shows how to operate as a central node sending data of the incoming P2P packets to the LoRaWAN network: www.libelium.com/development/waspmote/examples/lorawan-p2p-04-hybrid-p2p-to-lorawan -55- v7.6...
You can see an example of configuration in this code: www.libelium.com/development/waspmote/examples/lorawan-01a-configure-module-eu 4.1.2. LoRaWAN US As we can see in the section “Channel parameters”, LoRaWAN US module supports up to 64 channels to transmit uplink messages.
You can see an example of configuration in this code: www.libelium.com/development/waspmote/examples/lorawan-01b-configure-module-us 4.1.3. LoRaWAN AU As we can see in the section “Channel parameters”, LoRaWAN AU module supports up to 64 channels to transmit uplink messages.
You can see an example of configuration in this code: www.libelium.com/development/waspmote/examples/lorawan-01a-configure-module-eu 4.1.6. LoRaWAN JP / KR As we can see in the section “Channel parameters”, the LoRaWAN JP / KR module supports up to 16 channels to transmit information.
LoRaWAN back-ends 4.2. Actility ThingPark Wireless Device Manager is the back-end User Interface (UI) which allows you to manage all of your LoRaWAN devices. This Guide will provide the guidelines on the entire GUI, the device provisioning, device configuration and management, alarm and routing profile management and connectivity plan association.
Page 60
LoRaWAN back-ends Over The Air Activation: Information required to create a new device: Device EUI (DevEUI) • Application EUI (AppEUI) • Application key (AppKey) • These parameters match with the ones used by the server and defined by user. They will be used to negotiate necessary keys for the module to send data.
DevEUI length, ensuring it will be unique. DevAddr will be extracted from this manufacturer module’s identifier taking its last 32 bit. E.g., Microchip Module: EUI: 0004A30B001A836D, DevEUI: 0004A30B001A836D, DevAddr: 001A836D. Examples of setting configuration necessary to connect into a network and send packets: www.libelium.com/development/waspmote/examples/lorawan-06-join-abp-send-unconfirmed www.libelium.com/development/waspmote/examples/lorawan-07-join-abp-send-confirmed -61- v7.6...
LoRaWAN back-ends 4.3. LORIOT LORIOT.io is a provider of a LoRaWAN Network Server and Application Server software, which is commercially offered through a set of business models. They provide: Software for the supported LoRa gateways • Cloud-based LoRaWAN Network Server •...
Page 63
LoRaWAN back-ends Figure: LOIRIOT.io Wireless Device Manager (new device creation) Once the device is created you can access to its configuration and data clicking over the Device EUI field with the mouse. Data messages can be seen there. -63- v7.6...
Inside the device description in the LORIOT.io portal they warn to copy EUI and Address in little endian format, but it won’t be necessary for the Waspmote code, it can be copied big endian format. Examples of setting configuration necessary to connect into a network and send packets: www.libelium.com/development/waspmote/examples/lorawan-02-send-unconfirmed www.libelium.com/development/waspmote/examples/lorawan-03-send-confirmed -64-...
LoRaWAN back-ends 4.4. The Things Network The Things Network provides a set of open tools and a global, open network to build your next IoT application at low cost, featuring maximum security and ready to scale. Through robust end-to-end encryption, a secure and collaborative Internet of Things network is built that spans across many countries around the globe.
When is LoRaWAN recommended? 5. When is LoRaWAN recommended? LoRaWAN is a protocol with a good long-range performance. It is achieved thanks to the excellent receiver sensitivity of the LoRa modulation, which is possible due to very low data rates (few bps). The main drawback of LoRaWAN is the low data rate of the transmission modes with high Spreading Factor.
Certifications 6. 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 the client side. More info at: www.libelium.com/products/waspmote...
* Explanation: This example shows how to configure the module * and all general settings related to back-end registration * process. * Copyright (C) 2016 Libelium Comunicaciones Distribuidas S.L. * http://www.libelium.com * This program is free software: you can redistribute it and/or modify...
Page 69
Code examples and extended information USB.println(F(“| Server should configure the module during the |”)); USB.println(F(“| Over The Air Activation process. |”)); USB.println(F(“|_____________________________________________________|”)); USB.println(); ////////////////////////////////////////////// // 1. switch on ////////////////////////////////////////////// error = LoRaWAN.ON(socket); // Check status if( error == 0 ) USB.println(F(“1.
Page 70
Code examples and extended information USB.print(F(“Device EUI: “)); USB.println(LoRaWAN._devEUI); else USB.print(F(“3.2. Get Device EUI error = “)); USB.println(error, DEC); ////////////////////////////////////////////// // 4. Set/Get Device Address ////////////////////////////////////////////// // Set Device Address error = LoRaWAN.setDeviceAddr(DEVICE_ADDR); // Check status if( error == 0 ) USB.println(F(“4.1.
Page 71
Code examples and extended information error = LoRaWAN.setAppSessionKey(APP_SESSION_KEY); // Check status if( error == 0 ) USB.println(F(“6. Set Application Session Key OK”)); else USB.print(F(“6. Set Application Session Key error = “)); USB.println(error, DEC); ////////////////////////////////////////////// // 7. Set retransmissions for uplink confirmed packet ////////////////////////////////////////////// // set retries error = LoRaWAN.setRetries(7);...
Page 72
Code examples and extended information //////////////////////////////////////////////////////// // ______________________________________________________ // | // | It is not mandatory to configure channel parameters.| // | Server should configure the module during the // | Over The Air Activation process. If channels aren’t | // | configured, please uncomment channel configuration | // | functions below these lines.
Page 73
Code examples and extended information // for (uint8_t ch = 3; ch <= 7; ch++) // { error = LoRaWAN.setChannelDutyCycle(ch, 40000); // Check status if( error == 0 ) USB.println(F(“10. Duty cycle channel set OK”)); else USB.print(F(“10. Duty cycle channel set error = “)); USB.println(error, DEC);...
Page 74
Code examples and extended information // set ADR error = LoRaWAN.setADR(“on”); // Check status if( error == 0 ) USB.println(F(“13.1. Set Adaptive data rate status to on OK”)); else USB.print(F(“13.1. Set Adaptive data rate status to on error = “)); USB.println(error, DEC);...
Page 75
Code examples and extended information USB.println(“on”); else USB.println(“off”); else USB.print(F(“14.2. Get automatic reply status error = “)); USB.println(error, DEC); ////////////////////////////////////////////// // 15. Save configuration ////////////////////////////////////////////// error = LoRaWAN.saveConfig(); // Check status if( error == 0 ) USB.println(F(“15. Save configuration OK”)); else USB.print(F(“15.
API changelog 8. API changelog Keep track of the software changes on this link: www.libelium.com/development/waspmote/documentation/changelog/#LoRaWAN -76- v7.6...
Documentation changelog 9. Documentation changelog From v7.5 to v7.6 Added sections related to the LoRaWAN JP / KR module • New region standard added to the compatibility table • Added section about The Things Network • Changed details about the Loriot configuration •...
Need help?
Do you have a question about the Waspmote LoRaWAN and is the answer not in the manual?
Questions and answers