MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.

    PIR Sensor turning display on/off over and over

    Scheduled Pinned Locked Moved Unsolved Troubleshooting
    29 Posts 13 Posters 22.5k Views 13 Watching
    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.
    • strawberry 3.141S Offline
      strawberry 3.141 Project Sponsor Module Developer @elmerito25
      last edited by

      @elmerito25 I don’t have a mirror to test, but the code does the following

      from gpiozero import MotionSensor
      
      pir = MotionSensor(4)
      
      while True: #repeat this forever
          if pir.motion_detected: # if motion is detected print the message
              print("Motion detected!")
      

      after the print is done it immediately repeats the loop, because their is no sleep, timeout, delay or whatsoever in there. So for me the expected behaviour is that it prints over and over the same message. You could try to check motion not detected

      from gpiozero import MotionSensor
      import time
      
      pir = MotionSensor(4)
      
      while True: #repeat this forever
          if pir.motion_detected: # if motion is detected print the message
              print("Motion detected!")
          if not pir.motion_detected: # if no motion is detected print the message
              print("No motion detected!")
          time.sleep(1)
      

      run this and leave your sensor alone it will print just every second

      Please create a github issue if you need help, so I can keep track

      1 Reply Last reply Reply Quote 1
      • H Offline
        hermlam
        last edited by

        I have the same issue. Maybe it’s related to WiFi. I tested the PIR with on older PI 2, no WiFi. Ran the Python script, working perfectly.
        After installing the PIR to my Mirror Pi, a Pi 3 screen wouldn’t go out. Installed the test Python script again and I am getting a lot of false positives, over 5 a minute. So PIR stays highs and screen stays on.
        I am thinking that WiFi is interfering with the PIR.
        Anybody any experiences or ideas?

        Thanks,
        Herman

        1 Reply Last reply Reply Quote 0
        • F Offline
          fischi87
          last edited by

          by my mirror it works really nice. i have a question, it is possible the time to change right now it turns the display off after 4 minutes. i would like to change the time maybe 2 minutes or so.

          thanks

          1 Reply Last reply Reply Quote 0
          • R Offline
            Renfield
            last edited by

            It might be interference. Try installing a ferrite bead. The person whose site I’ve linked below had a very similar problem and describes how he fixed it.

            https://helentronica.com/2016/01/11/magic-mirror-with-motion-detector/

            Renfield

            cowboysdudeC johnnyboyJ 2 Replies Last reply Reply Quote 2
            • cowboysdudeC Offline
              cowboysdude Module Developer @Renfield
              last edited by

              @Renfield said in PIR Sensor turning display on/off over and over:

              It might be interference. Try installing a ferrite bead. The person whose site I’ve linked below had a very similar problem and describes how he fixed it.

              https://helentronica.com/2016/01/11/magic-mirror-with-motion-detector/

              Renfield

              It’s what I had to do with mine… they are very inexpensive…

              E 1 Reply Last reply Reply Quote 0
              • E Offline
                elmerito25 @cowboysdude
                last edited by

                @cowboysdude said in PIR Sensor turning display on/off over and over:

                @Renfield said in PIR Sensor turning display on/off over and over:

                It might be interference. Try installing a ferrite bead. The person whose site I’ve linked below had a very similar problem and describes how he fixed it.

                https://helentronica.com/2016/01/11/magic-mirror-with-motion-detector/

                Renfield

                It’s what I had to do with mine… they are very inexpensive…

                Thanks guys! Will try this once I get home tonight!

                E 1 Reply Last reply Reply Quote 1
                • E Offline
                  elmerito25 @elmerito25
                  last edited by

                  @elmerito25 said in PIR Sensor turning display on/off over and over:

                  @cowboysdude said in PIR Sensor turning display on/off over and over:

                  @Renfield said in PIR Sensor turning display on/off over and over:

                  It might be interference. Try installing a ferrite bead. The person whose site I’ve linked below had a very similar problem and describes how he fixed it.

                  https://helentronica.com/2016/01/11/magic-mirror-with-motion-detector/

                  Renfield

                  It’s what I had to do with mine… they are very inexpensive…

                  Thanks guys! Will try this once I get home tonight!

                  Thanks @Renfield and @cowboysdude ! Followed your advice and found a ferrite bead on unused USB cable and got the PIR sensor working perfectly!

                  1 Reply Last reply Reply Quote 0
                  • R Offline
                    Renfield
                    last edited by

                    Great to hear. I love it when a plan comes together.

                    Now I need to scrounge up a bead for my build.
                    Ren

                    1 Reply Last reply Reply Quote 0
                    • H Offline
                      hermlam
                      last edited by

                      Hi all,
                      Thanks for the reactions. I ordered one and will test tomorrow.
                      Herman

                      1 Reply Last reply Reply Quote 0
                      • C Offline
                        cyberphox
                        last edited by

                        i gave up on my PIR sensor cause this was happening to me…guess who is searching for a Ferrite bead tomorrow!!!

                        Full time Dad, DJ and entertainer and lover of technology.

                        1 Reply Last reply Reply Quote 1
                        • 1
                        • 2
                        • 3
                        • 1 / 3
                        • First post
                          Last post
                        Enjoying MagicMirror? Please consider a donation!
                        MagicMirror created by Michael Teeuw.
                        Forum managed by Sam, technical setup by Karsten.
                        This forum is using NodeBB as its core | Contributors
                        Contact | Privacy Policy