2

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 !

Thank you

Image if my connections the code

6
  • 1
    code * (not "Image if my connections", I wrote too fast sorry) Commented Jun 1, 2020 at 2:43
  • raspberrypi.stackexchange.com/questions/98371/…
    – tlfong01
    Commented Jun 1, 2020 at 2:50
  • 3
    DO NOT post pictures - post text! Without details of WHAT you have used and how it is CONNECTED the Question is meaningless.
    – Milliways
    Commented Jun 1, 2020 at 4:47
  • 1
    ok I've made another post with the connections and the written code. I really need help ! Commented Jun 1, 2020 at 6:14
  • 1
    But you can edit your old question here, instead of posting another new question confusing readers. Perhaps you can copy the photo there and pasted it here. By the way, the most important guy, the sensor, is not completely shown there. Is it a HC-SR501?
    – tlfong01
    Commented Jun 1, 2020 at 7:02

1 Answer 1

2

Question

How come all my three PIRs are always on?

pir 1


Answer

Because all of them are bad guys.

pir 2


Try the smallest guys below. They are very good.

pir 3


You might like to show your PIR and a schematic, like below.

am312 pir 1


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.

am312 pir 2


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.


References

(1) Introduction to HC-SR501 A complete step by step tutorial on Introduction to HC-SR501

(2) TaoBao HC-SR501 PIR Sensor Module - ¥3.23

(3) TaoBao DC 12V Water Proof Smart PIR Sensor Module With Switch - ¥12.80

(4) TaoBao AM312 PIR Sensor ¥5.28

(5) AliExpress AM312 DC 2.7 to 12V Mini IR Pyroelectric Infrared PIR Motion Human Sensor Automatic Detector Module - US$1.29

(6) Pyroelectric Infrared Radial Sensor AM312 (DSP, Schmidtt) Manual - NanYang SenBa

(7) PIR Sensor Description and Technical Details - AdaFruit

(8) PIR Sensor Tutorial - AdaFruit

(9) PIR Human Motion Module 10*8mm 2S delay time SB00322A-1 - Nanyang Senba Optical And Electronic, China

(10) SB312 Passive Infrared Sensor Module for Home Security System

(11) SB612 Human Motion Detector for Smart Toys From Senba Manufacturer

(12) SB412 High Sensitivity Digital PIR Modlue for Light Control Lamp

(13) Senbasensor

(14) Nanyang Senba Optical And Electronic Co., LtdNanyang Senba Optical And Electronic Co., Ltd

(15) How to use HC-SR501 PIR Motion Sensor with Arduino - Benne de Bakker, Maker Guides 2020Jan

(16) HC-SR501 PIR Motion Detect Producat Description

(17) BISS0001 Micro Power PIR Motion Detector IC Datasheet

(18) IR Parts Manual RE200B FL65 S211FL - GloLab

(19) Amazon Panasonic Plastic Pir Sensor (EKMC1603111, 3V~6VDC power, 12m detection range, digital output) - HK$110

(20) Panasonic PIR EKMC1603111, 102°, 12m, 3~6V enter link description here

(22) HX711 Weigh Scale 1/3

(23) HX711 Weigh Scale 2/3

(24) HX711 Weigh Scale 3/3

(25) Motion - Wikipedia

(26) MotionEye

(27) AlliExpress KonLen PIR motion detector 12V, 110 degrees Detection angle - US$10~40

(28) KeyStone KTS-PIR1-12V-AUX SMART PORT LED PASSIVE INFRARED (PIR) OCCUPANCY SENSOR (0~10V, 20mA Output) - US$30


Appendices

Appendix A - Pyroelectric Infrared Radial Sensor AM312 Specification

  1. Working voltage: DC 2.7-12V;

  2. Delay time: 2 seconds;

  3. Blocking time: 2 seconds;

  4. Triggering method: repeatable

  5. Sensing range: ≤ 100 degrees cone angle, 3-5 meters; (according to the specific lens)

  6. Operating temperature: -20 - +60 °

Features

  1. Anti-interference enhancement, the internal use of digital signal processing, direct high-low output.

  2. 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.


am312 pir 1

am312 pir 2


Appendix B - SB312 Passive Infrared Sensor Module for Home Security System

Update 2020jun02hkt0954

SB312

SB312 Passive Infrared Sensor Module for Home Security System

Overview

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.

References

(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

am312 app cct


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.

AM312 setup


Appendix E - HC-SR501 Adjustment Cheat Sheet

HC-SR501 Adjustment Cheat Sheet

27
  • 1
    Thank you very much for answering me ! I'll try the AM312 sensor ! Commented Jun 1, 2020 at 12:39
  • @Menelik Nouvellon. You are welcome. By the way, my PIR knowledge is a bit out of date. So just now I had a quick google to catch up, as summarized in Appendix B. Please feel free to ask me any newbie questions.
    – tlfong01
    Commented Jun 2, 2020 at 2:01
  • @Menelik Nouvellon, The HS-SR501 always returns High for at least two reasons: (1) They are knockoffs or reject grade pieces, (2) the impatient newbies don't bother to read the friendly user guide and therefore does not set the sensors properly, (say, impatient to wait for 1 minute to let sensor settle down after powering up, turn the adj know blindly, without knowing what they are doing, etc, etc. So if you are waiting for your new toys to arrive, perhaps you can read the manual and patiently try your luck again. References 15~18 are your friends. Good luck. Cheers.
    – tlfong01
    Commented Jun 2, 2020 at 3:02
  • 1
    And is it possible to change the block time ? Commented Jun 7, 2020 at 3:38
  • 1
    No, i'm doing this for me. It's supposed to be a camera that starts filming when an animal (for me it's a reptile) is passing in front of it (that's where the motion sensor is useful). I bought an AM312 motion sensor and it worked better than the HC-SR501. The first sensor I had was good but too much false positives and the second one is not very sensitive (both are AM312 motion sensor). Thank you Commented Jun 15, 2020 at 15:17

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