Detect and Track Humans with mmWave Radar on an Arduino

Hello forum goers, got another guide for you all.

mmWave radar sensors are becoming incredibly accessible. Modules like the one we look at in the guide (Rd-03D) have a mind-blowing amount of signal processing going on under the hood. This can do things like detect a 0.3 Picosecond difference in signal return to determine the angle of a target and use the micro-doppler shifts of your breathing to only detect humans (and maybe animals but we didn’t test it). It’s a wickedly cool and inexpensive sensor to add to your project or just play around with so check it out: “Detect and Track Humans with mmWave Radar on an Arduino”



In this guide, we are going to be learning how to use the Rd-03D radar sensor to detect and track humans in your next Arduino project. We will be looking at how it works and what you can expect from it, how to wire up and code your Arduino to interf…

Read more

3 Likes

Hi Jarryd

Great Guide! Thankyou so much for doing all of the heavy lifting on this one :smiling_face_with_sunglasses:.
I was just wondering if there would eventually be a guide using Micropython on the Raspbery Pi Pico with its’ dedicated 2nd UART interface??

cheers Bruce

3 Likes

Hey @Bruce288839,

We are working on it right now and if all goes to plan it will be out Wednesday. It will hopefully have a few more bells and whistles with multi-target tracking!

3 Likes

looking good! the video after yours was show casing how effective it is with at least 3 people also and runing it in home assistant. I suck at any sort of code “learning as i go” however, have you guys made any code for ESPhome at all? Ive currently used the LD2410c and honestly from my testing they are not the best, and very particular use case, this Rd-03D seems more promising =)

1 Like

Hi @Paul283026

Welcome to the forum!

We haven’t tested this sensor with ESPHome as of yet, currently the specific chipset that runs this sensor isn’t supported natively by ESPHome yet, but being that its a UART based sensor it does make it a little easier to get working.

Using an LLM like ChatGPT is a great way to get an idea of the code that would be needed to get things like this working.

1 Like

Hi Paul,

To add on to Dan’s response, the library decodes a bytes object rather than a somewhat-human-readable like NMEA from GPS.

I’ve got this planned for a project at home, but a second microcontroller would run the sensor interface, and output the required information in though UART like Dan said.
I haven’t delved too deep into the workings of this configuration but it should be possible (and a lot easier) with a second micro: UART Bus — ESPHome

When getting them onto the website they were the best-in-class sensor so should be a step up!

Liam

Hello. We want to implement this sensor in a nursing home to help monitor the movement of our residents and detect if they get up, sit up in bed, walk, and fall. We currently use PIR motion sensors, but I’m investigating this possibility to see if it provides us with more information and we can better care for our seniors.
If you think this project might be interesting, I encourage you to help me with the code so I can implement it with an ESp32. I suppose the ceiling would be a good place to place the sensor and capture two residents at the same time. We would greatly appreciate any support and assistance (by the way, I’m writing from Spain…)

Hi @JOSEIGNACIO296093

Welcome to the forum!

You should be able to use this sensor for that, I would though recommend having it mounted on the wall rather than the roof, as the sensor can only detect a body in 2 axis (X and Y) having it on the roof would give you top down view, having it on the wall will give you a side on view which you should be able to program the microcontroller to detect if a body has gone from being upright to not more accurately.

1 Like

Hi all,

Just leaving this here in case someone else runs into the same issue. I bought the RD-03D radar sensor from AI-Thinker (this one:
https://it.aliexpress.com/item/1005006240221601.html)

and tested a library shared here

Despite compiling and running without errors, the library doesn’t read anything. The sensor is definitely sending data—I confirmed it by reading the raw serial output—but the code fails to recognize or parse the packets. No target is ever detected, and nothing useful comes through.

It’s not a problem with the wiring or the baud rate. The sensor is active, but the parsing logic in the library just doesn’t match the actual structure of the data.

Here’s what I see in the raw serial output:

CopyEdit

0xAD 0xFF 0x03 0x00 0x52 0x00 0x4D 0xE0 0x84 0x80 0x6C 0x00 0x00 0x00 0x80 0x00 ...
0xAD 0xFF 0x03 0x00 0x4D 0x00 0x4E 0xC0 0x80 0x00 0x6C 0x00 0x00 0x00 0x00 0x00 ...

As you can see, the packets consistently begin with 0xAD 0xFF 0x03 0x00, not 0xAA 0xFF or any other header assumed by the library.

So if you have my same model and wondering why the sensor appears dead or unresponsive in your code, it’s most likely because the parsing logic is completely misaligned with the actual data format.

Is that correct or I’m missing something?

Nader

EDIT:

The problem is SoftwareSerial that in my case is not supporting the baudrate. Using arduino mega with serial1 it seems that the data is now consitent. I managed to print something, but the data is bulky the distance measurement keep jumping from the correct-ish position, to a nan value, something that is not happening in the example video.

X (mm): 285

Y (mm): 1741

Distance (mm): 179.20

Angle (degrees): 9.30

Speed (cm/s): 0.00


X (mm): 277

Y (mm): 1720

Distance (mm): 143.08

Angle (degrees): 9.15

Speed (cm/s): 0.00


X (mm): 271

Y (mm): 1706

Distance (mm): nan

Hey @Nader297638,

Thanks for letting us know! I just plugged in one I have here and it reads:

0xAA 0xFF 0x03 0x00....

I just want to confirm that after using the hardware serial it is outputting this header? These might be slightly different boards if it isn’t (our boards have a G502 model number, and that link has G331, directly under the AI Thinker logo on it).

There have been a lot of changes with Arduino serial in recent boards and we are using software serial to ensure compatibility across all of them. Hardware serial like you are doing would be the better option as it ensures a full message is read. However, we found that software serial was still fast enough to read the first half of the message which is where the tracking info for target 1 is. This board supports multi-target tracking but we found it to introduce issues and left it at single-target. Although only a partial message is read, the library was written to handle it and extract the single-target data.

Cheers!

1 Like

Hi, I purchased my Rd-03D board through Core Electronics. The model is G520. The same issue is occurring for the G520.

The code compiles and uploads OK.

However, no reading is transmitted.

The Serial Monitor reads

Radar Sensor Started

Could you confirm the library works for the G520? thanks Luke

1 Like

Those who are planning to work with mmWave, here is another good project for you. This compact, low-cost multifunctional sensor integrates presence detection (via an mmWave radar), light level sensing, and temperature monitoring onto a Wemos D1 mini board, with a small 2-layer PCB (37 × 44 mm) designed for easy connection via USB or JST. Built using components like the HLK-LD2410C radar, BH1750 light sensor (with a 4.7 kΩ resistor for calibration), and a DS18B20 temperature probe, it’s programmed in ESPHome and integrates seamlessly with Home Assistant for automating lights and even ceiling fans (via RF control). Everything fits into a 3D-printed corner-mountable case, and the design leaves GPIO pins accessible for future expansion. D1 mini MMwave multisensor - Share Project - PCBWay

Hey @Luke202527,

Welcome to the forum!

If you could share some images and code snippets from your project, it would make it a lot easier for us to help you debug.

Hi Ryan,

I have been following the instructions as per Detect and Track Humans with mmWave Radar on an Arduino - Tutorial Australia. I am using an UNO R3.

The model number on the radar is 520. The issue looked similar to the one described @Nayder297638. The Serial Monitor reads Radar Sensor started, but no readings are displayed (images attached). I was able to use some other code that shows the radar is sending something but I have been unable to read it. At first I suspected it was baud rate issue but now I am not so certain. Can you confirm that the library works with the 520 model? Thanks for your help.

Hi @Luke202527,

I can’t help but noticing that you have three ‘Radar Sensor Started’ messages in the serial output. Was that from you testing it from boot three times or were you receiving that message multiple times in the same cycle?

Hi Jane,

I uploaded the code a few times consecutively without clearing the serial monitor. It only prints the once during a cycle. Any ideas? Thanks, Luke

Hey @Luke202527 ,

I just gave your setup a test here at Core and was able to get the correct output using the code you provided and the same wiring as in your photos.

Could it be an issue with your jumper wires? If one of them has a break in it, this could explain the lack of communication between your board and the sensor. If you have a multimeter handy, I would check the continuity of these wires to make sure everything is working as expected.

Hope this helps!

Hey @Luke202527,

I’ve just had a deep dive into this and I think you may be encountering an issue that is specific to older Arduino boards.

First of all, the G520 is not an issue; I get the same results with older and newer mmWave boards.

The wiring and code you have work fine when using an Arduino R4, and when I plugged in my R3, it also worked. When developing the code, I used this Uno R3 and was happy that this managed to work on it as well. However, I plugged in another R3 I had lying around, and I got the same issue as you. In fact, I got the same issue that @Nader297638 was having.

When I run this with the R4, a Raspberry Pi Pico and an ESP32 (some in C++, some in MicroPython), they read the start of the message and the end of the message as the following.

0xAA 0xFF … (middle part of message here) … 0x55 0xCC

But when I read it on one of my R3s I get the following message:

0xAD 0x01 … (middle part of message here) … 0x52 0x8C

And because the library is looking for the first set of values for the head and tail ends of these messages, it doesn’t register that it has read a valid output. So I went ahead and modified the library to look for the new header and tail, and it started reading. However, there seems to be some sort of bit shifting or corruption happening as not only are the header and tail different, but the distance, angle and speed values are as well. They read consistently, but they are all wrong. I tried to see if I could apply an offset (if it was consistently reading at an offset, we could calibrate it), but the shifting of the bits seems random.

Why is this happening? My probably something very weird hardware-wise. A baud rate of 256,000 is a very non-standard rate and exceptionally fast for software serial. The fact that I had an R3 that worked, and another that didn’t, I suspect there might be some timing issues that are only present on certain R3 boards. We are really getting caught on some out-of-the-blue nonsense here, unfortunately.

So the bottom line is that software serial can’t support this on older R3 boards. Some fixes for this are to instead use an R4 that supports reading at this rate through software serial, or using the actual hardware-based serial on the R3 that you have (through pins 0 and 1). The only issue is that the hardware serial on your board is the same serial that you use to send and receive data from your pc, so you won’t be able to send the output data to the serial monitor or processing IDE. You might need an OLED screen or something else to view that data. If you are applying this in a project, you might not need to view it on your pc at all, but it makes debugging difficult. @Nader297638 was able to get it going as the Mega has a 2nd UART channel to use (in addition to the USB one), the Uno R4 has a 2nd one as well.

If you do want to try out the hardware serial approach, I have altered the library to use it instead of software. If you follow the same process from the guide of installing a library, you should be able to overwrite the old one:

RD03D_Hardware_Serial.zip (1.4 KB)

#include <RadarSensor.h>

RadarSensor radar;

void setup() {
  radar.begin(256000); // Radar connected to pins 0 (RX) and 1 (TX)
  // You cannot use Serial.print anymore on Uno if the radar is connected here
}

void loop() {
  if(radar.update()) {
    RadarTarget tgt = radar.getTarget();
  }
}

Sorry about all this hassle, you seem to of been snagged on a very weird bug, I’ll also go ahead and update the guides to mention this issue as well.

Cheers!
-Jaryd

1 Like