• Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
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 19.8k 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.
  • M Offline
    MattG
    last edited by Feb 22, 2017, 3:08 AM

    Hello!

    tl;dr - display wakes/sleeps repeatedly.

    Display sleeps fine, but once PIR Sensor is triggered, the monitor wakes, then immediately sleeps, then wakes, then sleeps, and so on, until I remove myself as a trigger to the PIR Sensor.

    FWIW - I utilized a tutorial for setting up the PIR Sensor and testing it via python script to see if it is even working. Here’s the script:

    from gpiozero import MotionSensor
    
    pir = MotionSensor(4)
    while True:
        if pir.motion_detected:
            print("Motion detected!")
    

    It works, but it continues to print over and over (and so on) until I remove the trigger for the PIR Sensor (much like how the display wakes and sleeps repeatedly).

    I’m honestly not sure if it is supposed to print that output over and over (like mine does), or not. But I feel like the two might be connected.

    Any pointers here would be much obliged. Thank you!

    1 Reply Last reply Reply Quote 0
    • E Offline
      elmerito25
      last edited by Feb 24, 2017, 12:32 AM

      Same here. I verified all the connections and tested using the same script and it keeps printing “Motion detected!” Did you play around with the jumpers on your PIR? I am still trying to figure out if my PIR is defective.

      S 1 Reply Last reply Feb 24, 2017, 9:31 AM Reply Quote 0
      • S Offline
        strawberry 3.141 Project Sponsor Module Developer @elmerito25
        last edited by Feb 24, 2017, 9:31 AM

        @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 Feb 24, 2017, 10:35 AM

          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 Feb 24, 2017, 2:47 PM

            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 Feb 24, 2017, 5:35 PM

              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

              C J 2 Replies Last reply Feb 24, 2017, 8:22 PM Reply Quote 2
              • C Offline
                cowboysdude Module Developer @Renfield
                last edited by Feb 24, 2017, 8:22 PM

                @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 Feb 24, 2017, 9:02 PM Reply Quote 0
                • E Offline
                  elmerito25 @cowboysdude
                  last edited by Feb 24, 2017, 9:02 PM

                  @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 Feb 27, 2017, 7:36 PM Reply Quote 1
                  • E Offline
                    elmerito25 @elmerito25
                    last edited by Feb 27, 2017, 7:36 PM

                    @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 Feb 28, 2017, 5:41 PM

                      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
                      • 1
                      • 2
                      • 3
                      • 1 / 3
                      1 / 3
                      • First post
                        6/29
                        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