Learn how to detect and track humans with an Rd-03D mmwave radar sensor and Arduino. Take a look at how the sensor works and what you can expect from it, how to wire up and program the Arduino, as well as how to create a visual radar display with Processing IDE.

Transcript

In this video, we're going to learn how to use this radar sensor in your next Arduino project. We'll explore how it works, what you can expect from it, how to use it with your Arduino, and to top it all off, we'll create a visualization to track humans with it. Let's get into it.

This is a 24 gigahertz millimetre wave radar sensor, a testament to modern technology. It's an inexpensive device with a lot going on under the hood—lots of math, filtering, and high-level engineering. Yet, we get a simple UI containing helpful information. It emits radio waves and listens for reflections that bounce back to gather information about its surroundings, similar to an ultrasonic sensor. However, this sensor is more advanced. It uses the time it takes for radio waves to bounce back to measure the distance to the target. These radio waves move at the speed of light, which is a very short time to measure. It also listens for frequency shifts from the Doppler effect to measure how fast the target is moving, similar to how a car's frequency changes as it drives by.

Additionally, it has two receiver antennas to detect the angle of the reflecting object. If you imagine the reflection coming back at an angle, it will hit one antenna before the other. Importantly, it only detects people. When it sends out radio waves, many things reflect back—your chair, walls, fridge, phone—but advanced signal processing helps it identify humans by the patterns of reflections. Your breathing, subtle arm movements, and tiny body movements create micro Doppler shifts, forming a distinctive pattern that the radar recognizes as a human.

With this sensor, you'll use 24 gigahertz radio waves to detect a person, determine how far they are from the sensor (up to eight meters), their angle (within 120 degrees), and their speed (only towards or away from the sensor, not side to side). One more thing: the sensor doesn't like to be moved. We think it performs a room calibration when set up, and moving it disrupts this calibration, leading to dodgy readings. Just give it a try and see what happens. Now that you know how it works, let's use it.

To follow along, you'll need the RD03D radar sensor and a way to connect jumper wires to it, either through the pinout at the top or with jumper wire adapters for the board connector. You'll also need an Arduino Uno (we're using the Arduino R4, but it should work with an R3) and some jumper wires. You can find everything you need in the written guide linked below.

Before we begin, note that the connector cable we're using for the radar is generic, so the colors might not match. For example, the red and black wires are not the power wires but the TX and RX. The green is the five volt, the yellow is the ground, and the black is TX while the red is RX. Double-check what's written on the board and which wire color goes where before starting.

Start by powering the radar by connecting the five volt pin of the radar to the five volt pin of the Arduino. Connect the ground pin of the radar (the yellow one, not the black one) to the ground pin of the Arduino. I'm using male-to-male jumper wires to do this and correcting the color to something more appropriate.

Our radar sensor outputs data through UART. Connect the TX pin of the radar to pin two, which will be our RX pin on the Arduino. Pins zero and one on the Arduino are the default UART pins, but they also handle the USB connection, so using them simultaneously causes issues. To avoid this, we'll use pins two and three as our UART pins and simulate that with software. Speaking of pin three, do not connect it. The radar runs on 3.3-volt logic, and the Arduino runs on five-volt logic. We might damage something if we're not careful. Right now, we're transmitting a 3.3-volt signal on the radar and receiving it on pin two, which can handle up to five volts. But if we connected pin three to the RX pin of the radar and sent data over, we'd be sending a five-volt signal to a pin rated only for 3.3 volts. So, we'll leave it at these three wires as we're only receiving data from the radar.

If you want to send data to the radar, you'll need a logic level converter. If not, we're done and ready to program our Arduino.

In the written guide linked below, you'll find the demo code we'll use. I'll paste it into our script. You'll also find a download for the library we've written for this sensor. Download the zip but don't unzip it yet. In the Arduino IDE, go to Sketch > Include Library > Add ZIP Library, and navigate to where you downloaded it. You'll get a confirmation in the shell that the library has been successfully installed.

How does the library work? First, import the library and set up an instance of our radar sensor. The pins here, two and three, are the TX and RX pins that software serial will use as your UART connection. We're using pin two, and pin three doesn't really matter, but you can change this first pin to suit your project needs.

In our setup, we'll use `serial.begin` to set up communication between the Arduino IDE and our Arduino. Then, `radar.begin` sets up communication between our radar and Arduino. You can change this first board rate if needed, but don't change the second one as it's the defined board rate the radar operates at.

In our void loop, we'll call `radar.update`, which gets the library to pull the latest information from the radar. It returns true if it gets a valid reading and false if it doesn't. So, when we say `if radar.update`, we're not only getting the latest information but also checking for a valid reading. If there is one, we'll print it out. After updating, the reading is held by the library, and we can get it into our script by using `radar.getTarget`, storing it in a variable like `target` or `tgt`.

The rest of the script is print lines to see in the serial monitor what's going on. All information from the reading is stored in this variable, so to get the speed, use `.speed`; for the angle, use `.angle`; for distance, use `.distance`. We also have `x` and `y`.

I'll use Blu-Tack to mount our radar sensor facing me so we can see what's going on. I'll plug in my Arduino, select our board and COM port, and compile and run the code. If we open the serial monitor and set it to the board we're communicating with, we should get all our readings printed out.

We have several things being printed, from bottom to top. First, speed in centimeters per second. Moving towards the camera is negative, and moving away is positive. Moving side to side doesn't pick up speed, but moving backwards and forwards does. It only measures movement towards or away from the sensor.

Next, angles in degrees. Imagine shooting a straight line from the sensor; anything to the left is negative up to -60 degrees, and anything to the right is positive up to +60 degrees. Moving left increases the angle positively, and moving right decreases it negatively.

Distance is self-explanatory—it's the absolute distance from the sensor to you. Moving back increases the reading. Then, we have X and Y. For X, imagine a straight line from the sensor down the middle. X measures how far you are from this line. Moving left increases the negative distance, and moving right increases the positive distance. The Y axis is similar but measures your distance from the wall. Facing the sensor one meter away, moving right or left keeps the Y reading at one meter.

Some quick tips: It's set up to detect one person, usually the closest one. Mount it between chest and head height. Radio waves can bounce off walls, so if you get readings with no one in the room, it might be reflections. If no one is near the sensor, it won't pick anyone up. Multiple sensors can interfere, so keep them far apart if using in multiple rooms.

Before we finish, let's see how to make a radar visualization. In the written guide, you'll find the second demo code needed. Replace the first code with this. It's similar but outputs readings in CSV format. Upload that code to the Arduino. In the serial monitor, it outputs angle, distance, and speed. Moving back and forth shows changes, and it outputs UART data over USB.

We can visualize this with Processing IDE, an open-source program for creating visuals like the radar we're making. Once installed, copy and paste the Processing IDE code from the guide. This code takes UART messages from the Arduino via USB and draws a radar visualization.

The Arduino's COM port can only connect to one app at a time. If the Arduino IDE is printing to the serial monitor, close it. Before doing so, check your COM port (e.g., COM port 3). Close the IDE, and in the Processing code, change the COM port line to your port. Set your board rate if different. Run the code, and with the radar, each circular line represents a two-meter measurement. At two meters away, shuffle around, and it picks up movements, dropping off at about 60 degrees. At maximum, it's nearly four meters away. Information is printed in the top left.

This tool is handy for testing and diagnosing issues, providing a way to visualize what the radar sees. It's fun to play with, having a microcontroller connected to a radar sensor emitting invisible waves and visualizing that information on a screen. It's amazing what you can do with such an inexpensive module.

That wraps us up. You now know how to use this radar to detect humans and get helpful information. Use the speed output to create a human speed camera, integrate the sensor into a smart home setup, or track a person's angle to move a fan towards them. If you make something cool or need help, visit our community forums. Until next time, happy making!

Feedback

Please continue if you would like to leave feedback for any of these topics:

  • Website features/issues
  • Content errors/improvements
  • Missing products/categories
  • Product assignments to categories
  • Search results relevance

For all other inquiries (orders status, stock levels, etc), please contact our support team for quick assistance.

Note: click continue and a draft email will be opened to edit. If you don't have an email client on your device, then send a message via the chat icon on the bottom left of our website.

Makers love reviews as much as you do, please follow this link to review the products you have purchased.