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.

    Trouble with PIR sensor

    Scheduled Pinned Locked Moved Troubleshooting
    15 Posts 2 Posters 7.5k Views 1 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.
    • J Offline
      jheller333
      last edited by

      I’ve been really struggling with setting up a PIR sensor. All I want is for the PIR sensor to turn off the TV monitor, not just the HDMI port which seems to be what most of the modules do. Has anyone done this with their mirror that could help me out? Or is there another option for having monitor turn off when not being used? The mirror will be in my room and I obviously don’t want it on 24/7.

      1 Reply Last reply Reply Quote 0
      • cruunnerrC Offline
        cruunnerr
        last edited by cruunnerr

        @jheller333

        Maybe with a relay? :)

        take a look at point 5.2
        https://forum.magicmirror.builders/topic/6291/howto-turn-on-off-your-monitor-time-based-pir-button-app?page=1

        edit: but the normal MMM-PIR module can use a relay, too ;)

        1 Reply Last reply Reply Quote 0
        • J Offline
          jheller333
          last edited by

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

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

              Try these commands in the *.sh files:

              vcgencmd display_power 1

              and

              vcgencmd display_power 0

              I need to update my post ^^

              1 Reply Last reply Reply Quote 0
              • J Offline
                jheller333
                last edited by

                I don’t have a relay at the moment but I’m going to order one. In the mean time, I tried part 2 of your guide to test if I could get the PIR sensor working but it’s not. The HDMI port is disabled after 120 seconds of no presence in the sensor. When I wave my hand in front of the sensor to turn the pi back on, the HDMI port activates but I only get a black screen. Any suggestions for what to do?

                cruunnerrC 1 Reply Last reply Reply Quote 0
                • cruunnerrC Offline
                  cruunnerr @jheller333
                  last edited by

                  @jheller333

                  Look above :)

                  1 Reply Last reply Reply Quote 0
                  • J Offline
                    jheller333
                    last edited by

                    I really appreciate the help. Been struggling with the PIR sensor for a week now. Is there a specific relay I should be looking for? I managed to get everything working with the PIR sensor, but once the TV turns off after there is no input detected, the PIR sensor can’t turn the tv back on. So it is not the most viable solution.

                    1 Reply Last reply Reply Quote 0
                    • cruunnerrC Offline
                      cruunnerr
                      last edited by

                      did u try what i posted?

                      U said, u tried part 2 of the tutorial. So u should have a “monitor_on.sh” and a “monitor_off.sh”

                      Try to change the content to the following:

                      sudo vcgencmd display_power 1 for monitor_on.sh
                      sudo vcgencmd display_power 0 for monitor_off.sh

                      or

                      sudo tvservice -p && sudo chvt 9 && sudo chvt 7 for monitor_on.sh
                      sudo tvservice -o for monitor_off.sh

                      If these don’t work at all u should go for the relay.
                      U could use every relay u want, but u should search for a 3 - 5V relay because otherwise u need to install a transistor.
                      https://www.ebay.com/sch/i.html?_from=R40&_trksid=p2380057.m570.l1313.TR0.TRC0.H0.Xraspberry+pi+relay.TRS0&_nkw=raspberry+pi+relay&_sacat=0

                      1 Reply Last reply Reply Quote 0
                      • J Offline
                        jheller333
                        last edited by

                        I got a relay and followed your guide to connect it. The relay has an LED light on it but it doesn’t seem to trigger. I still have all the code setup for turning off the HDMI port with the PIR sensor, so I’m not sure if thats the problem. Any suggestions?

                        cruunnerrC 1 Reply Last reply Reply Quote 0
                        • cruunnerrC Offline
                          cruunnerr @jheller333
                          last edited by cruunnerr

                          @jheller333

                          Do u have a link to your relay? Do u hear it clicking?

                          1 Reply Last reply Reply Quote 0
                          • J Offline
                            jheller333
                            last edited by

                            I dont hear it clicking. https://www.creatroninc.com/product/5v-10a-dc-relay-module/?search_query=relay&results=39. Thats the relay i purchased

                            1 Reply Last reply Reply Quote 0
                            • J Offline
                              jheller333
                              last edited by

                              When I run the python script relayPIR.py, the relay clicks and the green light turns on, but once I end that script, the light doesn’t come back on

                              1 Reply Last reply Reply Quote 0
                              • cruunnerrC Offline
                                cruunnerr
                                last edited by cruunnerr

                                hmm… I will check this tomorrow and will give a result

                                Installed a fresh Raspbian Stretch Desktop and just created the relayPIR.py which runs perfectly. can start and stop whenever i want the script and even autostart on reboot works great.

                                Hmm… so we used several options and nothing seems to work… You should delete all things we made and start again.

                                Maybe just try to create the relay script on point 5.2

                                1 Reply Last reply Reply Quote 0
                                • J Offline
                                  jheller333
                                  last edited by

                                  So I deleted everything and started over. Followed your instructions from point 5.2 and it’s still not working. Really not sure where to go from here

                                  1 Reply Last reply Reply Quote 0

                                  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 / 1
                                  • 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