Yeah perhaps not fully broken as it does still work in bluetooth mode which is how I’m now using it but perhaps some bad UART connections soldered onto the board. I don’t have too much time to look into it at the moment so I’m hoping in a few weeks time someone has wrote up a definitive tutorial on getting these working with a D1 mini with troubleshooting tips! If more people report the same issue I suspect there might be some quality control issues with the boards mind.
I will try to investigate, reason I want to check it this way is that if I keep receiving messages over UART when it’s a simple (non-esphome) sketch the issue might be in the esphome. Maybe the large amount of messages/updates is crashing the ESP/D1 in combination with Wifi/ethernet
The problem with that theory is there are plenty of people in here using the D1 mini successfully. I’d point the finger more towards the LD than the D1 personally.
A recent firmware update to the LD2410C board enables a light sensor. Has anyone worked out how to get that sensor into HA yet?
I installed LD2410 BLE and it works great.
LD2410 BLE
What firmware update will allow the on board LED to function? I updated the firmware from V1.07.22091516 to V2.04.23022511 using the Iphone HiLink app but LED still not functioning.
For anyone that purchased the LD2410 Kit board (comes with a LD2410B and the correct header for it to plug in to the board) there are other through holes wired on the board with the correct spacing for the LD2410C. But you will need to use jumpers to reverse the TX and RX lines to get it to work.
I have one question, mine seemed to work pretty good during testing but lately always is detecting occupied (the numbers keep varying so it is reading the data). I ready the very limited PDF and it states the voltage should be 3.6-5V. I am running from 3.3V could that be an issue and should I switch to 5V? That may also remove some of the power draw from the ESP32S2 Mini regulator as it seemed to get warm.
It should look like the above, no space for the variable ‘number’.
yes you should use 5v
Doh, this is why you should read the entire thread. I was trying to use the ld1115h yaml on the ld2410B all day and obviously it didn’t work. I am also using a Seeed XIAO ESP32-C3 due to their super small size so the ld2410 yaml should work but I am just to lazy to go back and fix it at the moment. I did get it working but just as a basic “detection” sensor with no controls. I’m sure it will work with the correct TX and RX pins and additional *.h file. I will try later.
I personally found the BT integration to be “flaky” but that is probably my terrible soldiering job as I cut a power only USB cable and soldiered the 5V power and ground cables but it’s a lot of fun with the 1.25mm spacing on the ld2410, with or without headers so I am suspecting that is more then likely the issue. Need to hook one up with headers to a spare USB cable that has a 5V and ground output among other outputs for flashing stuff for ESPHome to verify.
For the price, I wouldn’t be surprised if it was damaged in shipping but still, you can’t beat the price. The DFRobot is great but you can get 7 to 10 of these for the price of one of the DFRobot’s. I also own one of the Seeed 60Mhz fall detectors but it is WAY to sensitive but would probably be great under a bed for sleep detection. They have another 60Mhz model that can read your heart rate so they are obviously very, very sensitive to any movement at all. Fans and pets are not good for mmwave sensors, that is for sure. I have posted what I ended up (hope it truncates) with for the day but going to go back and use the other yaml code for the ld2410 as it has way more controls and options at some point but just in case it helps anyone as I had some “fun” today getting it to work just to find out there was different yaml code for the ld2410 as I thought it was the C3 that was just a few posts down. Yay me. If you ever have to use the output pin for an input from either model it will always hook to the MISO pin on whatever flavor ESP32 you are working with, had fun figuring that out (still learning).
substitutions:
devicename: "esp-radar" #Rename the device what you want.
upper_devicename: ESP Radar #Rename the device what you want.
esphome:
name: $devicename
esp32:
board: esp32-c3-devkitm-1
variant: esp32c3
framework:
type: esp-idf
version: recommended
# Enable logging
logger:
# level: DEBUG
# baud_rate: 0
# Enable Home Assistant API
api:
encryption:
key: "durrrrrrr"
ota:
password: "blahhh"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
use_address: xxx.xxx.x.x
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "esp-radar fallback hotspot"
password: "zzzzzzzz"
uart:
id: LD1115H_UART_BUS
rx_pin: GPIO7 #Using SDA and SCL pins, RX and TX should work fine (GPIO20 and 21 on seeed esp32-c3) but was to lazy to switch back as this works
tx_pin: GPIO6 #
baud_rate: 460800
#debug:
# direction: BOTH
# dummy_receiver: true
# after:
# delimiter: "\n"
# sequence:
# - lambda: UARTDebug::log_string(direction, bytes);
binary_sensor:
- platform: status
name: ${upper_devicename} Status
- platform: gpio
name: ${upper_devicename} LD1115H Occupancy or Movement
id: LD1115H_MovOcc_Binary
device_class: occupancy
pin:
number: GPIO9
mode:
input: true
pulldown: true
sensor:
- platform: wifi_signal
name: ${upper_devicename} WiFi Signal
update_interval: 60s
- platform: uptime
name: ${upper_devicename} Uptime
text_sensor:
- platform: wifi_info
ip_address:
name: ${upper_devicename} IP Address
ssid:
name: ${upper_devicename} SSID
bssid:
name: ${upper_devicename} BSSID
mac_address:
name: ${upper_devicename} Mac Address
Excellent discovery! Thanks for your post, it solves my same issue too. Was struggling 1 day to make it work and your post saved me. On top of the settings with using the other UART I’ve disabled also logging to finally be able to see values comming:
# Enable logging
logger:
level: none
baud_rate: 0
Hey guys,
How do your builds look with the Seeed XIAO ESP32-C3 what are you guys doing with the aerial? Are you printing cases or…
Hello all. Been trying everything i can find to get my HLK-LD2410B working with my D1 MINI V3.0.0 - Mini NodeMcu board. Only get unknown status whatever i do…
To make sure, i got 5 of each and all work on their own. However the LD2410 don’t seem to work when powered from the 5v on the esp… So using external power for both.
Then i also tried all combos of yaml files that i can find combined with the .h from GitHub - rain931215/ESPHome-LD2410: ESPHome LD2410 mmWave Radar Sensor Custom Component.
And tried all uart combos…
tx_pin: GPIO15, rx_pin: GPIO13
tx_pin: GPIO1, rx_pin: GPIO3
tx_pin: GPIO3, rx_pin: GPIO1
tx_pin: RX, rx_pin: TX
tx_pin: TX, rx_pin: RX
Using latest esphome 2023.5.0 (dev), and latest HA on a virtual machine.
Read that some had succes reverting to version 2023.3.2 of esphome but that seams impossible on a vm?
Currently my yaml looks like this
esphome:
name: ld2410
includes:
- ld2410_uart.h
on_boot:
priority: 600
# ...
then:
- lambda: |-
auto uart_component = static_cast<LD2410 *>(ld2410);
uart_component->setNumbers(maxMovingDistanceRange, maxStillDistanceRange, noneDuration);
external_components:
- source: github://esphome/esphome@dev
components: [ ld2410 ]
esp8266:
board: esp01_1m
logger:
baud_rate: 0
api:
encryption:
key: "="
ota:
password: ""
wifi:
ssid:
password:
manual_ip:
static_ip: 192.168.1.124
gateway: 192.168.1.1
subnet: 255.255.255.0
uart:
id: uart_1
rx_pin: GPIO3
tx_pin: GPIO1
baud_rate: 256000
data_bits: 8
stop_bits: 1
parity: NONE
custom_component:
- lambda: |-
return {new LD2410(id(uart_1))};
components:
- id: ld2410
binary_sensor:
- platform: custom
lambda: |-
auto uart_component = static_cast<LD2410 *>(ld2410);
return {uart_component->hasTarget,uart_component->hasMovingTarget,uart_component->hasStillTarget,uart_component->lastCommandSuccess};
binary_sensors:
- name: "Has Target"
- name: "Has Moving Target"
- name: "Has Still Target"
- name: "Last Command Success"
sensor:
- platform: custom
lambda: |-
auto uart_component = static_cast<LD2410 *>(ld2410);
return {uart_component->movingTargetDistance,uart_component->movingTargetEnergy,uart_component->stillTargetDistance,uart_component->stillTargetEnergy,uart_component->detectDistance};
sensors:
- name: "Moving Target Distance"
unit_of_measurement: "cm"
accuracy_decimals: 0
- name: "Moving Target Energy"
unit_of_measurement: "%"
accuracy_decimals: 0
- name: "Still Target Distance"
unit_of_measurement: "cm"
accuracy_decimals: 0
- name: "Still Target Energy"
unit_of_measurement: "%"
accuracy_decimals: 0
- name: "Detect Distance"
unit_of_measurement: "cm"
accuracy_decimals: 0
number:
- platform: template
name: "Max Moving Distance Range"
id: maxMovingDistanceRange
min_value: 1
max_value: 8
step: 1
update_interval: never
optimistic: true
set_action:
- lambda: |-
auto uart_component = static_cast<LD2410 *>(ld2410);
uart_component->setMaxDistancesAndNoneDuration(x,id(maxStillDistanceRange).state,id(noneDuration).state);
- platform: template
name: "Max Still Distance Range"
id: maxStillDistanceRange
min_value: 1
max_value: 8
step: 1
update_interval: never
optimistic: true
set_action:
- lambda: |-
auto uart_component = static_cast<LD2410 *>(ld2410);
uart_component->setMaxDistancesAndNoneDuration(id(maxMovingDistanceRange).state,x,id(noneDuration).state);
- platform: template
name: "None Duration"
id: noneDuration
min_value: 0
max_value: 32767
step: 1
mode: box
update_interval: never
optimistic: true
set_action:
- lambda: |-
auto uart_component = static_cast<LD2410 *>(ld2410);
uart_component->setMaxDistancesAndNoneDuration(id(maxMovingDistanceRange).state,id(maxStillDistanceRange).state,x);
button:
- platform: template
name: "Reboot LD2410"
on_press:
lambda: 'static_cast<LD2410 *>(ld2410)->reboot();'
- platform: template
name: "Turn on config mode"
on_press:
- lambda: 'static_cast<LD2410 *>(ld2410)->setConfigMode(true);'
- platform: template
name: "Turn off config mode"
on_press:
- lambda: 'static_cast<LD2410 *>(ld2410)->setConfigMode(false);'
- platform: template
name: "Get config"
on_press:
- lambda: 'static_cast<LD2410 *>(ld2410)->queryParameters();'
- platform: template
name: "Set baud rate to 256000"
on_press:
- lambda: 'static_cast<LD2410 *>(ld2410)->setBaudrate(7);'
- platform: template
name: "Set baud rate to 115200"
on_press:
- lambda: 'static_cast<LD2410 *>(ld2410)->setBaudrate(5);'
- platform: template
name: "Set baud rate to 9600"
on_press:
- lambda: 'static_cast<LD2410 *>(ld2410)->setBaudrate(1);'
Anyone have a similar setup with any succes?
If not, any thips for a new esp board that might work better?
Are you actually using an ESP01 board?
I would try with D1 mini or similar to start with as they have more memory and tend to be more stable.
This configuration worked for me on a D1 mini V4.0 to see the sensor information HA.
esphome:
name: d1miniv4
friendly_name: D1MiniV4
esp8266:
board: d1_mini
# Enable logging
logger:
level: none
baud_rate: 0
# Enable Home Assistant API
api:
encryption:
key: "long bit of text"
ota:
password: "hexadecimal text"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "D1Miniv4 Fallback Hotspot"
password: "tqk"
captive_portal:
uart:
id: uart_2
tx_pin: 15
rx_pin: 13
baud_rate: 256000
parity: NONE
stop_bits: 1
debug:
direction: BOTH
dummy_receiver: false
after:
delimiter: [0xF8,0xF7,0xF6,0xF5]
ld2410:
timeout: 150s
max_move_distance : 6m
max_still_distance: 0.75m
g0_move_threshold: 10
g0_still_threshold: 20
g1_move_threshold: 10
g1_still_threshold: 20
g2_move_threshold: 20
g2_still_threshold: 21
g3_move_threshold: 30
g3_still_threshold: 31
g4_move_threshold: 40
g4_still_threshold: 41
g5_move_threshold: 50
g5_still_threshold: 51
g6_move_threshold: 60
g6_still_threshold: 61
g7_move_threshold: 70
g7_still_threshold: 71
g8_move_threshold: 80
g8_still_threshold: 81
sensor:
- platform: ld2410
moving_distance:
name : Moving Distance
still_distance:
name: Still Distance
moving_energy:
name: Move Energy
still_energy:
name: Still Energy
detection_distance:
name: Detection Distance
binary_sensor:
- platform: ld2410
has_target:
name: Presence
has_moving_target:
name: Moving Target
has_still_target:
name: Still Target
Got this sensor up an running, reporting into HA consistenly.
Had a bit of a play with the levels and have it pretty bob on for my requirement.
Does anyone know of any automation blueprints published anywhere for this yet?
Also, there is a settting call spectral line. What does this value mean in real terms?
Thanks in advance.
Rob
I just got a couple of the HLK-LD115H sensors and I’m having so issue and was curious if y’all had the same problems.
I’m sitting about 5 or 6 feet from it with it about head height (when I’m sitting down, so about chest high standing) and I cannot get it dialed correctly. If I make it sensitive enough to detect me sitting still then it’s so sensitive that it detects people moving in the next room. If I lower the sensitivity down so that it can’t detect people in the next room, then it can’t detect me sitting still right next to it.
I have it connected to a ESP8266 (a wemos D1 type board).
Any ideas why it can’t see me reliably, but can see people 6 feet past me with no issues?
I got things mostly worked out. Turns out I was misunderstanding what “Clearance Time” meant on the LD115H. I thought it meant how long to wait before clearing a presence detected signal. What it actually means is Occupancy Signal Noise Requirement or how much change is required by TH2 (presence detector) to go active. Once I got this stuff worked out I was able to get it tuned in… minus my ceiling fan getting in the way. Reading through the thread I see that this is a common issue with the LD115H since distances can’t be set with it.
For anyone else in the future here’s what I found for each setting using Patrick’s very excellent ESPHome code:
Clearance Time - Actually occupancy signal noise (how much change is required by TH2 to notify Occupancy) - Bigger numbers = less sensitive. Setting this number low will detect big things farther away or small things up close.
Movement Time - Actually movement signal noise (how much change is required by TH1 to notify movement) - Bigger numbers = less sensitive
TH1 - Motion detection - Bigger numbers = less sensitive (I had to set this very high so it would stop detecting people in the next room)
TH2 - Presence detection - Bigger numbers = less sensitive (I had to set this very low so it would detect me sitting still at my desk about 6 feet away)
If someone else uses LD1115H together with M5stack-atom-lite boxes, I’ve updated the YML to include m5stack-specific bells’n’whistles (button and light), as well as all the latest features - BLE proxy and Improv-wifi.
I made a project for this sensor on Arduino, take a look, maybe it will be useful for you) GitHub - stiamon77/AQST-MS: Occupancy\Motion sensor HLK-LD1115H-24G ESP32 or ESP8266, Arduino, connection to Home Assistant, Human Presence Sensor Radar
Works stably for several months, suitable for ESP32 and ESP8266. Connecting to HA without dancing