maybe try this one HLK-LD012-5G with over all power consumption 68uA
The newer ld2411s is 48mA, but whether it is 1 day or 2 days, it is not practical.
I have a LD2410B connected with a esp32 with the tx and rx. I uploaded the yaml file to the esp. The yaml with the uart, tx, rx. And I got all the sensors and controls working in home assistant. Works fine.
Then I connected also the out pin from the LD2410b to the pin D3 from the esp.
And I added these lines to the existing yaml code:
- platform: gpio
pin: D3
name: “LD radar”
device_class: motion
Now I got an extra sensor. With detected and clear.
But it works the wrong way. When I am in the room the sensor reads CLEAR and when I am not in the room the sensor reads DETECTED. How can I change this? Thank you and sorry for my english.
If you are using the UART TX/RX pins, there is no need to connect up the Output pin for a sensor in HA as you would get the same result by using the ‘presence’ sensor setup with the following:
binary_sensor:
- platform: ld2410
has_target:
name: "presence"
has_moving_target:
name: "movement"
has_still_target:
name: "still"
The output pin is the combined still and movement values which is what ‘presence’ is.
If you do want to use the Output pin, you can try using the invert filter when setting up the sensor:
binary_sensor:
- platform: ...
# ...
filters:
- invert:
Thank you for your reply. Much helpful. It is also a learning experience for me.
I get more than 6hrs on 800mA battery, see below:
I just wonder one thing: when i played a bit with LiFePo battery and esp i found out that when battery voltage gets under 3V esp starts to act “funny” - and it tends to consume significant current (well above 100mA) which drains (empty) battery to zero. How you guys deal with it? I guess i should have a kind of control chip for power supply be cut off when battery is empty?
I specifically chose LiFePo because it’s voltage is lower than liion, just around 3.2 - 3.4V, so (theoretically) no voltage regulator would be needed…
Why do you all connect the Sensor to an ESP?
I simple power it and let it connect to an esp32 per BT. I see no reason to connect it to an esp.
If i use a power supply with 5V, 2A it works reliable.
Using 5V, 0.4A it permanently disconnected, so providing enough power is important!
If i power it off and on and it normally is found automatically.
I use the for configuration (has to be done only once) the current app version has a function to capture measured values for some time and show them wile configuring the gates.
The esp32 ble integration was pretty unreliable in the beginning, but seems to be good now.
All the problems i had with BT disconnecting was caused by a weak power supply.
I take it you mean power to the ld2410?
I dreamed of a self-powered ld2410 with a small solar panel. Alas, too power hungry.
yes, no ESP, only ld2410 + power supply with enough power.
Maybe use a Step Down Converter on your house powerline.
To have WiFi, BLE has short range, repeaters are messy, why to have so many different repeaters where WiFi has mesh already.
Yes you should have BMS. I use this for my Li-Po batteries pulled from depleted vapes:
They cut off power below 2.8V not to damage batteries and has sufficient overcharge protections. I can keep it connected to charger permanently, no probs. They charge battery, then keep cycle charging between 90-100%.
Aha…thanks. I’ll order some then. I just thought… since my intention was “battery only” device perhaps i wouldn’t need charger circuit at location and i’d just replace battey when it’s empty. But it seems it doesn’t work that way. Ok, normally i’d replace it before it’s empty, but if i forget… i guess it’s not worthy to take a chance since doing so too frequent would result in dead battery
I wouldn’t recommend fully battery operated unit, as even without ESP, microwave sensor consumes a lot! If you need standalone sensor look for motion sensors on zigbee (sonoff for instance) they run on battery very long. Other solution is to make it to run on solar cells, but little challenging too as you have to figure out size of the panel, size of battery and multiply them to 2 for reliability, cloudy days etc…
Updated YAML to work through MQTT as my sensors might not be in the same network:
esphome:
name: presence-sensor03
friendly_name: Presence_Sensor03
esp8266:
board: esp01_1m
# Enable logging
logger:
# Enable Home Assistant API
#api:
# encryption:
# key: !secret prsensor03_enckey
ota:
password: !secret prsensor03_ota
wifi:
ssid: !secret wifi_ssid2
password: !secret wifi_password2
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Presence-Sensor03"
password: !secret wifistereo01_fallbackpass
captive_portal:
# Example configuration entry
mqtt:
broker: 192.168.1.20
username: !secret mqtt_user
password: !secret mqtt_password
id: PR_Sensor_03
web_server:
port: 80
version: 2
include_internal: true
auth:
username: !secret mqtt_user
password: !secret mqtt_password
# Enable HTTP/HTTPS requests
http_request:
# default ESPHome
useragent: esphome/$device_name
# request time out / default 5s
timeout: 2s
# Example configuration entry
text_sensor:
- platform: wifi_info
ip_address:
name: ESP IP Address
ssid:
name: ESP Connected SSID
bssid:
name: ESP Connected BSSID
mac_address:
name: ESP Mac Wifi Address
scan_results:
name: ESP Latest Scan Results
dns_address:
name: ESP DNS Address
status_led:
pin:
number: GPIO02
inverted: true
# Example configuration entry
uart:
tx_pin: GPIO1
rx_pin: GPIO3
baud_rate: 256000
parity: NONE
stop_bits: 1
ld2410:
timeout: 5s
max_move_distance : 6m
max_still_distance: 6m
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
- platform: wifi_signal # Reports the WiFi signal strength/RSSI in dB
name: "WiFi Signal dB"
id: wifi_signal_db
update_interval: 60s
entity_category: "diagnostic"
- platform: copy # Reports the WiFi signal strength in %
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"
- platform: adc
pin: VCC
name: "VCC Voltage"
accuracy_decimals: 3
filters:
- multiply: 1.287
binary_sensor:
- platform: ld2410
has_target:
name: Presence
has_moving_target:
name: Moving Target
has_still_target:
name: Still Target
switch:
- platform: restart
name: "Presence Sensor Restart"
Have also added some more data to display, such as IP address and web interface.
I still run into some challenges to reconnect, some inconsistency there and only sorted out by rebooting router
UPDATE: Solved connection issues for ESP8266 by forcing it to connect using wifi 11g mode:
on_boot:
priority: 300
then:
lambda: |-
WiFi.setPhyMode(WIFI_PHY_MODE_11G);
Disable wifi sleep
I have similar problems with my ld2410C. Setting the thresholds in the yaml doesn’t seem to do anything. If I set all still thresholds to 0 it still turns off by an energy of < 30, which is the threshold I can see via the app. If I change these values via the app, it works.
YAML can’t reprogram default settings of the device unless you hookup 5th pin to GPIO and use different code other that the one listed in HA support page for this chip.
Refer to the following article if you want to change default settings:
YAML serves purely for HA filtering data sent by device