Shop OBEX P1 Docs P2 Docs Learn Events
PIR false alerts — Parallax Forums

PIR false alerts

jknight291jknight291 Posts: 9
edited 2011-05-10 09:03 in Accessories
Hello,

I am trying to right up 3 Parallax PIR Sensors to activate a corresponding LED when activated. I am used the BOE and Basic Stamp 2. I have a simple If..Then syntax (see below) that I believe is working. However, when testing that the program works, I initially thought the PIRs as incredibly sensitive to environment changes all three LEDs would immediately light up when I sent the program, but after further investigation and testing, it seems that the PIRs are simply sporadic, there is no rhyme or reason to their activation. It seems as if the BoE is browning out, but that's impossible as I have changed the batteries and tested with electric power. The LEDs are just some random LEDs I picked up at Radio Shack with variable resistance.

Does it seem like there is something wrong with my code, or is this a power issue?

Thanks!
' {$STAMP BS2}
' {$PBASIC 2.5}

PAUSE 60000   'PIR Warmup

DO

IF (IN2=1) THEN
  HIGH 15
ELSEIF (IN3=1) THEN
  HIGH 14
ELSEIF IN4=1 THEN
  HIGH 13
ELSE
  LOW 15
  LOW 4
  LOW 13

ENDIF

LOOP

Comments

  • LeonLeon Posts: 7,620
    edited 2011-05-10 03:49
    There has been at least one other thread about that problem, IIRC. Try a search.
  • jknight291jknight291 Posts: 9
    edited 2011-05-10 06:41
    Okay, I found an old thread about it, but it's about 3 years old and I still have some questions. Shall I continue using this thread or go bump that one?

    For reference: http://forums.parallax.com/showthread.php?104867-Still-have-false-trigger-issues-with-the-Parallax-PIR-sensor....


    Regardless, here is my question:

    So, it looks like my issue is a power issue. If I do not want to use an external power source, would putting 10 kohm resistors on the PIR sensors fix this issue? Like I said before, the LEDs I have came with built in resistors, so I can't really adjust that, but I can adjust the PIR circuit. If I were to put the resistors on, would it be between Vdd or Vss? I'm concerned about burning them out so I just want to be certain.
  • LeonLeon Posts: 7,620
    edited 2011-05-10 08:18
    I'm sure that there was a recent one. IIRC, the problem arose in sunlight.
  • jknight291jknight291 Posts: 9
    edited 2011-05-10 08:26
    Yes, the first few runs were right by a window during the day, so I moved into the bathroom and tried again. Being absolutely still, the PIRs still activated almost mechanically at regular time intervals.
  • RobotWorkshopRobotWorkshop Posts: 2,307
    edited 2011-05-10 08:35
    Looks like the second low statement should be a low 14 instead of low 4.

    To connect the LED's you should be able to easily connect them to the I/O pins and have a current limiting resistor inline with each LED. Unless the LED specifically has a built-in resistor (most do not) you need to add one. Typically a 470 ohm - 560 ohm is used for a 5V supply.

    For the PIR you would connect ground, +5V, and then the signal line to an I/O pin on the stamp. If you are unsure if the LED's are working you can always use the debug output to send the value read in by each PIR sensor to the debug window on the PC.

    You could also try the example in the PIR datasheet to test each sensor to make sure they are all working ok.

    Robert
  • jknight291jknight291 Posts: 9
    edited 2011-05-10 08:44
    Yes, I saw that code typo last night, thanks, though.

    The LEDs I am using do have built in resistors, so I have them plugged directly to an I/O pin and Vss. They work individually when tested with a simple Do.. High.. Low.. Loop program.

    Each PIR sensors works when tested individually using the DEBUG terminal and the information given on the data sheet. However, as soon as I run the above program, the LEDs start blinking sporadically - indicating the PIRs are being constantly activated; which is why I believe this is a power issue. Are the LEDs drawing too much? Would the resistor with the PIR help?
  • RobotWorkshopRobotWorkshop Posts: 2,307
    edited 2011-05-10 08:53
    jknight291 wrote: »
    Yes, I saw that code typo last night, thanks, though.

    The LEDs I am using do have built in resistors, so I have them plugged directly to an I/O pin and Vss. They work individually when tested with a simple Do.. High.. Low.. Loop program.

    Each PIR sensors works when tested individually using the DEBUG terminal and the information given on the data sheet. However, as soon as I run the above program, the LEDs start blinking sporadically - indicating the PIRs are being constantly activated; which is why I believe this is a power issue. Are the LEDs drawing too much? Would the resistor with the PIR help?

    I don't know how much current the LED's are using but I don't think they should be a problem. How are you powering the board? Are you using a wall PS? What is the voltage/current rating on that? Can you measure the 5V supply to see if it at least appears stable?

    How close are the PIR modules? Are they facing in completely different directions?

    You said it works fine with a single module but not with three. How about with two going?

    I'm not sure if multiple PIR modules will interfere with each other or not. That would be a good question for Parallax. You may want to call their support and ask.

    Robert
  • jknight291jknight291 Posts: 9
    edited 2011-05-10 09:03
    I have been powering the board with the battery back and 4 AA batteries. I could easily power it with the wall adapter Parallax sent with the Board of Education, but I believe that it would provide the same amount of power? I'm at work, but once I get home I can check to see if the PIRs are more stable with the wall adapter.

    In my setup, I have them in rectangular box of foam core with the side cut out. They are partitioned into three sections ("rooms"). See the picture I attached. In an attempt to reduce the sensitivity, I have further isolated each PIR with another "wall" blocking them from viewing outside of the box. The only way to activate them (in theory) is the reach around the wall.
    setup.JPG
    583 x 219 - 10K
Sign In or Register to comment.