UART communication with Arduino

Here is my trial using dwm1001-dev with arduino through UART communication.

I recommend to get an arduino mega instead of arduino uno since mega comes with more uart. It would be helpful when debugging since at least one uart is needed to communicate with your computer.

I connect my dwm1001-dev rx and tx to my arduino mega rx1 and tx1. Leave rx0 and tx0 alone since they are needed in my serial monitor of Arduino IDE.

And if you want use it with dwm1001, it is recommended to make sure the voltage is 3.3V between dwm1001 and arduino, especially for dwm1001 rx. I have broken one of my dwm1001 because of it.

Say I want to read the tag position.
I set one of my dwm1001 as the listener (passive anchor) and connect it to my arduino through uart.
According to the DWM1001 firmware API guide, I have to get into Shell Mode and send lec command to my dwm1001 listener.
So, now it is the code part of my arduino.

String c; //some temporary string variable
void setup() {
  Serial.begin(115200); //it could be different according to your arduino serial baud setup
  Serial1.begin(115200); //dwm1001 require 115200 baud
  Serial1.write(0x0D); //send the first "Enter"
  Serial1.write(0x0D); //send the second "Enter" to get into Shell Mode
  c = Serial1.readString(); //read the response from dwm1001
  Serial1.write(0x6C); //send "l"
  Serial1.write(0x65); //send "e"
  Serial1.write(0x63); //send "c"
  Serial1.write(0x0D); //send "Enter"

void loop() {
  Serial.println(Serial1.readStringUntil('\n')); //show position in Serial Monitor

That is it. Should be quite simple.
I used Serial1.write command instead of Serial1.print because somehow it is more stable in my trial.

As for those of you who want to use SPI communication with Arduino, please refer to this post.
It has worked on my test of SPI communication.

1 Like

This is really helpful.

How did you find which pins are the rx/tx pins on the dwm1001? I’ve been looking all over to see which pins are for UART and which to use for SPI but I can’t find a reliable pinout and they’re not marked on the module itself. I’m good with soldering and there’s a ton of info on everything else but I’m not sure which pins to solder to to connect to my arduino or teensy.

But thanks for the code here, this will really help.

-Odinn Dagur

Thanks so much!! I feel like a dweeb - I had honestly looked around but didn’t notice the J10 on the pcb or the RPI Header text in the schematic… heh.

Thanks, I really appreciate it.