Skip to main content
Skip table of contents

Tutorial 4: Multitag positioning (Arduino)

Multitag positioning

The multitag positioning is an extension of tutorial 2, where we went over the positioning of a single device, and this being an extension is also visible in the code. Therefore, this tutorial will seem rather short and will go over the additions to allow for multitag. It is thus essential to follow that tutorial first.

For this tutorial you'll need an Arduino, at least four anchors and at least three other powered devices. These can be either tags or anchors, but remember that anchors don't have an IMU.

Open up the multitag positioning example in the Arduino IDE under File > Examples > Pozyx > multitag_positioning.

Plug and play

Looking at the parameters of the multitag positioning, you will see one major addition over the regular positioning example, namely the tags parameter which replaced the remote_id and remote parameters. In this list, you'll have to write the IDs of the remote devices you'll be using. For your anchors, use the setup you measured out in the positioning tutorial. You can also again choose the dimension and algorithm used for the positioning.

There is also the num_tags parameter, which you'll need to change to the size of your tags array.

int num_tags = 3;
uint16_t tags[3] = {0x0001, 0x0002, 0x0003};

Once you put the IDs of your tags here, you can start with multitag positioning. You can use the positioning Processing sketch straight from the bat as well if you set your use_processing to true and set your Processing serial and port correctly. However, reading the terminal output offers a more deterministic way of knowing whether you've got it working.

Code additions and changes

As this is an extension of the ready to localize tutorial, the code has been modified to support multiple remote devices through the added tags parameter. Printing both error and position now takes an additional parameter: the ID of the device we're working with.

Anchor configuration

Each device needs to be configured with the anchors to successfully perform positioning. The anchor configuration is performed on every device using setAnchorsManual, which iterates over every remote device, and feedback on this configuration is printed.

void setAnchorsManual(){
  for (int i = 0; i < num_tags; i++){
    int status = Pozyx.clearDevices(tags[i]);
    for(int i = 0; i < num_anchors; i++){
      device_coordinates_t anchor;
      anchor.network_id = anchors[i];
      anchor.flag = 0x1;
      anchor.pos.x = anchors_x[i];
      anchor.pos.y = anchors_y[i];
      anchor.pos.z = heights[i];
      status &= Pozyx.addDevice(anchor, tags[i]);
    if (status == POZYX_SUCCESS){
      Serial.print("Configuring ID 0x");
      Serial.print(tags[i], HEX);
      Serial.println(" success!");
      printErrorCode("configuration", tags[i]);

Positioning loop

Positioning is done in the same way as the anchor configuration: every tag gets its turn. If successful, the position is printed and otherwise an error message gets printed. This is effectively a TDMA approach, where the remote devices won't interfere with each other, unlike if you perform positioning on different devices at the same time, which will not work.

void loop(){
  for (int i = 0; i < num_tags; i++){
    coordinates_t position;
    int status = Pozyx.doRemotePositioning(tags[i], &position, dimension, height, algorithm);
    if (status == POZYX_SUCCESS){
    // prints out the result
    printCoordinates(position, tags[i]);
      // prints out the error code
      printErrorCode("positioning", tags[i]);

Caveats and closing remarks

  • Positioning multiple devices at once is performed in a TDMA manner so that they don't interfere with each other. If your devices crash, try adding a small delay between the devices positioning to add robustness.

  • Since you're using TDMA, you're splitting the update rate between the different devices. If you'd start with 24 Hz for a single device, you'd get at most 12 Hz per device if you're using two devices on the same UWB settings. 8 Hz if you're using three, and so on. Depending on your usecase, this could be important.

  • Having more devices in a line-of-sight of both your master device and your anchors might be harder depending on your use case. Account for this to smartly set up your anchors and master.

  • If your area gets larger and you want to maintain a good update rate, adding more anchors which will loosen the constraints on your UWB settings is recommended.

Now that you finished all the tutorials, you should be all set for any usecase implementation that Pozyx is currently capable of. If you have any questions, remarks, or problems with the tutorials, please mail to

JavaScript errors detected

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

If this problem persists, please contact our support.