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 526.0k 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.
    • A Offline
      alihallo
      last edited by

      First of all, I also had the problem which could be solved by adding

      @reboot sudo modprobe bcm2835-v4l2
      

      at the last line of the crontab. Thank you very much!

      It works fine for some hours, but suddenly the monitor does not show up again.
      I cannot see error messages, but the following commands does not get an answer anymore…

      /opt/vc/bin/tvservice -s
      

      There is no return value anymore, it is just loading forever.
      In the log it looks like this:

      mm-0 monitor :state 0x12000a [HDMI CEA (16) RGB lim 16:9], 1920x1080 @ 60.00Hz, progressive
      mm-0 monitor has been activated
      mm-0 monitor :state 0x120002 [TV is off]
      mm-0 monitor has been deactivated
      mm-0 monitor :state 0x12000a [HDMI CEA (16) RGB lim 16:9], 1920x1080 @ 60.00Hz, progressive
      mm-0 monitor has been activated
      mm-0 monitor :state 0x120002 [TV is off]
      mm-0 monitor has been deactivated
      mm-0 monitor :state 0x12000a [HDMI CEA (16) RGB lim 16:9], 1920x1080 @ 60.00Hz, progressive
      mm-0 monitor :
      mm-0 monitor :
      mm-0 monitor has been deactivated
      mm-0 monitor :
      

      As soon as the problem occures, the command

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

      also does not switch the monitor on again.
      It seems that the tvservice command just got a problem after some hours… Any idea how to solve this?
      I need to restart the pi to get the monitor on again, after that everything works fine for some hours…

      Best regards,
      alihallo

      1 Reply Last reply Reply Quote 0
      • C Offline
        cpramhofer
        last edited by paviro

        Hi alihallo,

        i have exact the same problem. i also added the @reboot sudo modprobe bcm2835-v4l2 command into my cronetab.

        but once the screen is off for some hours it will not switch on again.

        for me it seems that the RPi 3 is going into some kind of sleepmode if the monitor is switched off for too long.

        kind regards
        Christoph

        cowboysdudeC 1 Reply Last reply Reply Quote 1
        • cowboysdudeC Offline
          cowboysdude Module Developer @cpramhofer
          last edited by

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

            Just as a side note, I have the same issue that my RasPi screen does not switch on again after a random time. But I am running v1 of the mirror (so not this motion detector module) and I use motion for motion detection. My guess is that this is an issue with the RasPi firmware because it was working fine several months ago (and I was frequently updating RasPi firmware)…

            1 Reply Last reply Reply Quote 0
            • cowboysdudeC Offline
              cowboysdude Module Developer
              last edited by

              I just run a straight cron job with a file called pir.py that runs two other files…

              monitor_on.sh
              monitor_off.sh

              It’s not incorporated into the mirror it runs the entire pi and I’ve had great luck with it! :)

              C 1 Reply Last reply Reply Quote 0
              • C Offline
                cpramhofer @cowboysdude
                last edited by

                hi @cowboysdude ,

                could you please give me (and maybe others) the detailed instruction how these files look in detail and where those are located?

                thanks a lot in advance,
                Christoph

                1 Reply Last reply Reply Quote 0
                • C Offline
                  cpramhofer
                  last edited by

                  here is what i have done, actually it works - i will watch it a few days.

                  switch to /bin/

                  cd /
                  cd bin

                  open nano and create a shell script

                  sudo nano monitor_on.sh

                  write the “On” Command in it and save with Ctrl+x

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

                  open nano and create another shell script

                  sudo nano monitor_off.sh

                  write the “Off” Command in it and save with Ctrl+x

                  /opt/vc/bin/tvservice -o

                  make both shell scripts executable

                  sudo chmod +x monitor_off.sh
                  sudo chmod +x monitor_on.sh

                  open the crontab and add the following at the end

                  switches the monitor off and on every 15 minutes. this is for experimenting, i will look how it works and will set the

                  time up as.

                  15 * * * * sudo /bin/monitor_off.sh
                  15 * * * * sudo /bin/monitor_on.sh
                  @reboot sudo modprobe bcm2835-vl2

                  1 Reply Last reply Reply Quote 0
                  • cowboysdudeC Offline
                    cowboysdude Module Developer
                    last edited by cowboysdude

                    Well hey Thanks for making that easy… was JUST working on that LOL I’m putting it on github with instructions and the files…

                    1 Reply Last reply Reply Quote 0
                    • cowboysdudeC Offline
                      cowboysdude Module Developer
                      last edited by

                      https://github.com/cowboysdude/Pir-Sensor

                      1 Reply Last reply Reply Quote 0
                      • cowboysdudeC Offline
                        cowboysdude Module Developer
                        last edited by

                        Update:

                        https://github.com/cowboysdude/Pir-Sensor

                        Monitor was only partially coming back on this should fix that.

                        1 Reply Last reply Reply Quote 0
                        • C Offline
                          chengstark
                          last edited by

                          my monitor won’t turn back on
                          when I run “npm start dev”, it shows “compare result=Infinity,Infinity;0,0” , seems like it can’t capture any movement
                          the camera module works outside MagicMirror
                          when I tried “sudo modprobe bcm2835-v4l2”, it says “modprobe: invalid option – ‘4’”
                          how can I fix this

                          1 Reply Last reply Reply Quote 0
                          • C Offline
                            cpramhofer
                            last edited by

                            Hi @cowboysdude

                            thank you for your files and the explanation. what i don´t understand is how this all works together with the “Motion Detector” - i would prefere to use a camera instead of a PIR Sensor but as far as i see i have to install the pir.py file which is calling the on&off files and referring to the PIN with the connected PIR sensor.

                            is there a way to use the on&off files with the “Motion Detector” Module?

                            greets
                            Christoph

                            cowboysdudeC 1 Reply Last reply Reply Quote 0
                            • C Offline
                              cpramhofer
                              last edited by

                              Hi guys

                              as it looks that it isn´t an MM problem but an Pi Problem…another try:

                              sudo nano /etc/kbd/config

                              change the values to zero

                              BLANK_TIME=0
                              POWERDOWN_TIME=0

                              good luck

                              D 1 Reply Last reply Reply Quote 0
                              • cowboysdudeC Offline
                                cowboysdude Module Developer @cpramhofer
                                last edited by

                                @cpramhofer There is a module for camera control… cannot remember the name of it but look around here I KNOW there’s one here.

                                1 Reply Last reply Reply Quote 0
                                • C Offline
                                  cpramhofer
                                  last edited by

                                  hi @cowboysdude,

                                  i´m sorry - i thought we are all speaking about the camera based motion detection by @alexyak
                                  https://github.com/alexyak/motiondetector

                                  have a nice sunday!

                                  cowboysdudeC 1 Reply Last reply Reply Quote 0
                                  • cowboysdudeC Offline
                                    cowboysdude Module Developer @cpramhofer
                                    last edited by

                                    @cpramhofer No that’s ok… I think this thread is getting mixed between PIR sensor and camera… opps

                                    1 Reply Last reply Reply Quote 0
                                    • bheplerB Offline
                                      bhepler Module Developer
                                      last edited by bhepler

                                      Greetings! I’m slowly working my way through this thread and trying to figure out what’s going on here.

                                      What works: configurable timeout for the motiondetector seems to work just fine. Turns the screen off. Interestingly, if I’m viewing the mirror via my desktop browser, refreshing the page will turn the monitor on.

                                      What doesn’t work: turning the screen on. Even after entering sudo modprobe bcm2835-vl2

                                      Additionally, I’m seeing this in the console with the developer tools enabled:
                                      getUserMedia() no longer works on insecure origins. To use this feature, you should consider switching your application to a secure origin, such as HTTPS. See https://goo.gl/rStTGz for more details.
                                      :8080/modules/motiondetector//webcamcapture.js:78 NavigatorUserMediaError

                                      1 Reply Last reply Reply Quote 0
                                      • paphkoP Offline
                                        paphko
                                        last edited by

                                        I just tried this module but cpu load made me stop using it. Please tell me, how busy is your Raspberry with and without the motiondetector module? Mine is as follows on a Raspberry Pi 2:

                                        • With motiondetector enabled, there is always an electron process with ~100% cpu
                                        • With motiondetector disabled, I observed one or two electron processes with up to 15% cpu

                                        I used a dedicated motion daemon on my old version of the mirror to switch on the screen on motion and I think I will set it up again. IIRC, it used ~40% cpu on a (single-core) Raspberry Pi 1 B+. What is your opinion?

                                        bheplerB 1 Reply Last reply Reply Quote 0
                                        • bheplerB Offline
                                          bhepler Module Developer @paphko
                                          last edited by

                                          @paphko I just looked at my Pi 3 and I’m showing 40% usage with the motion detection module running (and failing). I suspect it’s the constant pic-compare-pic-compare loop that runs. It would be trivial to insert a wait in that loop to lower the CPU usage. Even a delay of 750 ms would probably help quite a bit.

                                          1 Reply Last reply Reply Quote 0
                                          • A Offline
                                            alexyak
                                            last edited by

                                            @bhepler you’re right. putting a delay should help with the CPU usage.

                                            bheplerB 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
                                            • 2
                                            • 3
                                            • 4
                                            • 5
                                            • 6
                                            • 10
                                            • 11
                                            • 4 / 11
                                            • 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