MagicMirror Forum

    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • Donate
    • Discord

    PIR-Sensor detecting motion even when there's no movement

    Troubleshooting
    2
    2
    1434
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Mitchfarino
      Mitchfarino Module Developer last edited by paviro

      Hi All

      I’ve just hooked up my PIR sensor to my Pi3

      I ran a variant of this, and it was constantly detecting movement even when I was covering it up, so nothing should have been detected.

      Is there an issue with my sensor? Or is that standard? Or can I turn down the sensitivity in some way?

      import RPi.GPIO as GPIO
      import time
      GPIO.setwarnings(False)
      GPIO.setmode(GPIO.BOARD)
      GPIO.setup(3,GPIO.OUT)     #Define pin 3 as an output pin
      
      while True:
              GPIO.output(3,1)   #Outputs digital HIGH signal (5V) on pin 3
              time.sleep(1)      #Time delay of 1 second
      
              GPIO.output(3,0)   #Outputs digital LOW signal (0V) on pin 3
              time.sleep(1)      #Time delay of 1 second
      

      Edit from admin: Please use Markdown on code snippets!

      1 Reply Last reply Reply Quote 0
      • KirAsh4
        KirAsh4 Moderator last edited by KirAsh4

        I don’t have a PIR sensor to fiddle with … however, why are you setting pin 3 HIGH, and as an OUTPUT? If it’s to power the PIR sensor board, don’t, use either pin 1 or 17, those have a constant 3v3 on them (or if you know your sensor can tolerate 5V, use pins 2 or 4). If it’s to read from the PIR sensor, it needs to be set as an INPUT pin so it can detect when the sensor triggers it.

        A Life? Cool! Where can I download one of those from?

        1 Reply Last reply Reply Quote 0
        • 1 / 1
        • First post
          Last post
        Enjoying MagicMirror? Please consider a donation!
        MagicMirror created by Michael Teeuw.
        Forum managed by Paul-Vincent Roll and Rodrigo Ramírez Norambuena.
        This forum is using NodeBB as its core | Contributors
        Contact | Privacy Policy