Introduction: UWB Localization Feather

About: Maker, Hacker, creator of the things.

The Ultra-WideBand Feather incorporates the Decawave DWM1000 module and an ATSAMD21 ARM Cortex M0 into the Adafruit feather form-factor. The DWM1000 module is an IEEE802.15.4-2011 UWB compliant wireless module capable of precision indoor positioning and high data rates, making this board perfect for robotics projects where localization is required.

Features:
– Decawave DWM1000 for precision tracking
– ARM Cortex M0 for fast & powerful applications
– Adafruit Feather compatible to integrate with a wide existing ecosystem
– SWD interface for programming and debugging applications
– USB-C connector
– Intergrated LiPo battery charger

For the full project write-up and updates view this project on my site Prototyping Corner at prototypingcorner.io/projects/uwb-feather

Source hardware and software for this project is available from the GitHub Repository.

Step 1: Hardware Design

As mentioned in the introduction, the UWB Feather consists of an ATSAMD21 ARM Cortext M0+ for the brains and a Decawave DWM1000 module for the ultra-wide band wireless, in the feather form-factor. The design is relatively simple consisting of 20 BoM items on a 2-layer PCB. Pinout is Adafruit M0 Feather compatible

LiPo charging is handled by the MCP73831 single-cell, fully integrated charge management controller. Battery voltage can be monitored on D9, however is access to all the IO is required, JP1 can be cut to free up this pin. 3.3 volt regulation is preformed by the AP2112K-3.3 low dropout linear regulator, providing up to 600mA.

Pinout is fully compatible with the Adafruit M0 feather line for easy code portability. The DWM1000 IO lines are connected to the SPI bus and digital pins 2, 3 & 4 for RST, IRQ & SPI_CS respectivly (which are not exposed via the header). D13 is also connected to the onboard LED, as is standard among many Arduino-compatible boards.

Programming can be preformed over the SWD header or via USB if loaded with a corresponding bootloader such as the uf2-samdx1 from Microsoft. See firmware for more.

Note on V1.0:

There is an issue with the USB-C connector on version 1 of this board. The footprint I used did not include the cutout required for the cutout mounting method of this component.

Version 1.1 will include a fix for this as well as adding a micro-b connector for those who want it. See version 1.1 considerations below.

For Bill of Materials and Hardware Version 1.1 design considerations see the project writeup.

Step 2: Assembly

With only 20 BoM items and most components being no smaller than 0603 (the 2x crystal capacitors were 0402) , hand assembly of this board was easy. I had the PCB and solder stencil manufactured by JLCPCB in matte black with ENIG surface finish.

Total cost for 5 boards (although 10 had no price difference) and stencil was $68 AUD, however $42 of that was shipping. First time ordering from JLCPCB and boards were of very high quality with nice finish.

Step 3: Firmware: Programming the Bootloader

Firmware can be loaded over the SWD connector using a programmer such as the J-Link from Segger. Shown above is the J-Link EDU Mini. To start programming the board, we need to load our bootloader then set up our tool chain.

I’ll be using Atmel Studio for flashing the bootloader. To do so, plug in the J-Link and open Atmel Studio. Then select Tools > Device Programming. Under Tool select the J-Link and set Device to ATSAMD21G18A then click Apply.

Connect the J-Link to the feather SWD header and apply power either over USB or via the battery. Once connected, under Device Signature click Read. The Device Signature and Target Voltage text boxes should propagate accordingly. If they do not check the connections and try again.

To flash the bootloader we first need to disable the BOOTPROT fuse. To do this select Fuses > USER_WORD_0.NVMCTRL_BOOTPROT and change to 0 Bytes. Click Program to upload the changes.

Now we can flash the bootloader by selecting Memories > Flash and set the location of the bootloader. Ensure Erase Flash before programming is selected and click Program. If all goes well D13 on the board should begin to pulse.

Now you’ll need to set the BOOTPROT fuse to the 8kB bootloader size. To do this select Fuses > USER_WORD_0.NVMCTRL_BOOTPROT and change to 8192 Bytes. Click program to upload the changes.

Now that the bootloader has been flashed D13 should be pulsing and if plugged in over USB, a mass storage device should appear. This is where UF2 files can be uploaded for programming the board.

Step 4: Firmware: Flashing Code With PlatformIO

Firmware can be uploaded over the UF2 protocol or directly via the SWD interface. Here we’ll be using PlatformIO for its ease and simplicity. To get started create a new PIO project and select Adafruit Feather M0 as the target board. When uploading over SWD with a J-Link set the upload_protocol in platformio.ini as shown below.

[env:adafruit_feather_m0]
platform = atmelsam
board = adafruit_feather_m0
framework = arduino
upload_protocol = jlink

Now you can program the board with the simplicity of the Arduino framework.

Step 5: Firmware: Flashing the Anchor

The DWM1000 modules can be configured to be anchors or tags. Generally anchors are kept at known static locations and tags use anchors to get a relative position to them. To test the DWM1000 module you can upload the DW1000-Anchor example from the GitHub repository.

To flash this program with PlatformIO, from PIO Home, select Open Project then find the location of the DW1000-Anchor folder in the GitHub repository. Then click the PIO upload button and it will automagically find the attached debug probe (ensure it is connected and the board is powered).

The tag firmware will need to be uploaded to another board. Then the result can be viewed in a serial terminal.

Step 6: Going Further

Further improvements to this project will include development on a new DW1000 library, V1.1 board changes other projects that utilize this ranging technology. If there is sufficient interest I will consider manufacturing and selling these boards.

Thanks for reading. Leave any thoughts or criticisms in the comments below and be sure to check out the project on Prototyping Corner