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

Microwave/doppler motion detection -- anyone got it to work?

  • Hey all – I’m trying to get automatic shutoff to work with a microwave/doppler detector. I’ve verified that two different chips work, and can be read by the GPIO. I can’t seem to get either MMM-PIR-Sensor, or Pir-Sensor to enable the ‘vcgengcmd display_power’ change. Has anyone had success?

  • @invisible.inq

    I was having problems with this before (using a PIR sensor though, but shouldn’t matter so long as you use “GPIO read” to confirm the pin changes state from 0 to 1 when your sensor is triggered). My problem was that the screen saver was still active so although the monitor was switched ‘on’ the screen was still blank. I had tried various different things to disable the screen saver, but it just kept causing me problems. I solved it by using Xdotool to simulate a spacebar press after the vcgencmd was fired.

    1st thing to check is that the the vcgencmd does actually make the screen go on /off (you can just type the command in to putty and confirm the screen operates correctly.

    Note that that the modification I made above is now no longer required for me… for other reasons I actually started from scratch with a clean Raspian install, MM install etc. This time round it all just works correctly so the xdotool fix is no longer required.

  • I should have provided more detail. I can get the modules to work with a PIR sensor, but not a microwave sensor. It shouldn’t matter, but it seems to. That’s why I was hoping that someone had figured this out.

  • @invisible.inq can you confirm the input changes by using “gpio read (pin no eg 22)” before & after moving in front of the sensor? Is there a chance you need a resistor wired in?

  • I borrowed a little python script to check the status of my sensors, and it seems to show me just fine when there is motion-event (using BCM PIN 17)

    I’m not sure about needing a resistor…?

    # -*- coding: utf-8 -*-
    import RPi.GPIO as GPIO
    import time
    PIR_PIN = 17
    GPIO.setup(PIR_PIN, GPIO.IN)
    def MOTION(PIR_PIN):
                   print ("Motion Detected! " + time.strftime("%H:%M:%S")) 
    print "PIR Module Test (CTRL+C to exit)"
    print "Ready"
                   GPIO.add_event_detect(PIR_PIN, GPIO.RISING, callback=MOTION)
                   while 1:
    except KeyboardInterrupt:
                   print " Quit"

  • @invisible.inq OK, sounds like you confirmed it does work then (sometimes certain devices need a resistor wired in series with either gnd or the input pin so just thought it may have been a factor).

    Only other obvious thing I can think of is to confirm pin no in your mmm-pir-sensor config is correct… Your script uses bcm numbering pin 17 so configuration needs 17 as well.

  • Were you able to resolve the issue? I’m looking for a microwave sensor too. What sensor do you have?

  • @goprojojo Short answer is no.

    I’ve tried the HFS-DC06, XYC-WB-D0, and the RCWL-0516 chips. I’ve tried the MMM-PIR-Sensor and PIR-Sensor modules.

    Some observations:

    • Some of these chips are junk. I bought a pack of 4 RCWL-0516 chips from amazon, and only 2 of them worked. The HFS-DC06 chip has two adjustable settings, but I’m not convinced they work correctly
      -MMM-PIR-Sensor (paviro) seems to be less of a draw on resources. PIR-Sensor (cowboysdude) seemed simpler to me, but never worked quite as well
    • I do first test with the python code above, to verify that I’m getting signal. That’s a simple way to test the chips. But for whatever reason, that hasn’t translated into signal that either of the modules would act on correctly
    • At one point, I thought I had it working, but I was getting a lot of false-positives. Unfortunately I didn’t have any capacitors laying around to build a pi-filter. When I got them ordered, I couldn’t recreate the false positives. Pi-filter: schematic from this [thread]
      ( It’s simple enough to assemble on a breadboard.
    • At the same time, I also grabbed some ferrite beads based on this [thread].
      ( I figure that’s a good precaution.
    • Depending on how old your monitor is, shutting off and turning on the HDMI outlet may be more trouble than it’s worth. If you just want the screen to go blank, this has worked ok for me when I manually activate it:
      xset -display :0 s blank && xset -display :0 dpms force off

    I plan to spend some more time on it this weekend. I’ll let you know if I get it working.

  • Project Sponsor Module Developer

    I’m going to guess you issue isn’t the sensor, but instead how your monitor reacts to the vcgencmd command. Had you tried installing LibCEC and sending direct CEC power commands?

  • @j.e.f.f I don’t think so, but i could be off. As a second datapoint, I’m having the module run a shell script on status change, which first writes the current time to a log file, before then triggering xset or vcgencmd. I don’t think it’s vcgencmd that is causing me issue.

Log in to reply