Status | Date | Doc Version | Doc Number | Applicable | Confidentiality |
DEPRECATED | v1.3 | WP-RM-135 | v4.x, v5.x | PUBLIC |
Introduction
In order to locate a node through the Wirepas Positioning System (WPS) the node will have to collect received signal strength indicator (RSSI) measurements of the signals broadcasted by the anchor nodes visible in its vicinity and send the measurements over the Wirepas Mesh (WM) to the Wirepas Position Engine (WPE).
Positioning App implements the complete functionality required for collection and delivery of the RSSI measurements.
NOTE: This document describes the the Wirepas reference Positioning Application available as part of Wirepas Mesh SDK. This application being integrated by device manufacturers, please refer to the device manufacturer product documentation if you use off the shelf products.
User Guide
Operation modes
Positioning app was designed to run on both tags and anchor. At the moment the WM network role for a tag is non-router and for an anchor router.
There are operation modes dedicated for both tag and anchor as described below.
Tag: autoscan
In the autoscan mode the tag is a standard low-energy non-router. The tag will detect the WM and connect to the best available router in the vicinity. Connectivity to the WM is maintained as long as possible throughout the lifetime of the tag. As the tag is continuously connected it is possible to send and receive data messages at any moment.
At periodic configurable intervals the positioning app running on the tag will trigger a network scan for the purpose of detecting and collecting RSSI measurements. Once the measurements are collected the tag will send them though a data packed towards the sink / gateway / backend.
Autoscan mode is recommended in use cases where the tag has to be connected all the time to the WM i.e. there is the requirement to send and receive data packets at random times. This is not the typical use case for a standard asset tracking tag and is usually used only when the positioning app is expanded with additional functionality.
Because the in autoscan the tag maintains the connectivity the power consumption is higher than of the NRLS mode especially when the tag is moving around.
For this reason its use is recommended only in special use cases.
Tag: NRLS
In the non-router long sleep mode (NRLS) the tag is in sleep mode between two measurement updates. The tag will wakeup at periodic configurable intervals and perform a network scan, connect to WM, send the collected measurements, receive application configuration, disconnect from WM and finally go into sleep.
In this mode the positioning app does not trigger a network scan and the scan performed by the WM stack (required for establishing the connectivity) is used for collecting the RSSI measurements.
As in NRLS mode the tag maintains connectivity only as long is required to deliver the measurements there are two advantages: power consumption is reduced given that the tag is in sleep most of the time, the connection slot to the WM is freed allowing more tags to be served by the same anchors.
The disadvantage is that the tag cannot receive data while in sleep. The application configuration is used to provide configuration updates to the tag at wakeup.
NRLS mode is the recommended mode for a standard asset tracking tag.
Anchor: opportunistic
An anchor (router) is connected at all times to the WM network. For the purpose of maintaining the connectivity the WM stack will perform network scans in order to detect routers/sinks in the vicinity. The positioning app will collect and send the measurements generated by these scans thus the opportunistic mode. Given that the positioning app does not trigger additional scans the power impact on the anchor is minimal (only the cost of sending a data packet).
The opportunistic mode is the recommended mode to be used for an anchor.
Anchor: autoscan
The behavior of the anchor autoscan mode is identical to tag autoscan mode.
This mode was added for research and development and is not recommended to be used in a production system.
BLE beacons
The positioning app can be configured to send periodically BLE beacons (Eddystone / iBeacons) in all the operating modes i.e. both tags and anchors.
The BLE beacon configuration allows to send them all the time or only when outside WM coverage (e.g. this would allow to detect an asset tracking tag using a phone while outside the WM coverage).
The BLE beacon period is configurable and is possible to send Eddystone or iBeacon or both.
The supported beacon types are shown in Table 1.
Positioning app version | Eddystone URL | Eddystone UID | iBeacon |
v4.0.0 | X | X | |
v4.0.1 | X | X | |
v5.0.0 | X | X |
Table 1: Supported BLE beacon types
The main data content of the beacons are as follows:
For all the physical address is set to:
{0xC0, 0x00, NodeAdr[3], NodeAdr[2], NodeAdr[1], NodeAdr[0]}
- Eddystone URL
.url_advert = {'w', 'i', 'r', 'e', 'p', 'a', 's'}
- Eddystone UID
.nid ={'w','i','r','e','p','a','s', 0x00, 0x00, 0x00, NwAdr[2], NwAdr[1], NwAdr[0]}
.bid = {0x00, 0x00, NodeAdr[3], NodeAdr[2], NodeAdr[1], NodeAdr[0]}
- iBeacon
.uuid = {'w', 'i', 'r', 'e', 'p', 'a', 's',' ', 'm', 'e', 's', 'h', NwAdr[2], NwAdr[1], NwAdr[0] }
Where NwAdr is the node network address, and NodeAdr is the node address.
Measurement update rate
As mentioned in section Operation modes the measurement collection is done at periodic intervals set by the desired measurement update rate.
The measurement update rate is dynamically configurable through the application configuration (see section Positioning application configuration).
Device class
The tag and anchors can be grouped into classes. Currently there are 7 classes available. The tag/anchors in the same class will share the same configuration e.g. operating mode / update rate. It is recommended to use one class for the anchors and the other 6 for the tags. See more details in section Positioning application configuration.
Measurement message
The positioning app will send a data message on source/destination endpoint 238/238 containing the RSSI measurement and possibly other data.
The data message can contain up to 102 bytes and includes a header and one or several records. The records are encoded as type-length-value (TLV) and the record type is shown in Table 4.
Note that all multibyte fields are encoded as little-endian i.e. the least significant byte is first.
Header | Record 1 | … | Record n |
Octet 0…1 | Octet 2...x | … | Octet z...101 |
Table 2: Positioning app data message format
Field Name | Size | Description |
Seq | 2 | Sequence number. Incremented for every data packet |
Table 3: Header format
Record type [hex] | Description |
0x00 | Tag RSSI measurement, 3 byte node address, v4.0.x |
0x01 – 0x03 | Reserved for Wirepas |
0x04 | Battery voltage |
0x05 | Tag RSSI measurement, 4 byte node address, v5.0.x |
0x06 – 0x6F | Reserved for Wirepas |
0x70 – 0xEF | Reserved for customer |
0xF0 | Anchor RSSI measurement, 3 byte node address, v4.0.x |
0xF1 – 0xF4 | Reserved for Wirepas |
0xF5 | Anchor RSSI measurement, 4 byte node address, v5.0.x |
0xF6 – 0xFF | Reserved for Wirepas |
Table 4: Record type description
RSSI measurement record
The definition of the measurement record is shown in Table 5.
Field Name | Size | Description |
Type | 1 | Record type. See Table 4 |
Length | 1 | Payload length. E.g. N x 4 (v4.0.x) or N x 5 (v5.0.0) |
Repeated N times | ||
Node address | 3 | Node address has 3 bytes in v4.0.x |
4 | Node address has 4 bytes from v5.0.0 | |
Scaled RSS | 1 | RSSI value. Convert dBm as: value * -0.5 |
Table 5: RSSI measurement record
Battery voltage measurement record
Field Name | Size | Description |
Type | 1 | Record type. (set to 0x04) |
Length | 1 | Payload length (set to 2) |
Voltage | 2 | Battery voltage [mV] (uint16) |
Table 6: Battery voltage measurement record
Positioning application configuration
In WM there is the possibility to deliver an application configuration data message to each node in the network (see [1] for further details). The application configuration data can be up to 80 bytes and is paired with a sequence number i.e. the application configuration version. A WM node will receive the latest application configuration upon connection and every time the configuration is updated. The application is set to the sink (through the gateway) and then is broadcasted in the entire network tree served by the respective sink (e.g. it can be set through the Wirepas Network Tool (WNT) client). Positioning app is using the WM application configuration to customize the behavior of the tags and anchors dynamically at run time.
Prior to receiving the first configuration the node setting will be the default values set during manufacturing / initialization. If the node resets the default setting are used until the application configuration is received.
Format
In the positioning app configuration is formed by one or several configuration records representing the complete configuration for a device class (Table 7).
Class1 | ConfCmd1.1 | … | ConfCmd 1.n | Class2 | ConfCmd2.1 | … | ConfCmd 2.m |
Configuration record for Class 1 | Configuration record for Class 2 |
Table 7: Positioning app configuration format
A device class configuration record starts with the device class ID (encoded on first byte) followed by one or several configuration commands (encoded as type-length-value as shown in Table 8).
The device class can be one of the following values: 0xF9 …0xFF. Note that the device class needs to be set to the node at manufacturing.
Config command | Type | Length | Value | Description |
Measurement rate | 0x01 | 0x02 | 1 … 1800 sec | Supported in v4.0.x, v5.0.x |
0x04 | 1 … 86400 sec | Supported in v4.0.1 and v5.0.x | ||
Operating mode (1) | 0x02 | 0x01 | 1 | Tag NRLS |
2 | Tag autoscan | |||
3 | Anchor autoscan | |||
4 | Anchor opportunistic | |||
OTAP | 0x04 | 0x01 | 1…255 | Value is the OTAP sequence number to which the node should update if the scratchpad is available |
BLE beacon | 0x08 | 0x02 | 0 | BLE beacon broadcast disabled |
1… 65534 | BLE enabled when node is offline for as long as value field [sec] | |||
65535 | BLE beacon broadcast enabled always | |||
Device class change | 0x0A | 0x01 | 0xF9..0xFF | Changes the device class to value (special use) |
Table 8: Configuration commands
Note that the multi byte values are encoded in little-endian format.
(1) The node role is set at application build time. Only the Operating mode can be changed for a given node role (Tag or Anchor).
Example
- Device class: 0xF9
- Measurement rate: 300 s
- Operating mode: tag NRLS
0xF9 0x01 0x02 0x2C 0x01 0x02 0x01 0x01
Manufacturing provisioning
During the manufacturing it is possible to customize each node network parameters during the flashing process. This feature is available on nRF52x chip family.
To use the feature the following steps are required:
- set the parameter use_persistent_memory=yes in config.mk.
- write the content of UICR registers according to Table 9.
UICR register | Offset | Bytes | |||
0 | 1 | 2 | 3 | ||
CUSTOMER[0] | 0x080 | NODE ADDRESS (v4.0.x only bytes 0-2 used) | |||
CUSTOMER[1] | 0x084 | NETWORK ADDRESS (v4.0.x only bytes 0-2 used) | |||
CUSTOMER[2] | 0x088 | NETWORK CHANNEL | NODE ROLE | RFU | |
CUSTOMER[3] | 0x08C | RFU | |||
… | … | RFU | |||
CUSTOMER[30] | 0x0F8 | RFU | |||
CUSTOMER[31] | 0xFC | PERSISTENT_MAGIC_KEY (0xA133F0E8) |
Table 9: UICR register usage description
Notes:
- the configuration is only processed if CUSTOMER[31] register contains the magic key
- the multi byte parameters are expected to be encoded as little-endian
- if a parameter is set to 0xFF / 0xFFFFFFFF then it is considered invalid and ignored
- the parameters are only read and applied first time when the node boots
For how to write the UICR registers please consult your flashing tool manual. Note that the writing must occur before the node boots for the first time.
References
[1] Wirepas Mesh Dual-MCU API Reference Manual
Revision History
Date | Version | Notes |
v1.0 | Initial release | |
v1.1 | Added OTAP | |
v1.2 | Corrected Table 8 anchor mode codes | |
v1.3 | Added note to introduction |
Legal Notice
Use of this document is strictly subject to Wirepas’ Terms of Use and Legal Notice.
Copyright © 2021 Wirepas Oy