PIR Sensor Switch Issues

Hi All, I’m having some issues with the usability of the PIR Sensor Switch user mod. I admit I am green to WLED and user mods. I did the web install first, then did the compile from scratch and have no issues there. Now I’m adding in the PIR. I went through the Github instructions and then noticed at the bottom it said it was built into WLED now so all I needed to do was add the -D USERMOD_PIRxxx into my build enviornment (d1_mini) behind the build flags. Complied and all is good (using the default pin13)

So my issue. I can get the PIR to turn on WLED easily with no issues. However its not reliably switching off after the set time. My main purpose is to have the PIR turn on a preset to a solid color and then switch off. It has never once switch off when its on a solid color. If I switch to an effect in WLED it will usually shut itself off. But not always. I have set up the same PIR in a simple ESPHome sketch and according to the logs it switches on and off as it should. So I don’t believe the sensor is an issue staying on when it shouldn’t be. Its an AM312 sensor. Tested with two different sensors as well.

So I’m wondering if others have seen similar issues or maybe it is something inside the user mod that is conflicting. I’m a little to green to dive into to see, I’m still more of a basic programming level. If anyone has anything else I should be trying I’m all ears.

The only thing I have changed in my platformio.ini is uncommenting my board and adding the -D usermod in the builds below. Is that the correct procedure?

I don’t think you need any user mods for PIR’s any more with build 13.1. Have a look at the buttons section: Macros - WLED Project

Only if using HC-SR501 sensor or similar.
Still many more options are available using usermod.

@schmicj use pre-compiled binaries from @srg74

Thanks. I’m curious as to why the HC-SR501 would act differently than the AM312. They seem to both have a 3.3v output and the esp8266 just sensing a high/low. Just trying to hid the sensor as much as possible.

I’ve heard a little about the srg74 bin files while researching. Where do those reside?

Ok, So as an update to my original issues I was having I believe I have them ironed out and it all came down to…a GPIO. I was using D7 as most do on the Wemos D1 Mini (and what was in the user mod readme) and it didn’t want to work with macros in WLED either. So I moved it to D0 and its been working perfectly sense. I started with a Macro and it was working great although the min timer was 1 minute and I could get the sunrise/sunset to work physically but WLED would still kick on a timer but no lights if the PIR was tripped. So I figured I’d try the user mod again with the new pin maping and it works great and exactly how I wanted to function. I can even set the shutdown timer to less than a min.

Thank you all for the suggestions as it did help me learn more about the macros in WLED and building those out and also to just keep trying.

1 Like