4

I have been using a HC-SR501 PIR module with my Arduino Mega and it was tracking presence pretty well.

Because of cost constraints, I decided to go with HC-SR505 sensor - bought a bunch of them. The performance is very bad. It almost seems like it is giving random HIGH and LOW values. Out of the 20 odd sensors I bought, may be one or two are fairly ok - others are all behaving weird. Have someone experienced this kind of behavior with HC-SR505?

Are they highly sensitive to noise in the power supply - is there any workaround to mitigate the effect? Help?

Code:

const int buttonPin = 4;    

 void setup() {
  Serial.begin(9600);


   pinMode(buttonPin, INPUT);     
 }
 void loop()
 {
    if (digitalRead(buttonPin) == HIGH) 
    {     

      Serial.println("Presence Detected");
    } 
    else {

      Serial.println("No Presence Detected");
    }

 delay(2000);

 }
2

You asked if anyone else has experienced this behavior, and from the documentation I can find the answer must be yes.

The 505 holds the HIGH output for a certain amount of time. None of the documentation I can find on it specifies the amount of time. So it is very possible that you are operating right near that limit. If their quality control is not perfect, some might work correctly and some might not.

In other words, I believe the problem is that you are not allowing for the built-in time delay in the SR505.

That is the main difference between the 501 and the 505. On the 501 it is adjustable in both sensitivity and time delay. With the 505 those values are preset.

As a workaround, you can try increasing your delay upwards from 2000ms until you find the right value that will work consistently with your batch of them.

The sensitivity cannot be adjusted, either, but this can be an advantage if you are trying to cover a smaller area than you would try with the 501. They both have the same 90-100 degree width of view, but the 505 is made for shorter range like a doorway, as opposed to the 501 which can cover an entire room.

1

According to this wiki: https://www.elecrow.com/wiki/index.php?title=HC-SR505_Mini_PIR_Motion_Sensor, there is an 8 second +/-30% delay.

The sensor is very sensitive to motion. Waving your hand in front of it "as fast as you can" (at close range) will trigger the sensor. While testing the two I had purchased, they had to be pointed away from me or there were "false alarms".

0

I had the same problem of the sensor giving random 1/0 values. I then looked at the circuit closer.

The PINs are badly marked which doesn't tell great detail, PIN-1 is marked with "+", however the word "OUT" is sitting between PINs 2 and 3.

If you connect + to the +5V, and then the middle PIN into the GND and then OUT into your Arduino (say PIN-10 of your Arduino), then you will notice ups and downs that does not correspond to any movements, (i.e. telling you "Bad Sensor")... however:

Part-1 of the solution:

Swapping PINs 2 and 3 of the sensor (i.e. + goes into +5V of Arduino, Ground is PIN-3 of the sensor, and Middle is what you should be reading (i.e. PIN-10 of Arduino)) then this should start to work, but we're not finished yet, you would still get bad results...

Part-2 of the solution:

If you are reading from PIN-10 of Arduino, then on your setup() function would usually be like this:

setup()
{
 pinMode(10, INPUT);
}

This is NOT enough for that sensor!... I know,... should be right?!...

Anyway, you MUST tell that PIN to be ZERO at the start, otherwise, it's hell brake loose... Therefore, please write the PIN with 0 and then it should all work fine after that:

setup()
{
    pinMode(10, INPUT);
    digitalWrite (10, LOW);
}

Following the above does resolve the issue, the sensor worked absolutely fine.

One annoying issue however which I am currently trying to work on is to reduce the sensor delay timer from 8 seconds into just 1-2 seconds, i.e. once someone is in-front of the sensor I don't want it to tell me that the person was there still when he left the area almost 7 seconds ago... I might post another article on how to do this later.

In the mean time, I hope this helps to resolve this problem

Regards Heider

0
0

By shining with a bright light through the PCB, I came up with this reverse-engineered circuit diagram. From my understanding, the IC is some sort of special OP amp. I suppose one can change the timing by adjusting the 154 (150k) resistor and the sensitivity by adjusting the 335 (3.3Meg) and/or the 103 (10k) resistor. enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.