Low-latency presence sensor: mmWave + PIR using ESPHome

I got a few Panasonic 6ua PIRs in and want to make sure I understand the pinout, as they are not marked.

If it is oriented with the bottom pin down, the left would be ground, and the right 3.3v, right?

I tried hooking it up like that with the bottom pin to GPIO15, and it causes my ESP32 to act oddly. It turns off its LED and causes it to go offline

Recommend referring to the datasheet for the specific model you purchased.

Eg. https://api.pim.na.industrial.panasonic.com/file_stream/main/fileversion/235518
image

The pinout is orientation specific. And depending on how you plan to connect to it, be careful you do not ground-out the Vdd on the PIR.

I should have mentioned I had gone through the datasheet, I just wanted to confirm I was reading it properly. Ends up it was a dud, the other two work fine. Thanks!

This thing is impressive. After two days of tuning the DFrobot, the PIR is out of the box holding presence better than the radar.

There are three settings on the DFRobot that impact presence detection; distance, sensitivity and latency.

What on earth have you been testing in two days to get to the point of a PIR being better!? :crazy_face:

I have three of these PIR’s, they all turn off if you just “stand still right in front of them”.

Something sounds very off based on that statement.

More information on your tuning methodology would be needed to justify the statement that a PIR outperforms a mmwave in static presence including;

  • diagram of mmwave sensor placement and target zone
  • orientation of mmwave sensor
  • distance, sensitivity, latency parameters configured
  • size of target
  • type of target motion used for test
  • angle of target in relation to mmwave sensor perpendicular centerline
  • target_distance/SNR report of just before the mmwave reports no presence in the scenario in question

Actually, there seems to be something off about the location I have the PIR, it never clears there. Is there a way to adjust sensitivity on the PIR itself? I think it is picking up heat from the TV (which is in front of the couch)

To your questions…

  • diagram of mmwave sensor placement and target zone
    (attached)
  • orientation of mmwave sensor
    I have tried antenna lines horizontal, and vertical but I get confusing results. Sometimes it seems like
    vertical antenna lines is giving me horizontal FOV
  • distance, sensitivity, latency parameters configured
    9/9/5
  • size of target
    6’ 185lb
  • type of target motion used for test
    Sitting at desk
  • angle of target in relation to mmwave sensor perpendicular centerline
    45 degree
  • target_distance/SNR report of just before the mmwave reports no presence in the scenario in question
    6.5m/1.8snr

In the attached Position A about 7 feet up seems to be the most reliable. One issue with the room is there is a ceiling fan above the couch which creates some placement limitations. I believe the air from the fan can also cause small movements with some fuzzy pillow and the like.

Currently it is setup in Pos. A with antenna lines going horizontally.

Actually, there seems to be something off about the location I have the PIR, it never clears there. Is there a way to adjust sensitivity on the PIR itself? I think it is picking up heat from the TV (which is in front of the couch)

Scratch that… it seems to be an issue with the USB PSU I was using on that wall to power it. Very strange

Thanks for the detailed reply and excellent diagram. I think this highlights some of the challenges and assumptions that are made that I myself have fallen trap to. Which has driven me to try and expel some of them in the mmWave Wars thread; albeit we aren’t at the stage of providing full test results yet.

Discussing placement location A - based on the diagram is it safe to say that

  • the distance between A and the chair at the desk is approx 6M ?

  • the target (you) is obscured by the desk. Only exposing your upper torso?

And is it fair so summarize that you expect;

  • the mmwave sensor to maintain static presence detection of an obscured target at 6M at 45° off centerline axis?

Without spoiling too much of the mmWave Wars results that are yet to be published I will tell you this much;

  • detection range is reduced at 45° off centerline axis
  • the “sitting at a desk” (aka an obscured target) has far reduced static detection range (below 3M depending on angle and level of movement in testing to date which is incomplete…).

A few thoughts…

Given that the 100x100° version removes two rows of antenna block, I’m going with vertical they don’t make it easy on us…

The challenge I have faced here is that a large target <2M from the sensor doesn’t necessarily obey this. I need a larger room w/ far targets to really confirm.

Given that my working assumption is; you are beyond the range of ultra-small movement detection as 1.8 is a pretty low SNR. Increasing latency is likely the only improvement available here.

That’ll do it.

This would indeed prove a challenge if the goal was for a single sensor to see everywhere and somehow ignore this. Which I don’t see being the case.

Which brings up expectations. What about more than one sensor? While a “mid-wall-placement” will be limited to that ceiling fan, a ceiling placement or “high wall, right at the ceiling, facing down” might be an alternative. And require additional sensors to cover the full room.

Testing Thoughts…

Try placing it in the corner behind the desk. All the way to the top of the wall right at the ceiling, facing 45° down. And then test for a day with the sensor vertical, and another horizonal.

Set a low latency while testing. Observe the SNR on your phone while doing so. The sensor reports “no presence” at roughly the time SNR dips below zero then add the latency duration.

If you can’t maintain presence with a 3sec latency, increasing the latency is a potential means to better report at the end-of-range for a particular application. But setting the latency low is the key in finding this “fringe” area.

For “nearfield standing applications”, a latency <10s is just fine.

For “off-axis sitting”, you may want to try 10-30s latency settings after you have confirmed you are at the fringes of sensor range for the application.

But only increase the latency when you have confirmed in testing w/ a latency of 3s that you are no longer “seen” and don’t go farther than this range. Increasing latency does not improve range.

1 Like

Fantastic information, I really appreciate the time you put into all this.

There is a lot to digest here and some things I will need to investigate to respond to, but here is what I know off the top of my head.

Upper torso behind the desk, with perhaps my feet in view, is all Pos. A gets me at the rear right desk,. However, the black rear left desk has even more issues with losing me, and it is at about 10 degrees.

Another oddity is beyond those desks is a bedroom, and it picks me up in there with the doors closed.

Multiple sensors are always the way to go, I was just hoping to get adequate coverage with just one for cost reasons, as I have many more room to hit after I work out the issues in this one…and these sensors are still backordered

I have come to realize that wall composition and radar behavior is something that is hard to predict. Therefore a sensor with max distance adjustment and suitable placement is the strategy I am going with atm.

“These” as in DFRobot or other sensors? The Ali link in the mmWave thread has availability.

I think I got all the bugs worked out by just putting everything in an enclosure with an adjustable arm. My POC setup lacked fine adjustments, but I was able to nail it with this setup.


I do wish I had got the white PIR sensors now, as I can see guests mistaking this for a blink camera or something

1 Like

Nice work :+1:

Hello, a great project, I also ordered two Panasonic Pir, EKMB1301112K not so many in Stock here in Germany :frowning:
I just wonder how you trigger their automation in terms of daytime brightness? Do they have an extra light sensor that is not listed here? I mean you didnt want to switch on the light at every daytime on a Day

I am experimenting a bit here once with just the SEN0395 and the combo with the Panasonic PIR.

I don’t know what a good scene or automation would look like in HA. I just like short turn off times, so far I can’t do that in the living room with the Hue Motion Sensor without waving my hands a lot. Thanks alot for your help

Galley kitchen, no windows = dark all day.

The ‘turn off’ side of the automation actually changes based on lux, if the stove is on, etc. To leave the stove vent light on if cooking. You can do any number of things with HA.

Not OP, but I handle this with one outside Lux sensor to decide when to activate the lights or not. It works quite well as long as most of your rooms have windows. :slight_smile:

I have a corridor without windows in which we’ve replaced one door to be glass so we wouldn’t have this issue. (Also, the old door was ugly and didn’t close properly…)

Where does uart_read_line_sensor.h come from?

From the ESPHome docs

You are better off using a more up-to-date version of the DFRobot code found here

1 Like

Do you have a picture of the inside?

Nope. Look at the OP and imagine what header cables look like :wink:

@crlogic I am following your mmWave activity for a while and yesterday my SEN0395 module arrived. Thanks to your work the implementation was a charme and everything is working great.
But two questions haven’t been answered yet:

  • In which direction of the sensor the 100°x40° apply?
  • The more important question - Why the use of an PIR is important? I heard a lot of “slow reaction time of the mmWave” etc. and was prepared to combine my already existing PIRs with the new mmWave sensor. But the opposite occured and the mmWave sensor is insanly fast. Especially directing to the door and setting up the distance correctly outperforms the PIR clearly. So i would like to understand, why you (and many other people) add a PIR. There must be something that I am currently overlooking. I have also only had the sensor for 24 hours.

Edit: Is it just the detection of small movements of objects (not humans) which leads to use the PIR as the initial trigger for “presence” in a room? This would compromise the huge advantage of distance tuning for entrance areas.

Is it possible to have the mmw sensor boot up into detected state ?