Low-latency presence sensor: mmWave + PIR using ESPHome

Technically it is a camera, albeit a very very low resolution thermal one :wink: Yeah, the big advantage of the mmWave sensor is that you can hide it really well. Besides the creep-factor in bathrooms and similar, thatā€™s also an aesthetical advantage in general.

Good thing you sent the memo!

2Q==

Appreciate the background :slight_smile:

Ok so I have a prototype working, initially it runs fine, but after a couple of hours I experience lights turning on and off every few minutes. This seems worse when weā€™re around. The mmWave triggers even with the bathroom door closed, en sometimes even when I close the door to the hallway (appr 1.5m apart). My guess is that the radar can see through the doors (not very solid doors), or underneath the sloth of both doors. The strange thing is that lights turn on (so mmwave_pir_combined turns on) even if the PIR itself is not triggered.
But I must admit Iā€™m using it temporary over WiFi (since I have no network in the bathroom), and itā€™s a very early prototype so longer wires and no shielding whatsoever.
But letā€™s start with the basics: do you have any schematics on how to wire everything? I could not find that in your post, and although Iā€™m no newbie to electronics I could have missed something. And Iā€™m very curious how you hooked the PIR up to the board, did you use shielded cable? Do you (or anyone else) have any pictures of the finished product?
Thanks!

I believe I have since changed the lambda for similar reasons and eliminated this. I suspected that ESPHome didnā€™t like the if statements without an else.

Wonā€™t be home till Monday for wiring and pics. But I think I can perhaps copy/paste the code from my phone.

[edit] - here is what I did for the lambda

  - platform: template
    name: mmwave_pir_combined
    id: mmwave_pir_combined
    device_class: motion
    # internal: true
    filters:
      - delayed_off: 2s
    lambda: |-
      if ( ( id(mmwave_detection_lower).state or id(mmwave_detection_upper).state ) and id(pir_detection).state) {
        return true;
      } 
      else if (id(mmwave_detection_lower).state == 0 and id(mmwave_detection_upper).state == 0 and id(pir_detection).state == 0) {
        return false;
      } 
      else {
        return id(mmwave_pir_combined).state;
      }

Great! First tests look very promising, will test a little more.
So itā€™s no flapping or bouncing or transient noise, I was afraid that was part of the problem but just wouldnā€™t show up in the debug logging or status in Home Assistant.
Since I now know I can trust the PIR sensor and itā€™s logging I was able to determine that itā€™s not only the radar waves traveling underneath or through the door that triggers mmWave detection sensors, but also opening or closing a door somewhere else in the house. This probably causes the door to slightly tremble, thus causing a detection.
Man these sensors are really sensitive! These would not work well in my home without using the PIR for initial detection.

The lack of logging was indeed interesting. I wonder if there are some rules for lamdas that are not well known?

In many places I absolutely agree. Thatā€™s the beauty of them, and their curse. When my kitty curls up in a ball, it can trick it sometimes :wink:

So the way to break into your house undetected by your mmWave sensors is to curl up into a ball. Perfect. Takes notes

1 Like

Deploys lasersā€¦ :stuck_out_tongue:

that draw.io link lead to blank project.

I bought this one ages ago, but didnā€™t get to it because I moved house. Good reminder that I should start testing it out :wink: Iā€™m hoping itā€™ll be able to get me some very basic ā€˜humanā€™ detection, though that possibly would require machine learning (and that would be slow).

Iā€™m unsure what such a low resolution will bring of course, but demoā€™s I saw looked very impressive. This video by adafruit shows them using it, but it is clearly interpolated (the screen has way more pixels):

How does the sensor looks like?

Any photos of the device and placement? Its working well? I was thinking to make some devices to install in bathrooms and hallways.

1 Like

Works excellent. Has completely eliminated any lag in lights triggering and standing-still presence is a strength of the DFRobot sensor.

I did end up trying an EMKC and found it fractionally faster than the EMKB series. As a wired device the added power consumption isnā€™t a concern.

No pics, itā€™s full production-mode deployment and the case requires wall removal to disassemble.

Itā€™s placed in a wall near the ceiling? Can you show some photos of the placements?

This works independently from the HA, right? If HA fail the device with ESPHOME will still works?

I was thinking, for an hallway case maybe just a PIR will do the job, because itā€™s rare to stand still.

Another thing, a vaccum robot moving around the house will also trigger the lights. Will be a good ideia to add some logic to not trigger the lights when we are not at home and the vaccum robot is working.

I do the same. Just a PIR in hallways.

Seems easy enough to achieve. Or just donā€™t point it at the floor :wink: Have cats, avoid ceiling placement.

Remind me next week and Iā€™ll get an exterior photo.

Yes, it continues to work independently of HA; eg, have tested when HA is rebootingā€¦

1 Like

The latest mmWave project has been postedā€¦

2 Likes

Hi. Have you had the chance to take some photo? :slight_smile:

Right!

3 Likes