• 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.

Motion Detector

Scheduled Pinned Locked Moved Utilities
213 Posts 38 Posters 437.6k Views 39 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
    mongo116 Module Developer
    last edited by Jul 21, 2017, 8:30 AM

    I’ve got the motion detection now working - had to add bcm2835-v4l2 to \etc\modules - restarted and screen now turns off after defined period and on when motion is detected. This is really great, and I’m nearly there - but… Now when the motiondetector is running, the RPi3 temp just goes up and up and up, until it eventually crashes/freezes and I have to pull the power as RPi is completely unresponsive. If I remove motiondetector from MagicMirror, temperature stays stable and no crashing. Is there something I can change in the config to sort out this performance issue?

    S 1 Reply Last reply Jul 21, 2017, 9:26 AM Reply Quote 0
    • S Offline
      strawberry 3.141 Project Sponsor Module Developer @mongo116
      last edited by Jul 21, 2017, 9:26 AM

      @mongo116 it looks like https://github.com/alexyak/motiondetector/blob/master/diff-cam-engine.js#L37 it creates 10 images per second and compares it to the previous which is probably the intensive part

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

      M 1 Reply Last reply Jul 21, 2017, 11:15 AM Reply Quote 1
      • M Offline
        mongo116 Module Developer @strawberry 3.141
        last edited by Jul 21, 2017, 11:15 AM

        @strawberry-3.141 Thanks for that. I’ve amended this slightly so will keep an eye on it. Might also have a look at putting on some heatsinks to see if that helps.

        One (hopefully!) final question. When the monitor is turned off, is there a way to ‘freeze’ the other modules, so they stop running for the duration that the monitor is off? This would hopefully help with performance, in that the other modules are no longer running.

        S 1 Reply Last reply Jul 21, 2017, 7:43 PM Reply Quote 0
        • S Offline
          strawberry 3.141 Project Sponsor Module Developer @mongo116
          last edited by Jul 21, 2017, 7:43 PM

          @mongo116 every module has a suspend and resume function, but nearly none module that I’m aware of has implemented stopping intervals and fetching data in there. so calling those functions wouldn’t make a difference then just hiding it on the display.

          Furthermore I doubt that it would really make a difference if you’re not using another cpu intensive task like voice recognition …

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

          1 Reply Last reply Reply Quote 0
          • R Offline
            reaper81
            last edited by Jul 25, 2017, 12:09 PM

            sorry for my noob-Question but is there an setup or a explaination how to use the three .js files from alexeyak on github? normaly there is an readme-file.

            M 1 Reply Last reply Jul 25, 2017, 3:15 PM Reply Quote 0
            • M Offline
              mongo116 Module Developer @reaper81
              last edited by Jul 25, 2017, 3:15 PM

              @reaper81 I had the following in my config.js:

                            {
                              module: 'motiondetector',
                              config: {
                              timeout: 5*60*1000
                                 }
                             },
              

              You will need to ensure that the 3 files are located in the modules/motiondetector folder.

              I ended up using a different method for motion detection though, as tvservice kept stopping working.

              1 Reply Last reply Reply Quote 0
              • J Offline
                jdahli1
                last edited by Aug 2, 2017, 7:39 PM

                So after far too many months, I’ve finally gotten my mirror put together. Everything is working great, except for this module (sometimes). After a reboot everything works at least once, meaning that the monitor will turn off when no motion is detected and turn on once motion is detected. Sometimes, it will work correctly for an entire day. Others, it will work once and then the monitor will not turn back on until I reboot the pi. After the monitor refuses to wake up, I receive the following in the pm2 logs when it does detect motion.

                0|mm       | monitor :state 0x7ee68dbc [HDMI unknown AR x38128 HDCP], 2129038664x4287062190 @ 45744.00Hz, interlaced
                0|mm       | monitor :state 0x7ee8bdbc [HDMI unknown AR x13552 HDCP], 2129182024x4287062190 @ 21168.00Hz, interlaced
                0|mm       | monitor has been deactivated
                0|mm       | monitor :state 0x7ebe5dbc [HDMI unknown AR x25840 HDCP], 2126404936x4287062190 @ 33456.00Hz, interlaced
                0|mm       | monitor :state 0x7e9afdbc [HDMI unknown AR x13552 HDCP], 2124086600x4287062190 @ 21168.00Hz, interlaced
                0|mm       | monitor has been deactivated
                0|mm       | monitor :state 0x7e8dadbc [HDMI unknown AR x21744 HDCP], 2123214152x4287062190 @ 29360.00Hz, interlaced
                0|mm       | monitor :state 0x7efdcdbc [HDMI unknown AR x54512 HDCP], 2130562376x4287062190 @ 62128.00Hz, interlaced```
                

                Does anyone have any thoughts on how to prevent this from happening? Is there a better place to look at logs other than pm2 to see exactly what is happening. It is very odd to me that it works for different amounts of time after each reboot.

                For what it’s worth, when the screen stops waking up, I can navigate to rasperrybi.local:8080 in a browser and all of the modules are up and running.

                Any thoughts or comments are appreciated.

                H 1 Reply Last reply Aug 2, 2017, 9:03 PM Reply Quote 0
                • H Offline
                  Hawking @jdahli1
                  last edited by Aug 2, 2017, 9:03 PM

                  @jdahli1
                  I don’t know this error, therefore the following two comments might be totally wrong:

                  The motion detector uses

                  /opt/vc/bin/tvservice --preferred && sudo chvt 6 && sudo chvt 7
                  

                  to switch the monitor on. What happens if you execute this command manually while the observed problem occurs (I assume you can still login to the PI?). Then you might know weather it is a problem of the motion detection (and MMM) or if it is a more general problem. Maybe you even get additional error messages that help you to identify the problem

                  1. Do you know the HDMI-settings in /boot/config.txt ?
                    Maybe it is worth to play around with hdmi_force_hotplug, hdmi_drive, hdmi_group and hdmi_mode . See the file and here https://raspberrypi.stackexchange.com/tags/config.txt/info for more information. Maybe the “AR” in your error stands for “aspect ratio”, this could be set explicitly be these parameters.

                  If somebody got this module to work on a Raspberry Pi Zero (using the Midori browser) I would be highly interested in how it was done!

                  J 1 Reply Last reply Aug 3, 2017, 5:07 PM Reply Quote 0
                  • J Offline
                    jdahli1 @Hawking
                    last edited by Aug 3, 2017, 5:07 PM

                    @Hawking Thank you for the reply. Running that command does not appear to do anything. I let it sit for a minute and the command never completes, nor does the screen come on. It will sit until I ctrl + c. I will start to mess with the hdmi settings and see if that makes any difference.

                    H 1 Reply Last reply Aug 3, 2017, 8:44 PM Reply Quote 0
                    • H Offline
                      Hawking @jdahli1
                      last edited by Aug 3, 2017, 8:44 PM

                      @jdahli1
                      Can you just execute /opt/vc/bin/tvservice --preferred to see if it is tvservice or chvt that does not respond?

                      Here https://news.screenly.io/how-to-automatically-turn-off-and-on-your-monitor-from-your-raspberry-pi-5f259f40cae5 also problems with turning the screen back on using tvservice are mentioned. Maybe the other methods mentioned in the article are worth a try. If they work you can simply change the commands used in ~/MagicMirror/modules/motiondetector/node_helper.js

                      J 1 Reply Last reply Aug 4, 2017, 2:51 AM Reply Quote 0
                      • 1
                      • 2
                      • 17
                      • 18
                      • 19
                      • 20
                      • 21
                      • 22
                      • 19 / 22
                      • 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