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.
(20) Panasonic PIR EKMC1603111, 102°, 12m, 3~6V enter link description here
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.
Appendix B – SB312 Passive Infrared Sensor Module for Home Security System
SB312 Passive Infrared Sensor Module for Home Security System
New Smart PIR Sensor Module with improved digital sensor.
This unit has enhanced delay time adjustments, with an expanded range from 2 seconds to 70 minutes. The unit includes an integral light sensor with adjustable sensitivity, the unit is suitable for outdoor and indoor mounting. Detecting length is also adjustable. The output is a standard TTL output signal, that can be used with a microcontroller or for switching lights, etc.
(B1) PIR Human Motion Module 10*8mm 2S delay time SB00322A-1 – Nanyang Senba Optical And Electronic, China https://www.asmag.com/suppliers/productcontent.aspx?co=senba&id=22978
(B2) SB312 Passive Infrared Sensor Module for Home Security System https://www.senbasensor.com/products/sb312-passive-infrared-sensor-module-2s.html
(B3) SB612 Human Motion Detector for Smart Toys From Senba Manufacturer https://www.senbasensor.com/products/sb612-human-motion-detector-for-smart-toys.html
(B4) SB412 High Sensitivity Digital PIR Modlue for Light Control Lamp https://www.senbasensor.com/products/high-sensitivity-digital-pir-modlue.html
(B5) Senbasensor https://www.senbasensor.com/
(B6) Nanyang Senba Optical And Electronic Co., LtdNanyang Senba Optical And Electronic Co., Ltd https://www.asmag.com/senba.co
Appendix C – AM312 Application Schematic
Appendix D – AM312 Setup
This PIR sensor is “plug and play”. This is no adjustments necessary. Just power and sensor is automatically set up, in two seconds.
Appendix E – HC-SR501 Adjustment Cheat Sheet