The circuit for this, shows the PIR unit connected to 3.3v, which I did. When I ran the program I received constant false movement detection. I looked at the information for the PIR modules on Banggood.com and noted that the operations voltage range is 4.5V to 20V, so the 3.3 volts shown in your drawing is out of range. I connected the power for the PIR to VIN (5V) and all is working very well
Thanks for bringing that up, but are you using the Mini HC-SR505 PIR Motion Sensor? Or the normal size PIR sensor HC-SR501?
Hi Rui,
I am using the normal size PIR HC-SR501 that I have had for some time but have not used. My version only has one set of three pins, for VCC, GND and OUT, where as the one shown in your reference above has two sets of three pins one that has a jumper across two of the pins. I guess that I will have to get a new version, which would you recommend?
Regards
John
You are right. The PIR HC-SR501 that you’re using operates at 5V (by the way you can make it work at 3.3V, if you follow this tutorial: Modifying Cheap PIR Motion Sensor to Work at 3.3V).
In the course, I’m using the Mini HC-SR505 PIR Motion sensor that operates at 3.3V, so that’s why my sensor is connected to 3.3V. The sensor used in the course also only has 3 pins (VCC OUT GND). You can keep using the PIR HC-SR501 sensor, there’s not need to upgrade, but if you want a smaller sensor I recommend the Mini HC-SR505 PIR Motion Sensor. I also think this mini sensor is more reliable.
I hope that helps!
Thanks again Rui, I have made the modification as per your tutorial, and HC-SR501 is now working at 3.3V. I have also ordered some HC-SR505 for comparison.
Regards
John
My PIR (using SR505 Mini Sensor) Interrupt sketch seems to generate an interrupt (“motion detected”message) consistently every 7 sec. whether there is motion or not. The serial monitor almost never prints a “Motion Stopped” message. I’ve covered the PIC with Aluminum foil and get the same readings.I have tested the SR505 using just a battery (3.6V) and LED. Motion will activate the LED for about 10 sec and then turn off. I am using a Node MCU 36 Pin esp32 Board. The PIR is connected to pin 12 and the LED to pin27
If you remove your PIR motion sensor from the ESP32 pin and you connect that pin to GND, does the interrupt still keep triggering?
The interrupt does not trigger. The serial monitor prints “motion stopped”. I am guessing this indicates a faulty signal from the PIR and that the ESP32 is OK. I would have thought my test of the PIR with just batteries ( 3.6v – I have the PIR connected to the VIN 3.3 v port) and an LED ruled out a faulty PIR. So now I am anticipating learning what your test indicates.
Exactly, it sounds like the code is running OK and the ESP32 is also OK. It can be noise wireless noise that is causing those false positives to trigger the PIR or a faulty sensor… If you could test with another PIR sensor that would help us debug that problem (it can be the normal sized PIR sensor powered at 5V).