I have setup my raspberry pi and have inserted the correct wires to the motion sensor, i am currently running a a simple script that detects motion however it constantly outputs that it motion is detected although i have no interacted with the sensor. I am unsure as to what i should do as ive tried numerous things. enter image description here

here is the script also:

from gpiozero import MotionSensor
import time

print ("Ready")
pir = MotionSensor(4)
while True:
    if pir.motion_detected:
        print("Motion detected")
  • what is the purpose of the picture? ... please draw a diagram of the connections between the sensor and the RPi
    – jsotola
    Apr 26, 2021 at 22:32
  • It's possible the wiring is bad, especially ground. I find that these types of jumper wire are not reliable.
    – Aloha
    May 11, 2021 at 19:09

2 Answers 2


That is not a motion sensor. It is a heat detector. If it sees a change in infra-red (heat) it raises an alarm.

As long as you are 'seen' by the sensor it will raise an alarm.

  • 1
    As you said, if it sees a change in IR it will trigger the output. If a warm object is stationery then the sensor sees no change and does not raise an alarm. So, it is a motion sensor if it is a warm object that is in motion. Apr 26, 2021 at 21:23
  • 1
    Yes it is a motion sensor, here is the link of the purchase - thepihut.com/products/…
    – Kazi Ilyas
    Apr 26, 2021 at 23:54


How come my PIR motion sensor output is always High, falsely detecting something moving?

pir 2


pir sensors

  1. Your photo is very nice.

  2. I see the PIR motion sensor in the bottom right corner.

  3. You motion sensor HC-SR502 (Ref 3) is very popular, but usually not very stable.

  4. I would recommend to use a good sensor AM302.

  5. You might like to read my PIR answer (Ref 1), for more details on:

    a. How to prove that the PIR is unstable.

    b. Which stable PIR sensor to use.


(1) Why is HC-SR501 PIR motion Sensor always on? Asked 2020, Viewed 3k times

(2) tlfong01's Penzu Learning Notes v0.3 2021apr30

(3) PIR Motion Sensor Module THE PI HUT SKU: 100283 (50 Reviews) Price: £3

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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