• 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 - put your mirror to sleep if not used

Scheduled Pinned Locked Moved System
utilitygpiomotion-sensorpower-saving
56 Posts 32 Posters 98.2k Views 47 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.
  • K Offline
    Klinge
    last edited by May 31, 2017, 10:20 AM

    @paviro
    Hi,
    I need some help please, because my PIR-Sensor doesn´t work with your module.
    I do not know what I did wrong. I wrote my Problem in another category in the MM Forum, but unfortunately until now nobody could help me.

    My problem is that my monitor does not turn off. I configured the config.js like this

                module: 'MMM-PIR-Sensor',
                config: {
                        sensorPIN: 23,
                        powerSaving: true,  
    

    and connect the sensor to the raspberry like this
    https://www.tutorials-raspberrypi.de/wp-content/uploads/pir.png

    Waiting about one, two minutes, but the monitor does not turn off. I would be really happy if you could help me.

    Thanks in advance.

    1 Reply Last reply Reply Quote 0
    • R Offline
      randomnoise
      last edited by Jun 19, 2017, 8:08 PM

      @paviro Cheers for making a very useful module.

      I have made some modifications to node.js to make it work in my situation. I’ve never really done any javascript programming, so what I did was kind of hacked together from various forums. As you know what you’re doing it would be great if you could include any of these features for future versions (I’ve never used GIT before so not sure how to fork etc).

      I had to make the following modifications-

      1. Use the vcgencmd function to turn on/off screen (I couldn’t get it to wake up using tvservice despite trying many variations found online). I found this option suggested by others on the forum. Perhaps a config option to use this in place of the TV service for those who it doesn’t work for?
      2. The PIR sensor I used is not the same as that used by nearly everyone else (the ones I bought are Wingoneer… they come on a smaller board & don’t have the sensitivity adjustments)… the outcome of this is that the sensor pin is high (+5V) when there is no detection & pulled low (0V) when you move in front of sensor. I therefore had to invert your motion detected logic by swapping the 1 & 0. Could an option for ‘invert pin’ be included?
      3. I followed various options online for how to disable the screen saver… but my pi still goes in to screen save mode after 30 mins. This means even if motion is detected, the screen switches on but remains blank. I solved this in a bit of a hacky way by using the xdotool package to simulate pressing “space” and therefore end the screensaver.
      4. One final issue which I haven’t been able to resolve yet is that after restarting my PI, assuming there is no motion detected, the screen will be ‘On’ even though there is no motion detected. As an event is not generated (i.e the state didn’t change) it will stay on until the sensor has detected someone & then moved away. Although this isn’t really a huge deal (it should only be restarted if I’m using the screen so I can trigger an event by moving in front & away again) I just wondered if there is a way to do an initial poll of the sensor after start up. I’m not sure if this is because my sensor logic is inverted or if this behaviour is seen on those using the normal PIRs.

      As I understand I will lose these changes if you upgrade your module next time I do a GIT pull.

      My code below if it is of interest to anyone:

      switch off

      exec("vcgencmd display_power 0"); //Used in favour of tvservice
      

      switch on

      exec("vcgencmd display_power 1"); //Used in favour of tvservice
      exec("xdotool key space"); //simulate  spacebar to disable screensaver. Needs xdotool to be installed
      
      S 1 Reply Last reply Jul 17, 2019, 12:42 AM Reply Quote 0
      • B Offline
        BanksyPaint
        last edited by Aug 14, 2017, 3:37 PM

        Hi! I’ve run through the posts - though I haven’t been able to find anybody that’s had the sample problem that I’ve had. To test the hardware, I put a towel over the IR sensor, and I find that the monitor flickers on and off, even when the sensor is covered.

        Has anybody had this issue? Or can suggest some solutions?

        Thanks!

        1 Reply Last reply Reply Quote 0
        • K Offline
          Kimzer
          last edited by Aug 22, 2017, 12:33 PM

          Anyway this can send a signal to openhab to control the lights ive put around my frame?

          1 Reply Last reply Reply Quote 0
          • S Offline
            SvenT @Jopyth
            last edited by Jan 30, 2018, 2:42 PM

            @Jopyth Hi.
            Could You give a hint?
            It makes sense just to get data for buses/train departures when screen is active…
            /Sven

            1 Reply Last reply Reply Quote 0
            • S Offline
              SdeGeata @randomnoise
              last edited by Jul 17, 2019, 12:42 AM

              @randomnoise said in PIR-Sensor - put your mirror to sleep if not used:

              exec(“xdotool key space”); //simulate spacebar to disable screensaver. Needs xdotool to be installed

              Hello Randomnoise;

              So you did exactly what I am looking to do. Can you elaborate on how to configure this so my PIR will turn off the screen saver? I’ve already installed Xdotool, but I don’t know where to go from there.

              1 Reply Last reply Reply Quote 0
              • 1
              • 2
              • 3
              • 4
              • 5
              • 6
              • 6 / 6
              • 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