Contents

Interfacing DWM1000 Positioning Module with Arduino

DWM1000 Transceiver Module Features

DWM1000 is an IEEE802.15.4-2011 UWB-compliant wireless transceiver module based on DecaWave’s DW1000 IC. DWM1000 measures location of objects using Real-Time Location Systems (RTLS) to a precision of 10cm indoors. This modules features a high data communication rate, up to 6.8 Mb/s, and has excellent communications range of up to 300m. It is also used in Wireless Sensor Networks (WSN).

Tip
  • You need at least 2 pieces of this sensor to use it.
  • It is better to design a PCB to make sure the connection to the microcontroller is safe and secure .
  • Refer to this and this link to get more sample designs and tips. 

Download the datasheet of this module here.

DWM1000 Positioning Module Pinout

This sensor has 24 pins:

  • 3.3: Module power supply – 3.3 V
  • GND: Ground
  • IRQ: Interrupt from module
  • SCK: SPI clock
  • MOSI: Data output from master
  • MISO: Data output from slave
  • CS: Slave Select (often active low, output from master)

You can see pinout of this module in the image below.

Required Materials

Hardware Components

Arduino UNO R3 × 1
DWM1000 Transceiver Module × 1
Logic Level Converter × 2
AMS1117 3.3V DC Power Supply Module × 1
Male to Female jumper wire × 1

Software Apps

Arduino IDE

Interfacing DWM1000 with Arduino

Step 1: Circuit

The following circuit shows how you should connect Arduino to DWM1000 module. Connect wires accordingly.

Step 2: Code

Install the following library on your Arduino.

https://github.com/thotro/arduino-dw1000

Tip

If you need more help with installing a library on Arduino, read this tutorial: How to Install an Arduino Library

Upload the following code to the first Arduino.

    /**
 * 
 * @todo
 *  - move strings to flash (less RAM consumption)
 *  - fix deprecated convertation form string to char* startAsAnchor
 *  - give example description
 */
#include <SPI.h>
#include "DW1000Ranging.h"

// connection pins
const uint8_t PIN_RST = 9; // reset pin
const uint8_t PIN_IRQ = 2; // irq pin
const uint8_t PIN_SS = SS; // spi select pin

void setup() {
  Serial.begin(115200);
  delay(1000);
  //init the configuration
  DW1000Ranging.initCommunication(PIN_RST, PIN_SS, PIN_IRQ); //Reset, CS, IRQ pin
  //define the sketch as anchor. It will be great to dynamically change the type of module
  DW1000Ranging.attachNewRange(newRange);
  DW1000Ranging.attachBlinkDevice(newBlink);
  DW1000Ranging.attachInactiveDevice(inactiveDevice);
  //Enable the filter to smooth the distance
  //DW1000Ranging.useRangeFilter(true);
  
  //we start the module as an anchor
  DW1000Ranging.startAsAnchor("82:17:5B:D5:A9:9A:E2:9C", DW1000.MODE_LONGDATA_RANGE_ACCURACY);
}

void loop() {
  DW1000Ranging.loop();
}

void newRange() {
  Serial.print("from: "); Serial.print(DW1000Ranging.getDistantDevice()->getShortAddress(), HEX);
  Serial.print("\t Range: "); Serial.print(DW1000Ranging.getDistantDevice()->getRange()); Serial.print(" m");
  Serial.print("\t RX power: "); Serial.print(DW1000Ranging.getDistantDevice()->getRXPower()); Serial.println(" dBm");
}

void newBlink(DW1000Device* device) {
  Serial.print("blink; 1 device added ! -> ");
  Serial.print(" short:");
  Serial.println(device->getShortAddress(), HEX);
}

void inactiveDevice(DW1000Device* device) {
  Serial.print("delete inactive device: ");
  Serial.println(device->getShortAddress(), HEX);
}

Upload the following code to the second Arduino board.

    /**
 * 
 * @todo
 *  - move strings to flash (less RAM consumption)
 *  - fix deprecated convertation form string to char* startAsTag
 *  - give example description
 */
#include <SPI.h>
#include "DW1000Ranging.h"

// connection pins
const uint8_t PIN_RST = 9; // reset pin
const uint8_t PIN_IRQ = 2; // irq pin
const uint8_t PIN_SS = SS; // spi select pin

void setup() {
  Serial.begin(115200);
  delay(1000);
  //init the configuration
  DW1000Ranging.initCommunication(PIN_RST, PIN_SS, PIN_IRQ); //Reset, CS, IRQ pin
  //define the sketch as anchor. It will be great to dynamically change the type of module
  DW1000Ranging.attachNewRange(newRange);
  DW1000Ranging.attachNewDevice(newDevice);
  DW1000Ranging.attachInactiveDevice(inactiveDevice);
  //Enable the filter to smooth the distance
  //DW1000Ranging.useRangeFilter(true);
  
  //we start the module as a tag
  DW1000Ranging.startAsTag("7D:00:22:EA:82:60:3B:9C", DW1000.MODE_LONGDATA_RANGE_ACCURACY);
}

void loop() {
  DW1000Ranging.loop();
}

void newRange() {
  Serial.print("from: "); Serial.print(DW1000Ranging.getDistantDevice()->getShortAddress(), HEX);
  Serial.print("\t Range: "); Serial.print(DW1000Ranging.getDistantDevice()->getRange()); Serial.print(" m");
  Serial.print("\t RX power: "); Serial.print(DW1000Ranging.getDistantDevice()->getRXPower()); Serial.println(" dBm");
}

void newDevice(DW1000Device* device) {
  Serial.print("ranging init; 1 device added ! -> ");
  Serial.print(" short:");
  Serial.println(device->getShortAddress(), HEX);
}

void inactiveDevice(DW1000Device* device) {
  Serial.print("delete inactive device: ");
  Serial.println(device->getShortAddress(), HEX);
}
Liked What You See?​
Get Updates And Learn From The Best​

Comments (77)

  • Philipp Reply

    Hey there, it seems like you made a mistake in the “required parts” list. It says that you only need one Logic Level Converter, but you need 2 according to the wiring image below.

    September 9, 2021 at 5:46 am
    • Mehran Maleki Reply

      Hi…
      Yes, you’re right! It has been modified now. Thanks for your attention!

      September 11, 2021 at 4:57 am
  • Rick Reply

    Hi.. Is it possible for a tag to identify another tag???

    October 4, 2021 at 2:42 pm
    • Mehran Maleki Reply

      Hi… What do you mean by tag?! Is your question regarding this tutorial?

      October 6, 2021 at 6:13 am
  • Mohammad Reply

    Hey…
    I’ve run this project with Arduino Leonardo instead of Uno. It works fine with 3 anchors and 1 tag but when I add the 4th anchor, it won’t range. Do you have any idea where the problem is?

    October 15, 2021 at 8:45 am
    • Mehran Maleki Reply

      Hi…
      We have actually done this project with one anchor and one tag and just stopped there! So, unfortunately, I can’t say where you have gone wrong exactly. But generally speaking, these modules are so sensitive to noise, and using them with a 5V microcontroller makes it worse. So, if you use a 3.3V microcontroller like an ESP32 board and omit the logic converters from your circuit, you may get better results.

      October 16, 2021 at 7:06 am
      • Mohammad Reply

        thank you
        By the way, I was going to try Arduino Uno according to this page, but the suggested library for dw1000 module wont work and ends in errors while uploading the code. Is there any problem with the library?

        October 18, 2021 at 5:49 am
        • Mehran Maleki Reply

          You’re welcome!
          Do you get errors while uploading the codes or compiling them? I just compiled both codes and no error popped up. If you’re just getting errors while uploading the codes, double-check the wiring. Also, make sure you have selected the right PORT.

          October 18, 2021 at 6:36 am
          • Mohammad

            Actually, I meant the compiling. It has got trouble with header files and stuff like these. I am pretty sure about the wiring or port selection as I have done the same project with other Arduino modules and library packages.

            October 18, 2021 at 7:50 am
        • Mehran Maleki Reply

          Yes, there might be some conflicts between the library of this tutorial and some other libraries you have. But it’s not easy to say which library of yours is causing the problem.

          October 18, 2021 at 1:14 pm
    • Danny Reply

      Hi, Mohamed. Do you mind sharing your circuit connection and how you use the code with 3 anchors + 1 tag? Thank you in advance.

      May 19, 2022 at 8:16 pm
      • Mohammad Damirchi Reply

        Hi Danny,
        the circuit remains the same as described in the article.
        For the code section of 3 anchors + 1 tag, you can refer to the ‘DW1000Ranging’ library where there is an example specifically tailored for this circuit.

        March 4, 2024 at 6:26 am
    • pablo graynood Reply

      please to send the code for the 3 anchors and 1 tag please

      March 3, 2024 at 7:34 pm
      • Mohammad Damirchi Reply

        Hi pablo,
        you can refer to the ‘DW1000Ranging’ library where there is an example.

        March 4, 2024 at 6:33 am
  • Jack Pat Reply

    Hi,

    I was wondering if this PCB board would work well with the DWM1000: https://www.aliexpress.com/i/4000259302044.html

    Also, do we need any resistors on the outputs of the DWM1000 chip?

    Thanks!

    December 12, 2021 at 5:11 pm
    • Mehran Maleki Reply

      Hi,
      Yes, that PCB is especially designed for DWM1000 module.
      And no, you don’t need to use any extra resistors on the output of the chip. You can just use it out of the box.

      December 13, 2021 at 5:51 am
      • Jack Pat Reply

        Hi Mehran,

        Thank you so much for the reply! So, I can simply connect the PCB board just like you showed in this tutorial, and then download the Thotro library?

        Thanks again, I really appreciate it!

        December 13, 2021 at 7:18 pm
        • Zakaria Patel Reply

          Actually, I was also wondering if the resistors on the PCB (here: https://www.aliexpress.com/i/4000259302044.html) would cause any problems with the Arduino Uno? The schematic is on the bottom. Should I use another Arduino board?

          Thanks!

          December 15, 2021 at 9:24 pm
          • Mehran Maleki

            Hi,
            No, that board is completely compatible with Arduino Uno. You don’t need to change your Arduino board.

            December 18, 2021 at 6:24 am
        • Mehran Maleki Reply

          You’re so welcome! Yes, you can do that without any problems.

          December 18, 2021 at 6:21 am
          • Jack Pat

            Hi Mehran,

            Thank you so much for this tutorial! I was successful in getting two sensors to provide a distance. The antenna delay has led to some errors in my measurements, but I am working to fix that. I was wondering what kind of accuracy you get? Also, readings are very easily disturbed of I touch the sensor – I wonder if that is a hardware problem, maybe due to the wires. Do you have any tips?

            January 17, 2022 at 1:22 am
          • Mehran Maleki

            Hi. You’re welcome!
            These modules are actually so sensitive to noise and disturbances. So, you need to make sure they are completely fixed, and they get no kind of noise. Also, use a SMD to DIP converter for them, so you can be sure that wiring is fully stable.

            January 17, 2022 at 6:32 am
  • Dan Luq Reply

    Hi, is it possible if I don’t use the AMS1117 3.3V DC Power Supply Module, and just connect the 3.3V of DWM1000 directly from 3.3V Arduino pin? Will it cause any issue? Thank you

    December 13, 2021 at 4:25 pm
    • Mehran Maleki Reply

      Hi.
      Actually, it’s not possible. The 3.3V Arduino pin doesn’t provide enough current for the DWM1000 module. So, connecting the 3.3V of DWM1000 directly to the 3.3V Arduino pin might damage your Arduino board.

      December 18, 2021 at 6:18 am
  • Principe Mestizo Reply

    I’m interested in doing this, but how will the two arduinos communicate between the two? I mean, how do you know what the other arduino to look for is to measure the distance.

    December 28, 2021 at 9:43 pm
    • Mehran Maleki Reply

      Hi.
      Actually, the Arduino boards are not supposed to communicate with each other. The DMW1000 modules are the ones that communicate. And here’s how they do that: As you can see, there are “startAsAnchor” and “startAsTag” command lines in each of the codes, both in line 29. That sets the module to be the anchor or the tag. The anchors keep searching for the tags around and start communicating once they find one. So, the communication is automatically done by the DWM1000 modules.

      December 29, 2021 at 6:40 am
      • Principe Mestizo Reply

        Is there a way to make it not global? That is, they communicate with each other with a key so that they are not confused if there is a tag or nearby anchors.

        January 3, 2022 at 9:42 pm
        • Principe Mestizo Reply

          It occurs to me that each tag and anchor have a unique number, I print it in Arduino serial… and if the number matches then it is the one indicated, what do you recommend?

          January 3, 2022 at 9:56 pm
        • Principe Mestizo Reply

          Let me explain myself better. I’m going to have several different devices that don’t connect to each other, so how do I know which one corresponds to which one? That is, 3 anchors that correspond to 1 tag and 3 more anchors that correspond to another tag. Both in the same range.

          January 4, 2022 at 1:56 pm
  • Principe Mestizo Reply

    I have 3 modules for anchors on an Arduino Mega and 1 for tag on an Arduino nano.

    My question is: I already know how to connect 1 tag on an arduino nano from your tutorial above, how should I connect 3 anchors on an arduino mega? I’m asking because your tutorial only shows that you use pins 9 and 2 in the code.

    January 3, 2022 at 9:40 pm
  • Çağdaş Reply

    Hi
    Can I use DWM3000 instead of DWM1000 ?

    January 6, 2022 at 12:13 pm
  • AdL Reply

    Monsieur,

    Etant novice en arduino, j’ai suivi à la lettre votre tutoriel (qui est vraiment très bien fait) mais je n’arrive pas a récupérer les résultats, cad la distances entre l’ancre et le tag.

    Pourriez vous m’éclairer s’il vous plait ?

    Merci !

    Adl

    January 7, 2022 at 1:25 pm
    • Mehran Maleki Reply

      Hi.
      First, try to write your comments in English. This way, others might be able to help you, too. And about your problem, what do you mean you don’t get the results? Do you mean you don’t see anything in the Serial Monitor? Or, you get wrong results in the Serial Monitor? In case you see nothing in the Serial Monitor, it might be because you haven’t set the Serial Monitor baud rate to the right value. Make sure you have set the baud rate to 115200.

      January 8, 2022 at 6:26 am
  • Principe Mestizo Reply

    Hello. I just bought 4 of these adapters (with soldered components): https://www.aliexpress.com/item/1005001800916186.html
    What changes in relation to your diagram? Do I not need the Logic Level Converter or is it necessary? (I want to have everything ready for when they arrive)

    January 10, 2022 at 10:30 pm
    • Mehran Maleki Reply

      Hi.
      According to the schematics in the link, that adapter is merely an SMD to DIP converter and can help you use your DWM1000 modules more easily. So, you still need the logic level converter if you want to use the modules with a 5V logic microcontroller like Arduino Uno.

      January 11, 2022 at 6:45 am
  • Principe Mestizo Reply

    I apologize if the question is very basic, I’m new to programming with Arduino. But what is the Logic Level Converter for? I see that the line comes in from the UWB module, goes through the Logic Level Converter and then connects to the corresponding pin on the Arduino, but why? What is it for?

    January 16, 2022 at 7:30 pm
    • Mehran Maleki Reply

      Hi.
      Well, the Logic Level Converter has nothing to do with the programming part. As you know, the Arduino Uno is a 5V Logic board, but the DWM1000 module works with 3.3V. So, you cannot connect them to each other directly. That’s why you need to use a Logic Level Converter to interface them. It converts 5V to 3.3V, and vice versa.

      January 17, 2022 at 6:19 am
      • Principe Mestizo Reply

        I already understand, thank you very much, what it does is send 5V from the digital pins of the Arduino, MOSI, MISO, etc. to the Logic Level Converter so that it changes it from 5V to 3.3V so that it is received by the DWM1000 module (although I think the DWM1000 module is the one who sends and Arduino receives, but, it is the same logic).

        What happens if I use an Arduino Nano or an Arduino Mega? I guess it’s the same, right?

        January 17, 2022 at 2:36 pm
  • Principe Mestizo Reply

    I saw that someone above recommended using an SMD to DIP. What do you think if I use this? https://www.amazon.com/-/en/KeeYees-TQFP100-adaptor-plug-heads/dp/B085L8SK7Z/
    Would one of those be compatible?
    Note: I plan to use an ESP32 microcontroller, so I avoid using a logic converter.

    January 25, 2022 at 9:06 pm
    • Mehran Maleki Reply

      Well, none of those seem to be compatible with DWM1000 module. The one you once said you wanted to buy seemed fine. I guess that was it: https://www.aliexpress.com/item/1005001800916186.html
      And also, your diagram of DWM1000 on ESP32 seems fine.

      January 29, 2022 at 8:28 am
  • Marcos Puliesi Reply

    Hello friends!
    In my tests, I’m only getting communication at a maximum of 4 meters. Above this distance, communication is lost.
    In the documentation of the DWM1000 it says that it reaches up to 300 meters.
    What am I doing wrong?
    Please, can anyone help me?

    February 14, 2022 at 11:54 pm
    • Mehran Maleki Reply

      Hi.
      I don’t think you’re right. As far as I know, DWM1000 modules can only work within a range of 10 meters at best.

      February 20, 2022 at 7:38 am
  • Deniz Reply

    Hello can I use this guide for DWM1001 module?

    March 10, 2022 at 1:40 am
  • Subrahmanyam Reply

    HELLO,
    what if I want to use two DWM1000 modules for Tag purpose,
    and what can I change to measure the distance between them. Like I want to measure the distance between two tags specifying some threshold value

    April 20, 2022 at 2:15 pm
  • Jin Su Baek Reply

    Hi,
    I have a 1 tag and 1 anchor module. and i success basic sender and basic receiver code in arduino-dw1000 library, but i don’t sucess dw1000-rangring code
    Please, can anyone help me?

    May 29, 2022 at 5:00 pm
  • Fillipe Reply

    Hi I would like to use arduino with dwm1000 for wireless vide streaming can you help me with that ? Thanks.

    August 3, 2022 at 6:10 am
  • Rohit Singh Reply

    Hi,
    I am using the setup shown in circuit above with Uno ,dwm 1000 and external power source. I am getting very inconsistent results. On the BasicConnectivityTest.ino. Most of the time the addresses(Device address and NetworkID) are read as FFFF and FFFF. Sometimes i might get the correct addresses I set like 01 and 02 but I can not replicate it reliably. I have checked all connections and voltages and they seem to be correct. Ive seen multiple forums where this is a issue I have not seen a solution yet. Do I need to switch to a different micro controller(Nano doesn’t work either).

    Any help would be appreciated..

    August 5, 2022 at 3:25 am
  • Amin Akbari Reply

    Hi, had this module accuracy about 10cm? I am going to apply this module for localization.

    November 24, 2022 at 11:40 am
    • Ali Abdolmaleki Reply

      Hi.
      According to data sheet yes is about 10cm

      March 1, 2023 at 12:03 pm
  • kira Reply

    Hi, does the basic sender and receiver code work with this circuit diagram?

    February 15, 2023 at 6:34 pm
    • Ali Abdolmaleki Reply

      Hi dear
      what do you mean about basic code?

      February 19, 2023 at 6:21 am
  • krish Reply

    can i use dw1000 instead dwm1000?

    March 15, 2023 at 4:03 am
    • Ali Abdolmaleki Reply

      Hi dear
      note that dw1000 is a radio chip on its own but dwm1000 is a module containing a dw1000 chip , antenna, clock and a few other parts needed to make the dw1000 hardware work.

      March 26, 2023 at 8:59 pm
  • GabWittig Reply

    Hi all, I am currently trying to make this work to use it to calculate the relative position of a drone to its pilot. I wanted to use two arduino nanos as anchors on the pilot and one tag on the drone itself, but I realized I would need some type of power source to power the anchors. My question now is, if anyone has measured the current draw from this circuit, whether it be with an arduino nano or anything else? This would be needed to find an appropriate battery/power bank for it, so if anyone already figured out a solution to that, feel free to post the link to it!

    June 12, 2023 at 5:48 pm
    • Mohammad Damirchi Reply

      Hi,
      u can use a simple and chip power bank for your purpose.
      if I remember correctly, these two parts draw around 50-100 mA
      if you want to use the li-po battery, the following product can help you Lithium Battery Power Bank Charger Module – 5V, 1A

      June 13, 2023 at 1:33 pm
  • Oliver Reply

    Hi, is it possible not using logic level converter, if i use 3.3v power supply on the arduino?

    October 25, 2023 at 2:20 pm
    • Mohammad Damirchi Reply

      Hi Oliver,

      If you don’t want to use a logic level converter, you should use microcontrollers that operate with a 3.3-volt power source, such as STM, ESP, or certain Atmel modules (Arduino). Most Arduino boards operate at 5 volts and are not compatible with 3.3 volts

      October 28, 2023 at 6:05 am
  • Delbert Grady Reply

    I am wanting to have this system placed within a moving object. As it won’t be plugged into a laptop for power, what sort of power supply would be recommeded and how would I connect it?

    January 12, 2024 at 11:24 am
    • Mohammad Damirchi Reply

      Hi Delbert,
      For powering this module, you can use any power bank or a LiPo battery with a power bank module to maintain a stable 5-volt voltage for this purpose.

      January 15, 2024 at 7:40 am
  • Albert Reply

    Hello Mohamed, can i use the esp32 DW1000 kit as a tag and the (Arduino+DWM1000) as anchor ?

    November 25, 2024 at 9:09 am
    • Mohammad Damirchi Reply

      Hello Albert,
      Yes, absolutely! You can use an ESP instead of an Arduino. Additionally, with ESP32, you don’t need a logic converter—you can directly connect the ESP32 to the DW1000.

      November 27, 2024 at 2:03 pm

Leave a Reply

Your email address will not be published. Required fields are marked *