mmWave Presence Detection - ESPHome style

Ok, I’m pulling my hair out! I have a D1 Mini soldered up to the DF Robot board by following the the Everything Smart Home YT video and everything is working perfectly…However, I wanted the ability to turn off the Red Blinking LED light and tried to install the code from this thread and I keep running into a ESPHome roadblock! When I try and upload the code based on the GitHub installation directions I get the following message:

INFO Reading configuration /config/esphome/mmwave01.yaml…
Failed config

esphome: None

Platform missing for core options!.
name: mmwave01
includes:
- leapmmw_sensor.h

My code looks like this:

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "mmWave-Occupancy"
    password: "password"
    
substitutions:
  device_name: mmwave01

  # This will vary based on your board
  uart_tx_pin: GPIO4
  
  # This will vary based on your board
  uart_rx_pin: GPIO5
  
  # This will vary based on your board
  gpio_pin: GPIO16
  
  # (Optional) Path to the leapmmw_sensor.h file relative to your esphome configuration directory.
  header_file: leapmmw_sensor.h

packages:
  remote_package:
    url: https://github.com/hjmcnew/esphome-hs2xx3a-custom-component
    ref: release
    file: packages/leapmmw_sensor.yml
    

and my directory structure inside the ESPHome folder looks like this:
image

Help!!!

The sensors instant reacts but “Presence” is always on even when I’m sure there is no presence. Any one an idea?

Yeah you are missing some required ESPHome options. Check my config below and adapt it to your needs

#mmwave
substitutions:
  devicename: esp32mmwave
  device_name: esp32mmwave
  friendly_name: mmwave
  header_file: leapmmw_sensor.h
  uart_tx_pin: GPIO21
  uart_rx_pin: GPIO22
  gpio_pin: GPIO16

esphome:
  name: $devicename
  platform: ESP32
  board: wemos_d1_mini32

packages:
  remote_package:
    url: https://github.com/hjmcnew/esphome-hs2xx3a-custom-component
    ref: release
    file: packages/leapmmw_sensor.yml

wifi:
  networks:
    - ssid: !secret ssid1
      password: !secret ssid1_password
  domain: .local
  use_address: $devicename.local
  fast_connect: True
  power_save_mode: none
  # Optional manual IP
  manual_ip:
    static_ip: 10.0.10.34
    gateway: 10.0.10.1
    subnet: 255.255.255.0

ota:
  password: "password"

api:
  
logger:
  logs:
    sensor: INFO # reduced logging to minimize web_server target overload..
    
web_server:
  port: 80
  version: 2
  include_internal: true

http_request:
  useragent: esphome/$device_name
  timeout: 2s
1 Like

Thanks! I’ll try this when I get home tonight! (fingers crossed)

Which kind of environment or room that can trouble the sensor ?

That did the trick! Thanks again!

Just wanted to share a quick setup you can do using a protoboard, no need for soldering or messing with cables. The PINS will align perfectly for VCC, GND and the rest (my config is a couple of messages above this one)

3 Likes

@crlogic just wanted to ask if you are willing to help me out with a thing. I’m trying to understand how to read the beam angle specification “100ºx40º”. I’ve prepared an image to see if what I’m thinking is correct.

Also, do you know a way to calculate, based on the distance from the subject. what would be the diameter of the detection zone? (assuming it’s a circle)

1 Like

I don’t know how to do that math. I don’t see why you would, the angle numbers are not laws.

Even if you figured out the math to follow the picture. That’s not what the radar signal will be following. That’s a ‘rough estimate’ from the ODM. And they don’t tell you the details of their testing.

Target RCS, kinesis, angle and distance all impact detection. And that’s ignoring room influence, antenna manufacturing tolerances, etc.

You find out “what a sensor can see” by testing. Because even if you could PhD your way through making an equation for just this sensor, I don’t know how anyone else could use it without learning more fancy RCS, occlusion maths…

Thanks a lot for the reply! I think, as you said, will be a rough estimate but could give an idea between tolerances on how much area the sensor would approximately cover so you can also get an idea on how many and where you would need to position them. My idea is to position them on the ceiling in a 90 degree angle. If I know the angles of the “triangle” and the height (distance from the sensor to the floor for example) I might be able to tell the cover area

If you look at the image, are the angles correct?

2 Likes

Dears,

I have the DFrobot connected to a ESP32 nodemcu-32S working well. But I cant see the entire configuration page in the web server. My webpage is:

But in this thread I see that there is another more complex configurations in order to turn off the led, etc.

Actually I configured the DFRobot with the configuration showed in the video https://www.youtube.com/watch?v=VEqWlOeJ2YA&t=342s, I downloaded the yaml, and only with come modifications for the GPIO pins taht I use. But the wiki speaks about to download a file named “leapmmw_sensor.h” and included the following code in the yaml file:

substitutions:
  device_name: leapmmw

  # This will vary based on your board
  uart_tx_pin: TX
  
  # This will vary based on your board
  uart_rx_pin: RX
  
  # This will vary based on your board
  gpio_pin: D0
  
  # (Optional) Path to the leapmmw_sensor.h file relative to your esphome configuration directory.
  # header_file: leapmmw_sensor.h

packages:
  remote_package:
    url: https://github.com/hjmcnew/esphome-hs2xx3a-custom-component
    ref: release
    files: [packages/uart.yml, packages/leapmmw_sensor.yml]
    # For additional debugging replace the above line with:
    # files: [packages/uart_debug.yml, packages/leapmmw_sensor.yml]

What is the better way to installed in HA the DFRobot?.

And finally, the web page have a section to update the firmware. There are new firmware updates and where we download these updates?.

Thanks,

That code is old.

Follow the GitHub link in the Installation section of the OP and use the instructions noted there.

Only if you build them and install them that way.

1 Like

Thanks crlogic,

Now is working well with all the parameters.

Jose

My first mmwave dfrobot is in the kitchen since months now and working well (except when one of the light is moving from ON to OFF, then mwave detect that as a presence :slight_smile: → this one is a small circle fluo tube - solved in automation)
This sensor is still working with the first yaml file that don’t have all the advance technics found by @crlogic.
I would like here to thank you again to him for the effort and support given to the community.
Without this post, I would even not be aware of that possibility.

My config is simple: all my rooms have at least one Hue motion sensor because those are so great in term of reliability, position, battery life and functionnalities(thanks to include temperature & lux sensor on it which help in many cases.)
With the adding of mmwave sensor, it’s solve the no motion part of the presence but give a bit of challenge in the automation.

Now, I’m planning to install some mmwave again in some rooms. I would like to redesign my first 3D Print (mmWave Presence Detection - ESPHome style - #176 by zigomatic) to a smaller version.

Before starting the new model which will use one esp32 mini, I saw chinese translated information from leapmmw:

“Millimeter wave human presence detection module antenna-shell spacing ≥ 6.2mm (if the shell design principle is not met, please test and verify)”
“Do not cover the millimeter-wave human presence detection module with metal, and the casing should avoid metal materials, metal spray paint, and toner particles, so as not to block electromagnetic waves and make the sensor detection invalid”

In my own language, the translation from chinesse sound different. Do I need to understand that the cover of the sensor antenna part should be placed at more than 6.2mm (which is may be equal to wave curve frequency) ?

I’m going to look into redo the design of Hue motion sensor which use magnet (none of my hue senso are fixed, I’m just use the magnet and the wall metal plate that are on every angle/corner in my house).

Do you know if this magnet will be react into failure ?

Also as extra with the ESP32, there is Bluetooth. On my testing, If I add BT proxy on the actual mmwave yaml version, the esp32 don’t really like to have both running. Someone have already test this ?

Wow, great work! I had the DFRobot sensor laying around from playing with it and an Arduino a few months ago. The ESPHome setup is great!

One thing I was wondering about: The pins from the sensor almost fit the Wemos D1 Mini perfectly, so you could just solder the things together and put them in a tiny box. Saw a few posts in this topic of others doing similar things. But that would connect the IO1 and IO2 ports to the D3 and D4 (GPIO0 and GPIO2), which is an issue for the Wemos because it won’t boot if you pull any of those two ports low.

If I only connect the V, G and TX/RX pins (leaving the IO1 and IO2 disconnected), could I just modify the code to use the UART as input for the binary sensor instead of IO2? Or does that not work?

Use an esp32 mini which have all pins in one line. On Uart, I don’t think that’s a good idea.

Ah that’s also an option. Did you mean the S2 mini or the C3? Or another one? Haven’t found the details on the IO pins for those, because I think the esp32 has a similar thing where some pins need to be set to boot.

I am having a difficult time getting good SNR on mine, but I don’t have any context on what “good” is. standing 3-4 feet directly in front of mine I get ~20ish SNR. standing 3-4 meters away directly in front of it I get single digits or lower.

What are you guys seeing and/or do you know of anything I can check to help improve it?

Single digits are ok.

Improve it how? Radar reflectors :man_shrugging: