mmWave Wars: one sensor (module) to rule them all

Use google translate on your smartphone (translation with camera). First mesage is “unable to open serial device” which means that something is wrong with your serial connection to device (bad / wrong connections, wrong baudrate…)

1 Like

Thank you for the suggestion… Unfortunately, my connections are correct according to the manual. I am not using the Serial to USB adapter from HiLink but another one i had around (FT232RL). Not sure if this is the problem.

My connections are correct, the PC recognizes the device but the Hilink Software cannot connect to it…

I will keep trying

The manual is lying to you, OT1 an RX are serial pins

1 Like

THAT’S IT!!! Now it connects and i can get a reading from the sensor!!! Still trying to workaround the esphome code though…

I have the following and my entities are “Unknown”

external_components:
  - source: github://pr#4847
    components: [ ld2420 ]
    refresh: 0s

uart:
  id: ld2420_uart
  tx_pin: 1
  rx_pin: 3
  baud_rate: 256000
  parity: NONE
  stop_bits: 1

binary_sensor:
  - platform: gpio
    pin: GPIO02
    name: "Bedroom Motion Sensor"
    device_class: motion
  - platform: ld2420
    has_target:
      name: Bedroom Presence

ld2420:
  presence_time_window: 120s
  detection_gate_min: 1
  detection_gate_max: 12
  g0_move_threshold: 60000
  g0_still_threshold: 40000
  g1_move_threshold: 30000
  g1_still_threshold: 20000
  g2_move_threshold: 400
  g2_still_threshold: 200
  g3_move_threshold: 250
  g3_still_threshold: 200
  g4_move_threshold: 250
  g4_still_threshold: 200
  g5_move_threshold: 250
  g5_still_threshold: 200
  g6_move_threshold: 250
  g6_still_threshold: 200
  g7_move_threshold: 250
  g7_still_threshold: 150
  g8_move_threshold: 250
  g8_still_threshold: 150
  g9_move_threshold: 250
  g9_still_threshold: 100
  g10_move_threshold: 250
  g10_still_threshold: 100
  g11_move_threshold: 250
  g11_still_threshold: 100
  g12_move_threshold: 250
  g12_still_threshold: 100
  g13_move_threshold: 200
  g13_still_threshold: 100
  g14_move_threshold: 200
  g14_still_threshold: 100
  g15_move_threshold: 200
  g15_still_threshold: 100


sensor:
  - platform: ld2420
    moving_distance:
      name : Moving Distance

There is also a PIR sensor in the code but this is working properly!

Hai,

My config below. It’s practically the same as yours. If the 2420 sensors are still stated unknown consider the following:
Stay away from the ancient 8266, it’s a no go for this sensor.
One other thing, there are 2 FW versions of the LD2420, they changed the bautrate from 256000 to 115200 for the newer ones, so try changing this if the sensors remain “Unknown”


esphome:
  name: mmw-ld2420
  comment: S2 MINI LD2420

external_components:    
   source: github://pr#4847 
   #github://descipher/[email protected]
   components: [ ld2420 ]
   refresh: 0s

esp32:
  board: esp32-s2-saola-1
  framework:
    type: arduino

# Enable logging
logger:


captive_portal:
    
web_server:
  port: 80

uart:
  id: ubus
  tx_pin: GPIO18
  rx_pin: GPIO33 
  baud_rate: 256000
  parity: NONE
  stop_bits: 1



ld2420:
  presence_time_window: 2s
  detection_gate_min: 1
  detection_gate_max: 4
  g0_move_threshold: 60000
  g0_still_threshold: 40000
  g1_move_threshold: 30000
  g1_still_threshold: 20000
  g2_move_threshold: 400
  g2_still_threshold: 200
  g3_move_threshold: 250
  g3_still_threshold: 200
  g4_move_threshold: 250
  g4_still_threshold: 200
  g5_move_threshold: 250
  g5_still_threshold: 200
  g6_move_threshold: 250
  g6_still_threshold: 200
  g7_move_threshold: 250
  g7_still_threshold: 150
  g8_move_threshold: 250
  g8_still_threshold: 150
  g9_move_threshold: 250
  g9_still_threshold: 100
  g10_move_threshold: 250
  g10_still_threshold: 100
  g11_move_threshold: 250
  g11_still_threshold: 100
  g12_move_threshold: 250
  g12_still_threshold: 100
  g13_move_threshold: 200
  g13_still_threshold: 100
  g14_move_threshold: 200
  g14_still_threshold: 100
  g15_move_threshold: 200
  g15_still_threshold: 100

sensor:
  - platform: ld2420
    moving_distance:
      name : ld2420 Moving Distance

binary_sensor:
  - platform: ld2420
    has_target:
      name: ld2420 Presence

switch:
  - platform: restart
    name: ld2420 Restart    ```

Didnt you need to set the baudrate for the logger to 0?

Its logging seems to interfere with the UART.

Been playing around with this on a Firebeetle board.

The 2410C works flawlessly connected to TX and RX ports, all data is coming in.
The 2420 only works on the OUT port. I cannot use TX or RX data in esphome, its the same kind of board and I am using the same RX and TX pins where the 2410C works fine.

Anyone got any idea what I could be doing wrong? I switched baud rates I switch RX and TX tried connecting to the HLK tool but that also didnt work.

It is not the same board, 2410 != 2420. Differences in features and differences in protocols

Yes I understand. Its a different setup and different Yaml. The board I am referring to there is the ESP32 both are DF Robot Firebeetle boards.

Thanks for the great post! I ordered a couple of LD2410B sensors to test. What i am interested is to use them for turning off the lights when no one is in a room...

They are quite good…

I use PIR sensors in the kitchen and the toilet and the LD2410 in the living room. When i am watching a movie (determined by if my plex media player is “Playing”) and one of the PIR sensors senses motion, the movie pauses. It means that i stood up to go to the kitchen for a snack or to the toilet.

When coming back, the LD2410 still energy increases and the movie resumes. This is also good when watching a movie with friends as it will not pause in case the LD2410 has high still energy. This is just another case usage for these sensors.

1 Like

Only presence detection works
distance doesn’t work
what is the problem?


all files and examples are here

Which sensor is this?

LD2410
Wemos d1 mini

Check the connection to the board, it needs to have TX to RX and RX to TX connected in order to have all the readings.




Hello everyone,
I got a test breadboard setup in my loungeroom to test the 2410b before I setup a permanent solution. The issue is its constantly in a detected state and I’m not sure what is causing such a high move / still %.
Ia the location fine or could that be causing the false positives?
The dashboard photo is showing the values when no one is home

Can anyone give me some pointers please?

some tips that worked for myself

setup a web server within esphome for this device , this way it was much easier to view and adjust each gate

setting all gates to a little higher than your readings of know one in the room gave me a good base line to start with

i read somewhere gate 0 has or can cause a problem, not sure why or if this was right. BUT after setting gate 0 to nothing 99.9% of my fulse triggers disappeared

I think the key here is the calibration. The sensor exposes between others

  • Move energy
  • Move target
  • Still Energy
  • Still Target

The position is important. The sensor has a 60 degree view and needs to be pointed in a location that “sees” you where you usually sit (ex the sofa, bed etc) but it also needs to have a view of the entrance to the room (door).

Now, the way you set your automations will vary depending on the readings of the sensor. My suggestion is before you set any automations, do some testing. I did the following for me:

  • Tested the readings when no one is in the room (i had 0 moving energy, and about 4% still energy)
  • Tested when entering the room (i had about 30% moving energy and 70% still energy. When i sat on the sofa the still energy went to 100% and then if i stay completely still, holding my breath it was about 10 - 12%)
  • Tested when exiting the room (the moving energy was high but the still energy was dropping after i exited eventually reaching the 4%)

I did all those tests with another person in the room as well.

Now that i know how the sensor reads, i had to set the sensitivity. The sensitivity is the point of which if the energy will overcome, the sensor will report the target. To make it simpler, if i set up still sensitivity to 6% and i have still energy 4%, the sensor will not report still target. If the energy goes higher than the 6%, then it will report still target. Same applies for the moving target.

This now gives you 2 options. You can set automations based on target, or you can set automations based on energy (with numeric states) or a combination of the 2. The way i have set it up is the following:

To turn my lights on:
When Moving target is detected → Turn the lights on. This is controlled by the sensitivity you have set on the moving thresholds but essencially since i have set my sensitivity to 60%, when i enter the room, i get about 70% and this is above the sensitivity so the sensor reports moving target and i use this to turn the lights on. My trigger is the state of the Moving Target.

To turn my lights off:
When still energy falls below 5% → Turn the lights off. Remember that my reading of the empty room is about 4% and when i am in the room is deffinately above 5% even if i stay completely still. Knowing that, i set the numeric state in my trigger to 5%. That means, that when i exit the room, the still energy will drop below 5% and this will turn the lights off. What is important to understand here, is that setting up the automation like this, it does not look into the still target (because we only used the energy level). So calibrating sensitivity of the still target is not important at this stage. If you would use the Still Target as a trigger then it must be calibrated.

Last thing, the sensor’s energy is changing very fast. There are times that i am in the room but the still energy falls momentaraly below 4% and the lights turn off with me in the room. In order to mitigate that, i set up a delay in the turning off trigger so now it becomes: When the still energy is below 4% for more than 20 seconds → Turn the light off. That filters the fluctuations in the still energy.

During your tests and while setting the sensitivity, it is also good to have the app open on your phone and understand on which gate the energy is fluctuating based on your movements. Example: when i sit on my sofa i have energy on gates 4 and 5. Then i set my sensitivity to those gates to be 5% so it will report presence. This becomes important if you sofa angled and sitting in different places changes the energy of the gates. Same with the moving target. When i enter or exit the room, i get moving energy on gates 7 and 8. Based on that, i set my sensitivity on those gates lower so it will report movement as soon as i reach the door.

I don’t recommend setting the sensitivity to 100% in the gates you don’t need because this will disable these gates and definately you need all of them. You need to think in 3 dimentional perspective. Let me give you an example. When i noticed that when i enter the room i get 70% moving energy on gates 7 and 8, i set the sensitivity on the other gates to 100% so i disabled them. That was stupid because when i was in the middle of the room (gates 3-4) and the lights turned off, i could jump but still the sensor was only looking in the gates 7-8… Keep the sensitivity to about 60-70% and only lower those that you need the sensor to react quickly (when entering the room).

To wrap up, setting up the sensor requires some trial and error but what needs to be tested is the following:

  • Find the best location (sensor has 60 degrees view and needs to see the sofa and the door)
  • After finding the best location, take readings from the sensor in various scenarios especially if you have pets :slight_smile:
  • Set up your automations in a way that it will always work based on the test’s readings. You can use either the target or the energy or combinations of both. You can even use some these as conditions too if you wish.

Apologies for the long post, i tried to do my best in explaining how the sensor works and how i set it up and more importantly why i set it up like this.

Hope this is helpful!

Kind Regards
M

5 Likes

In your print, gate 1 is above the threshold.
What device is that next to the sensor? Camera?
Try turning off that device to see if it is causing interference.

There is a function in the app, where you define a delay in detection, for you to leave the room and the detection time. The app will tell you the minimum, maximum and average readings. Have you tested to configure the thresholds?

price wise it is also comparable to 2410.
Now supported in esphome too

LD2420 24Ghz mmWave Radar Sensor — ESPHome