I recently bought an HC-SR505 Mini PIR sensor. I connected its positive to my Arduino UNO's 5v, output to digital pin 2, and ground to ground. I used Adafruit's code to test it, but all the serial monitor displayed was "Motion detected", which meant the PIR was always on a HIGH state. I then also tried powering it using 3V3 but the PIR kept on cycling on a HIGH and LOW state. Any help on getting my sensor to actually work would be greatly appreciated.
5 Answers
The PIR sensor has delay of 8 seconds. So when you turn on arduino, take care that no movement is on the PIR, and then after 8 seconds it should detect no movement. And it has always this delay,every time when detects movement.
-
-
-
The PIR sensor has delay of 8 seconds is not a fact that affects all PIRs.– Dat HaNov 9, 2016 at 22:51
-
1
-
I was struggling on the same issue. Here's the specs also: elecrow.com/wiki/… Thanks for clarrifying it up. To sum it up. The 8 seconds start by the time it last sensed a movement. Apr 21, 2020 at 6:09
The PIR works at 5V but you need to tweak the amount of sensibility and the signal length. Usually when a motion is detected, the PIR keeps sending HIGH until x seconds defined by a potentiometer on the board, when it goes down, the sensor is ready to capture another motion.
-
1Thanks for the explanation. Just want to point out that the HC-SR505 doesn't have a pot on it. Also, do you know if the output voltage is 5v or 3V3?– BrandonJan 31, 2016 at 4:27
Switch to use 5v for Vcc, the sensor will work correctly. I have the same trouble if I use 3.3v for Vcc. The output still 3.3v even your Vcc is higher than 5v.
-
While using 3.3v does sound problematic, if you read the question again you will see that the asker started their experiments with the 5v supply, and found that not to work. So the actual problem must be something else. Oct 15, 2016 at 17:38
-
I tried with another power source, not from the board. In my case I'm using an ESP8266 and to get 5v I need another power source.– ndphuOct 15, 2016 at 17:43
-
You may be using an ESP8266, but the asker is using an Arduino Uno. Oct 15, 2016 at 17:46
-
Let the asker try 5v from another power source, not from Uno. Does it make sense?– ndphuOct 17, 2016 at 6:12
-
Even though this may not help the OP, this was my problem and I am thankful for having found this answer. Jan 10, 2019 at 21:07
I have similar problem with the HC-SR505 sensor. First few seconds it holds 0 on the output pin, and then always 1. I think it was bad batch of sensors. Bad batch in chinese manufacturing means thousands (or hundreds of thousands) bad modules flooded the market.
Meanwhile I decided to choose one of options:
- Stick with HC-SR501 sensor. It's bigger but works more or less.
- Buy expensive ($5.90) PIR sensor from seeed.
- Build my own PIR module by my required dimensions and function (in progress).
Update: From 5 sensors received 2 do the job. Supply voltage must be 5V or higher. First 20-60 seconds the output is not reliable and should be ignored. Then it works OK (if it works at all). Since the module has 3.3V LDO onboard the output signal is 3.3V.
I'm a noob. I had the same problem.
I connected the signal to pin 7 so I listened to gpio7 which always gave 1. But pin 7 is gpio4... Listening to gpio4 fixed the issue :)