Page 3
Index 7.5. Receiving Data ..........................21 7.5.1. Receiving function .......................21 7.5.2. Examples ..........................21 8. Node Discovery ........................22 8.1. Structure used in Discovery ......................22 8.2. Searching specific nodes ....................... 23 8.3. Node discovery to a specific node ....................23 8.4.
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.
Ignoring this, could lead to considerable penalties. Remark: Libelium replaced the XBee 868 module with its natural evolution, the XBee 868LP, in October 2016. The XBee 868LP module is not compatible with other XBee products. Among other differences, they use different baudrates so they cannot interoperate.
Page 6
Hardware Figure : Available frequencies for XBee 868LP Encryption is provided through the AES 128 bits algorithm. Specifically through the type AES-CTR. In this case the Frame Counter field has a unique ID and encrypts all the information contained in the Payload field which is the place in the link layer frame where the data to be sent is stored.
Hardware 2.2. How to connect the module This module can be connected to both SOCKET0 and SOCKET1 on the Waspmote board. Figure : Module connected to Waspmote in SOCKET0 In order to connect the module to the SOCKET1, the user must use the Expansion Radio Board. v7.1...
Hardware 2.3. Expansion Radio Board (XBee 868LP) 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 9
Hardware The API provides a function called in order to switch the XBee module on. This function supports a parameter ON() which permits to select the SOCKET. It is possible to choose between SOCKET0 and SOCKET1. Selecting SOCKET0 (both are valid): xbee868LP.ON();...
General Considerations 3. General Considerations 3.1. Waspmote Libraries 3.1.1. Waspmote XBee Files Waspmote API files: WaspXBeeCore.h WaspXBeeCore.cpp WaspXBee868LP.h WaspXBee868LP.cpp It is mandatory to include the XBee 868LP library when using this module. The following line must be introduced at the beginning of the code: #include <WaspXBee868LP.h>...
→ stores the response given by the module up to 100 bytes commandAT[0-99] • Sending AT commands example: http://www.libelium.com/development/waspmote/examples/868lp-11-send-atcommand 3.4. Waspmote reboot When Waspmote is rebooted the application code will start again, creating all the variables and objects from the beginning.
Initialization 4. Initialization Before starting to use a module, it needs to be initialized. During this process, the UART to communicate with the module has to be opened and the XBee switch has to be set on. 4.1. Setting ON function initializes all the global variables, opens the correspondent UART and switches the XBee ON.
Node Parameters 5. Node Parameters When configuring a node, it is necessary to set some parameters which will be used lately in the network, and some parameters necessary for using the API functions. 5.1. MAC Address A 64-bit RF module’s unique IEEE address. It is divided in two groups of 32 bits (High and Low). It identifies uniquely a node inside a network due to it can not be modified and it is given by the manufacturer.
→ stores the 16-bit PAN ID. It is stored in the two first positions. PAN_ID[0-7] • XBee configuration example: http://www.libelium.com/development/waspmote/examples/868lp-01-configure-xbee-parameters 5.3. Node Identifier It is an ASCII string of 20 characters at most which identifies the node in a network. It is used to identify a node in the application level.
Page 15
Node Parameters This read-only command can be queried to return a bitfield of the frequencies that are available in the module’s region of operation. Each bit corresponds to a physical channel. Channels are spaced 200 kHz apart: Bitfield Frecuency (MHz) Bit 0 863.150 Bit 1...
→ stores the operating channel _channelMask[0-3] • XBee configuration example: http://www.libelium.com/development/waspmote/examples/868lp-01-configure-xbee-parameters 5.6. Preamble ID Only modules with matching preamble IDs can communicate with each other. Different preamble IDs minimize interference between multiple sets of modules operating in the same vicinity. When receiving a packet this is checked before the network ID, as it is encoded in the preamble, and the network ID is encoded in the MAC header.
Each application scenario will need some tests to find the best combination of both parameters. Get RSSI example: http://www.libelium.com/development/waspmote/examples/868lp-05-get-rssi 6.2. Power Level It is possible to set/get the power level at which the RF module transmits conducted power. Power level 4 is calibrated and the other power levels are approximate.
Networking methods 7. Networking methods Note: It is important to keep in mind that XBee networks are defined by the networking parameters. Every XBee module within a network must share the same networking parameters. In the case of the XBee 868, every node in a network must have the same: •...
WaspFrame 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 Frame Programming Guide in order to understand the XBee examples: http://www.libelium.com/development/waspmote/documentation/data-frame-guide/ 7.4.2. Sending function The function sends a packet via XBee module.
Related variables: → stores the maximum number of application-level retries _send_retries 7.4.3. Examples Send packets in unicast mode: • http://www.libelium.com/development/waspmote/examples/868lp-02-send-packets Send packets in broadcast mode: • http://www.libelium.com/development/waspmote/examples/868lp-04a-send-broadcast Send packets using the expansion board: • http://www.libelium.com/development/waspmote/examples/868lp-06a-expansion-board-send Complete example, send packets in unicast mode and wait for a response: •...
→ Length of the buffer _length → Source’s MAC address _srcMAC[0-7] 7.5.2. Examples Receiving packets example: • http://www.libelium.com/development/waspmote/examples/868lp-03-receive-packets Receive packets in broadcast mode (the same procedure as if it was unicast mode): • http://www.libelium.com/development/waspmote/examples/868lp-04b-receive-broadcast Receive packets using the expansion board: • http://www.libelium.com/development/waspmote/examples/868lp-06b-expansion-board-reception Complete example, receive packets and send a response back to the sender: •...
Example of use: xbee868LP.scanNetwork(); Related variables: → stores the number of discovered brothers totalScannedBrothers → Node structure array that stores the info scannedBrothers Scan network example: • http://www.libelium.com/development/waspmote/examples/868lp-09-scan-network -22- v7.1...
→ Stores the 64-bit address of the searched node mac[0-7] Node search example: • http://www.libelium.com/development/waspmote/examples/868lp-10a-node-search-tx http://www.libelium.com/development/waspmote/examples/868lp-10b-node-search-rx 8.3. Node discovery to a specific node When executing a Node Discovery all the nodes respond to it. If its Node Identifier is known, a Node Discovery using its as an input can be executed.
Node Discovery 8.4. Node Discovery Time It is the amount of time a node will wait for responses from other nodes when performing a ND. Parameter range: From 0x0020 to 0x2EE0 [x100 ms]. Default value: 0x0082. Example of use: uint8_t time[2] = { 0x00, 0x82 }; xbee868LP.setScanningTime(time);...
(put to ‘high’), the module will finish any transmit or receive operations and enter a low-power state. The module will wake from the low-power state when the pin sleep is de-asserted (‘low’). For this purpose, the functions are defined. sleep() wake() Example of use: xbee868LP.sleep(); delay(5000); xbee868LP.wake(); • Sleep mode example: http://www.libelium.com/development/waspmote/examples/868lp-07-set-low-power-mode -25- v7.1...
→ stores if security is enabled or not encryptMode • XBee configuration example: http://www.libelium.com/development/waspmote/examples/868lp-01-configure-xbee-parameters 10.2.2. Encryption Key 128-bit AES encryption key used to encrypt/decrypt data. The entire payload of the packet is encrypted using the key and the CRC is computed across the ciphertext. When encryption is enabled, each packet carries an additional 16 Bytes to convey the random CBC Initialization Vector (IV) to the receivers.
Security and Data Encryption 10.3. Security in a network When creating or joining a network, using security is highly recommended to prevent the network from attacks or intruder nodes. It is necessary to enable security and set the same encryption key in all nodes in order to set security in a network. If not, it won’t be possible to communicate between different XBee modules.
Certifications 11. 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...
Code examples and extended information 12. Code examples and extended information In the Waspmote Development section you can find complete examples: http://www.libelium.com/development/waspmote/examples Example: #include <WaspXBee868LP.h> #include <WaspFrame.h> // Destination MAC address ////////////////////////////////////////// char RX_ADDRESS[] = “0013A20040A63E21”; ////////////////////////////////////////// // Define the Waspmote ID char WASPMOTE_ID[] = “node_01”;...
API changelog 13. API changelog Keep track of the software changes on this link: www.libelium.com/development/waspmote/documentation/changelog/#868lp -30- v7.1...
Documentation changelog 14. Documentation changelog From v7.0 to v7.1 Added a new section to show the user how to connect the module to Waspmote • -31- v7.1...
Need help?
Do you have a question about the Waspmote 868LP and is the answer not in the manual?
Questions and answers