dw1000 ranging demo

From InCircuit
Jump to: navigation, search
A newer, more accurate DW1000 demo is available: dw1000 advanced demo



The dw1000 ranging demo is a measurement example for the DW1000 at the radino32 DW1000. The dw1000 ranging demo on radino32 DW1000 modules is optimized for radino spiders with ultra-wideband antenna. The demo is based on the DW1000 library by Thomas Trojer. The demo is also tested on radinoL4 DW1000.

For communication are one Anchor and at least one Tag required.


At the first part of the sketch the hardware has to be configured.

Defines for ANCHOR (WE_ARE_ANCHOR == 1) or TAG (WE_ARE_ANCHOR == 0) mode on DW1000. At the third mode (WE_ARE_ANCHOR == 2), the read input from pin (PIN_READMODE) will set the TAG (internal pull-up) or the ANCHOR (connect to ground) mode. One ANCHOR can handle up to six TAGs.

#define WE_ARE_ANCHOR      0
#define PIN_READMODE      A1

Set an individual short address for every device (for ANCHOR and for TAG)

#define MY_SHORT_ADDRESS   0x1234

Set the TX power in dBm from 0 to 33.5 in steps of 0.5. If the value is too high, the signals may overdrive and the results distort. Activate only, if you known your local wireless regulations.

//#define DW_TX_POWER      33.5

If set to 1, the Anchor regularly prints out a table of known devices. Else it prints every ranging event separately.


LED toggles on successful measurement. Set to 0xFF to deactivate functionality. Default on pin 13 for led L on radino spider.

#define PIN_LED 13

Set where to printout information. Serial for serial communication by USB and Serial1 for communication by the UART port.

#define SerialOut if(Serial)Serial
#define SerialOutBegin() Serial.begin()

Here you can set actions to execute when a TAG gets near an ANCHOR. MODULE_NEAR_VALUE in meters and MODULE_NEAR_TIMEOUT in milliseconds.

#define MODULE_NEAR_VALUE    1.0

Activate (#if 1) or deactivate (#if 0) output signal for a near TAG at ANCHOR

  • MODULE_NEAR_INIT : Executed during setup()
  • MODULE_NEAR_ON : Executed when any tag is nearer than MODULE_NEAR_VALUE for at least MODULE_NEAR_TIMEOUT
  • MODULE_NEAR_OFF : Executed when no tag is nearer than MODULE_NEAR_VALUE
#if 0
#define MODULE_NEAR_INIT() do{ pinMode(22,OUTPUT); }while(0)
#define MODULE_NEAR_ON() do{ digitalWrite(22,HIGH); }while(0)
#define MODULE_NEAR_OFF() do{ digitalWrite(22,LOW); }while(0)
#define MODULE_NEAR_INIT() do{}while(0)
#define MODULE_NEAR_ON() do{}while(0)
#define MODULE_NEAR_OFF() do{}while(0)

DW1000 USB-Stick Demo

The DW1000 USB-Stick use a modified version of the dw1000 ranging demo. At the third mode (WE_ARE_ANCHOR == 2), the DW1000 USB-Stick always starts as TAG, but the mode can be changed to ANCHOR by serial communication.

Please press enter and follow the instructions of the serial output.

Set mode:
  'a' for ANCHOR
  't' for TAG


The dw1000 ranging demo can be found at our radino library.

Demo for DW1000 USB-Stick: Demo_DW1000_USB-Stick.zip

  • Unzip and copy to your Arduino Sketchbook folder.

Personal tools