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);
}