Arduino - advice please DWM1000 DWM1001

Hello everyone,

Please excuse me, but I need to have a few answers before I go ahead and make a purchase. I also want to make sure I buy the correct items for my project. I have pretty basic background in electronics from many years ago, as a hobby, and also have some experience in development languages such as VB and C.

My question in this:
If I buy two modules - dwm1000 or dwm1001 (I’m not sure which one I need?), would it be possible to set one up as an anchor, and the other up as a tag, and then determine the distance between the two using a program on my laptop? What would I need to do this?

Ultimately, I need to determine the (x,y) coordinate of a tag in an ‘indoor space’, but if I am able to get the straight line distance between an anchor and a tag, then I should be able to get the (x,y) coordinate with additional anchors (in principle). Is that correct? I just want to do a proof of concept at this stage.

I will be using an Arduino to prototype this. Is there code available and working successfully? I have seen some posts on this forum using the Arduino but It’s not clear if the code actually works? I don’t mind tweaking code here or there but really looking to get this done as quickly as possible. If I can get this to work at home, then I can buy more modules to start on a bigger project. I need to do this simple proof of concept, before buying a full kit and more modules.

Do I even need to use an Arduino? Is there a simpler way to do this? For example, would any of the modules just work out of the box? Would I be able to get the (x,y) coordinates using the PC Application? I need to be able to access these coordinates from a custom-made program on my laptop to process them in real time.

Ultimately, I am looking to have this set-up in several large indoor spaces, with anything from 10 to 100 tags in each indoor space, and to be able to monitor the (x,y) coordinates of these tags in real time. On my laptop I want to be able to track each tag and process these (x.y) coordinates. Is there an easy way to get these coordinates?

Finally, I wasn’t sure if I would need the dwm1000 module or the dwm1001 module?

Thank you all so much for your help.

Sunny

The two modules are very different.

The DWM1000 is basically the DW1000 chip with an antenna, clock and a few other bits of required circuitry. It is an SPI slave device and requires a processor to be attached in order to do anything.

With a correctly connected processor running the correct device driver firmware then the DW1000 / DWM1000 will allow you to send and receive radio packets with very accurate time stamps on both the transmit and receive times.
If you know the time time a radio packet takes to get between two devices then you can divide by the speed of light and get the distance. While the basic concept is fairly simple there are a lot of little details you need to get right if you want an accurate result.

The DWM1001 module includes a processor and can run either your own firmware or the PANS firmware that decawave supply, this is a generic location tracking application. It’s not optimized for any specific use case and has some limitations but provides a good starting point. If it does what you need then it makes life a lot easier for you. Source code is not available for this application so it’s a take it or leave it situation, you can’t modify it.
Using this module gives you less flexibility in your hardware but as long as you are OK with the parts they used you can avoid making your own hardware.

Decawave also supply the source for some basic device drivers and example application code for point to point ranging. These may need modifying to run on your final hardware (mostly updating the SPI bus commands to match the hardware you have) but are a good starting point and provide basic building blocks of a system.

Their application notes also provide a lot of information on how to put a system together, measure ranges and all the different refinements that can be made to improve performance. If you do look at building your own system then read all of the ones that look even remotely relevant.

This is purely personal opinion but I’d avoid Arduino and take any “community” drivers / code with a large pinch of salt.
One of the critical things is message turn around time, you measure range by receiving a message and sending a reply a known amount of time later. Arduinos (except the ARM ones) are slow which means this time has to be larger to allow for more processing time which in turn costs accuracy. Range and position calculations aldo involve a fair amount of maths, reasonable CPU power helps with this too. And if you are going to use an ARM processor then program it in c rather than the barstardised, limited version of c that arduinos use. Arduino has it’s uses, I’ve used it for a few quick hacks but I’d hate to try and build anything complicated in it.
And 90% of open source community generated code that I’ve seen for smaller/more obscure parts has either been so full of bugs or so badly written that it’s easier to start from scratch than try to fix it.

1 Like

Thanks so much for your reply, Andy. So very helpful.

To conclude then, as a first step, if I purchased just two DWM1001 modules, would I then be able to set them up as an anchor / tag pair and use them to find the distance between the two, and to have that data available within a custom application on my laptop?

Another question is how would I interface any custom application on my laptop to Decawave’s own PC App, to read the coordinates in real-time?

If the above works as a proof of concept, I could then look at buying more modules to create more anchors - to see if I could get the x and y location coordinates as well.

Please let me know if I’m on the right track?

As stated in my original post ultimately this would be used for tracking people, in real time, moving in large indoor spaces; perhaps up to 100 or so people (tags).

Thank you for your help.

Sunny

I don’t have direct personal experience of the decawave system, we went straight to custom firmware and hardware. But I believe that is correct, you should be able to get range with just two and X/Y location with more.

The connection to the PC would be over a serial / COM port.

Check the documentation for PANS for more details on what the out of the box firmware can do (see this post: DWM1001 PANS Release 2)

Tracking lots of people/tags is possible as long as you don’t need particularly high update rates. As mentioned before if the out of the box firmware does what you need then that makes things a lot easier. If it doesn’t do what you need then you can definitely improve on it if you don’t mind making some trade offs.
e.g. our system gives a far higher position output rate (100 Hz), higher accuracy (2-3cm standard deviation), and the ability to switch seamlessly between GPS and UWB positioning. But we achieve all of that at the cost of number of simultaneous tags and flexibility (currently only 2, going up to 5 soon, they need to know about each other in advance).

That’s great. I’ve made a purchase of two modules.

Thanks Andy.

One more thing please I forgot to ask, can one of the anchors be connected directly to the PC, or does it need to go via a Raspeberry Pi (of which I have no experience)?

The reason I ask is that the product brief shows a Raspbery Pi configured as a gateway between an anchor and the PC. Please see here:
https://www.decawave.com/dwm1001dev/productbrief/

btw you referred to the update rate - I’m guessing it would only need to be 2 or 3 Hz for what I need it for but certainly no more than 5Hz (I think).

Thanks,
Sunny

I appreciate all of your answers, but need to know this please, if someone could answer me. If I have several anchors, can one of the anchors be connected directly to the PC’s serial port to read the coordinates, or does it need to go via a Raspberry Pi? The product brief shows a Raspberry Pi configured as a gateway between an anchor and the PC. I’m not sure what this is for? Does that mean you can’t connect an anchor directly to the serial port to read the coordinates?

Hallo Sunny,
I will try to answer.

you should not connect the anchor to the PC to read its location, the anchor is always fixed, and by design, is supposed to be mounted in the corner or somewhere else.

when you are able to read the location of the tag via SPI, on the same line (in the command line), you also can see the coordinates of the anchor as well. (this approach, will show 4 nearest anchors)

another approach, you can use the Decawave application on your android phone to know the location of all anchors

Regards,
Febby Madrin

Hello Febby,
Thank you so much.

I thought to read the coordinates of a tag, you needed to have one anchor physically connected to the PC, but it seems not.

I guess my question then is, what do I actually connect to the PC? The USB cable connects to the serial (USB) port on the PC, but where does it connect to on the other end? This is the bit that I don’t understand.

The DWM1001 Firmware Guide says,”the DWM1001 module can be physically connected to external controlling hardware, either wired or wirelessly over Bluetooth radio.”, but it doesn’t say how the module is configured ie an anchor or a tag? You have said it’s not an anchor, and it can’t be a tag because that wouldn’t make sense. This is what I don’t understand. What does the PC actually connect to in a wired connection?

Also, I am writing a desktop application on the PC that will read all the tags’ coordinates to process them in real-time, which is the reason I can’t use the Decawave mobile app. I hope that it will be straightforward to read the coordinates from the serial port on the PC.

Thank you once again.

Sunny

Hi Sunny,

When you have multiple tags in an indoor space, it wouldn’t make sense to attach each and every tag to PC and collect location data from each of it.

If you have a setup where you just want to check whether the location is being actually determined or not, you can connect the tag through USB port to PC and use serial monitor to see the data.

sudo pico com -b 115200 /dev/serial0 should do the trick, considering you are connected via serial0 port. You can check which port is being used when you connect your tag to the PC ( there are commands to see if in Windows/Mac/Linux ).

Now to address the larger question, if you have the whole setup done in larger space, then you would either need a listener or a gateway which will in-turn collect data (aggregate?) data for you by reading data from all the tags and then you can attach them to any microcontroller which will then transfer all those data to the server/local machine.

If you are using gateway approach then it’s required to use Raspberry pi 3B as of now. In case of listener any microcontroller can be used.

Hope it helps.

Thanks

Hi, yes, thank you. That does help and clarifies a lot. I don’t really have any experience using a Raspberry Pi.

Is there any clear documentation about this? I’ve had a look at the product brief and the Firmware API guide but can’t see where all this is documented, on how to set this up?

What are the main advantages and disadvantages of using a Gateway vs Listener, and what would be simpler to use (for a large space perhaps with up to 100 tags or so)?

My main experience is with software, so I’m trying to understand the electronics; not just the ‘what’ and ‘how’, but also the ‘why’.

Is there a reason why it would not be possible to use a PC instead of a Raspberry Pi / Microcontroller to collect the data? Could you use some sort of interface to do this? If an Android app is capable of collecting coordinates then surely there must be a way for a PC to do it?

Thank you.

Sunny

Valuable information regarding the operation of an arduino, regards

Guacardo

Hi Sunny,

If you haven’t already, please take a look at the PANS system overview. It should answer most of your questions.

To answer some:

Is there a reason why it would not be possible to use a PC instead of a Raspberry Pi / Microcontroller
to collect the data? Could you use some sort of interface to do this? If an Android app is capable of collecting coordinates then surely there must be a way for a PC to do it?

Yes, you can use the UART / serial over USB. See the user manual and API guide. The Android app uses BLE, the Raspberry Pi by default uses SPI. The main advantage of using SPI is the speed: compared to UART over USB and BLE it offers the option with the lowest latency and highest throughput. making it the preferred solution for a gateway.

A gateway is basically a listener that will forward messages on an MQTT topic.

Another question is how would I interface any custom application on my laptop to Decawave’s own PC App, to read the coordinates in real-time?

This is not supported. You will have to create your own application that uses the USB serial interface. Only one application can use this at the same time unless you are willing to jump through a lot of hoops. I don’t think the DRTLS application has any IPC allowing to send the location data to other apps. The gateway application on the other hand has MQTT for this, but we only support it on Raspberry Pi 3.

Hi Seppe,

Thank you so much for taking the time for your reply. The post is a few weeks old and I have made much progress since then. At the time I wasn’t aware of all the documentation available, but have since been through a lot of it and as you say most of the questions have been answered there.

Sunny