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 24.9k 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.
    • 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
                      • johnnyboyJ Offline
                        johnnyboy @Renfield
                        last edited by johnnyboy

                        This post is deleted!
                        1 Reply Last reply Reply Quote 1
                        • P Offline
                          phrazelle
                          last edited by

                          FWIW, a ferrite bead is a working solution, but I was able to circumvent this issue by keeping the PIR Sensor a good distance from the Pi. Mine is about 3 feet away from the Pi and doesn’t act erratically as it did when it was right next to it during testing.

                          johnnyboyJ H 2 Replies Last reply Reply Quote 3
                          • johnnyboyJ Offline
                            johnnyboy @phrazelle
                            last edited by johnnyboy

                            This post is deleted!
                            1 Reply Last reply Reply Quote 0
                            • JayJ Offline
                              Jay
                              last edited by

                              Similar problem here, PIR works like a charm (tested with code of post #4) but after starting the MagicMirror the display is turned off and on over and over even though nothing is changed in front of the sensor. (I use MMM-PIR).

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

                                @phrazelle Since I am having a ‘cordless’ mirror (power is coming from wall behind mirror) I don’t want to see cables to my mirror. I’ve build the PIR into the frame of my mirror.

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

                                  Even with the bead installed I have various results. Sometimes it’s running ok for an hour or so, but most of the time I’m getting a lot of false positives. And very strange, only with the output timer (2nd yellow knob) on minimal it’s working ok. But then the screen lits up far too short. But output time has nothing to do with it?

                                  1 Reply Last reply Reply Quote 0
                                  • JayJ Offline
                                    Jay
                                    last edited by

                                    Basically I had the same error with the display turning on and off over time. All in anger, I deinstalled the MagicMirror from the Pi and began at zero again.
                                    After updating and upgrading the Pi and installing the MagicMirror, a new try with the PIR-Module was iniciated. So I installed the PIR-Module and somehow noticed that my GPIO cables were wrong connected (ground connected to GPIO21 and vice-versa).
                                    So after this embarassing moment of disbelieve I changed the connections and checked if the sensor is working with a simple python script:

                                    from gpiozero import MotionSensor
                                    import time
                                    
                                    pir = MotionSensor(21)
                                    
                                    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)
                                    

                                    Note that my pir is using GPIO21.
                                    With this script I tested the sensor and it worked like a charm, even though the sensor is placed 5 centimeters away from the raspberry pi 3 (with no case or even a bead installed).
                                    In the end, I only had to do a cd MagicMirror again, and install the MagicMirror:
                                    npm install. With this setup the MMM-PIR-module works magnificient.

                                    D 1 Reply Last reply Reply Quote 1
                                    • D Offline
                                      deepshades @Jay
                                      last edited by

                                      @Jay

                                      Hi Jay, can you reply a link to your PIR module you finaly use?

                                      JayJ 1 Reply Last reply Reply Quote 0
                                      • JayJ Offline
                                        Jay @deepshades
                                        last edited by

                                        @deepshades
                                        Basically its just the standard PIR-Sensor shipped with female to female gpio connections (PIR-Sensor Amazon).

                                        D 1 Reply Last reply Reply Quote 0
                                        • D Offline
                                          deepshades @Jay
                                          last edited by

                                          @Jay

                                          Ok, so you just use a script to let the sensor deactivate the hdmi output?
                                          Could you tell me the steps to let all work together?

                                          JayJ 1 Reply Last reply Reply Quote 0
                                          • JayJ Offline
                                            Jay @deepshades
                                            last edited by

                                            @deepshades
                                            Well ok…
                                            step 1: get nodejs and npm --> sudo apt-get install nodejs then sudo apt-get install npm
                                            step 2: update + upgrade the pi --> sudo apt-get update then sudo apt-get dist-upgrade
                                            step 3: install MagicMirror --> as seen here MagicMirror Github Page
                                            step 4: connect the PIR-Sensor to your Pi --> ground to ground (e.g. Pin 6), VCC to 5V (e.g. Pin 2), Out to GPIO XX (e.g. Pin 16)
                                            step 5: check if PIR-Sensor works --> as seen at my script above (watch your connected GPIO pin, maybe change in script is required) --> some fiddling with sensitivity knobs here is needed
                                            step 6: install MMM-PIR --> MMM-PIR Github Page
                                            step 7: reboot and reinstall MagicMirror in MagicMirror directory --> cd MagicMirror and npm install

                                            this has worked for me…

                                            johnnyboyJ 1 Reply Last reply Reply Quote 1

                                            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                                            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                                            With your input, this post could be even better 💗

                                            Register Login
                                            • 1
                                            • 2
                                            • 1 / 2
                                            • 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