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…?

    #!/usr/bin/python
    # -*- coding: utf-8 -*-
    
    import RPi.GPIO as GPIO
    import time
    
    GPIO.setmode(GPIO.BCM)
    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)"
    time.sleep(2)
    print "Ready"
    
    try:
                   GPIO.add_event_detect(PIR_PIN, GPIO.RISING, callback=MOTION)
                   while 1:
                                  time.sleep(100)
    except KeyboardInterrupt:
                   print " Quit"
                   GPIO.cleanup()
    


  • @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]
      (https://github.com/jdesbonnet/RCWL-0516/issues/2). It’s simple enough to assemble on a breadboard.
    • At the same time, I also grabbed some ferrite beads based on this [thread].
      (https://helentronica.com/2016/01/11/magic-mirror-with-motion-detector/). 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.


  • 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
 

Looks like your connection to MagicMirror Forum was lost, please wait while we try to reconnect.