ThisCalculator

Everyday

ESP32-C6 mmWave Presence Sensor: Build a 2D Tracker

Updated · Standard formula, shown below

ESP32-C6 mmWave Presence Sensor: Build a 2D Tracker

To build a 2D presence tracker with the ESP32-C6 and an mmWave sensor, you need the sensor module, the ESP32-C6 board, a power source, and code that converts the sensor’s range and angle data into coordinates. The most common choice is a 60 GHz mmWave sensor like the Seeed Studio MR60BHA1 or the DFRobot SEN0395, which outputs target coordinates over UART. This article explains the hardware, wiring, data parsing, and visualization steps so you can build your own room‑scale tracker.

Background: Why mmWave for Presence Tracking?

mmWave radar uses radio waves in the 60 GHz band (or 24 GHz for some modules) to detect objects and their movement. Unlike PIR sensors, which only sense large changes in infrared radiation, mmWave can detect tiny movements like breathing and can provide precise distance and angle information. This makes it ideal for presence detection, fall detection, and 2D tracking within a room. The ESP32-C6 is a low‑power Wi‑Fi 6 and Bluetooth 5 SoC that can handle the sensor data and send it to a network, making it a popular choice for smart‑home projects.

How the 2D Tracking Works

A 2D tracker gives you the X and Y coordinates of a person (or multiple people) relative to the sensor. The sensor uses multiple receiving antennas to measure the angle of arrival (AoA) of the reflected radar signal. By combining the distance (range) and the angle, it calculates the position in polar coordinates (r, θ). The microcontroller then converts these to Cartesian coordinates using:

  • X = r × cos(θ) (horizontal distance from the sensor)
  • Y = r × sin(θ) (lateral offset, often perpendicular to the sensor’s facing direction)

Most sensors output the range and angle directly in their data frames, so you don’t need to do the radar signal processing yourself—you just parse the serial data.

Hardware You’ll Need

Here is a list of the essential components:

  • ESP32-C6 development board (e.g., ESP32-C6-DevKitM-1) – the main controller.
  • 60 GHz mmWave presence sensor – choose one that supports 2D tracking (e.g., Seeed MR60BHA1, DFRobot SEN0395, or similar). These typically output data over UART at 115200 baud.
  • Power supply – 5V USB cable or a 3.3V/5V regulated supply. Check the sensor’s voltage requirement; many run on 5V but have 3.3V logic.
  • Jumper wires – for connecting the sensor’s TX, RX, VCC, and GND to the ESP32-C6.
  • Optional: a small OLED display or an LED matrix to visualize the position locally.

Wiring the Sensor to the ESP32-C6

Most mmWave sensors use UART (serial) communication. Connect the sensor’s TX pin to the ESP32-C6’s RX pin (e.g., GPIO5) and the sensor’s RX to the ESP32-C6’s TX (e.g., GPIO4). Use a logic level shifter if the sensor runs at 5V logic, though many are 3.3V compatible. Power the sensor with its required voltage (usually 5V) and ground it to the ESP32’s GND.

Here is a typical wiring table:

  • Sensor VCC → 5V (or 3.3V if supported)
  • Sensor GND → GND
  • Sensor TX → ESP32-C6 RX (GPIO5)
  • Sensor RX → ESP32-C6 TX (GPIO4)

Reading and Parsing the Data

Once wired, you need to read the serial data. The sensor sends binary frames or ASCII strings containing target information. For example, the Seeed MR60BHA1 sends a frame with a header, length, command, and data bytes. You’ll need to parse this to extract the X and Y coordinates (or range and angle).

Here is a simple approach using the Arduino IDE:

  1. Install the ESP32 board support in the Arduino IDE.
  2. Use the Serial2 peripheral (or any UART) to read the sensor data.
  3. Look for the frame header (e.g., 0x53 0x59) and then parse the payload.
  4. Convert the raw bytes to floating-point values (often in centimeters and degrees).
  5. Apply the Cartesian conversion if needed.

Many sensors have manufacturer-provided libraries or example code that you can adapt. If you’re using a common module, search for its datasheet to get the exact frame format.

Visualizing the 2D Tracker

Once you have the coordinates, you can display them in several ways:

  • Serial plotter – Use the Arduino IDE’s serial plotter to see X and Y as separate lines.
  • Processing or p5.js – Send the coordinates over serial or Wi‑Fi and draw a dot on a canvas.
  • Web dashboard – Use the ESP32-C6’s Wi‑Fi to serve a simple HTML page that updates a canvas via WebSocket or HTTP.
  • OLED/LED matrix – Draw the position on a small display for a standalone device.

Common Problems and Troubleshooting

Here are frequent issues you might encounter:

  • No serial data – Check wiring, baud rate, and that the sensor is powered.
  • Garbage characters – The baud rate or logic level might be wrong.
  • Inaccurate coordinates – The sensor may need a clear field of view; metal objects and walls can cause multipath reflections.
  • Multiple targets – Some sensors only report one target; check if your module supports multi‑target tracking.
  • Range limitations – Most 60 GHz sensors have a range of about 5–8 meters; ensure your room is within that.

Cost and Power Considerations

The total cost for a basic 2D tracker is roughly $20–$40: the ESP32-C6 board costs around $5–$10, and the mmWave sensor ranges from $15 to $30. Power consumption is low—the ESP32-C6 can run on battery for a while, but the sensor may draw up to 100 mA. For a permanent installation, a USB power adapter is simplest.

Safety and Regulatory Notes

mmWave radar operates at low power and is generally safe for indoor use. However, you should follow the manufacturer’s guidelines for mounting height and angle. In some regions, 60 GHz devices must comply with local radio regulations; check that your module is certified for your country. Also, avoid pointing the sensor directly at eyes or using it in medical devices without proper approvals.

Frequently Asked Questions

Can I use a 24 GHz sensor instead of 60 GHz?

Yes, but 24 GHz sensors are often less precise and may not provide 2D angle data. For a 2D tracker, a 60 GHz module is recommended because it offers better resolution and multiple antennas for angle measurement.

Do I need a second ESP32 for processing?

No, the ESP32-C6 is powerful enough to parse the data and send it over Wi‑Fi. You can also do simple visualization on the same board.

How many people can the sensor track simultaneously?

Most consumer mmWave sensors track only one target at a time. If you need multi‑person tracking, you’ll need a more advanced (and more expensive) radar module.

What is the maximum range for tracking?

Typically 5 to 8 meters, depending on the sensor and environment. The datasheet will give the exact range.

Can I use this with Home Assistant or other smart home systems?

Yes, you can send the coordinates via MQTT or HTTP to Home Assistant and create automations based on presence and position.

Related

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.