mmWave Presence Detection - ESPHome style

Oh, I thought they could be connected straight away, are the capacitors needed then? If so I’ll have to wait longer until I can get them (sorry, but I’m a noob on electronics yet)

Based on the emphasis in the datasheet. It sounds like it is a gamble without having the equipment to test the supply of any device in question. Since false positives are horrible to deal with, I went with the safe rather than sorry approach.

It’d be very helpful if you could post a picture when you get it done… I’m not even sure of what capacitors I should get.

I guess it’s time to find a 101 course on this!

Picture of wires going everywhere… …check.

A course would be a good idea. I just bumble through it myself :stuck_out_tongue:

As for capacitors, the diagram shows an electrolytic 220uF @10V and a ceramic 104 which turn out to be a 0.1uF.

I had two 100uF 16V electrolytic on hand and ordered a 104. Hopefully that’s close enough :slight_smile:

Excuse my very basic knowledge of hardware but I’m going to have a go at creating one of these this weekend. I see in your picture you’ve got the logic level converter/shifter, is that necessary as from the mmwave board docs it looks as though it can go direct to the pins on a D1 mini instead?

If someone could let me know why that’s needed it would be much appreciated!

After spending some time reading about what capacitors are and how they work I guess it’d be very similar to have 2 100uF vs 1 220uF (I undestand the 16V doesn’t really matter as the input will be 5V).

If I understood correctly, there’s a need of using a ceramic and a electrolytic to filter the different ranges, right?

I have to find somewhere to buy these things where I leave, amazon wants to sell me a whole box and I think that’s too much for my purpose

It is not needed. I believe that was mentioned early in the thread. I never updated the picture to reflect.

1 Like

I read similar. Waiting on my ceramics from Amazon. I would have ordered from Digikey but as always, didn’t realize until after I ordered the sensor.

@Steveo - whelp… …now that I have a SeedStudio mmwave. It sees through my drywall+2x4 walls with the default sensitivity. This definitely makes it more precarious to position and tune.

Appreciate the custom .h file. Have you taken a stab at the sensitivity settings?

The following is my shot in the dark at interpreting User Manual Section 8.1

Peer review the bytearray below? I have no experience here…

My interpretation of Section 8.1 Fig A

Start Len Len2 Func Add1 Add2 Data Check1 Check2
0x55[1] low[1] high[1] 0x01[1] (read)
0x02[1] (write)
0x04[1] (system params) 0x0C[1] (threshold) 0x01-0x0A[1] crc16_L[256] crc16_H[256]

I am unsure about the correct length per Section 8.1 Bb.

Length = Data Length + Function Code + Address Code 1 + Address Code 2 + Data + Checksum.

Length of 517 = 1 + 1 + 1 + 1 + 1 + 256 + 256

Decimal of 517 is hex of 0x205 ?

Assuming I want the lowest sensitivity of 1 that gives me the following ESPHome yaml,

uart.write: [0x55,0x205,0x02,0x04,0x0C,0x01,$crc16_L,$crc16_H]

Did I get any of that correct?

There’s another thread about this mmWave sensors and they just answered to your question here:

Let us know how’s everything!

I got mine today so I’ll see if I can do something on the weekend with them :slight_smile:

Thanks for the link, I’ll take a look!

Fantastic, fed up of waiting for the FP1 and all the other off the shelf ones have few reviews/equally expensive. I’ll get a DFRobot ordered this afternoon thanks!

With some excellent assistance from @phillip1 I am going to have to echo this post.

The SeeedStudio Human Presence Module tries to be too smart for its own good is not really comparible with the DFRobot.

The DFRobot is adjustable in distance and milliseconds. This means you can be 6" away from it and it won’t trigger if that is what you want. The SeeedStudio on the lowest sensitivity stays “ON” for a three bedroom apartment.

The SeeedStudio stays “ON” for ages when you might think no one is around. The DFRobot can be set to a delay of 25ms increments.

So from a use-case perspective - if you want “movement-based” detection in milliseconds for individual rooms. Get the DFRobot. Combined with a PIR, it makes an excellent motion lighting sensor. Fast and reliable.

If you want to get away with fewer sensors and can live with greater on-to-off latency, get the SeeedStudio.

1 Like

Completely agree! “it tries to be too smart for its own good.”

I would add that when setting the sensitivity to low, the seeed starts failing to pick up non-moving targets.
I personally like setting up the DFRobot one with an output latency of 0s to get more of the underlying data and then process it myself for fantastic results.

I’ve learned that the distance setting is really quite important. What you want for presence detection is high sensitivity in a targeted, generally smaller area such as a room. The DFRobot one lets you do that, and with the Seeed, who knows what you could be detecting 15m away.

You can always get a radar motion detector + the DFRobot (which still has a 9m max range!) to detect through walls.

1 Like

This is an excellent strategy.

@phillip1 In an effort to make tuning the DFRobot easier for the masses, perhaps your CPP skills could look over the following lambdas?

I’ve tried about every “float to string” google search and continue to misunderstand the type errors.

number:
  - platform: template
    name: distance
    id: distance
    min_value: 0
    max_value: 127
    initial_value: 9
    step: 1
    restore_value: true
    unit_of_measurement: 15cm
    set_action:
      - uart.write: "sensorStop"
      - uart.write: !lambda
                        std::string cm = to_string(x)
                        return printf("outputLatency -1 0 %c", cm);
      - uart.write: "saveCfg 0x45670123 0xCDEF89AB 0x956128C6 0xDF54AC89"
      - uart.write: "sensorStart"
      
  - platform: template
    name: latency
    id: latency
    min_value: 0
    max_value: 2000
    initial_value: 200
    step: 1
    restore_value: true
    unit_of_measurement: 25ms
    set_action:
      - uart.write: "sensorStop"
      - uart.write: !lambda
                        std::string ms = to_string(x)
                        return printf("outputLatency -1 0 %c", ms);
      - uart.write: "saveCfg 0x45670123 0xCDEF89AB 0x956128C6 0xDF54AC89"
      - uart.write: "sensorStart"

I have this Zigbee Menselijke Aanwezigheid Sensor Tuya Smart Pir Mmwave Radar Bewegingsmelder Fall Detectie Verlichtingssterkte Monitor App Alarm Dc 12V| | - AliExpress

Worked out of the box with zigbee2Mqtt and seems to work well with presence. There are some sensitivity params as well

My DFRobot arrived today so will be getting that hooked up soon, thanks for all the info in this thread as otherwise I’d be a bit lost on where to start!

Am I right in thinking based on the ESPHome yaml in your OP you’ve wired up the TX (to GPIO18), RX(to GPIO19) AND GPIO(to GPIO23) pin to your board? As without the TX/RX you’re unable to modify certain distance settings? Also the esphome code in the OP your most up to date version of code for this?

Thanks once again!

Oh no… And I bought 3 of them! :frowning:

I will still give it a try this weekend but one of my use cases was to reliably turn on and off the lights of the kitchen faster :frowning:

@crlogic what’s your experience with returns to Digikey?

I have five of these DFRobot now, each wired to suit their deployment with other sensors and different dev boards. So be sure to wire them up and adjust the yaml GPIO to suit your actual deployment.

As for UART, yes that is entirely optional. And yes you are correct that without UART you will be using the stock distance and delay parameters setting per the DFRobot wiki :slight_smile:

I would highly recommend configuring serial as it makes them very versatile.

As for the rest of the yaml - yes it works and works well. If any new developments occur I will be sure to update.

Good luck and have fun!

1 Like

The SeeedStudio or DFRobot?

The DFRobot are excellent for lighting. Especially with a PIR. Sadly the SeeedStudio are not really suitable IMHO. I have never tried to return anything to Digikey - sooo let me know how it goes!

1 Like