Jed Hodson
Published © CC BY-NC

UWB Localization Feather

Incorporating the Decawave DWM1000 and an ATSAMD21 Arm M0 into the Adafruit Feather form-factor for robotic localization projects.

IntermediateFull instructions provided3 hours3,354
UWB Localization Feather

Things used in this project

Software apps and online services

Microchip Studio
Microchip Studio

Hand tools and fabrication machines

Segger J-Link

Story

Read more

Schematics

Schematic V1

Version 1.0 of the UWB Feather

Code

DW1000-Anchor

C/C++
Simple anchor example for the DW1000
/**
 * UWB Feather Anchor Demo
 * Configures device as. Derived from DW1000Ranging_ANCHOR
 * example in thoro/arduino-dw1000
 * 
 * Visit prototypingcorner.io/projects/uwb-feather for more information
 */

#include <Arduino.h>
#include <SPI.h>
#include "DW1000Ranging.h"

#define DW1000_RST  2
#define DW1000_IRQ  3
#define DW1000_CS   4
#define LED         13

void newRange() {
  // Quick flash of LED for visual confirmation
  digitalWrite(LED, HIGH);
  delay(20);
  digitalWrite(LED, LOW);

  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);
}

void setup() {
  Serial.begin(115200);
  pinMode(13, OUTPUT);

  //init the configuration
  DW1000Ranging.initCommunication(DW1000_RST, DW1000_CS, DW1000_IRQ);

  // Attach events
  DW1000Ranging.attachNewRange(newRange);
  DW1000Ranging.attachBlinkDevice(newBlink);
  DW1000Ranging.attachInactiveDevice(inactiveDevice);

  //Enable the filter to smooth the distance
  //DW1000Ranging.useRangeFilter(true);
  
  // Start module as Anchor
  DW1000Ranging.startAsAnchor("82:17:5B:D5:A9:9A:E2:9C", DW1000.MODE_LONGDATA_RANGE_ACCURACY);
}

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

Github

https://github.com/prototyping-corner/UWB-Feather

Github

https://github.com/microsoft/uf2-samdx1

Credits

Jed Hodson
13 projects • 45 followers
Hacker, maker, creator of the things.
Contact

Comments

Please log in or sign up to comment.