Hi everyone, long time reader but realised I didn’t have an account so I’m signed up.
I recently found these mmWave modules for a good price: Human Micro-Motion Detection mmWave Sensor (24GHz) | The Pi Hut
The board itself looks remarkably like the LD2420 pictured on this ESPHome page:
I’ve had the unit linked up to a Wemos D1 Mini and working with an Arduino set of code so I know the connections are all OK and it’s talking.
Moving across to ESPHome and using the example code on that page (above) doesn’t result in anything apart from “unknown” for the presence or distance measures.
Before sharing code I was woindering if anyone had used this module (specifically the Waveshare branded one in case there are differences) please?
I’m still quite new to mmWave modules but I’m trying my best! Thanks.
Did you see that depending on the FW, pins 3 and 5 are inverted?
Thanks for the quick response, I have tried both pin 3 and 5 although pin 3 is actually labelled as Tx on this board.
What about the baudrate?
Depending on the firmware you have serial baudrates will be 256000 for any
module with less than firmware v1.5.3 and 115200 on newer versions
Thank you again @walberjunior . I have tried both baud rates. I’ll plough on, next step is to try connecting it to a PC and seeing what I can get out of the little devil!
I was wondering if anyone else had come across the Wavshare branded ones in case there were differences that had been resolved.
PaulEast
(Paul)
July 10, 2024, 12:55pm
6
Well I switched the D1 mini for a ESP-WROOM-32 that I found lying around and fot it working with a bit of help from the feature request here: Support Hi-Link LD2420 (HLK-LD2420) 24GHz Radar Sensor · Issue #2219 · esphome/feature-requests · GitHub
So in terms of a cheap mmWave module, this does the job!
I need to try it with an ESP01 now for size,
can you please share your config… im trying on my esp32 and it keeps going into bootloop…
Here you go, I’ve added a few bits but it’s fairly stock from the LD2420 page on esphome. This is working on a Wemos S2 Mini.
esphome:
name: office-presence
friendly_name: Office presence
esp32:
board: esp32-s2-saola-1
framework:
type: arduino
# Enable Home Assistant API
api:
encryption:
key: "xxxxx REPLACED xxxxx"
ota:
- platform: esphome
password: "xxxxx REPLACED xxxxx"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Office-Presence Fallback Hotspot"
password: "xxxxx REPLACED xxxxx"
captive_portal:
# Enable logging
logger:
level: DEBUG
#baud_rate: 0
############################################################################
# LED Output
switch:
- platform: gpio
id: led_1
name: "LED 2"
pin: GPIO18
- platform: gpio
id: led_2
name: "LED 1"
pin: GPIO39
############################################################################
uart:
id: ld2420_uart
tx_pin: GPIO17
rx_pin: GPIO16
baud_rate: 115200
parity: NONE
stop_bits: 1
#debug:
# direction: both
ld2420:
############################################################################
text_sensor:
- platform: ld2420
fw_version:
name: LD2420 Firmware
sensor:
############################################################################
# Reports the WiFi signal strength/RSSI in dB
- platform: wifi_signal
name: "WiFi Signal dB"
id: wifi_signal_db
update_interval: 60s
entity_category: "diagnostic"
# Reports the WiFi signal strength in %
- platform: copy
source_id: wifi_signal_db
name: "WiFi Signal Percent"
filters:
- lambda: return min(max(2 * (x + 100.0), 0.0), 100.0);
unit_of_measurement: "Signal %"
entity_category: "diagnostic"
device_class: ""
############################################################################
- platform: ld2420
moving_distance:
name : Moving Distance
# Turn on LED 2 when movement is detected
#on_value:
# then:
# - switch.turn_on: led_2
# - delay: 5s
# - switch.turn_off: led_2
# Turn on LED 1 when precence is within 120cm
on_value_range:
- above: 0.0
below: 1.0
then:
- switch.turn_off: led_1
- switch.turn_off: led_2 #Removed for movement LED above
- above: 1.0
below: 200.0
then:
- switch.turn_on: led_1
- switch.turn_off: led_2 #Removed for movement LED above
- above: 200.0
then:
- switch.turn_off: led_1
- switch.turn_on: led_2 #Removed for movement LED above
# Filter out values over 8m
filters:
- clamp:
min_value: 0.0
max_value: 800.0
ignore_out_of_range: true
############################################################################
binary_sensor:
- platform: ld2420
has_target:
name: Presence
############################################################################
select:
- platform: ld2420
operating_mode:
name: Operating Mode
############################################################################
button:
- platform: restart
name: "Office Presence Restart"
- platform: ld2420
apply_config:
name: Apply Config
factory_reset:
name: Factory Reset
restart_module:
name: Restart Module
revert_config:
name: Undo Edits
############################################################################
number:
- platform: ld2420
presence_timeout:
name: Detection Presence Timeout
min_gate_distance:
name: Detection Gate Minimum
max_gate_distance:
name: Detection Gate Maximum
#gate_select:
# name: Select Gate to Set
#still_threshold:
# name: Set Still Threshold Value
#move_threshold:
# name: Set Move Threshold Value
gate_move_sensitivity:
name: Move Calibration Sensitivity Factor
gate_still_sensitivity:
name: Still Calibration Sensitivity Factor
gate_0:
move_threshold:
name: Gate 0 Move Threshold
still_threshold:
name: Gate 0 Still Threshold
gate_1:
move_threshold:
name: Gate 1 Move Threshold
still_threshold:
name: Gate 1 Still Threshold
gate_2:
move_threshold:
name: Gate 2 Move Threshold
still_threshold:
name: Gate 2 Still Threshold
gate_3:
move_threshold:
name: Gate 3 Move Threshold
still_threshold:
name: Gate 3 Still Threshold
gate_4:
move_threshold:
name: Gate 4 Move Threshold
still_threshold:
name: Gate 4 Still Threshold
gate_5:
move_threshold:
name: Gate 5 Move Threshold
still_threshold:
name: Gate 5 Still Threshold
gate_6:
move_threshold:
name: Gate 6 Move Threshold
still_threshold:
name: Gate 6 Still Threshold
gate_7:
move_threshold:
name: Gate 7 Move Threshold
still_threshold:
name: Gate 7 Still Threshold
gate_8:
move_threshold:
name: Gate 8 Move Threshold
still_threshold:
name: Gate 8 Still Threshold
gate_9:
move_threshold:
name: Gate 9 Move Threshold
still_threshold:
name: Gate 9 Still Threshold
gate_10:
move_threshold:
name: Gate 10 Move Threshold
still_threshold:
name: Gate 10 Still Threshold
gate_11:
move_threshold:
name: Gate 11 Move Threshold
still_threshold:
name: Gate 11 Still Threshold
gate_12:
move_threshold:
name: Gate 12 Move Threshold
still_threshold:
name: Gate 12 Still Threshold
gate_13:
move_threshold:
name: Gate 13 Move Threshold
still_threshold:
name: Gate 13 Still Threshold
gate_14:
move_threshold:
name: Gate 14 Move Threshold
still_threshold:
name: Gate 14 Still Threshold
gate_15:
move_threshold:
name: Gate 15 Move Threshold
still_threshold:
name: Gate 15 Still Threshold
Thanks got it to work on my dfrobot esp32 c3 mini using tx GPIO5
and rx GPIO4
PaulEast
(Paul)
July 24, 2024, 11:08am
10
Good news, I’d be interested to hear how you get on. I was having trouble with the S2 Minis I was using so now have a couple up and running using the Wemos D1 Mini (ESP8266) They detect movement well but the calibration seems to be all over the place (doesn’t seem to update the gate thresholds with better values) and it doesn’t seem to sense “still” presence over about 1.5m.
Yes calibration is horrible on these i have manually adjusted it for now and seems to be working fine. still presense working fine too around 4m for me which is not a big issue as my room is not that big…
PaulEast Paul
Was wondering if you managed to get the WaveShare module working?
I have mine attached to the ESP32 which I am sure it is working but need the code to get the sensor itself going. Any Suggestions?