Shop OBEX P1 Docs P2 Docs Learn Events
Stranges BS2 results — Parallax Forums

Stranges BS2 results

ArchiverArchiver Posts: 46,084
edited 2001-08-25 09:10 in General Discussion
I have a setup in testing with a BS2 , LED with built in resistor,
and a hacked Passive Infrared Sensor. The PIR shows 0.03 volts when
active and 5.06 when idle. I have written code that basically turns
on the led when motion is detected (Will use a Relay next), and
display via Debug "Motion detected". When there is no motion it
displays "All's still".

Now the problem. When I turn on the unit is Waits for and displays
the "All's still" message over and over as it should, then when I
cause the PIR to go active the "Motion detected" message displays and
the Led lights as is should. Now here is the actual problem. The
stamp from this point forward either the BS2 is reseting and my
results are when the PIR goes low it like causes a loop and makes the
PIR active again over and over.I know there is no movement being
detected. Now when I remove the LED and rest the Stamp, the PIR works
fine and displays the correct message. Now, as soon as I re-install
the led the next time motion is detected it begins the strange loop
of detecting movment, and when the PIR goes high, within a breif
second somthing causes the PIR to go low and the LED to light over
and over. This is so strange since the BS2 pin 9 is input and not
out, so why would it cause the PIR to go low?

Here is my BS2 prog.

Start:

If in8=0 then movement 'IF PIR goes low goto movment

in7=0 'turn off led
Debug "All's still",cr
goto start

movement:

in7=1 ' turn on led motion detected
Degug "Motion detected",cr
pause 5000 'Let PIR settle befor returning

goto Start:

Circuit is simple

BS2
Pin 8 to 330 ohm to signal line of PIR (PIR powered by 5 volts) PIR
is Active low. High voltage is 5.06 volts
Pin 7 to LED(built in resistance unknown came from a BS@ kit from a
professor at a university who sells alot of BS2 kits and how-to's
online) to GND

I hope someone out there knows what I'm trying to say. I'm very new
to Electronics and stamps, but having fun until it don't work. I plan
to add a relay into the LED circuit to turn on and off a flashing 12
VDC security light when motion is detected.

Thanks tremendously!

Shawn

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2001-08-24 15:37
    I don't know exactly what you are saying, but two observations:

    1) To turn on/off the LED, don't use IN7, use OUT7. Or better yet, use HIGH
    7 and LOW 7.

    2) To see if the Stamp is resetting, but this as the first line:

    Debug "RESET",cr
    Start:

    3) We'll assume Degug is a typo in the e-mail :-)

    Good luck!

    Al Williams
    AWC
    * Floating point A/D
    http://www.al-williams.com/awce/pak9.htm

    >
    Original Message
    > From: shawnusa@e... [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=B12yk1ktnNV-ZM2jdLSYNcxpQ09hdedgOdmzd3Lqg5b-nzVV6UGhGf-luCY9wgC7bHwGRUI17epF]shawnusa@e...[/url
    > Sent: Friday, August 24, 2001 9:25 AM
    > To: basicstamps@yahoogroups.com
    > Subject: [noparse][[/noparse]basicstamps] Stranges BS2 results
    >
    >
    >
    > I have a setup in testing with a BS2 , LED with built in resistor,
    > and a hacked Passive Infrared Sensor. The PIR shows 0.03 volts when
    > active and 5.06 when idle. I have written code that basically turns
    > on the led when motion is detected (Will use a Relay next), and
    > display via Debug "Motion detected". When there is no motion it
    > displays "All's still".
    >
    > Now the problem. When I turn on the unit is Waits for and displays
    > the "All's still" message over and over as it should, then when I
    > cause the PIR to go active the "Motion detected" message displays and
    > the Led lights as is should. Now here is the actual problem. The
    > stamp from this point forward either the BS2 is reseting and my
    > results are when the PIR goes low it like causes a loop and makes the
    > PIR active again over and over.I know there is no movement being
    > detected. Now when I remove the LED and rest the Stamp, the PIR works
    > fine and displays the correct message. Now, as soon as I re-install
    > the led the next time motion is detected it begins the strange loop
    > of detecting movment, and when the PIR goes high, within a breif
    > second somthing causes the PIR to go low and the LED to light over
    > and over. This is so strange since the BS2 pin 9 is input and not
    > out, so why would it cause the PIR to go low?
    >
    > Here is my BS2 prog.
    >
    > Start:
    >
    > If in8=0 then movement 'IF PIR goes low goto movment
    >
    > in7=0 'turn off led
    > Debug "All's still",cr
    > goto start
    >
    > movement:
    >
    > in7=1 ' turn on led motion detected
    > Degug "Motion detected",cr
    > pause 5000 'Let PIR settle befor returning
    >
    > goto Start:
    >
    > Circuit is simple
    >
    > BS2
    > Pin 8 to 330 ohm to signal line of PIR (PIR powered by 5 volts) PIR
    > is Active low. High voltage is 5.06 volts
    > Pin 7 to LED(built in resistance unknown came from a BS@ kit from a
    > professor at a university who sells alot of BS2 kits and how-to's
    > online) to GND
    >
    > I hope someone out there knows what I'm trying to say. I'm very new
    > to Electronics and stamps, but having fun until it don't work. I plan
    > to add a relay into the LED circuit to turn on and off a flashing 12
    > VDC security light when motion is detected.
    >
    > Thanks tremendously!
    >
    > Shawn
    >
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    > from the same email address that you subscribed. Text in the
    > Subject and Body of the message will be ignored.
    >
    >
    > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
    >
  • ArchiverArchiver Posts: 46,084
    edited 2001-08-24 16:02
    My oops in the "in7" thing and the debug spelling was just a typo.

    I did use High and low for the led. I will try the rest test
    tonight. I still find it strange that the thing works when the led is
    removed.

    Here is a running example of the problem to try and better explain
    the problem.

    While the unit is running I'm measuring the voltage at PIR input pin

    voltage on the PIR Debug Ouput LED status

    5.06 all still off
    5.06 all still off

    I wave my hand in front of PIR

    0.03 Motion detected on

    pause to wait for PIR to settle
    loops to start (PIR is now at 5.06 volts). Good so far

    5.06 all still off
    5.06 all still off

    this repeats for what appears to be half a second or a little more
    then this is where it "Loops" without me activating"waiving my hand"
    the PIR.

    0.03 Motion detected on

    pause

    5.06 all still off

    5.06 voltage shows for a second or less then

    0.03 motion detected on

    From here it just keep going over and over with same results each
    time. Now when I remove the LED everything is fine.

    Now let's say that the stamp is indeed restting. What and or why
    would it do such a thing, and more importanly how would I fix it?

    Again thanks for all help

    Shawn
  • ArchiverArchiver Posts: 46,084
    edited 2001-08-24 16:56
    Hi Shawn,

    Since you are actually measuring a change in voltage on the PIR pin,
    it looks like there is coupling from LED into the PIR module circuit.
    PIR circuits are kind of slow, so the effect adds a delay in the
    feedback loop that results in an oscillation on and off. The
    coupling could be electrical from a ground loop, or electromagnetic
    from coupling through the air. Or even optical, but I doubt that a
    red led would have much if any effect on a PIR sensor.

    Are you sure the red led has a built-in resistor? See if putting an
    additional 330 ohms in series with the led helps the problem.

    Also, try (1) put a bypass capacitor across the PIR sensor power
    supply, say 1 to 100 uF. (2) Locate the PIR sensor further from the
    Stamp circuit, and even shield it inside a tin can. (3) move the
    ground for the PIR as close as possible to pin23 on the stamp.

    I hope something in there helps!

    -- regards,
    Tracy Allen
    electronically monitored ecosystems
    mailto:tracy@e...
    http://www.emesystems.com

    At 3:02 PM +0000 8/24/01, shawnusa@e... wrote:
    >0.03 Motion detected on
    >
    >pause
    >
    >5.06 all still off
    >
    > 5.06 voltage shows for a second or less then
    >
    >0.03 motion detected on
    >
    > From here it just keep going over and over with same results each
    >time.

    >Now when I remove the LED everything is fine.
    >
    >Now let's say that the stamp is indeed restting. What and or why
    >would it do such a thing, and more importanly how would I fix it?
  • ArchiverArchiver Posts: 46,084
    edited 2001-08-25 09:10
    Hi Shawn,

    Do you feed the PIR and the Stamp with the same power supply ?
    Then you should place decoupling capacitors, and also check the maximum
    current of the power supply. The reset may be caused by the switching of the
    PIR.
    Hope this helps.

    Best regards,

    Phil.

    Original Message
    From: <shawnusa@e...>
    To: <basicstamps@yahoogroups.com>
    Sent: Friday, August 24, 2001 5:02 PM
    Subject: [noparse][[/noparse]basicstamps] Re: Stranges BS2 results


    >
    > My oops in the "in7" thing and the debug spelling was just a typo.
    >
    > I did use High and low for the led. I will try the rest test
    > tonight. I still find it strange that the thing works when the led is
    > removed.
    >
    > Here is a running example of the problem to try and better explain
    > the problem.
    >
    > While the unit is running I'm measuring the voltage at PIR input pin
    >
    > voltage on the PIR Debug Ouput LED status
    >
    > 5.06 all still off
    > 5.06 all still off
    >
    > I wave my hand in front of PIR
    >
    > 0.03 Motion detected on
    >
    > pause to wait for PIR to settle
    > loops to start (PIR is now at 5.06 volts). Good so far
    >
    > 5.06 all still off
    > 5.06 all still off
    >
    > this repeats for what appears to be half a second or a little more
    > then this is where it "Loops" without me activating"waiving my hand"
    > the PIR.
    >
    > 0.03 Motion detected on
    >
    > pause
    >
    > 5.06 all still off
    >
    > 5.06 voltage shows for a second or less then
    >
    > 0.03 motion detected on
    >
    > From here it just keep going over and over with same results each
    > time. Now when I remove the LED everything is fine.
    >
    > Now let's say that the stamp is indeed restting. What and or why
    > would it do such a thing, and more importanly how would I fix it?
    >
    > Again thanks for all help
    >
    > Shawn
    >
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    > from the same email address that you subscribed. Text in the Subject and
    Body of the message will be ignored.
    >
    >
    > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
    >
    >
    >
Sign In or Register to comment.