Motion Sensor triggering on its own



  • Hi, I build a mysensors motion sensor with a nano a couple of weeks ago, and initially it appeared to be working very well and has been switching on my lights when motion is detected for the last few weeks perfectly happily

    However I have noticed over the last few days it has been triggering on its own without any motion.

    I was watching the mqtt messages earlier today and it was appearing to be triggered with motion every few minutes, even though nothing was there. I have not tried swapping the sensor for another one in case its a problem with the sensor, but I was wondering if there is any other possible reason for these false triggers??

    I do have the sensor powered directly from the nano via the 5v pin, is that likely to cause any problems?

    I've also just rememebered that there is a radiator in the hall way where the sensor is placed, so I'm wondering if when the heating comes on it detects that heat and triggers the sensor?


  • Admin

    Yes, the motion sensor actually detects heat movement. So you probably shouldn't point the motion detector against a radiator.



  • thanks @hek the sensor is currently stuck half way up a wall, where would you recommend installing it? wall or ceiling? I was also a little unclear about the jumper settings which is best?


  • Admin

    On the wall, in a corner pointing into the room (away from the windows). I usually put them just below the ceiling, but it depends on your wall height.

    
    ________WINDOW___________________
    |*     RADIATOR
    | \
    |  \
    |   \
    |
    |
    |
    


  • A tutorial how a PIR sensor is detecting, using the Fresnel lens. To understand that the PIR is detect areas of "heat" and "cold"
    http://www.instructables.com/id/PIR-Motion-Sensor-Tutorial/


  • Plugin Developer

    I have just find out the same problem with one of my nodes that have a HC-SR501 motion sensor.
    It is a Arduino 5v with the same sketch as 3 other nodes.

    It updates every second and i have it right now in a closed box so it shuld not trigger any motion.
    I have tried to clearEEPROM and tried again, but i get the same result.

    What can i do?


  • Hardware Contributor

    @ErrK try to rewire the node - you can also measure if the signal pin from motion sensor is high all the time.


  • Plugin Developer

    @sundberg84 thanks. I will try it.



  • @ErrK I had similar problem with my hc-sr501 pir. It seems that some pirs are very sensitive to any electromagnetic noise. For me pir was reporting false positives each time nrf was sending data. You can easily test it: just remove any gw.send commands and solder led to pir output (of course through 1k resistor). When pir is detecting a motion output goes high so led will go on for the time set by pir potentiometer. In my case each sending (when for example battery level was reported each 30 min) resulted in false pir trigger.
    It seems that this depends on specific device. I switched pirs between my sensors and this false triggering went to other node 🙂
    Finally I solved this problem in software. I can share my sketch that is working well for two of my nodes.

    Btw: there are many discussions on the web about those pir false triggering concerning remote radio nodes. I took the idea of software solution from there.

    Of course in your case reasons can be different...


  • Plugin Developer

    @Maciej-Kulawik Thanks.

    Today my second node started to do this too.
    I have tried to change the HC-SR501 and the problem seams to be on the node and not on the sensor.
    Can i see how you fixed this in the sketch?



  • I have solved this by reading the status of the HC-SR501 twice. Works finde for me.

     boolean tripped = digitalRead(DIGITAL_INPUT_SENSOR) == HIGH; 
            
      Serial.println(tripped);
      if (tripped==1){
        //wait
        delay(100);
        //read the pin again
        tripped = digitalRead(DIGITAL_INPUT_SENSOR) == HIGH; 
         if (tripped==1){
      gw.send(msg2.set(tripped?"1":"0"));  // Send tripped value to gw 
      }
      }
    


  • The same problem for me. Different HC-SR501 sensors (connected to one of three nodes with this sensors) periodically entering "flood mode" with continuous sending 1/0 values. I suspect that this is power supply related problems.



  • I have for a sonar sensor (Ultrasonic Module HC-SR04) used in RPI and written in Python, used to measure 3 times and if all 3 measurements are same, then result is valid and data send. This is working perfect for me. You can create something similar for your Arduino

    intdistance = 0

            distance = -1
            continueLoop = True
            log.debug("Loop until distance1 = distance2 = distance3")
            while(continueLoop):
                #distance = ser.read(size=3)
                distance = ser.readline()
                getValue1 =  distance.rstrip('\r\n')
                log.debug("distance1: %s", getValue1)
    
                distance = ser.readline()
                getValue2 =  distance.rstrip('\r\n')
                log.debug("distance2: %s", getValue2)
    
                distance = ser.readline()
                getValue3 =  distance.rstrip('\r\n')
                log.debug("distance3: %s", getValue3)
    
                distance == getValue1
    
                if  getValue1 == getValue2 and getValue2 == getValue3 :
                    continueLoop = False
    
            intdistance = int(distance)
            log.info("distance: %d to be sent to Agocontrol", intdistance)


  • @robosensor Have you tried to enable the ibternal pullup for the pin?



  • @Jan-Gatzke said:

    @robosensor Have you tried to enable the ibternal pullup for the pin?

    Didn't read biss0001 datasheet, so I don't know is output pin 5V-compatible (for pullup) or not, so I didn't tried to enable internal pullup.

    In any case I will try to check what happens with OUT pin of module during this 1/0 flood.


  • Plugin Developer

    Thanks @Jan-Gatzke it did not work for me this time.

    I'm using a 5v Arduino Pro mini and when i measure the power on the HC-SR501 i get 3.71v.
    When i measure the power on the VCC i get 3.69v and when i measure the RAW i get 5.43v.

    Here you can se how everything is wired, I use the Easy/Newbie PCB by @sundberg84.
    1_1457118103690_IMG_6345 copy.jpg
    0_1457118103689_IMG_6346 copy.jpg

    First i used the 5v cable to the raw on the PCB and then it did't work.
    When I change to connect to the PWR then it works. Don't know why. Maybe @sundberg84 know why?


  • Hardware Contributor

    Hi @ErrK.

    Work your way backwards with the multimeter. Are you powering with 5v there shouldnt be a drop to 3v. Check volt over arduino and then vcc output. As i said work you way backwards in the circuit.

    I suspect a faulty hardware somewhere, measure the input and output on the voltage regulator on the arduino.



  • @ErrK In my case PIR switches into HIGH for some seconds (depending on potentiometer), so reading after 100ms will give the same value.

    @ErrK Unfortunately my solution is not 100% reliable. For 2 of my nodes it works well, but for 3rd node (the same hardware, the same sketch, only PCB is a little bi different - previous version, but difference only in dimension) - pir is false triggerring almost each minute (sometimes with 2 minutes delay with false triggering). And I checked - it is not caused by NRF sending. I have no idea whats going on.


  • Hero Member

    @Maciej-Kulawik , how are you powering the node? I had once a PIR false-triggering due power instabilities...



  • Hi,

    i'm wanted to share my experience also with those sensor.
    I had a lot of issue with false trigger when running on 3.3V. In my case the power was definitely the issue.
    it's looks like sleeping the radio/mcu cause some noise on the voltage line.

    I solve 100% of my false trigger issue when doing a small sleep, before enabling the sleep with interrupt.

    gw.sleep(500);
    gw.sleep(INTERRUPT,RISING, SLEEP_TIME);
    


  • @rvendrame I'm powering all with 2xAA baterries. On PIR I removed regulator. The problem with false trigerring is independent from voltage level. It is the same if I put old baterries (2,8V) or brand new (3,2V).
    @fifipil909 I also suspect that it is somehow connected to powering noises and mcu sleeping. In my one case PIR is triggering each minute - and sleep time is also one minute.


  • Hero Member

    @Maciej-Kulawik , maybe if you try to power the PIR with +5V for a while and watch the results? Don't forget to keep all GNDs inter-connected...



  • I'm also having this issue at 3V. It gets triggered if there is a (little) voltage drop. All my pirs only wake with an interrupt and no timer, then it works fine. But with a sleep timer it won't work the normal way.

    At 5V everything works fine.

    Maybe @fifipil909 's solution works.



  • I was testing the below sensor with 3.3v and it was reporting false status. It worked well with 5v. Although the site claims it works between 3 to 5 volts.
    Maybe power issues

    http://store.fut-electronics.com/products/pir-motion-sensor-module-adjustable-range



  • @ahmedadelhosni All those PIRs are built using the same chip. All all have 3,3v regulator onboard, so they always work with 3,3v. I don't understand why powering directly with 3,2v from battery makes so trouble.
    Maybe this LDO regulator adds some additional stabilisation/filtering on power line, when powered with greater voltage...


  • Hero Member

    @Maciej-Kulawik It can be that the on-board LDO needs more than 3.3v to activate. It maybe even dropping the voltage from batteries, and doing nothing but disturbing 🙂 Maybe it worth to remove it when running the circuit with 3V from batteries.



  • @rvendrame But I work only with pirs with ldo removed (and diode).


  • Hero Member

    @Maciej-Kulawik if so, your PIR looks to need at least 3.3V, so the ~3V from 2xAA is not enough and it is causing instabilities (probably the same as reported by others here).



  • @Maciej-Kulawik I didnt know that info. Thanks.


  • Hardware Contributor

    Did you guys get them working? I tried to power the pir sensor via the "H" pad directly with 3.3V from a boost converter (via a coin cell). Now I get random readings that I didn't have when using a stable 3.3V source. Any ideas how to solve this?
    I haven't (yet) removed the voltage regulator on board. Perhaps that might help...



  • I have the same issue first when I tried to power the PIR with the VCC from the arduino mini pro 3.3V. It seems like the PIR does not work with 3.3V. Now I power the PIR directly from the 9V battery. Problem solved.



  • Hi,

    False detection is only due to power stability issue.
    Personnaly i remove the regulator and power the PIR without any boost on the VCC pin. Even below 2v the PIR continue working without any a single issue.

    Did you try to do a small delay before sleeping with interupt ? See my post a bit upper.

    For me it solve all my false trigger issue.


  • Hardware Contributor

    I know this thread's about hc-501. But I guess one can apply some of my hc-505 (mini-pir) experiences from here:
    https://forum.mysensors.org/topic/2715/slim-node-as-a-mini-2aa-battery-pir-motion-sensor



  • Same problem here every time m node wake-up I have a false trigger. With delay (@fifipil909) it's not better


  • Hardware Contributor

    Mhm I still have strange results from my PIR sensor (doesn't even seem to be the wake up that influences them).
    I have the pir with diode and voltage regulator removed powered by a boost converter with the low pass filter and a pull down resistor. Using a clean 3.3V worked though, but I really want to use batteries (with sometimes less than 3V). Directly powering the sensor with the 2.x V did not work either.
    For one of the guys with working sensors: what is your exact setup? None of the tipps I found seem to work. I would really love to get one sensor running. Only idea I still have is to try with another sensor.

    Here is the code I am currently using:

    
    #include <MySensor.h>  
    #include <SPI.h>
    
    unsigned long SLEEP_TIME = 120000; // Sleep time between reports (in milliseconds)
    #define DIGITAL_INPUT_SENSOR 3   // The digital input you attached your motion sensor.  (Only 2 and 3 generates interrupt!)
    #define INTERRUPT DIGITAL_INPUT_SENSOR-2 // Usually the interrupt = pin -2 (on uno/nano anyway)
    #define CHILD_ID 1   // Id of the sensor child
    
    #ifdef DEBUG
    #define DEBUG_SERIAL(x) Serial.begin(x)
    #define DEBUG_PRINT(x) Serial.print(x)
    #define DEBUG_PRINTLN(x) Serial.println(x)
    #else
    #define DEBUG_SERIAL(x)
    #define DEBUG_PRINT(x) 
    #define DEBUG_PRINTLN(x) 
    #endif
    
    MySensor gw;
    // Initialize motion message
    MyMessage msg(CHILD_ID, V_TRIPPED);
    
    void setup()  
    {  
    
      DEBUG_SERIAL(9600);    // <<<<<<<<<<<<<<<<<<<<<<<<<< Note BAUD_RATE in MySensors.h
      DEBUG_PRINTLN("Serial started");
    
      gw.begin();
    
      // Send the sketch version information to the gateway and Controller
      gw.sendSketchInfo("Motion Sensor Test", "24052016");
    
      pinMode(DIGITAL_INPUT_SENSOR, INPUT);      // sets the motion sensor digital pin as input
      // Register all sensors to gw (they will be created as child devices)
      gw.present(CHILD_ID, S_MOTION);
      
    }
    
    void loop()     
    {     
      // Read digital motion value
      boolean tripped = digitalRead(DIGITAL_INPUT_SENSOR) == HIGH; 
      DEBUG_PRINT("Got tripped: ");
      DEBUG_PRINTLN(tripped);
            
      gw.send(msg.set(tripped?"1":"0"));  // Send tripped value to gw 
     
      DEBUG_PRINTLN("Sleeping till next interrupt");
    
      // Sleep until interrupt comes in on motion sensor. Send update every two minute. 
      //gw.sleep(INTERRUPT,CHANGE, SLEEP_TIME);
      // Sleep until interrupt comes in on motion sensor. Won't wake up otherwise
      gw.sleep(500);
      gw.sleep(INTERRUPT, CHANGE, 0);
      //gw.sleep(INTERRUPT, RISING, 0);
    }
    
    

  • Hardware Contributor

    Does anyone have an idea how to get the pir sensor running with a coin cell? Or perhaps if that doesn't work with 2 aa's? See my post above



  • Sorry for necroposting on my first forum post but I have the exact same issue at the moment. I power PIR sensors from the same 3.3V switching regulator that powers an esp12 module. I took off the anti-inversion diode and the linear regulator, added a 470uF and 100nF capacitor on the sensor supply input. This has been done to two sensors, one is working flawlessly the other one has a false trigger once every half an hour.
    Adding HF and LF bypass capacitors with some improvement told me that was a supply instability issue but it's not solving the problem completely. My suspect is that the polarity inversion diode that I took off had a role in the play improving the supply voltage stability.....I'll try to put back the diode and I'll let you know.

    cheers
    Luca



  • This is an issue i've been fighting for awhile as well. In industry, i've encountered PIR modules / old sensors can be susceptible to high freq interference. E.g. I have WiFi on my PI.

    1. Ensure the PIR is a 6in+ physical distance from your dev board / any radios. This helps.

    2. Ensure no high freq noise can couple on any of the 3 wires connected to the PIR

    0_1560114349879_c4ca7289-112c-4d3e-88c8-9aeea62ec2b9-image.png

    I did #2 via a PI filter. Inductors + a cap. Ideally i'd have caps at both ends of high and low values for both frequency contents. The signal line itself can couple noise so ideally a ferrite bead + resistor to snub any type of noise. I've had to employ similar strategies with other sensors to deal w/ interference issues.



  • Have this same issue and it makes me crazy... I use a step up converter DCDC 1.8V up to 3.3 input and output 3.3V. If solder from DCDC Out via 220uF direct soldered after stabilizer of HC501 direct on pcb and sometimes it will detect motion where no motion happens. I use two AA accu and i know that they have together 2,4V. Less voltage less current. But i try also with normal AA 3V then i have this issue not so often. But i have. It will much more if the voltage will more less.


Log in to reply
 

Suggested Topics

46
Online

11.4k
Users

11.1k
Topics

112.6k
Posts