ESP32 MR24HPB1 Human Presence Radar Sensor
Overview
The MR24HPB1 is a high-sensitivity 24GHz radar sensor capable of detecting human presence and motion. It communicates via UART and is ideal for smart home and security applications.
Choose Your Platform
About MR24HPB1 Human Presence Radar Sensor
The MR24HPB1 is a 24GHz mmWave radar sensor designed for human presence detection. Utilizing FMCW (Frequency Modulated Continuous Wave) technology, it can detect both moving and stationary human targets within a range of up to 6 meters. The sensor provides real-time data on motion speed, distance, and presence intensity, making it suitable for applications such as smart lighting, security systems, and occupancy monitoring. For more information, refer to the official datasheet: MR24HPB1 Datasheet.
Technical Specifications
Pinout Configuration
The VCC
pin is used to supply power to the sensor, and it typically requires 3.3V or 5V (refer to the datasheet for specific voltage requirements). The GND
pin is the ground connection and must be connected to the ground of your ESP32.
The MR24HPB1 is a 24GHz FMCW radar sensor from Seeed Studio, designed for accurate human presence and motion detection. It features a simple UART communication interface and operates at 5V. The available pins are:
5V
– Power input. Connect to a stable 5V DC source. This powers the internal radar and processing circuits. Ensure the power source can handle current spikes during radar bursts.GND
– Ground connection. Connect this pin to the ground of your ESP32 or power supply. This establishes the common reference needed for both power and UART signal integrity.TX
– UART transmit pin. Sends sensor data (such as presence status, motion intensity, distance) from the MR24HPB1 to a host microcontroller. Connect this to the ESP32's RX pin (e.g., GPIO16).RX
– UART receive pin. Receives configuration commands or query requests from the ESP32. Connect this to the ESP32’s TX pin (e.g., GPIO17).
Note: Although MR24HPB1 operates at 5V, the UART logic levels are often 3.3V tolerant. Confirm with the datasheet or test using a logic analyzer if unsure. If needed, use a logic level shifter between ESP32 and the sensor.
Wiring with ESP32
To connect the MR24HPB1 radar sensor to an ESP32 using UART for serial communication, follow the wiring plan below. This allows you to receive detailed movement and presence data in real-time:
5V
(red wire) → 5V pin on ESP32 or external 5V regulated supply. Ensures consistent operation of the radar module.GND
(black wire) → GND on ESP32. Provides a shared ground reference, critical for UART and power stability.TX
(green wire) → GPIO16 on ESP32 (UART RX). This line transmits sensor output to the ESP32 for processing or display.RX
(blue wire) → GPIO17 on ESP32 (UART TX). This allows the ESP32 to send configuration commands to the MR24HPB1 if needed.
Configuration Tip: Set the UART interface to 115200
baud, 8 data bits, no parity, and 1 stop bit (8N1). Confirm that no other peripherals (e.g., sensors, debug logs) are sharing UART2 (GPIO16/17), unless multiplexed intentionally.
Troubleshooting Guide
Common Issues
🚫 No Data Received
Issue: The ESP32 receives no data from the sensor.
Ensure correct wiring: verify that TX and RX lines are properly connected, and confirm that the UART baud rate is set to 115200 bps. Also, ensure that the sensor is powered with a stable 5V supply.
❌ Presence Not Detected
Issue: The sensor does not detect presence even when someone is in range.
Check the sensor's field of view and ensure there are no obstructions. Verify that the sensor's configuration parameters are set correctly for the desired detection range and sensitivity.
⚠️ Intermittent Detection
Issue: Sensor intermittently detects presence or fails to maintain detection.
Ensure that the sensor is securely mounted and not subject to vibrations. Check for sources of interference in the environment that may affect radar performance.
🔌 UART Initialization Fails
Issue: UART component in ESPHome reports failure to initialize.
Verify that the UART pins specified in the configuration match the physical connections. Ensure that no other devices are using the same UART bus, and that the baud rate is correctly set to 115200 bps.
Debugging Tips
🔍 Serial Monitor
Use the Serial Monitor to check for error messages and verify the sensor's output. Add debug prints in your code to track the sensor's state.
⚡ Voltage Checks
Use a multimeter to verify voltage levels and check for continuity in your connections. Ensure the power supply is stable and within the sensor's requirements.
Additional Resources
Code Examples
Arduino Example
#include <Arduino.h>
#include "mr24fdb1.h"
MR24FDB1 radar;
void setup() {
Serial.begin(115200); // Debug output
Serial1.begin(115200); // UART for MR24HPB1
radar.begin(&Serial1);
}
void loop() {
if (radar.read()) {
Serial.print("Presence: ");
Serial.println(radar.presence() ? "YES" : "NO");
Serial.print("Motion: ");
Serial.println(radar.motion());
Serial.print("Distance: ");
Serial.println(radar.distance());
}
delay(250);
}
This Arduino example uses the MR24FDB1
library to communicate with the MR24HPB1 radar sensor over UART. The sensor is initialized on Serial1
(GPIO16/17 on ESP32), with a baud rate of 115200. The loop()
function reads presence status, motion intensity, and distance, and prints the values to the serial monitor. The library simplifies communication and parsing of radar output. You can find the library and more information at github.com/limengdu/Seeed-Studio-MR24FDB1-Sensor.
ESPHome Example
uart:
id: uart_bus
tx_pin: GPIO17
rx_pin: GPIO16
baud_rate: 115200
parity: NONE
stop_bits: 1
seeed_mr24hpb1:
id: my_mr24hpb1
binary_sensor:
- platform: seeed_mr24hpb1
has_target:
name: "Presence Detected"
sensor:
- platform: seeed_mr24hpb1
custom_presence_of_detection:
name: "Static Distance"
movement_signs:
name: "Body Movement Parameter"
custom_motion_distance:
name: "Motion Distance"
custom_spatial_static_value:
name: "Existence Energy"
custom_spatial_motion_value:
name: "Motion Energy"
custom_motion_speed:
name: "Motion Speed"
custom_mode_num:
name: "Mode Number"
This ESPHome configuration sets up the MR24HPB1 sensor using the seeed_mr24hpb1
platform. The UART interface is configured with a baud rate of 115200, no parity, and 1 stop bit. The binary_sensor
detects presence, while the sensor
entries provide detailed information on static distance, body movement, motion distance, existence energy, motion energy, motion speed, and mode number. Ensure that the UART pins are correctly connected and that the sensor is powered with a stable 5V supply.
Conclusion
The ESP32 MR24HPB1 Human Presence Radar Sensor is a powerful Human Presence sensor that offers excellent performance and reliability. With support for multiple development platforms including Arduino, ESP-IDF, ESPHome, PlatformIO, and MicroPython, it's a versatile choice for your IoT projects.
For optimal performance, ensure proper wiring and follow the recommended configuration for your chosen development platform.
Always verify power supply requirements and pin connections before powering up your project to avoid potential damage.