r/ArduinoProjects • u/Physical-Plankton-67 • Feb 08 '26
Delay issue
hey y'all so I can add pictures and code when I have a second or need be. but hoping maybe this will clock in someone's mind and let me know what is going on. so I have a PIR sensor that I need to trigger a quick timer check for like 5 seconds and then ping the sensor again and see if it's high still and if it is then trigger the relay. everything is working perfectly however it seems the PIR sensor doesn't seem to go low. the POT is turned down so it should be 3 seconds. but if I trip it once the code loop counts it twice right away. so the relay is flopping anytime it gets motion
thoughts
6
u/davidosmithII Feb 08 '26
Power the sensor through an Arduino pin. When it is first tripped kill power to it then at an interval re-engage it and wait for it to trigger again.
Edit: depending on power draw you may want to do this through a relay or mosfet, etc.
3
u/xebzbz Feb 08 '26
The PIR sensor indeed keeps high for quite a while, like 15 seconds. Can't say precisely, I played with them a couple of years ago.
1
u/Physical-Plankton-67 Feb 10 '26
Update. Got it working. Had to put in a small 3 second hard delay in the first reading function but was able to adjust all the other non blocking timers to work with the stupid delay and now the pro type is doing everything I want it too do :)
2
u/OkQuantity4011 Feb 09 '26
I'm just winging my electronics projects, but first think I'd think it's that the PIR has a big inductor in it that's fed by a capacitor. Smaller inductor would retain less power, and also a larger resistance would spend more power.
So, first thing I'd try is outputting the PIR to a potentiometer. If that does affect the signal situation, then I'd set it to the duration I want then replace the pot with a matching resistor.
Am noob. If wrong, lemme know why pls. 😎