Distance Control using UWD

In this crazy time of corona there has been a lot of talking about social distancing and keeping at least 1.5m away from one another. We thought it might be fun to think of a way to find a way to indicate when someone is getting to close. 

Reading through different forum there where ways to use Bluetooth and WiFi using a method called RSSI, you can read more about it here.

The trouble with those technologies is that there are so many devices that use that technology that can cause interference. BLE and WiFi make use of signal strength to determine distance. Signal strength can change when you just sneeze so reliability is not that good. 

Further investigation brought us to a technology called Ultra-wideband(UWB) technology. This technology makes use of a radio frequency between 2.8Ghz to 6.1Ghz frequency.  with this, we can determine the distance between devices by measuring the time between sent and received messages.

The most popular UWB device on the market currently is from DEVAWAVE called the DW1001-DEV board. The module has built-in accelerometer and Bluetooth as well as the UWB that we will use. It has a similar feel to it as the famous ESP32


Below you will see the DW1001-DEV MODULE the best part of this board is that the antenna design is already done, the DW1001 is already in a nice Faraday cage. So you can just buy the module and you can get started straight away, it is also not to badly priced at about $38, I do not think you can make this board yourself at that price, especially at low volume.

You can buy a DW1001-DEV Module here.

The principle of the distance measurement

To measure the distance between two devices. We make use of the transmission of the radio frequency. In simple terms, a device will keep broadcasting a message with a timestamp of when it was sent, it will keep sending this message until another device hears its message when a device hears the message it will send a message back to that device telling him that he was heard and at what time he was heard.

Using the time difference and the speed of light you can calculate the distance of the two devices.

The biggest problem we have is when so many devices keep talking there is a lot of noises in the environment. You should only focus. on the devices that are the closest to you, in this tutorial we will show you how to do this.

The DW1001 consist of an NRF Microcontroller that communicates to the DW1000 IC, to program the chip, we need to make use of an IDE called SEGGER Embedded studio, you can download the software here  

Once it is installed you can use J-link to program your unit. As most of the designs we do, we never reinvent the wheel, we always look at how we can use what there is online to help us. Through research we found the hero we needed, there has been a sample code given by Decawave on GitHub and that can be found here

Here you will find two different codes to use. This is because we need one device that will transmit a signal and another that will receive it. The two files we need as examples are:

  1. ss_twr_init – This program makes your DW1001 into a transmitter, this device will now keep transmitting until it finds a receiver in the proximity.
  2. ss_twr_resp – Here the DW1001 will be a receiver, it will keep listening for a transmitter in the area when it receives a message from the transmitter, it will send a message back to the transmitter, with a time stamp. This difference between the time of the sent and receive signal allows us to calculate the distance between the two devices.
 Below you will see a video of how it works in real life 🙂
We will be making a YouTube video soon on explaining in detail, how you can do this. So if you would like to learn. Please go to our YouTube channel here and go subscribe to it, so you do not miss it!!


Follow us to learn more.