mmWave Presence Detection - ESPHome style

That doesn’t look right, only one-way comms. Check your RX/TX.

Should show both direction of communication <<< and >>>

Doh!

Yep. That’s done it

Nice, I will try it later. Where do you get distance from?

@crlogic

Hi Crlogic, one proposition for the first post:
use attribute: entity_category: config
for entities created for configuration purpose, this will move those parameters to the correct place in HA.
Example:

  - platform: template
    name: latency
    id: latency
    entity_category: config

for Uart, you can put diagnostic

    name: "uart_target_output"
    id: "uart_target_output"
    optimistic: true
    entity_category: diagnostic 
2 Likes

What was your solution here? Did you have the RX and TX pins the wrong way around? I think I have a similar issue, I can set the latency to whatever and it doesn’t really seem to make much difference i.e. I could set it to 30000 for 30s and the sensor will still happily go from “clear” to “detected” within a 3 second window which is useless. Looking at your post I can see I’m also only getting one way communication with >>> which might be the reason…

RX pin from ESP goes to TX pin on the sensor
TX pin from ESP goes to RX pin on the sensor

Check your code, pin assignment from your ESP and wires

Thanks, that’s good to know. I’ve not got access to the device at the moment but just swapping the pins in the code has given me both directions in the logs <<< and >>> so hopefully it’s obvious it’s fixed when someone heads in the room! I’ve just been randomly changing the distance for days and thinking “why isn’t this working”, how foolish!

:frowning: I cant even get my hands on any of these sensors, out of stock everywhere

Who is doing a bulk order from Taobao? DFRobot ODM → 24GHz 呼吸存在检测:HS2xx3A — 人存在、运动、微动检测 V1.2 文档

For delivery in EU or US ?

Shipping to Canada-land was outrageous :frowning:

1 Like

Has anyone successfully implemented this in a larger room i.e. 25sqm? I’m been trying for weeks now to get this to work well in our living room but I just can’t get it accurate enough to be useful. In the smaller office it’s very accurate but just not the larger room.

I’ve tried every combination of distance and sensitivity (with max 65000 latency set) but I’m not getting accurate results from the whole room, despite the sensor being visible from all parts of the room. It’s either constantly detected or it easily swaps to cleared when we’re sat on the sofa. The max distance is 9m so setting it to 550 distance should reach the other corner of the room leaving me with just sensitivity to tweak… Any tips on getting the perfect balance…?

Don’t use a latency that high. Instead, set it ultra low; less than a second. Then you can “map” the room very quickly to see where it can and cannot detect you.

Your SO will love it when you break out the string and grid the room, dinosaur hunting style :slight_smile:

Since we don’t know the shape/layout of the room, or the sensor placement we can only speculate where it can see. A drawing would help. Remember the specs show 100x40 deg at best. And like any other radio signal, it is weakest at the fringes.

I wouldn’t be surprised if you need two.

1 Like

995 pieces available on Ali… → Millimeter Wave Human Presence Detection Module Stand Still Breathing Micro movement Sleep Detection|Kitchen Islands & Trolleys| - AliExpress

Expensive …
There is this one Hi link 1pcs/Lot 5V HLK LD1115H 24G Human Presence Sensor Micro Motion Detection Ground Connect Radar Module| | - AliExpress with less antenna but nearly 1/3 of the price

1 Like

Yet quite reliable…

…until we have a direct comparison of performance characteristics, all we see is price.

I do like their pictures in that listing though. The static range detection vs sensitivity is great to know. And validate :wink:

A few minor updates to the config. Use more useful configuration parameters; seconds vs milliseconds and meters vs cm

number:
  - platform: template
    name: distance_$shortname
    id: distance_$shortname
    entity_category: config
    min_value: 0.15
    max_value: 9.45
    initial_value: 6
    optimistic: true
    step: 0.15
    restore_value: true
    unit_of_measurement: M
    mode: box
    set_action:
      - switch.turn_off: mmwave_sensor_$shortname
      - delay: 1s
      - uart.write: !lambda
                      std::string range = "setRange 0 " + str_sprintf("%.2f", x);
                      return std::vector<unsigned char>(range.begin(), range.end());
      - delay: 1s
      - uart.write: "saveConfig"
      - delay: 1s
      - switch.turn_on: mmwave_sensor_$shortname 
      - delay: 1s
      
  - platform: template
    name: latency_$shortname
    id: latency_$shortname
    entity_category: config
    min_value: 1
    max_value: 600
    initial_value: 15
    optimistic: true
    step: 1
    restore_value: true
    unit_of_measurement: s
    mode: box
    set_action:
      - switch.turn_off: mmwave_sensor_$shortname
      - delay: 1s
      - uart.write: !lambda
                      std::string setL = "setLatency 0.1 " +str_sprintf("%.0f", x);
                      return std::vector<unsigned char>(setL.begin(), setL.end());
      - delay: 1s
      - uart.write: "saveConfig"
      - delay: 1s
      - switch.turn_on: mmwave_sensor_$shortname  

button:
  - platform: restart
    name: Restart $device_name
    entity_category: diagnostic
  
  - platform: template
    name: getSensitivity_$device_name
    entity_category: diagnostic
    internal: true
    on_press:
    - uart.write: !lambda
                      std::string getS = "getSensitivity";
                      return std::vector<unsigned char>(getS.begin(), getS.end());

  - platform: template
    name: getLatency_$device_name
    entity_category: diagnostic
    internal: true
    on_press:
    - uart.write: !lambda
                      std::string getL = "getLatency";
                      return std::vector<unsigned char>(getL.begin(), getL.end());

  - platform: template
    name: getRange_$device_name
    entity_category: diagnostic
    internal: true
    on_press:
    - uart.write: !lambda
                      std::string getR = "getRange";
                      return std::vector<unsigned char>(getR.begin(), getR.end());
2 Likes

Can you please tell me if you have used Arduino IDE to program your D1 mini, if so please share the code.

Progress…
9C21267A-7C6E-4537-9EA0-68FA963C2BAA

1 Like

How many targets are useful for HA automations…?

(targets are defined as, “major motion sources”. ie. one person waving arms may be >1 target)