ESPHome and motion sensors

Hi there,
I am trying to place motion sensors (SR501 & AM312) all over my house with ESPHome on NodeMCU integrated with Home Assistant. Each 4 sensors are powered 3,3V and wired from one NodeMCU as the longest distance is about 15 meters.

  • AM312 sensors coverage is too short. I need to walk under the sensor in order to detect activity.
  • Using SR501 seems to work good but the sensors/nodeMCU become unavailable every several minutes for 20-30 seconds.
    Do you guys have any ideas how to solve those issues? I tried to use an external power supply for the sensors, but with same results.

thank you,

Am312 sensors has short coverage and we cant do much about it unlike the SR501, for which the sensitivity can be adjusted.

Secondly to diagnose the issue with nodemcu, please run nodemcu after disconnecting all sensors and see if the problem persists. If it doesnot persists we can rule the cause as either the sensors or the long wires which could be taking more load.

I’ve used generic security system PIR sensors in a couple of places. You’ll need 12V as well as 5/3.3V, but you can fit a Wemos D1 mini in most of them. Very sensitive, e.g.

1 Like

Some PIR tests by Andreas Spiess.

1 Like

Blockquote I’ve used generic security system PIR sensors in a couple of places. You’ll need 12V as well as 5/3.3V

Do you have a wiring diagram to connect these PIR sensors? Most of them are 12v, do you have to use any special circuit to connect to D1 Mini?
(Sorry for resurrecting an old post).

Nope. Nothing more than a 12v supply. No special circuitry. All the standard security PIRs have a voltage free relay contact.

Though they will not work as well with an ESP8266 like the D1 mini without an external pull-up resistor. ESP32s have software enabled pull-up resistors on all the inputs so no extra hardware is required.

Connect one terminal of the PIR relay to ground, the other to the input and enable (or add in hardware) the pull-up resistor (anywhere between 10k and 100k Ohms for an IRL resistor). Set the input to be inverted (the relay is NC, normally closed), and you are done.

Use twisted pair cable for transverse mode noise rejection. Even cat3 2 pair telephone cable works for household distances. Cat5 cable if that is all you have (more expensive).

1 Like

Thanks a lot, some of my cheap motion sensors trigger randomly due to sun light. I am going to try security system motion sensors for those areas

Don’t bother. Every PIR, no matter what the marketing says, no matter if it has fancy dual PIR or Radar as well, all of them false trigger in fast changing strong sunlight.

Oh I see, I am trying an ESPHome setup with one radar and another PIR sensor. Motion is reported only if both the sensors triggered.
Hope is that the radar won’t be triggered with the sunlight and the lights and fans won’t turn on in the day time

These existing HC-SR501 sensors are wired back to an Arduino mega in the closet fair way away. Some of them report motion when unrelated sensors triggers such as door opening. I am going to try your advice to use twisted pair cables too.

what i did to fix that issue, is I used the lens from the sr501 and 3d printed an adapter so it would fit on the am312 and the distance issue was no more.

Not by the sunlight, they are triggered by moving hot air.

Partly solution would be using radar sensor instead of IR one. But then you have other issues with it, like sensing through the wall (not concrete, though), glass… Mine gets triggered when i go to/from cellar and it “sees” me through the window on the stairs. It can trigger if things “fly” in the air during the storm…
Best option would be using combo sensors, like it’s used for burglar alarm. They are not so cheap, though…
Regarding SR501 and power supply: (although it’s old conversation) it will run from 4-5V onwards, it won’t on 3.3V unmodified, because it has 3.3V voltage regulator installed. Running on 3.3V IS possible, but you must remove /bypass that regulator. It’s 3 pin thing, appr.3x5mm in size. (LM1117-3.3)

Not outside.

What do you mean? That moving hot air also triggers radar sensor? I kinda doubt it… radar is triggered when it gets a reflection from an object… right?
I have radar sensor mounted outside (two of them, actually).

Yes that is exactly what I mean. I’ve used them. They false trigger outside due to moving hot air.

Interesting! So it seems that sudden change of air causes different wave reflection and thus triggering sensor. Thanks for that info! I must observe mine a bit more…
Interesting thing is that mine sensors were sold for outdoor use.

There were warnings in the install instructions in the Bosch radar & pir sensor I was using. It probably triggered more often on birds and moving trees though.

Either way I have yet to find an outdoor movement sensor that does not have so many issues with false triggering as to be useless.

Next thing I’m going to try is image recognition.

If you call one (or more) rcwl-0516 your own you can break out one of the analog pins to get some more insights like see the difference between head scratching and jumping: