MagicMirror² v2.5.0 is available! For more information about this release, check out this topic.

MMM-PIR-Sensor problems



  • Hi there,

    At the moment I am a bit proud having built a working smart mirror using IKEA RIBBA in 40x50cm.
    But, for saving energy, I connected a PIR HC-SR504 to a Raspberry Pi 3 like this:

    0_1523790592096_F3G4PI9IWMQYC7L.LARGE.jpg

    Instructions: I followed these instructions by StacheEnthusiast by:

    • cd ~/MagicMirror/modules
    • git clone https://github.com/paviro/MMM-PIR-Sensor.git
    • cd ~/MagicMirror/modules/MMM-PIR-Sensor
    • npm install wiring-pi
    • sudo usermod -a -G gpio pi
    • sudo chmod u+s /opt/vc/bin/tvservice && sudo chmod u+s /bin/chvt
    • mv node_helper.js node_helper_backup.js
    • sudo nano node_helper.js (copied and pasted his code) and saved this
    • inserted this into config.js:
    	{
    		module: 'MMM-PIR-Sensor',
    		config: {
    			sensorPIN: 25,
    			powerSaving: true,
    			offDelay: 30000,
    		}
    	}
    

    But, it is not working… so I executed npm install in directory MMM-PIR-Sensor afterwards. Still not working… After booting, the screen is showing MagicMirror with all modules. After a couple of minutes, the monitor is showing a blank screen with backlight switched on. The module does not cut off HDMI signal and the HC-SR504 does not switch back to MagicMirror. I can not see if the sensor is recognizing me.

    “GPIO -v” shows the message "Unable to determine hardware version. I see: Hardware : BCM2835 - expecting BCM2708 or BCM2709. Please report this to project@drogon.net.”. Version 2.25 instead of a newer version is install, even after “npm install wiring-pi”.

    I am not sure having configured the module correctly, because as shown above I have connected the sensor to pin22/GPIO25. Is my module setting correct ?

    And, the HC-SR504 is offering 2 potentio meters (detection delay/sensing distance) and a jumper (impulse signal permanently or just one). Don´t know what do here:
    The mirror is fixed on a wall, where people are crossing several times a day. The mirror monitor should switch on if a person is standing in front of the mirror for about 5 seconds as long as the person is standing there.

    Would like to save some energy - some help would be very great… Thanks in advance.


  • Module Developer

    @blebbens I have checked on my js file

    It says for the offDelay seconds (30000 = almost 8:20 hours or so. Long time to look at yourself.)

    {
        		 module: 'MMM-PIR-Sensor',
    		   		config: {
    					powerSavingDelay:40
    				}
      		},
    

    I am also connected to PIN 25 so no need to add to config.

    This my is config.js I hope it helps. Mine works perfect.

    If you are unsure about the pins check this at the bottom of the page.
    https://pinout.xyz/
    pinout



  • The only thing missing is the energy saving PIR-module…

    Okay, now my config.js PIR-part looks like this:

    {
    			module: 'MMM-PIR-Sensor',
    			config: {
    				//sensorPIN: 25,
    				powerSaving: true,
    				offDelay: 60,
    			}
    		},
    

    After booting magic mirror, the monitor is showing the working magic mirror. After a few minutes (not the 60 seconds as setup in MMM-PIR-Sensors config.js-part) the screen is showing a blank black screen with backlight on is full power consumption. Seems, as if the HDMI signal does not get the OFF order… A problem with a screen saver, perhaps ? Turned it off as shown in the official tutorial (running Raspbian Stretch).

    Running in front of the PIR does not turn the magic mirror screen on. Pressing a key on the wireless keyboard does turn it back on…

    So, there are 2 problems: why does the HDMI switches to “show blank screen” instead of “switch off” ? What kind of settings do I have to do with the PIR-Jumper and potent meters ?


  • Module Developer

    @Charley said in MMM-PIR-Sensor problems:

    powerSavingDelay:40

    You may want to change your config to only: powerSavingDelay:40

    If you switch off thru HDMI then powerSaving:true is not needed imho.
    and better use powerSavingDelay: 60 instaead of offDelay just copy mine config.js settings from above it should work



  • 0_1523810785172_Bildschirmfoto 2018-04-15 um 18.45.37.png

    Okay, I changed to your config.js-settings.

    Not sure if I have connected the cables correctly RPIPIR.

    According to github, default is pin#22 (BCM).
    Since the beginning I connected the data cable to pin#22/GPIO 25.
    But, github is telling BCM22 should be default, so I now connected it to pin#15/BCM22.
    Tried to find correct pins using the scheme above.


  • Module Developer

    I have just checked my Mirror I am at pin 22 the 8th pin on the bottom of this print
    The 8th pin on the bottom



  • Yes, it is connected to the 8th bottom from the left…

    Building the mirror, setting up the pi and magic mirror with modules - no problems… until trying to use the PIR…

    HDMI signal is sending still in blank screen… magic mirror does not turn back on… it still does not care about the PIR.

    at what position are your potentio meters and the jumper ?


  • Module Developer

    My PIR has no jumper. From banggood
    The two potentiometers are both in the middle position.
    There are a few more topics on the screen not reacting properly a few LCD screens do not support switching thru HDMI.

    I tested the PIR on an Arduino Nano to see when it was detecting and at what range, but you can also do that with a Raspberry.



  • Normally the monitor is switching to standby if there is no signal from HDMI. I think the problem is the Raspberry. Found nothing to fix this.

    I am also wondering why magic mirror switches to no signal/blank screen after a couple of minutes. Is there a possibility to change this to a fix number of seconds? Seems as if the MMM-PIR-setting for switching on/off in seconds has no effect.


  • Module Developer

    Maybe you have screensaver not disabled.