MMM-PIR-Sensor tuning



  • @jc21 just for closure here I found the issue. After running the python script again I realised that the PIR was always HIGH even with the sensitivty dialled right down.

    So I checked the leads going into the pi and found that, despite checking it many times, I’d mixed up GND and VCC 😞

    The lesson for any other idiots out there when testing is, run this Python script and make sure that the PIR stops broadcasting “Motion Detected!” when you cover it with something:

    from gpiozero import MotionSensor
    import os
    
    pir= MotionSensor(22) //the gpio pin PIR OUT is connected to
    while True:
                   if pir.motion_detected:
                   print (“Motion Detected!”)
    

    Code from this site

    With some further adjustments for sensitivity it’s now working great!



  • Great stuff. People shouldn’t discount a faulty PIR either. The one I had on the shelf for ages wasn’t detecting quite right so I ordered another one and the difference in detection is huge. I’m not sure if these have a shelf life or what but yeah, that was my recent experience.



  • Hi all,

    i have an issue with the PIR Sensor. I get alltime this error:

    1|mm | at bindings (/home/pi/MagicMirror/modules/MMM-PIR-Sensor/node_modules/bindings/bindings.js:76:44)
    1|mm | (node:1714) DeprecationWarning: sys is deprecated. Use util instead.
    1|mm | WARNING! Could not load config file. Starting with default configuration. Error found: Error: Module version mismatch. Expected 50, got 49.
    1|mm | App threw an error during load
    1|mm | Error: Module version mismatch. Expected 50, got 49.
    1|mm | at Error (native)
    1|mm | at process.module.(anonymous function) [as dlopen] (ELECTRON_ASAR.js:173:20)
    1|mm | at Object.Module._extensions…node (module.js:583:18)
    1|mm | at Object.module.(anonymous function) [as .node] (ELECTRON_ASAR.js:173:20)
    1|mm | at Module.load (module.js:473:32)
    1|mm | at tryModuleLoad (module.js:432:12)
    1|mm | at Function.Module._load (module.js:424:3)
    1|mm | at Module.require (module.js:483:17)
    1|mm | at require (internal/module.js:20:19)
    1|mm | at bindings (/home/pi/MagicMirror/modules/MMM-PIR-Sensor/node_modules/bindings/bindings.js:76:44)
    1|mm | Error: Module version mismatch. Expected 50, got 49.
    1|mm | at Error (native)
    1|mm | at process.module.(anonymous function) [as dlopen] (ELECTRON_ASAR.js:173:20)
    1|mm | at Object.Module._extensions…node (module.js:583:18)
    1|mm | at Object.module.(anonymous function) [as .node] (ELECTRON_ASAR.js:173:20)
    1|mm | at Module.load (module.js:473:32)
    1|mm | at tryModuleLoad (module.js:432:12)
    1|mm | at Function.Module._load (module.js:424:3)
    1|mm | at Module.require (module.js:483:17)
    1|mm | at require (internal/module.js:20:19)
    1|mm | at bindings (/home/pi/MagicMirror/modules/MMM-PIR-Sensor/node_modules/bindings/bindings.js:76:44)

    It’s equal if i have the original from @paviro or the modification.

    Can anybody help me?

    Regards Daniel


  • Moderator

    @ostfilinchen

    1. please run npm list and find out your version number of electron
    2. change into the MMM-PIR-Sensor folder cd ~/MagicMirror/modules/MMM-PIR-Sensor
    3. run npm rebuild --runtime=electron --target=ELECTRONVERSION --disturl=https://atom.io/download/atom-shell --abi=50 and replace ELECTRONVERSION with the version number you found in step 1


  • @yawns. Is it possible that my Version is 1.4.13?


  • Moderator

    Yes, that is possible. When I had to run this command last time I was using 1.4.0 …
    Just give it a try. Worst case is you have to delete the MMM-PIR-Sensor folder and git clone it again.



  • @yawns now i get this error

    pi@raspberrypi:~/MagicMirror/modules/MMM-PIR-Sensor $ sudo npm rebuild --runtime=electron --target=1.4.13 --disturl=https://atom.io/download/atom-shell --abi=50

    epoll@0.1.20 install /home/pi/MagicMirror/modules/MMM-PIR-Sensor/node_modules/epoll
    node-gyp rebuild

    gyp ERR! clean error
    gyp ERR! stack Error: EACCES: permission denied, unlink ‘build/Makefile’
    gyp ERR! System Linux 4.4.38-v7+
    gyp ERR! command “/usr/local/bin/node” “/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js” “rebuild”
    gyp ERR! cwd /home/pi/MagicMirror/modules/MMM-PIR-Sensor/node_modules/epoll
    gyp ERR! node -v v7.0.0
    gyp ERR! node-gyp -v v3.4.0
    gyp ERR! not ok

    npm ERR! Linux 4.4.38-v7+
    npm ERR! argv “/usr/local/bin/node” “/usr/local/bin/npm” “rebuild” “–runtime=electron” “–target=1.4.13” “–disturl=https://atom.io/download/atom-shell” “–abi=50”
    npm ERR! node v7.0.0
    npm ERR! npm v3.10.8
    npm ERR! code ELIFECYCLE
    npm ERR! epoll@0.1.20 install: node-gyp rebuild
    npm ERR! Exit status 1
    npm ERR!
    npm ERR! Failed at the epoll@0.1.20 install script ‘node-gyp rebuild’.
    npm ERR! Make sure you have the latest version of node.js and npm installed.
    npm ERR! If you do, this is most likely a problem with the epoll package,
    npm ERR! not with npm itself.
    npm ERR! Tell the author that this fails on your system:
    npm ERR! node-gyp rebuild
    npm ERR! You can get information on how to open an issue for this project with:
    npm ERR! npm bugs epoll
    npm ERR! Or if that isn’t available, you can get their info via:
    npm ERR! npm owner ls epoll
    npm ERR! There is likely additional logging output above.

    npm ERR! Please include the following file with any support request:
    npm ERR! /home/pi/MagicMirror/modules/MMM-PIR-Sensor/npm-debug.log
    pi@raspberrypi:~/MagicMirror/modules/MMM-PIR-Sensor $


  • Moderator

    why are you running it with sudo??



  • without sudo i get the same error



  • After a few New Installations now the mm starts and the PIR works.