// Ai-Thinker RD-03E 24GHz mmWave human-movement/gesture radar, over UART. // // Confirmed against the actual part in use (not the originally-assumed // Hi-Link LD2410 — a different manufacturer with a different, incompatible // UART protocol; do not mix up wiring or frame parsing between the two). // Reports distance-ranged human presence (not just a boolean, per the // module's own "Precise Ranging & Positioning" naming) plus a gesture // code, better suited to a handheld device meant to sense "how close" and // "what kind of movement" rather than just "something moved." // // Implements the sensor_driver_t interface (see sensor_driver.h). // // Default wiring — see README.md's wiring section for the full pinout // table: // RD-03E OT1 (module's UART TX) -> ESP32 RX (RD03E_UART_RX_GPIO) // RD-03E RX (module's UART RX) -> ESP32 TX (RD03E_UART_TX_GPIO) // RD-03E VCC -> 5V (module power; UART logic is 0-3.3V, ESP32-safe) // RD-03E GND -> GND // RD-03E OT2 -> not connected (reserved on the module, unused here) // Default UART settings: 256000 baud, 8N1 (module factory default). #pragma once #include "esp_err.h" #include "sensor_driver.h" #ifdef __cplusplus extern "C" { #endif #ifndef RD03E_UART_PORT #define RD03E_UART_PORT 1 #endif // GPIO 14-19 and 54 are reserved on the target board (Waveshare // ESP32-P4-Module-DEV-KIT) for the onboard Wi-Fi co-processor's SDIO link // — see README.md and sdkconfig.defaults. These pins avoid that range and // the BMP280's I2C pins (8/9). #ifndef RD03E_UART_RX_GPIO #define RD03E_UART_RX_GPIO 4 #endif #ifndef RD03E_UART_TX_GPIO #define RD03E_UART_TX_GPIO 5 #endif #ifndef RD03E_UART_BAUD #define RD03E_UART_BAUD 256000 #endif // sensor_driver_t-compatible entry points. esp_err_t rd03e_init(void); esp_err_t rd03e_read(sensor_reading_t *out, size_t max_out, size_t *out_count); #ifdef __cplusplus } #endif