Getting the RD‑03D radar module working with ESP32 (library + code adjustments?)

Hi everyone,

I’m currently trying to get the RD‑03D 24GHz radar module running on an ESP32, but I’m running into issues with the existing Arduino library and example sketches. The RD‑03D works fine on an Arduino Uno/Mega, but the same code does not behave correctly on the ESP32 (garbled UART data, incomplete frames, or no valid output).

Before I start rewriting the whole library, I wanted to ask the community:

  1. Has anyone successfully used the RD‑03D with an ESP32?**

If yes, did you need to modify the library or the UART handling?

  1. What changes are required in the library to make it ESP32‑compatible?**

For example:

  • different HardwareSerial handling
  • different readBytes() timing
  • disabling FIFO
  • adjusting frame parsing
  • using Serial1 instead of Serial2
  • or switching to a non‑blocking read loop
  1. Does anyone have a working ESP32 sketch for the RD‑03D?**

Thanks in advance!

Manuel

1 Like

Keeping in mind that I dont work with Arduino, rather I use the idf directly; so I cant comment on Arduino specifics.

If you are getting something on the UART, but its not what you expect, this sounds like something needs to be tweaked in the config for the UART, e.g. board/speed.
I would not assume any defaults and ensure you have setup the needed baud rates/start/stop/parity as well as ensure you are using the correct GPIO Pins. Im not a fan of calling them “Serial1 and Serial2” it does not really tell you what pins and if that is should be used. e.g. on most ESP32 boards UART0 is the program/debug port, so I would tend to stay away from that If I dont need to use it, then user UART1 and/or 2. But is Serial1 UART1 or UART0 on the ESP32?

1 Like

Hey there, @Manuel310356, and welcome to the forums, glad to have you here.

I’ve not tried using it with an ESP32, but almost certainly you would need to modify the library.

May I ask what code you have been using so far to work with the radar sensor? I’d be curious to see the specific errors you were getting as well.

Thanks for sharing this!

I can confirm the same behaviour (How To Use An Rd-03D mmwave Sensor To Create A Human Radar with Arduino - Video Tutorial Australia - comments)

My RD‑03D module (G331 marking under the AI‑Thinker logo) does not use the same header as the G502 version shown in the Core Electronics tutorial.

The library expects frames starting with:
0xAA 0xFF 0x03 0x00

But my module consistently sends:
0xAD 0xFF 0x03 0x00

So the parsing logic in the library never matches the actual data and no target is ever detected.
It’s not a wiring or baudrate issue – the protocol is simply different.

I switched to HardwareSerial on the ESP32 and wrote a small state‑machine parser that matches the 0xAD FF 03 00 header and reads the 24‑byte payload. With that, the sensor works reliably.

Just to be transparent: I’m still learning and I adapted the code together with help from Microsoft Copilot, so this is a collaborative effort rather than my own deep knowledge. Any corrections or insights are welcome.

1 Like

Hey @Manuel310356,

Glad you managed to solve it.

I have seen a lot of people dig themselves deeper into their problems with AI, so it’s wonderful to hear you managed to use it efficiently.