Ultra-wideband (UWB) technology can be used in areas, such as precision radar imaging, high-bandwidth communication, or for precision localization. These are all areas that could be very useful for my future DIY drone/robot project(I hope that "future" means within one year :/). Finally, I've got some time to play around with Decawave's DWM1000 module. In this post I'll write about the basic module connection and start-up. I used Adafruit's Trinket Pro 3V as the controller for the module. Both pieces - DWM1000 module, and Trinket Pro - are pretty tiny. DWM1000 Trinket Pro

Pin Connections

You can find the pin numbering of DWM1000 on page 9 of the datasheet. Make sure that you are connecting 3V to the correct pin. Pin connections All connected

Soldering to Adapter Board

To be able to attach wires to the castellated half-vias module, I used the following pcb adapter. This was probably the hardest part. Thotro's PCB adapter

SPI Interface Configuration

DWM1000 module can be configured to use different SPI modes. The default configuration is MODE0, which means data is output on falling edge and sampled on rising edge. Additionally, the most significant bit is shifted first(MSBFIRST). The maximum frequency of Trinket Pro 3V is 12MHz, but DWM1000 can run the SPI Clock at up to 20MHz(in IDLE state when CLKPLL is locked - see DWM1000 datasheet page 6).

#include <SPI.h>

void setup() {
  Serial.begin(9600);

  // DWM1000 is active low by default
  pinMode(SS, OUTPUT);
  digitalWrite(SS, HIGH);

  SPI.beginTransaction(SPISettings(12000000, MSBFIRST, SPI_MODE0));
  SPI.endTransaction();
  delay(100);
}

First Interaction

The SPI transactions for DWM1000 start with one to three bytes(octets) header. I started with the most basic transaction - I instructed the module to give me its Device ID. That means I've send a byte with value of zero(0x00) to the module and the module replied with four bytes register values containing 0x30 0x01, 0xCA, 0xDE. After transferring the register id 0x00, I kept transferring 4 bytes of some random value, to shift the register content out. After the initial register value is set to 0x00, the next 4 bytes sent are ignored by DWM1000 module.

void loop() {
  digitalWrite(SS, LOW);
  delayMicroseconds(10);

  SPI.transfer(0x00);
  for (int i = 0; i < 4; i++) 
    Serial.println(SPI.transfer(0), HEX);

  digitalWrite(SS, HIGH); 
}

Reading Serial Data From Trinket

To read the serial console, you'll probably also need to attach USB to serial adapter to Trinket's FTDI header. The serial console should look something like this Serial console

Add a comment