Custom sensor using NodeMCU and RCWL-0516 [Solved]

Wouldn’t a pir solve the problem?

Yes HC-SR501 is a PIR sensor. In the comments section of few of the DIY tutorials for motion sensors, folks mentioned that combing HC-SR501 with RCWL-0156 gives much more reliable performance so was curious.

PS: here is a good video on both the sensor types and does a decent job of explaining the pros/cons - RCWL-0516 Microwave & HC-SR501 PIR Motion sensors | Tutorial with ESP32 and LoRa Project - YouTube

Sorry I was confusing with hc-sr04 which is an ultrasonic distance sensor

Thanks @nickrout & @exxamalte both PIR (HC-SR501) and RCWL-0516 are working like a charm for me now :sunglasses:

1 Like

Do you have a diagram of your connections? Maybe a picture of your device to see how you connected the capacitor and resistor? Thank you!

I did find some schematics, I am posting them here in case someone needs them.

I found them at: RCWL-0516 Microwave Motion Sensor - Let's Control It

1 Like

Sure, here you go:

5 Likes

Most boards (NodeMCU, D1 etc) have built-in pull up resistors and all you have to do is activate it - one less thing to solder!

Here is how I have done it using ESPHome:

binary_sensor:
  - platform: status
    name: ${name_of_board} Status
  - platform: gpio
    pin: 
      number: D2
      mode: INPUT_PULLUP
    name: ${name_of_board} Doppler
    id: doppler
    internal: true
    device_class: motion
  - platform: gpio
    pin: 
      number: D4
      mode: INPUT_PULLUP 
    name: ${name_of_board} PIR
    device_class: motion
    id: PIR

In the above code " mode: INPUT_PULLUP" would do the trick.

5 Likes

I’ve just set one of these up as an experiment. The problem in having is that it never seems to register as off. Even tucked away somewhere or if site.

1 Like

Put it in a metal box to test?

Or stick w/ the DFRobot. Which seems to have spoiled our expectations because it works so well :wink:

2 Likes

Yeah, the DFRobot one is definitely better. But I got 5 of these for £4.99 so it would be a shame to waste an opportunity to play!

I think it is actually working. It’s just even more sensitive

1 Like

Same here!! Just ordered 5 of them to play…

Andyjacobs you are always one step ahead of me, Nspanel you were there before me, now this… I’m going to start following you!!!

Can’t wait to receive them and see if it’s true that they detect movement even though walls :star_struck:

1 Like

Hello, it’s my first time sharing here
I am in the rcwl-0516 radar sensor project, I was able to make it work, I integrated it into esphome, however, home assistant does not recognize the entity, only the device

We might be able to help if you share the ESPHome device’s configuration. If the entity does work in ESPHome but not in Home Assistant, then it either isn’t correctly set up as a binary sensor in ESPHome, or you accidentally set the sensor as internal which prevents it to manifest itself in Home Assistant.

Hi, I have ordered 5 of these sensors. I am using a D1 mini and the RCWL sensor. I have soldered a 10 KOhm resistor between the sensor output and GND and have also included the 1 mF capacitor between the Vin and Gnd of the sensor. I am able to see my sensor in my Home Assistant, however, it shows “DETECTED” all the time. I have left it a day with an aluminum foil cover to see if it goes from “DETECTED” to “CLEAR” state, however, it does not change. The only difference I have with your diagram is that I am connecting the sensor output to my D1 pin. My code is as follows:

type or paste code here

esphome:
  name: presence-sensor-1

esp8266:
  board: esp01_1m

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:
  password: "6be121c9fbc94c61d241c78c81d9cc48"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Presence-Sensor-1"
    password: "MwpiaTWoFAFo"

captive_portal:
binary_sensor:
  - platform: gpio
    pin: 1
    name: "Kitchen Sensor"
    device_class: motion
    #filters:
      #- delayed_on_off: 4000ms

Ah, I found the problem. The GPIO pinout is different. I did not realize that the pinout for D1 is GPIO5… I replaced the pin:1 to pin:5 and it worked fine!!! I hope my mistake can help others that might be having the same issue.

1 Like

pin: D1 would work just as fine, FYI.

The weird thing is that it did not allow me to put D1. But anyways :slight_smile: it is working now.

This is a working configuration for me for over one year now:

binary_sensor:
  - platform: gpio
    pin: 
      number: D2
      mode: INPUT_PULLUP
    name: ${name_of_board} Doppler
    id: doppler
    device_class: motion
  - platform: gpio
    pin: 
      number: D4
      mode: INPUT_PULLUP
    name: ${name_of_board} PIR
    device_class: motion
    id: PIR

Also notice that you do NOT need to put a pull up resistor as D1-Mini board has a built in resistor which can be activated as shown above. Since you are not running a load like say a motor, not sure if balance capacitor is needed for a doppler/PIR motion sensor.

3 Likes

Hi All

I also have a problem, I connected the radar to nodemcu and the detection range is very short

Hi,

Just tested it. It does work, but the range is a few centimeters.
Any ideas?

Thanks.