mmWave Presence Detection - ESPHome style

i did get this as well.

[20:00:05][I][ota:105]: Boot seems successful, resetting boot loop counter.
[20:00:05][D][esp32.preferences:113]: Saving 1 preferences to flash...
[20:00:05][D][esp32.preferences:142]: Saving 1 preferences to flash: 0 cached, 1 written, 0 failed

Those lines are normal. Missing debug logs, not so much.

I think I figured it out. I changed the install method back to method 1 cuz i figured that I edited the local file and should have it included in the config :slight_smile:

heres the output now:

[20:40:08][D][uart_debug:158]: <<< "+\xFF\x00\xFF\x00\xFF\x00\xFF\x00\xFF\x00\xFF\x00\xFF\x00\xFF\x00\xFF\x00\xFF\x00\x00\x00\xFF\x00\x00\xFF\x00\x00\xFF\x00\xFF\x00\xFF\x00\xFF\x00\x00\xFF\x00\xFF\x00\x00\x00\x00\x00\xFF\x00\xFF\x00\x00\x00\x00\x00\x00\xFF\x00\xFF\x00\x00\x00\xFF\x00\x00\xFF\x00\xFF\x00\x00\x00\xFF\x00\xFF\x00\xFF\x00\xFF\x00\x00\x00\xFF\x00\x00\x00\x00\x00\xFF\x00\xFF\x01\x00\xFF\x00\x00\xFF\x00\xFF\x00\xFF\x00\xFF\x00\xFF\x00\x00\x00\x00\x00\x00\x00\x00\xFF\x00\x00\x00\x00\xFF\x00\xFF\x00\
[20:40:10][D][uart_debug:158]: <<< "\xFF\x00\x00\x00\xFF\x00\x00\xFF\x00\xFF\x00\x00\x00\xFF\x00\x00\xFF\x00\x00\x00\x00\x00\x00\xFF\x00\x00\xFF\x00\x00\xFE\r\xFF\x00\x00\x00\x00\xFF\x00\x00\xFF\x00\x00\x00\x00\x01\xFF\x00\x00\x00\x00\x00\xFF\x00\xFF\x00\x00\x00\x00\xFF\x01\x00\xFF\x00\x00\xFF\x00\xFF\x00\xFF\x00\x00\x00\xFF\x00\x00\x00\x00\x00\xFF\x00\x00\xFE\x00\x00\xFF\x00\xFF\x00\x00\xFF\x00\x00\xFF\x00\x00\x00\x00\x00\xFF\x01\xFF\x00\xFF\x00\x00\x00\x00\x00\x00\xFF\x00\x00\x00\x00\xFF\x00\xFF\x00\x00\x00
[20:40:11][D][uart_debug:158]: <<< "\x00\x00\xFF\x00\xFF\x00\xFF\x00\xFF\x00\x00\x00\x00\x00\x00\x00\x00\x00\xFF\x00\x00\x00\x00\xFF\x00\x00\xFF\x00\x00\xFF\x00\xFF\x00\x00\x00\xFF\x00\xFE\x00\xFF\x00\xFF\x00\x00\xFF\x00\x00\xFE\x00\x00\xFF\x8A)\x00\x00\x00\xFF\x00\x00\x00\x00\xFF\x00\xFF\x00\x00\x00\x00\xFF\x00\x00\x00\x00\xFF\x00\xFF\x00\x00\x00\x00\x00\x00\x00\x00\x00\xFF\x00\x00\xFF\x00\x00\xFF\x00\x00\xFF\x00\xFF\x00\x00\x00\x00\x00\x00\xFF\x00\x00\x00\xFF\x00\x00\x00\x00\x00\x00\x00\x00\xFF\x00\x00\xFF\
[20:40:11][D][switch:017]: 'led' Turning OFF.
[20:40:11][D][switch:017]: 'mmwave_sensor' Turning OFF.
[20:40:11][D][uart_debug:158]: <<< "\xFF\x00\x00\xFF\x00"
[20:40:11][D][switch:037]: 'mmwave_sensor': Sending state OFF
[20:40:11][D][switch:037]: 'led': Sending state OFF
[20:40:11][D][uart_debug:158]: >>> "sensorStop"
[20:40:12][D][uart_debug:158]: <<< "\xFF\x00\xFE\x00\xFF\x00\xFF\x00\x00\xFF\x00\x00\xFF\x00\xFF\x00\xFF\x00\xFF\x00\x00\x00\xFF\x00\x00\xFF\x00\xFF\x00\x00\x00\x00\xFF\x00\x00\xFF\x00\xFF\x00\x00\x00\x00\xFF\x00\x00\x00\x00\xFF\x00\x00\x00\x00\xFF\x00\x00\x00\xFF\x00\x00\xFF\x00\xFF)\x00\x00\x00\x00\xFF\x00\xFF\x00\x00\xFF\x00\xFF\x00\x00\xFF\x00\x00\xFE\x00\xFF\x00\xFF\x00\x00\xFF\x00\x00\x00"
[20:40:12][D][uart_debug:158]: >>> "setLedMode 1 1"
[20:40:14][D][uart_debug:158]: <<< "\x00\x00\xFF\x00\xFF\x00\x00\xFF\x00\xFF\x00\xFF\x00\x00\xFF\x00\x00\xFF\x00\xFF\x00\x00\x00\xFF\x00\x00\x00\xFF\x00\x00\x00\xFF\x00\x00\xFF\x00\xFF\x00\xFF\x00\xFF\x00\xFF\x00\xFE\x00\x00\x00\x00\x00\xFF\x00\xFF\x00\xFF\x00\xFF\x00\x00\x00\x00\x00\x00\xFF\x00\x00\xFF\x00\x00\xFF\x00\x00\xFF\x00\x00\xFF\x00\x00\xFF\x00\x00\x00\xFF\x00\xFF\x00\x00\xFF\x00\x00\x00\xFF\x00"
[20:40:14][D][uart_debug:158]: >>> "getLedMode 1\r"
[20:40:15][D][switch:013]: 'mmwave_sensor' Turning ON.
[20:40:15][D][uart_debug:158]: <<< "\x00\xFF\x00\x00\xFF\x00\xFF\x00\x00\x00\x00\xFF\x00\xFF\x00\xFF\x01\xFF\x00\xFF\x00\x00\x00\x00\x00\x00\x00\xFF\x00\x00\xFF\x00\xFF\x00\xFF\x00\x00\x00\x00\x00\xFF\x00\x00\xFF\x00\x00\xFF\x00\x00\x00\x00\xFF\x00\x00\xFF\x00\xFF\x00\x00\x00\xFF\x00\x00\xFF\x00\xFF\x00\x00\xFE\x00\x00\xFF\x00\x00\x00\xFF\x00\x00\x00\x00\x00\xFF\x00\xFF\x00\x00\xFF\x00\xFF\x00\xFF\x00"
[20:40:15][D][switch:037]: 'mmwave_sensor': Sending state ON
[20:40:15][D][uart_debug:158]: >>> "setUartOutput 1 0"
[20:40:15][D][uart_debug:158]: <<< "\xFF\x01\xFF\x00\xFF\x00\x00\xFF\x00\xFF\x00\xFF\x00\xFF\x00\x00\x00\xFF\x00\xFF\x00\x00\xFF\x00\x00\x00\x00\x00"
[20:40:15][D][uart_debug:158]: >>> "getSensitivity\r"
[20:40:16][D][uart_debug:158]: <<< "\x00\xFF\x00\x00\xFF\x00\xFF\x00\xFF\x00\x00\xFF\x00\x00\x00\x00\xFF\x00\xFF\x00\x00\xFF\x00\x00\x01\xFF\x00\x00\xFE\x00\x00\xFF\x00\x00\xFF\x00\x00\x00\xFF\x00\x00\x00\x00\x00\xFF\x00\x00\xFF\x00\x00\xFF\x00\x00\x00\x00\xFF\x00\x00\x00\x00\xFF\x00\x00"
[20:40:16][D][uart_debug:158]: >>> "setUartOutput 2 1 1 2"
[20:40:17][D][uart_debug:158]: <<< "\xC9 1 1 \x02\x00\x00\x00\x00\xFF\x00\xFF\x00\xFF\x00\xFF\x00\x00\x00\x00\x00\x00\xFF\x00\x00\x00\x00\xFF\x00\xFF\x00\xFF\x00\xFF\x00\x00\xFF\x00\xFF\x00\xFF\x00\x00\x00\xFF\x00\x00\x00\x00\xFE\x00\xEC\x00\xFF\x00\xFF\x00\x00\x00\x00\x00\xFF\x00\xFF\x00\xFF\x00\xFF\x00\x00\x00\x00\x00\x00\x00\x00\xFF\x00\xFF\x00\x00\xFF\x00\xFF\x00\x00\x00\xFF\x00\x00\x00\x00"
[20:40:17][D][uart_debug:158]: >>> "saveConfig"
[20:40:18][D][uart_debug:158]: <<< "\xFF\x00\xFF\x00\xFF\x00\xFE\x00\xFF\x00\xFF\x00\xFF\x00\xFF\x00\x00\x00\x00\x00\x00\x00\x00\xFF\x00\x00\x00\x00\xFF\x00\x00\xFF\x00\xFF\x00\xFF\x00\x00\x00\x00\xFF\x00\x00\x00\x00\x00\x00\xFF\x00\x00\x00\x00\xFF\x00\xFF\x00\xFF\x00\x00\xFF\x00\x00\x00\x00\x00\xFF\x00\x00\xFF\x00\x00\xFF\x00\x00\xFF\x00\x00\x00\x00\xFE\x00\x00\xFF\x00\x00\x00\x00\x00\x00\x00\xFF\x00\x00\x00\xFF\x00\xFF\x00\x00\xFF\x00\xFF\x00\x00\xFF\x00\x00\x00\x00\x00\x00\x00\xFE\x00\xFF\x00\x00\x00\xFF\x
[20:40:20][D][uart_debug:158]: <<< "\xFF\x00\xFF\x00\x00\x00\xFF\x00\x00\xFF\x00\x00\x00\x00\x00\xFF\x00\xFF\x00\x00\x00\x00\x00\x00\x00\x00\x00\xFF\x00\x00\x00\xFF\x00\x00\xFF\x00\x00\xFF\x00\xFF\x00\xFF\x00\x00\xFF\x00\xFF\x00\xFF\x00\x00\x00\xFF\x00\x00\x00\x00\x00\x00\xFF\x00\x00\xFF\x00\xFF\x00\x00\xFF\x00\xFE\x00\xFF\x00\xFF\x00\xFF\x00\xFF\x00\x00\x00\xFF\x00\xFF\x00\x00\x00\x00\xFF\x00\x00\xFF\x00\x00\xFF\x00\x00\xFF\x00\x00\xFF\x00\x00\x00\x00\xFE\x00\xFF\x00\x00"
[20:40:20][D][uart_debug:158]: >>> "sensorStart"
[20:40:22][D][uart_debug:158]: <<< "\x00\x00\xFF\x00\x00\x00\x00\x00\x00\xFF\x00\xFF\x00\xFF\x00\x00\x00\x00\x00\x00\xFF\x00\x00\xFF\x00\x00\x00\x00\xFE\x00\xFE\x00\x00\x00\x00\xFF\x00\x00\xC9\x00\x00\x00\x00\xFF\x00\x00\x00\xFF\x00\xFF\x00\x00\x00\xFF\x00\x00\x00\x00\x00\xFF\x00\x00\xFF\x00\xFF\x00\x00\xFF\x00\xFF\x00\x00\xFF\x00\x00\x00\xFF\x00\x00\xFF\x00\xFF\x00\x00\x00\x00\x00\x00\x00\x00\x00\xFF\x00\x00\x00\x00\xFF\x00\x00\xFF\x00\x00\x00\x00\xFF\x00\xFF\x00\xFF\x00\x00\xFE\x00\xFF\x00\xFF\x00\x00\xFF\x
[20:40:23][D][uart_debug:158]: <<< "\xFF\x00\x00\xFF\x00\xFF\x00\x00\xFF\x00\x00\x00\x00\xFF\x00\x00\x00\x00\x00\xFF\x00\x00\x00\xFF\x00\x00\xFF\x00\x00\x00\x00\x00\x00\xFF\x00\xFF\x00\x00\xFF\x00\x00\x00\x00\xFF\x00\x00\x00\xFF\x00\xFF\x00\xFA\x00\xFF\x00\x00\xFF\x00\x00\x00\xFF\x00\x00\xFF\x00\x00\xFE\x00\x00\x00\x00\x00\x00\x00\xFF\x00\x00\x00\x00\x00\xFF\x00\x00\x00\xFF\x00\x00\x00\xFF\x01\x00\x00\x00\xFF\x00\x00\x00\x00\xFE\x00\x00\xFF\x00\xFF\x00\xFF\x00\x00\xFF\x00\x00\x00\xFF\x00\xFE\x00\xFF\x00\x00\x
[20:40:24][I][ota:105]: Boot seems successful, resetting boot loop counter.
[20:40:24][D][esp32.preferences:113]: Saving 1 preferences to flash...
[20:40:24][D][esp32.preferences:142]: Saving 1 preferences to flash: 0 cached, 1 written, 0 failed
[20:40:25][D][uart_debug:158]: <<< "\xFF\x00\xFF\x00\x00\xFF\x00\xFF\x00\xFF\x00\xFF\x00\xFF\x00\x00\x00\xFE\x00\x00\xFF\x00\xFF\x00\x00\xFF\x00\xFF\x00\x00\x00\xFF\x00\x00\x00\xFF\x00\xFE\x00\xFF\x00\xFF\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xFF\x00\x00\x00\xFF\x00\x00\x00\x00\xFF\x00\xEA\x00\xFF\x00\x00\xFF\x00\x00\x00\x00\xFF\x00\xFF\x00\xFE\x00\xFF\x00\xFF\x00\x00\x00\xFF\x00\x00\x00\x00\x00\x00\x00\xFF\x00\xFF\x00\x00\xFF\x00\xFF\x00\x00\x00\xFF\x00\xFF\x00\x00\x00\x00\x00\x00\x00\x
[20:40:27][D][uart_debug:158]: <<< "\xFF\x00\xFF\x00\xFF\x00\x00\xFF\x00\x00\xFE\x00\x00\x00\x00\x00\xFF\x00\x00\xFF\x00\x00\x00\xFF\x00\x00\x00\x00\x00\xFF\x00\xFF\x00\x00\xFF\x00\x00\xFF\x00\xFF\x00\x00\xFF\x00\x00\xFF\x00\xFF\x00\xFF\x00\x00\xFF\x00\x00\x00\x00\x00\xFF\x00\x00\x00\x00\xFF\x00\x00\x00\xFF\x00\xFF\x00\xFF\x00\x00\xFF\x00\x00\x00\x00\x00\xFF\x00\x00\xFF\x00\xFF\x00\xFF\x00\x00\xF1\x00\xFF\x00\xFF\x00\xFF\x00\x00\xFF\x00\xFF\x00\xFF\x00\x00\x00\x00\x00\x00\x00\xFF\x00\x00\x00\xFF\x00\xFF\x00\x

Comms in both directions?

Yes. But that looks like garbled data. No baud rate changes? Try new wires?

Wow i fiddled with it a little bit and swapped some wires. I have control of the LED and the other adjustable functions!!

[21:16:52][D][switch:013]: 'led' Turning ON.
[21:16:52][D][switch:017]: 'mmwave_sensor' Turning OFF.
[21:16:52][D][switch:037]: 'mmwave_sensor': Sending state OFF
[21:16:52][D][switch:037]: 'led': Sending state ON
[21:16:52][D][uart_debug:158]: >>> "sensorStop"
[21:16:52][D][uart_debug:158]: <<< "sensorStop\r\n"
[21:16:52][D][uart_debug:158]: <<< "Done\r\n"
[21:16:52][D][uart_debug:158]: <<< "leapMMW:/>"
[21:16:53][D][uart_debug:158]: >>> "setLedMode 1 0"
[21:16:53][D][uart_debug:158]: <<< "setLedMode 1 0\r\n"
[21:16:53][D][uart_debug:158]: <<< "Done\r\n"
[21:16:53][D][uart_debug:158]: <<< "leapMMW:/>"
[21:16:54][D][uart_debug:158]: >>> "getLedMode 1\r"
[21:16:54][D][uart_debug:158]: <<< "getLedMode 1\r\n"
[21:16:54][D][uart_debug:158]: <<< "Response 1 0\r\n"
[21:16:54][D][uart_debug:158]: <<< "Done\r\n"
[21:16:54][D][uart_debug:158]: <<< "leapMMW:/>"
[21:16:55][D][switch:013]: 'mmwave_sensor' Turning ON.
[21:16:55][D][switch:037]: 'mmwave_sensor': Sending state ON
[21:16:55][D][uart_debug:158]: >>> "setUartOutput 1 0"
[21:16:55][D][uart_debug:158]: <<< "setUartOutput 1 0\r\n"
[21:16:55][D][uart_debug:158]: <<< "Done\r\n"
[21:16:55][D][uart_debug:158]: <<< "leapMMW:/>"
[21:16:56][D][uart_debug:158]: >>> "setUartOutput 2 1 1 2"
[21:16:56][D][uart_debug:158]: <<< "setUartOutput 2 1 1 2\r\n"
[21:16:56][D][uart_debug:158]: <<< "Done\r\n"
[21:16:56][D][uart_debug:158]: <<< "leapMMW:/>"
[21:16:56][D][uart_debug:158]: >>> "getLatency\r"
[21:16:56][D][uart_debug:158]: <<< "getLatency\r\n"
[21:16:56][D][number:012]: 'latency': Sending state 1.000000
[21:16:56][D][uart_debug:158]: <<< "Response 0.100 1.000\r\n"
[21:16:56][D][uart_debug:158]: <<< "Done\r\n"
[21:16:56][D][uart_debug:158]: <<< "leapMMW:/>"
[21:16:57][D][uart_debug:158]: >>> "saveConfig"
[21:16:57][D][uart_debug:158]: >>> "getRange\r"
[21:16:57][D][uart_debug:158]: <<< "saveConfig\r\n"
[21:16:57][D][uart_debug:158]: <<< "save cfg complete\r\n"
[21:16:57][D][uart_debug:158]: <<< "Done\r\n"
[21:16:57][D][uart_debug:158]: <<< "leapMMW:/>"
[21:17:00][D][uart_debug:158]: >>> "sensorStart"
[21:17:00][D][uart_debug:158]: <<< "sensorStart\r\n"
[21:17:00][D][uart_debug:158]: <<< "Done\r\n"
[21:17:00][D][uart_debug:158]: <<< "leapMMW:/>"

Thanks so much for your expertise. Faulty wiring jeez!

I have a question though about the install methods. If I choose the remote packages option does that mean my config files stay most up to date with your changes? I assume with a local file usage i will have to periodically download from the repo?

Again…thank you so much for your time

Nice work. You got it :slightly_smiling_face:

Great thread going on here. I got a few dfrobots going fairly easily and am now just brainstorming ways to block out interference.

Most rooms have ceiling fans which is an issue if the device is not placed just right. I would think a visor of some kind in an enclosure could block off the upper half of the FOV to resolve that, has anyone played around with that? Are there materials to stay away from?

Rotate and tilt down? Tilting does work at distance.

If the fan is >2M from the sensor this may work as the advertised * Angle: 100°×40°@6dB. I do know that this angle does not hold true for motion very close to the sensor.

Likewise perhaps the HS2643A part is a better fit advertising *Angle: 60°×40°@6dB. Mine hasn’t arrive yet to determine actual detection ranges/angles.

I have always stuck with “placement first” as the primary tuning step. Also the most inconvenient!

Lastly metal does interfere. Stick a baking tray on top :stuck_out_tongue: someone used tinfoil on the FP1, haven’t tested it myself

Thank you @hjmcnew for the latest release

This is an awesome project and really well put together. I have a question though, everything seems to be working properly but the mmwave_presence_detection never changes from clear, even though he num_targets fluctuates as expected. Should mmwave_presence_detection change once num_targets is greater than 0? Or is mmwave_presence_detection entirely separate?

Also am I missing where Distance, Latency, Sensitivity and Safe Mode are explained?

num_targets is parsed from serial output. Detection is from the sensor IO2 high.

Nope :sweat_smile:

MMWave not showing in HA?
I am just starting with the DFRobot mmwave and your thread is really helpful. I have created a basic setup using ESPHome in HA. The logs seem to run OK and I can see presence is detected but I have a couple of issues. The main one is that the device simply does not show in HA devices/integrations. My ESPHome devices are normally discovered automatically. Am I missing something? Also the logs show a ‘latency’ state of 0.00000 and I get a warning (yellow text) of Socket Operation Fails (See screenshot)

Any suggestions as to where I might be going wrong?

Disconnect the sensor. Confirm same issues. Post a support thread in the ESPHome category as these are not related to the sensor. mDNS / router issues I suspect.

This is curious considering the other values are picked up. Did you try changing the value? Give it 3-4 seconds between further changes. The sensor needs considerable time between configuration commands.

Thanks for your suggestions. I’ll run some more tests as you suggest.

If latency doesn’t show up after making a value change (refreshes every 60sec). You can try a reboot (also refreshes on boot).

Enabling UART debugging is the next step.

All sorted! As is all too common in my world, it was down to (my) human error :frowning:
Thank you for pointing me in the right direction

Red LED blinking once per second!

Grrrr.

I have built a combo of a D1-mini and a SEN0395 and loaded a simple ESPHome code on it.

And a red LED is blinking once per second. First I thought it was ESPHome signalling a warning condition as it is documented. I tried to change everything in the ESPHome yaml. Then suddenly it struk me that the LED was red. But the LED on the D1-mini is blue. I had been chasing the wrong thing. ESPHome was happy and working as it should. It is the little SEN0395 that seems to be flashing when it is communicating.

Solution: Soldering iron! LED gone, problem solved! I thought I would share that experience with anyone going through similar project.

1 Like

New problems created. Now you have no visual indicator when the sensor is in config mode or not. Because the LED behaves differently in config mode and we get enough posts here about “it doesn’t work” that the LED is valuable.

Soldering iron was a workaround months ago, lol.

AliExpress seller linked in OP came in clutch and the final variant sensor of the LeapMMW series has been delivered.

Initial testing in place of the “DFRobot” version (100x40°) shows that the HS2643A (60×40°) performs better at range for a narrow hallway. Perfect. I suspect the “wider” view of the OG sensor creates reflections/occlusions down the hall that limits its range.

Hey, did you ever upload this to thingiverse? I’d like to assemble mine into a smaller case and would save me having to design one!