Skip to main content
Skip table of contents

Customizing the Developer Tag data payload


In this tutorial you will learn how to include custom data in the tag transmission payload. This will essentially transform the Enterprise system in a wireless sensor network. The data transmitted will be available in the local MQTT stream on the gateway, with the position included. This will allow you to capture location-based events or location-based sensor data for your application.

The custom payload will only be available locally, not over the cloud

The developer tag can be used both for the Creator and the Enterprise series. For the Enterprise series, the tag must be configured to be in the Enterprise TDOA Aloha mode. Using the device configurator, it is already possible to change the behavior of the tag such as positioning update rate, or by selecting between some standard payloads. The standard payloads capture sensor data from the developer tag and include it in the transmission packet. Sensors to choose from are the on-board accelerometer, gyroscope, magnetometer or pressure sensor.

We will see now how to customize the payload even further.

Python library setup

First we’re going to need the Pozyx python library to communicate with the Developer Tag over USB. You can download it through git. When cloning the repository, make sure you checkout the develop branch.

Make sure you have the prerequisites as stated in the readme.rst

  • python installed

  • pyserial package installed

  • ST’s virtual COM driver installed

Custom payload

Here we will create a script that connects to the developer tag. It will enable the ALOHA-mode and write the custom data that needs to be transmitted as payload. In the script below, the custom payload is an incrementing integer which is transmitted every 0.5 seconds. To encapsulate other types of data, please check the Python function pack.

from pypozyx import *
from pypozyx.definitions.registers import *
from time import *
import struct

p = PozyxSerial(get_first_pozyx_serial_port())
index = 0
while True:
    transmit_data = struct.pack("I", index)
    index += 1

Other custom payload options

The struct.pack(fmt, v1, v2, …) function packs the variables v1, v2, … according to the given format. Changing the format allows you to cover a wide range of payload options. Some useful formats are summarized below:


Python type









Grabbing the data through MQTT

Finally, we can capture the transmitted data by connecting to the MQTT stream. For the example above, the output looks as follows. The custom payload can be found under data > tagData > customSensors. There you can find the custompayload and the value we added with the script. Remember that the data is represented as bytes in BigEndian. Use the unpack function if you want the data back in it’s original form.

				"name":"zone 2",
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.