I’m trying to use a motion sensor with the Raspberry Pi but despite all the tutorials I followed, the input of the raspberry pi is always high.
Here is my code below. I used a LED to turn it on when movement is detected but I didn’t insert the code to do it yet. I’m trying first to make the motion sensor work.
I thought it was the sensors that didn’t work but I have tried with 3 different sensors so it might not be this. I checked all the connection too so it’s not the connection. The Raspberry Pi works fine with other projects so it’s not the Raspberry Pi. I don’t how to solve this. I spent almost 3 days trying to make it work.
Someone help me !
How come all my three PIRs are always on?
Because all of them are bad guys.
Try the smallest guys below. They are very good.
You might like to show your PIR and a schematic, like below.
You might also like to study the datasheet and make a summary for troubleshooting reference.
More details are in Appendix A. You need to know more details when testing and troubleshooting.
You might notice that the datasheet does not give the output voltage values for motion detect and motion not detected. What are given are current values IOH, IOL +-10mA, and corresponding VOH, VOL values (Yes, you need a have a basic idea of IOH, IOL, VOH, VOL). The reason is that PIRs are often placed far far away from Rpi, so outputting currents through a long wire, perhaps 20 meters, and causes a DC voltage drop across a resistance (Note 1) near the Rpi is the usual trick for the PIR application.
If you don’t have installed this current sensing resistor, you might have fake positives, I mean High signal, for ever.
I forgot to tell you how to check out the always High PIRs are bad guys. The trick is to use a rice bowl to cover up the bad guy. If the bad guy still says something is moving, of course he is lying.
Appendix A – Pyroelectric Infrared Radial Sensor AM312 Specification
- Working voltage: DC 2.7-12V;
- Delay time: 2 seconds;
- Blocking time: 2 seconds;
- Triggering method: repeatable
- Sensing range: ≤ 100 degrees cone angle, 3-5 meters; (according to the specific lens)
- Operating temperature: -20 – +60 °
- Anti-interference enhancement, the internal use of digital signal processing, direct high-low output.
- Repeatable triggering mode: If a cat moves in the sensing range during the delay period, and output is high, output will remain high until delay time after the cast has left, ie, the sensing module will automatically delay after detecting an activity of the cat, with the time of the last activity as the starting point of the delay time.